Sha256: ca8ddd05a88cc0a12f8c833ddb6dd78fb609cfa7a392d9c9e07c760856512f01

Contents?: true

Size: 724 Bytes

Versions: 5

Compression:

Stored size: 724 Bytes

Contents

module SmsBroker
  module Client
    module Response
      class NexmoVoiceSuccess < VoiceSuccess
        def initialize(nexmo_response)
          super :nexmo, nexmo_response, serialize(nexmo_response)
        end

        private

        def serialize(response)
          {
            call_id: response['call_id'],
            to: response['to'],
            raw: response_to_hash(response)
          }
        end

        def response_to_hash(response)
          attributes = %w(
            call_id to status error_text
          )

          {}.tap do |hash|
            attributes.each do |attr|
              hash[attr.to_sym] = response[attr]
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sms_broker-1.0.8 lib/sms_broker/client/response/nexmo_voice_success.rb
sms_broker-1.0.7 lib/sms_broker/client/response/nexmo_voice_success.rb
sms_broker-1.0.5 lib/sms_broker/client/response/nexmo_voice_success.rb
sms_broker-1.0.4 lib/sms_broker/client/response/nexmo_voice_success.rb
sms_broker-1.0.3 lib/sms_broker/client/response/nexmo_voice_success.rb