Class: Rafflesia::UsageSummaryData

Inherits:
Types::BaseModel
  • Object
show all
Defined in:
lib/rafflesia/billing/usage_summary_data.rb

Constant Summary collapse

HASH_ATTRS =
{
  bucket_interval: :bucket_interval,
  cost_usd_data: :cost_usd_data,
  currency: :currency,
  data: :data,
  ended_at: :ended_at,
  environment_id: :environment_id,
  object: :object,
  operations_data: :operations_data,
  organization_id: :organization_id,
  started_at: :started_at,
  total_rated_amount_microusd: :total_rated_amount_microusd
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ UsageSummaryData

Returns a new instance of UsageSummaryData.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/rafflesia/billing/usage_summary_data.rb', line 35

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @bucket_interval = hash[:bucket_interval]
  @cost_usd_data = (hash[:cost_usd_data] || []).map { |item| item ? Rafflesia::UsageTimeSeriesPoint.new(item) : nil }
  @currency = hash[:currency]
  @data = (hash[:data] || []).map { |item| item ? Rafflesia::UsageSummary.new(item) : nil }
  @ended_at = hash[:ended_at]
  @environment_id = hash[:environment_id]
  @object = hash[:object]
  @operations_data = (hash[:operations_data] || []).map { |item| item ? Rafflesia::UsageTimeSeriesPoint.new(item) : nil }
  @organization_id = hash[:organization_id]
  @started_at = hash[:started_at]
  @total_rated_amount_microusd = hash[:total_rated_amount_microusd]
end

Instance Attribute Details

#bucket_intervalObject

Returns the value of attribute bucket_interval.



22
23
24
# File 'lib/rafflesia/billing/usage_summary_data.rb', line 22

def bucket_interval
  @bucket_interval
end

#cost_usd_dataObject

Returns the value of attribute cost_usd_data.



22
23
24
# File 'lib/rafflesia/billing/usage_summary_data.rb', line 22

def cost_usd_data
  @cost_usd_data
end

#currencyObject

Returns the value of attribute currency.



22
23
24
# File 'lib/rafflesia/billing/usage_summary_data.rb', line 22

def currency
  @currency
end

#dataObject

Returns the value of attribute data.



22
23
24
# File 'lib/rafflesia/billing/usage_summary_data.rb', line 22

def data
  @data
end

#ended_atObject

Returns the value of attribute ended_at.



22
23
24
# File 'lib/rafflesia/billing/usage_summary_data.rb', line 22

def ended_at
  @ended_at
end

#environment_idObject

Returns the value of attribute environment_id.



22
23
24
# File 'lib/rafflesia/billing/usage_summary_data.rb', line 22

def environment_id
  @environment_id
end

#objectObject

Returns the value of attribute object.



22
23
24
# File 'lib/rafflesia/billing/usage_summary_data.rb', line 22

def object
  @object
end

#operations_dataObject

Returns the value of attribute operations_data.



22
23
24
# File 'lib/rafflesia/billing/usage_summary_data.rb', line 22

def operations_data
  @operations_data
end

#organization_idObject

Returns the value of attribute organization_id.



22
23
24
# File 'lib/rafflesia/billing/usage_summary_data.rb', line 22

def organization_id
  @organization_id
end

#started_atObject

Returns the value of attribute started_at.



22
23
24
# File 'lib/rafflesia/billing/usage_summary_data.rb', line 22

def started_at
  @started_at
end

#total_rated_amount_microusdObject

Returns the value of attribute total_rated_amount_microusd.



22
23
24
# File 'lib/rafflesia/billing/usage_summary_data.rb', line 22

def total_rated_amount_microusd
  @total_rated_amount_microusd
end