Sha256: 2a2f3e84235dcad66731cfb28d53e1d31e2aa80587b662257fed1ca1537124fa

Contents?: true

Size: 1.31 KB

Versions: 53

Compression:

Stored size: 1.31 KB

Contents

module Fog
  module Parsers
    module Terremark
      module Shared

        class GetOrganization < Fog::Parsers::Base

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

          def start_element(name, attributes)
            super
            case name
            when 'Link'
              link = {}
              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 = {}
              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

53 entries across 53 versions & 15 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/terremark/parsers/shared/get_organization.rb
fog-nirvanix-1.8.1 lib/fog/terremark/parsers/shared/get_organization.rb
fog-parser-fix-1.6.1 lib/fog/terremark/parsers/shared/get_organization.rb
fog-test-again-1.6.0 lib/fog/terremark/parsers/shared/get_organization.rb
fog-parser-fix-1.6.0 lib/fog/terremark/parsers/shared/get_organization.rb
fog-1.9.0 lib/fog/terremark/parsers/shared/get_organization.rb
fog-maestrodev-1.8.0.20130114204828 lib/fog/terremark/parsers/shared/get_organization.rb
fog-maestrodev-1.8.0.20130111070250 lib/fog/terremark/parsers/shared/get_organization.rb
fog-maestrodev-1.8.0.20130109172219 lib/fog/terremark/parsers/shared/get_organization.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/terremark/parsers/shared/get_organization.rb
fog-sgonyea-1.8.1 lib/fog/terremark/parsers/shared/get_organization.rb
fog-1.8.0 lib/fog/terremark/parsers/shared/get_organization.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/terremark/parsers/shared/get_organization.rb
fog-1.7.0 lib/fog/terremark/parsers/shared/get_organization.rb
fog-1.6.0 lib/fog/terremark/parsers/shared/get_organization.rb
fog-1.5.0 lib/fog/terremark/parsers/shared/get_organization.rb
rackspace-fog-1.4.2 lib/rackspace-fog/terremark/parsers/shared/get_organization.rb
fog-1.4.0 lib/fog/terremark/parsers/shared/get_organization.rb
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/terremark/parsers/shared/get_organization.rb
michiels-fog-1.3.1 lib/fog/terremark/parsers/shared/get_organization.rb