Sha256: b43b2f8154dfbe8defac3d2c8b17c02aad8f5801e8837146e7d80518b6651284

Contents?: true

Size: 895 Bytes

Versions: 9

Compression:

Stored size: 895 Bytes

Contents

module Fog
  module Parsers
    module TerremarkEcloud
      module Compute

        class GetCatalog < Fog::Parsers::Base

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

          def start_element(name, attrs = [])
            case name
            when 'Catalog'
              for attribute in %w{href name}
                if value = attr_value(attribute, attrs)
                  @response[attribute] = value
                end
              end
            when 'CatalogItem'
              catalog_item = {}
              for attribute in %w{href name rel type}
                if value = attr_value(attribute, attrs)
                  catalog_item[attribute] = value
                end
              end
              @response['CatalogItems'] << catalog_item
            end

            super
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
fog-0.5.3 lib/fog/compute/parsers/terremark_ecloud/get_catalog.rb
fog-0.5.2 lib/fog/compute/parsers/terremark_ecloud/get_catalog.rb
fog-0.5.1 lib/fog/compute/parsers/terremark_ecloud/get_catalog.rb
fog-0.5.0 lib/fog/compute/parsers/terremark_ecloud/get_catalog.rb
phpfog-fog-0.4.1.3 lib/fog/compute/parsers/terremark_ecloud/get_catalog.rb
phpfog-fog-0.4.1.2 lib/fog/compute/parsers/terremark_ecloud/get_catalog.rb
phpfog-fog-0.4.1.1 lib/fog/compute/parsers/terremark_ecloud/get_catalog.rb
phpfog-fog-0.4.1 lib/fog/compute/parsers/terremark_ecloud/get_catalog.rb
fog-0.4.1 lib/fog/compute/parsers/terremark_ecloud/get_catalog.rb