Sha256: a8c7a9fe55115baa9cbffd29cb63c478356ac31ece1fc9fc0263f3e1a3903143

Contents?: true

Size: 604 Bytes

Versions: 27

Compression:

Stored size: 604 Bytes

Contents

module Spreedly

  class Gateway < Model

    field :gateway_type, :state, :name
    attr_reader :credentials

    def initialize(xml_doc)
      super
      init_credentials(xml_doc)
    end

    def self.new_list_from(xml_doc)
      gateways = xml_doc.xpath('.//gateways/gateway')
      gateways.map do |each|
        self.new(each)
      end
    end

    private
    def init_credentials(xml_doc)
      @credentials = {}

      xml_doc.xpath('.//credentials/credential').each do |each|
        @credentials[each.at_xpath('.//name').text] = each.at_xpath('.//value').text
      end
    end

  end

end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
spreedly-2.0.28 lib/spreedly/gateway.rb
spreedly-2.0.27 lib/spreedly/gateway.rb
spreedly-2.0.26 lib/spreedly/gateway.rb
spreedly-2.0.25 lib/spreedly/gateway.rb
spreedly-2.0.24 lib/spreedly/gateway.rb
spreedly-2.0.23 lib/spreedly/gateway.rb
spreedly-2.0.22 lib/spreedly/gateway.rb
spreedly-2.0.21 lib/spreedly/gateway.rb
spreedly-2.0.20 lib/spreedly/gateway.rb
spreedly-2.0.19 lib/spreedly/gateway.rb
spreedly-2.0.18 lib/spreedly/gateway.rb
spreedly-2.0.17 lib/spreedly/gateway.rb
spreedly-2.0.16 lib/spreedly/gateway.rb
spreedly-2.0.15 lib/spreedly/gateway.rb
spreedly-2.0.14 lib/spreedly/gateway.rb
spreedly-2.0.13 lib/spreedly/gateway.rb
spreedly-2.0.11 lib/spreedly/gateway.rb
spreedly-2.0.10 lib/spreedly/gateway.rb
spreedly-2.0.9 lib/spreedly/gateway.rb
spreedly-2.0.8 lib/spreedly/gateway.rb