Class: Brightbox::Image
- Inherits:
-
Api
- Object
- Api
- Brightbox::Image
show all
- Defined in:
- lib/bbcloud/images.rb
Instance Attribute Summary
Attributes inherited from Api
#id
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Api
cache_all!, cached_get, conn, #exists?, find, find_by_handle, find_or_call, #fog_model, #initialize, #method_missing, #to_s
Constructor Details
This class inherits a constructor from Brightbox::Api
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Brightbox::Api
Class Method Details
.all ⇒ Object
37
38
39
|
# File 'lib/bbcloud/images.rb', line 37
def self.all
conn.images
end
|
.default_field_order ⇒ Object
45
46
47
|
# File 'lib/bbcloud/images.rb', line 45
def self.default_field_order
[:id, :owner, :type, :created_on, :status, :size, :name]
end
|
.get(id) ⇒ Object
41
42
43
|
# File 'lib/bbcloud/images.rb', line 41
def self.get(id)
conn.images.get(id)
end
|
.register(options = {}) ⇒ Object
28
29
30
31
|
# File 'lib/bbcloud/images.rb', line 28
def self.register(options = {})
image = conn.create_image(options)
find image['id']
end
|
Instance Method Details
#public? ⇒ Boolean
33
34
35
|
# File 'lib/bbcloud/images.rb', line 33
def public?
public
end
|
#to_row ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/bbcloud/images.rb', line 4
def to_row
o = fog_model.attributes
o[:id] = fog_model.id
if status == "available"
o[:status] = (public ? 'public' : 'private')
else
o[:status] = status
end
o[:arch] = arch
o[:name] = name.to_s + " (#{arch})"
o[:owner] = owner_id
if official
o[:type] = "official"
o[:owner] = "brightbox"
else
o[:type] = source_type
end
o[:created_at] = created_at
o[:created_on] = created_at.to_s.split('T').first
o[:description] = description if description
o[:size] = virtual_size
o
end
|