Sha256: f162da93474c1623ca769c48a73eba454f7ed3899bc59261b7b172b1400532fc

Contents?: true

Size: 403 Bytes

Versions: 2

Compression:

Stored size: 403 Bytes

Contents

module SmsTraffic
  class Client
    class Reply
      attr_reader :xml, :hash

      def initialize(xml, xml_parser: SmsTraffic.configuration.xml_parser)
        @xml = xml.gsub!(/\s+/, ' ')
        @hash = fetch_value(xml_parser.parse(xml), :reply)
      end

      private

      def fetch_value(hash, key)
        hash.fetch(key.to_s, nil) || hash.fetch(key.to_sym, nil)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sms_traffic_sdk-0.0.2 lib/sms_traffic/client/reply.rb
sms_traffic_sdk-0.0.1 lib/sms_traffic/client/reply.rb