Sha256: 85ce5dc4b5763e108fef0d832b9c982f553c1c123b9b06327dd45f3b32002c52

Contents?: true

Size: 857 Bytes

Versions: 20

Compression:

Stored size: 857 Bytes

Contents

module Vcloud
  module Core
    module MetadataHelper

      def extract_metadata vcloud_metadata_entries
        metadata = {}
        vcloud_metadata_entries.each do |entry|
          next unless entry[:type] == Vcloud::Fog::ContentTypes::METADATA
          key = entry[:Key].to_sym
          val = entry[:TypedValue][:Value]
          case entry[:TypedValue][:xsi_type]
            when Fog::MetadataValueType::Number
              val = val.to_i
            when Fog::MetadataValueType::String
              val = val.to_s
            when Fog::MetadataValueType::DateTime
              val = DateTime.parse(val)
            when Fog::MetadataValueType::Boolean
              val = val == 'true' ? true : false
          end
          metadata[key] = val
        end
        metadata
      end

      module_function :extract_metadata
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
vcloud-core-0.7.0 lib/vcloud/core/metadata_helper.rb
vcloud-core-0.6.0 lib/vcloud/core/metadata_helper.rb
vcloud-core-0.5.0 lib/vcloud/core/metadata_helper.rb
vcloud-core-0.4.0 lib/vcloud/core/metadata_helper.rb
vcloud-core-0.3.0 lib/vcloud/core/metadata_helper.rb
vcloud-core-0.2.0 lib/vcloud/core/metadata_helper.rb
vcloud-core-0.1.0 lib/vcloud/core/metadata_helper.rb
vcloud-core-0.0.13 lib/vcloud/core/metadata_helper.rb
vcloud-core-0.0.12 lib/vcloud/core/metadata_helper.rb
vcloud-core-0.0.11 lib/vcloud/core/metadata_helper.rb
vcloud-core-0.0.10 lib/vcloud/core/metadata_helper.rb
vcloud-core-0.0.9 lib/vcloud/core/metadata_helper.rb
vcloud-core-0.0.8 lib/vcloud/core/metadata_helper.rb
vcloud-core-0.0.7 lib/vcloud/core/metadata_helper.rb
vcloud-core-0.0.6 lib/vcloud/core/metadata_helper.rb
vcloud-core-0.0.5 lib/vcloud/core/metadata_helper.rb
vcloud-core-0.0.4 lib/vcloud/core/metadata_helper.rb
vcloud-core-0.0.3 lib/vcloud/core/metadata_helper.rb
vcloud-core-0.0.2 lib/vcloud/core/metadata_helper.rb
vcloud-core-0.0.1 lib/vcloud/core/metadata_helper.rb