Sha256: 9850a80bb5895274c0bf0b086f7ef0b943144d1dc11e7a8ed85736cc4afacc77

Contents?: true

Size: 556 Bytes

Versions: 10

Compression:

Stored size: 556 Bytes

Contents

module Spreedly

  class Receiver < Model

    field :receiver_type, :hostnames, :state, :company_name
    attr_reader :credentials

    def initialize(xml_doc)
      super
      init_credentials(xml_doc)
    end

    private
    def init_credentials(xml_doc)
      @credentials = {}

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

    def cred_value(cred)
      value = cred.at_xpath('.//value')
      value ? value.text : nil
    end

  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
spreedly-2.0.28 lib/spreedly/receiver.rb
spreedly-2.0.27 lib/spreedly/receiver.rb
spreedly-2.0.26 lib/spreedly/receiver.rb
spreedly-2.0.25 lib/spreedly/receiver.rb
spreedly-2.0.24 lib/spreedly/receiver.rb
spreedly-2.0.23 lib/spreedly/receiver.rb
spreedly-2.0.22 lib/spreedly/receiver.rb
spreedly-2.0.21 lib/spreedly/receiver.rb
spreedly-2.0.20 lib/spreedly/receiver.rb
spreedly-2.0.19 lib/spreedly/receiver.rb