lib/fog/openstack/models/compute/metadata.rb in fog-1.9.0 vs lib/fog/openstack/models/compute/metadata.rb in fog-1.10.0
- old
+ new
@@ -22,34 +22,33 @@
load(metas)
end
def get(key)
requires :parent
- data = service.get_meta(collection_name, @parent.id, key).body["meta"]
+ data = service.get_metadata(collection_name, @parent.id, key).body["meta"]
metas = []
data.each_pair {|k,v| metas << {"key" => k, "value" => v} }
new(metas[0])
rescue Fog::Compute::OpenStack::NotFound
nil
end
def update(data=nil)
requires :parent
- service.update_metadata(collection_name, @parent.id, meta_hash(data))
+ service.update_metadata(collection_name, @parent.id, to_hash(data))
end
def set(data=nil)
requires :parent
- service.set_metadata(collection_name, @parent.id, meta_hash(data))
+ service.set_metadata(collection_name, @parent.id, to_hash(data))
end
def new(attributes = {})
requires :parent
super({ :parent => @parent }.merge!(attributes))
end
- private
- def meta_hash(data=nil)
+ def to_hash(data=nil)
if data.nil?
data={}
self.each do |meta|
if meta.is_a?(Fog::Compute::OpenStack::Metadatum) then
data.store(meta.key, meta.value)