Class: Brightbox::DatabaseType
- Inherits:
-
Api
- Object
- Api
- Brightbox::DatabaseType
show all
- Defined in:
- lib/brightbox-cli/database_type.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, #created_on, #exists?, find, find_all_or_warn, find_by_handle, find_or_call, #fog_attributes, #fog_model, #initialize, klass_name, #method_missing, #respond_to_missing?, #to_row, #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
20
21
22
|
# File 'lib/brightbox-cli/database_type.rb', line 20
def self.all
conn.database_types
end
|
.default_field_order ⇒ Object
28
29
30
|
# File 'lib/brightbox-cli/database_type.rb', line 28
def self.default_field_order
%i[id name ram disk]
end
|
.get(id) ⇒ Object
24
25
26
|
# File 'lib/brightbox-cli/database_type.rb', line 24
def self.get(id)
conn.database_types.get id
end
|
.require_account? ⇒ Boolean
3
|
# File 'lib/brightbox-cli/database_type.rb', line 3
def self.require_account?; true; end
|
Instance Method Details
#<=>(other) ⇒ Object
32
33
34
35
36
37
38
|
# File 'lib/brightbox-cli/database_type.rb', line 32
def <=>(other)
ram <=> if other.is_a? DatabaseType
other.ram
else
other
end
end
|
#attributes ⇒ Object
5
6
7
8
9
10
|
# File 'lib/brightbox-cli/database_type.rb', line 5
def attributes
fog_attributes.tap do |attrs|
attrs[:ram] = ram
attrs[:disk] = disk
end
end
|
#disk ⇒ Object
16
17
18
|
# File 'lib/brightbox-cli/database_type.rb', line 16
def disk
fog_model.disk.to_i
end
|
#ram ⇒ Object
12
13
14
|
# File 'lib/brightbox-cli/database_type.rb', line 12
def ram
fog_model.ram.to_i
end
|