Class: Brightbox::Account
- Inherits:
-
Api
- Object
- Api
- Brightbox::Account
show all
- Defined in:
- lib/bbcloud/accounts.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
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
16
17
18
19
20
|
# File 'lib/bbcloud/accounts.rb', line 16
def self.all
a = conn.account
a.connection = conn
[a]
end
|
.default_field_order ⇒ Object
32
33
34
|
# File 'lib/bbcloud/accounts.rb', line 32
def self.default_field_order
[:id, :name, :cloud_ip_limit, :ram_limit, :ram_used, :ram_free]
end
|
.get(id) ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'lib/bbcloud/accounts.rb', line 22
def self.get(id)
a = conn.account
a.connection = conn
if a.id == id
a
else
nil
end
end
|
Instance Method Details
#cloud_ip_limit ⇒ Object
8
9
10
|
# File 'lib/bbcloud/accounts.rb', line 8
def cloud_ip_limit
attributes['cloud_ips_limit']
end
|
#ram_free ⇒ Object
4
5
6
|
# File 'lib/bbcloud/accounts.rb', line 4
def ram_free
[ram_limit.to_i - ram_used.to_i, 0].max
end
|
#to_row ⇒ Object
12
13
14
|
# File 'lib/bbcloud/accounts.rb', line 12
def to_row
attributes.merge(:ram_free => ram_free, :cloud_ip_limit => cloud_ip_limit)
end
|
#to_s ⇒ Object
36
37
38
|
# File 'lib/bbcloud/accounts.rb', line 36
def to_s
@id
end
|