Sha256: 46c0fb22032147c78c786a5f0e2dfef054a9f1a09803114bcc1e14d550b89291
Contents?: true
Size: 910 Bytes
Versions: 6
Compression:
Stored size: 910 Bytes
Contents
module SmsBroker module Client module Response class NexmoSuccess < Success def initialize(nexmo_response) super :nexmo, nexmo_response, serialize(nexmo_response) end private def serialize(response) single_response = response['messages'][0] { to: single_response['to'], from: single_response['from'], message_id: single_response['message-id'], raw: response_to_hash(single_response) } end def response_to_hash(response) attributes = %w( to from status network message-id client-ref remaining-balance message-price ) {}.tap do |hash| attributes.each do |attr| hash[attr.tr('-', '_').to_sym] = response[attr] end end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems