Sha256: c44d2140b09bbf6ee53508c476a7b30eebb77d89114423ceeddc8d39888e60da

Contents?: true

Size: 691 Bytes

Versions: 20

Compression:

Stored size: 691 Bytes

Contents

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

        def parent=(new_parent)
          @parent = new_parent
        end

        def collection_name
          if @parent.class == Fog::OpenStack::Compute::Image
            return "images"
          elsif @parent.class == Fog::OpenStack::Compute::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

20 entries across 20 versions & 3 rubygems

Version Path
fog-openstack-1.1.3 lib/fog/openstack/models/meta_parent.rb
fog-openstack-1.1.2 lib/fog/openstack/models/meta_parent.rb
fog-openstack-fork-99 lib/fog/openstack/models/meta_parent.rb
fog-openstack-1.1.0 lib/fog/openstack/models/meta_parent.rb
fog-openstack-1.1.0.pre lib/fog/openstack/models/meta_parent.rb
fog-openstack-apibank-1.0.102 lib/fog/openstack/models/meta_parent.rb
fog-openstack-1.0.11 lib/fog/openstack/models/meta_parent.rb
fog-openstack-apibank-1.0.101 lib/fog/openstack/models/meta_parent.rb
fog-openstack-1.0.10 lib/fog/openstack/models/meta_parent.rb
fog-openstack-1.0.9 lib/fog/openstack/models/meta_parent.rb
fog-openstack-1.0.8 lib/fog/openstack/models/meta_parent.rb
fog-openstack-1.0.7 lib/fog/openstack/models/meta_parent.rb
fog-openstack-1.0.6 lib/fog/openstack/models/meta_parent.rb
fog-openstack-1.0.5 lib/fog/openstack/models/meta_parent.rb
fog-openstack-1.0.4 lib/fog/openstack/models/meta_parent.rb
fog-openstack-1.0.3 lib/fog/openstack/models/meta_parent.rb
fog-openstack-1.0.2 lib/fog/openstack/models/meta_parent.rb
fog-openstack-1.0.1 lib/fog/openstack/models/meta_parent.rb
fog-openstack-1.0.0 lib/fog/openstack/models/meta_parent.rb
fog-openstack-0.3.1 lib/fog/openstack/models/meta_parent.rb