Class: Brightbox::Type

Inherits:
Api
  • Object
show all
Defined in:
lib/bbcloud/types.rb

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

.allObject



31
32
33
# File 'lib/bbcloud/types.rb', line 31

def self.all
  conn.flavors
end

.default_field_orderObject



39
40
41
# File 'lib/bbcloud/types.rb', line 39

def self.default_field_order
  [:id, :name, :handle, :ram, :disk, :cores, :description]
end

.get(id) ⇒ Object



35
36
37
# File 'lib/bbcloud/types.rb', line 35

def self.get id
  conn.flavors.get id
end

Instance Method Details

#attributesObject



4
5
6
7
8
9
# File 'lib/bbcloud/types.rb', line 4

def attributes
  o = fog_model.attributes
  o[:ram] = ram
  o[:disk] = disk
  o
end

#diskObject



15
16
17
# File 'lib/bbcloud/types.rb', line 15

def disk
  fog_model.disk.to_i
end

#idObject



27
28
29
# File 'lib/bbcloud/types.rb', line 27

def id
  fog_model.id
end

#ramObject



11
12
13
# File 'lib/bbcloud/types.rb', line 11

def ram
  fog_model.ram.to_i
end

#render_cellObject



23
24
25
# File 'lib/bbcloud/types.rb', line 23

def render_cell
  handle
end

#to_rowObject



19
20
21
# File 'lib/bbcloud/types.rb', line 19

def to_row
  attributes
end