postman-ruby/lib/postman/message_scope.rb
2020-03-20 02:24:35 +07:00

41 lines
596 B
Ruby

require 'postman/message'
module Postman
class MessageScope
attr_reader :client
def initialize(client)
@client = client
@includes = []
end
#
# Add includes to the scope
#
def includes(*includes)
@includes.push(*includes)
self
end
#
# Return the current includes
#
def expansions
if @includes.include?(:all)
true
else
@includes.map(&:to_s)
end
end
#
# Find a given message by its ID
#
def find_by_id(id)
Message.find_with_scope(self, id)
end
end
end