Sha256: d6cc7eba99d100c6ee62ddfb8d2eb1d95b2db44f4e1e13f1c30836c1e4b1c589

Contents?: true

Size: 533 Bytes

Versions: 6

Compression:

Stored size: 533 Bytes

Contents

module Spreedly

  class Receiver < Model

    field :receiver_type, :hostnames
    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

6 entries across 6 versions & 1 rubygems

Version Path
spreedly-2.0.18 lib/spreedly/receiver.rb
spreedly-2.0.17 lib/spreedly/receiver.rb
spreedly-2.0.16 lib/spreedly/receiver.rb
spreedly-2.0.15 lib/spreedly/receiver.rb
spreedly-2.0.14 lib/spreedly/receiver.rb
spreedly-2.0.13 lib/spreedly/receiver.rb