Class: Fog::Brightbox::Compute::Image

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

Instance Attribute Summary

Attributes inherited from Model

#collection, #connection

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #reload, #to_json, #wait_for

Methods included from Attributes::ClassMethods

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

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #identity, #identity=, #merge_attributes, #new_record?, #requires

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#destroyObject



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

def destroy
  requires :identity
  connection.destroy_image(identity)
  true
end

#ready?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/fog/compute/models/brightbox/image.rb', line 29

def ready?
  status == "available"
end

#saveObject



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/fog/compute/models/brightbox/image.rb', line 33

def save
  requires :source, :arch
  options = {
    :source => source,
    :arch => arch,
    :name => name,
    :description => description
  }.delete_if {|k,v| v.nil? || v == "" }
  data = connection.create_image(options)
  merge_attributes(data)
  true
end