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

31 lines
555 B
Ruby

module Postman
class SendResult
def initialize(client, result)
@client = client
@result = result
end
def message_id
@result['message_id']
end
def recipients
@recipients ||= begin
@result['messages'].each_with_object({}) do |(recipient, message_details), hash|
hash[recipient.to_s.downcase] = Message.new(@client, message_details)
end
end
end
def [](recipient)
recipients[recipient.to_s.downcase]
end
def size
recipients.size
end
end
end