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, #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
32
33
34
|
# File 'lib/bbcloud/images.rb', line 32
def self.all
conn.images
end
|
.default_field_order ⇒ Object
40
41
42
|
# File 'lib/bbcloud/images.rb', line 40
def self.default_field_order
[:id, :owner, :type, :created_on, :status, :size, :name]
end
|
.get(id) ⇒ Object
36
37
38
|
# File 'lib/bbcloud/images.rb', line 36
def self.get(id)
conn.images.get(id)
end
|
Instance Method Details
#public? ⇒ Boolean
28
29
30
|
# File 'lib/bbcloud/images.rb', line 28
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
|