Class: Fog::Compute::Google::Image

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/google/models/compute/image.rb

Instance Attribute Summary

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#reloadObject



32
33
34
35
36
37
38
39
# File 'lib/fog/google/models/compute/image.rb', line 32

def reload
  requires :name

  data = service.get_image(name, self.project).body

  self.merge_attributes(data)
  self
end

#resource_urlObject



47
48
49
# File 'lib/fog/google/models/compute/image.rb', line 47

def resource_url
  "#{self.project}/global/images/#{name}"
end

#saveObject



41
42
43
44
45
# File 'lib/fog/google/models/compute/image.rb', line 41

def save
  requires :name

  reload
end