Sha256: dc8b94063204cd93b54a91fca74a59f24eb8d6ce68d08fa8c52d75dbbc1243f8

Contents?: true

Size: 697 Bytes

Versions: 4

Compression:

Stored size: 697 Bytes

Contents

module Fog
  module Compute
    class HuaweiCloud
      module MetaParent
        def parent
          @parent
        end

        def parent=(new_parent)
          @parent = new_parent
        end

        def collection_name
          if @parent.class == Fog::Compute::HuaweiCloud::Image
            return "images"
          elsif @parent.class == Fog::Compute::HuaweiCloud::Server
            return "servers"
          else
            raise "Metadata is not supported for this model type."
          end
        end

        def metas_to_hash(metas)
          hash = {}
          metas.each { |meta| hash.store(meta.key, meta.value) }
          hash
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/huaweicloud/models/meta_parent.rb
fog-huaweicloud-0.0.2 lib/fog/huaweicloud/models/meta_parent.rb
fog-huaweicloud-0.1.3 lib/fog/huaweicloud/models/meta_parent.rb
fog-huaweicloud-0.1.2 lib/fog/huaweicloud/models/meta_parent.rb