Sha256: 71c5a397f86211aa03abf03ebcc311c209f1df0ae0dc15ca068c54bbbf4aac51

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

Contents

module Fog
  module Parsers
    module Vcloud

      def self.de_camel(str)
        str.gsub(/(.)([A-Z])/,'\1_\2').downcase
      end

      class Base < Fog::Parsers::Base

        private

        def generate_link(attributes)
          link = Struct::VcloudLink.new
          until attributes.empty?
            link[attributes.shift.downcase] = attributes.shift
          end
          if link.href
            link.href = URI.parse(link.href)
          end
          link
        end

        def handle_root(attributes)
          root = {}
          until attributes.empty?
            if attributes.first.is_a?(Array)
              attribute = attributes.shift
              root[attribute.first.downcase] = attribute.last
            else
              root[attributes.shift.downcase] = attributes.shift
            end
          end
          @response.href = URI.parse(root['href'])
          @response.name = root['name']
          @response.type = root['type']
          @response.xmlns = root['xmlns']
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fog-0.2.0 lib/fog/vcloud/parser.rb
fog-0.1.10 lib/fog/vcloud/parser.rb
fog-0.1.9 lib/fog/vcloud/parser.rb
fog-0.1.8 lib/fog/vcloud/parser.rb
fog-0.1.7 lib/fog/vcloud/parser.rb
fog-0.1.6 lib/fog/vcloud/parser.rb