Class: TreasureData::Account
Instance Attribute Summary collapse
- #account_id ⇒ Object readonly
- #guaranteed_cores ⇒ Object readonly
-
#maximum_cores ⇒ Object
readonly
Returns the value of attribute maximum_cores.
- #plan ⇒ Object readonly
- #storage_size ⇒ Object readonly
Attributes inherited from Model
Instance Method Summary collapse
- #created_at ⇒ Time?
-
#initialize(client, account_id, plan, storage_size = nil, guaranteed_cores = nil, maximum_cores = nil, created_at = nil) ⇒ Account
constructor
A new instance of Account.
- #storage_size_string ⇒ String
Constructor Details
#initialize(client, account_id, plan, storage_size = nil, guaranteed_cores = nil, maximum_cores = nil, created_at = nil) ⇒ Account
Returns a new instance of Account.
24 25 26 27 28 29 30 31 32 |
# File 'lib/td/client/model.rb', line 24 def initialize(client, account_id, plan, storage_size=nil, guaranteed_cores=nil, maximum_cores=nil, created_at=nil) super(client) @account_id = account_id @plan = plan @storage_size = storage_size @guaranteed_cores = guaranteed_cores @maximum_cores = maximum_cores @created_at = created_at end |
Instance Attribute Details
#account_id ⇒ Object (readonly)
39 40 41 |
# File 'lib/td/client/model.rb', line 39 def account_id @account_id end |
#guaranteed_cores ⇒ Object (readonly)
39 |
# File 'lib/td/client/model.rb', line 39 attr_reader :account_id, :plan, :storage_size, :guaranteed_cores, :maximum_cores |
#maximum_cores ⇒ Object (readonly)
Returns the value of attribute maximum_cores.
39 |
# File 'lib/td/client/model.rb', line 39 attr_reader :account_id, :plan, :storage_size, :guaranteed_cores, :maximum_cores |
#plan ⇒ Object (readonly)
39 |
# File 'lib/td/client/model.rb', line 39 attr_reader :account_id, :plan, :storage_size, :guaranteed_cores, :maximum_cores |
#storage_size ⇒ Object (readonly)
39 |
# File 'lib/td/client/model.rb', line 39 attr_reader :account_id, :plan, :storage_size, :guaranteed_cores, :maximum_cores |
Instance Method Details
#created_at ⇒ Time?
42 43 44 |
# File 'lib/td/client/model.rb', line 42 def created_at @created_at && !@created_at.empty? ? Time.parse(@created_at) : nil end |
#storage_size_string ⇒ String
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/td/client/model.rb', line 47 def storage_size_string if @storage_size <= 1024 * 1024 return "0.0 GB" elsif @storage_size <= 60 * 1024 * 1024 return "0.01 GB" elsif @storage_size <= 60 * 1024 * 1024 * 1024 "%.1f GB" % (@storage_size.to_f / (1024 * 1024 * 1024)) else "%d GB" % (@storage_size.to_f / (1024 * 1024 * 1024)).to_i end end |