class TreasureData::Account

Attributes

account_id[R]

@!attribute [r] account_id @!attribute [r] plan @!attribute [r] storage_size @!attribute [r] guaranteed_cores @!attribute [r] maximum_cores

guaranteed_cores[R]

@!attribute [r] account_id @!attribute [r] plan @!attribute [r] storage_size @!attribute [r] guaranteed_cores @!attribute [r] maximum_cores

maximum_cores[R]

@!attribute [r] account_id @!attribute [r] plan @!attribute [r] storage_size @!attribute [r] guaranteed_cores @!attribute [r] maximum_cores

plan[R]

@!attribute [r] account_id @!attribute [r] plan @!attribute [r] storage_size @!attribute [r] guaranteed_cores @!attribute [r] maximum_cores

storage_size[R]

@!attribute [r] account_id @!attribute [r] plan @!attribute [r] storage_size @!attribute [r] guaranteed_cores @!attribute [r] maximum_cores

Public Class Methods

new(client, account_id, plan, storage_size=nil, guaranteed_cores=nil, maximum_cores=nil, created_at=nil) click to toggle source

@param [TreasureData::Client] client @param [String] account_id @param [Fixnum] plan @param [Fixnum] storage_size @param [Fixnum] guaranteed_cores @param [Fixnum] maximum_cores @param [String] created_at

Calls superclass method TreasureData::Model::new
# 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

Public Instance Methods

created_at() click to toggle source

@return <Time, nil>

# 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() click to toggle source

@return <String>

# 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