Sha256: c4bf444676fb456a13131523c31bf4a0c73eab54765e1ddc52b2215f67caef37

Contents?: true

Size: 1.08 KB

Versions: 12

Compression:

Stored size: 1.08 KB

Contents

module Fog
  module Parsers
    module Terremark
      module Shared

        class InstantiateVappTemplate < Fog::Parsers::Base

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

          def start_element(name, attributes)
            @value = ''
            case name
            when 'Link'
              link = {}
              until attributes.empty?
                link[attributes.shift] = attributes.shift
              end
              @response['Links'] << link
            when 'VApp'
              vapp_template = {}
              until attributes.empty?
                if attributes.first.is_a?(Array)
                  attribute = attributes.shift
                  vapp_template[attribute.first] = attribute.last
                else
                  vapp_template[attributes.shift] = attributes.shift
                end
              end
              @response.merge!(vapp_template.reject {|key, value| !['href', 'name', 'size', 'status', 'type'].include?(key)})
            end
          end

        end

      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
fog-0.0.89 lib/fog/terremark/parsers/shared/instantiate_vapp_template.rb
fog-0.0.88 lib/fog/terremark/parsers/shared/instantiate_vapp_template.rb
fog-0.0.87 lib/fog/terremark/parsers/shared/instantiate_vapp_template.rb
fog-0.0.86 lib/fog/terremark/parsers/shared/instantiate_vapp_template.rb
fog-0.0.85 lib/fog/terremark/parsers/shared/instantiate_vapp_template.rb
fog-0.0.84 lib/fog/terremark/parsers/shared/instantiate_vapp_template.rb
fog-0.0.83 lib/fog/terremark/parsers/shared/instantiate_vapp_template.rb
fog-0.0.82 lib/fog/terremark/parsers/shared/instantiate_vapp_template.rb
fog-0.0.81 lib/fog/terremark/parsers/shared/instantiate_vapp_template.rb
fog-0.0.80 lib/fog/terremark/parsers/shared/instantiate_vapp_template.rb
fog-0.0.79 lib/fog/terremark/parsers/shared/instantiate_vapp_template.rb
fog-0.0.78 lib/fog/terremark/parsers/shared/instantiate_vapp_template.rb