Sha256: 1491caeffee39a9b805fbb904bb397078d6a5cadce77863de5809928c39f14f5

Contents?: true

Size: 1.41 KB

Versions: 14

Compression:

Stored size: 1.41 KB

Contents

module Fog
  module Parsers
    module Terremark
      module Shared
        class GetOrganization < TerremarkParser
          # include Fog::Terremark::Shared::Parser

          def reset
            @response = { 'Links' => [] }
          end

          def start_element(name, attributes)
            super
            case name
            when 'Link'
              link = extract_attributes(attributes)
              until attributes.empty?
                if attributes.first.is_a?(Array)
                  attribute = attributes.shift
                  link[attribute.first] = attribute.last
                else
                  link[attributes.shift] = attributes.shift
                end
              end
              @response['Links'] << link
            when 'Org'
              org = extract_attributes(attributes)
              until attributes.empty?
                if attributes.first.is_a?(Array)
                  attribute = attributes.shift
                  org[attribute.first] = attribute.last
                else
                  org[attributes.shift] = attributes.shift
                end
              end
              @response['href'] = org['href']
              @response['name'] = org['name']
            end
          end

          def end_element(name)
            if name == 'Description'
              @response[name] = value
            end
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 4 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/terremark/parsers/shared/get_organization.rb
nsidc-fog-1.24.1 lib/fog/terremark/parsers/shared/get_organization.rb
fog-1.24.0 lib/fog/terremark/parsers/shared/get_organization.rb
ns-fog-1.22.11 lib/fog/terremark/parsers/shared/get_organization.rb
ns-fog-1.22.10 lib/fog/terremark/parsers/shared/get_organization.rb
ns-fog-1.22.9 lib/fog/terremark/parsers/shared/get_organization.rb
ns-fog-1.22.8 lib/fog/terremark/parsers/shared/get_organization.rb
ns-fog-1.22.7 lib/fog/terremark/parsers/shared/get_organization.rb
ns-fog-1.22.6 lib/fog/terremark/parsers/shared/get_organization.rb
fog-1.23.0 lib/fog/terremark/parsers/shared/get_organization.rb
ns-fog-1.22.4 lib/fog/terremark/parsers/shared/get_organization.rb
ns-fog-1.22.3 lib/fog/terremark/parsers/shared/get_organization.rb
ns-fog-1.22.2 lib/fog/terremark/parsers/shared/get_organization.rb
fog-1.22.1 lib/fog/terremark/parsers/shared/get_organization.rb