Class: GreenButtonData::UsageSummary

Inherits:
Entry
  • Object
show all
Includes:
Enumerations, Utilities
Defined in:
lib/green-button-data/usage_summary.rb

Constant Summary

Constants included from Enumerations

Enumerations::ACCUMULATION, Enumerations::AUTHORIZATION_STATUS, Enumerations::COMMODITY, Enumerations::CURRENCY, Enumerations::DATA_CUSTODIAN_APPLICATION_STATUS, Enumerations::DATA_QUALIFIER, Enumerations::ESPI_SERVICE_STATUS, Enumerations::FLOW_DIRECTION, Enumerations::MEASUREMENT, Enumerations::PHASE_CODE, Enumerations::QUALITY_OF_READING, Enumerations::SERVICE, Enumerations::THIRD_PARTY_APPLICATION_STATUS, Enumerations::THIRD_PARTY_APPLICATION_TYPE, Enumerations::THIRD_PARTY_APPLICATION_USE, Enumerations::TIME_ATTRIBUTE, Enumerations::TIME_PERIOD_OF_INTEREST, Enumerations::UNIT_MULTIPLIER, Enumerations::UNIT_SYMBOL

Instance Attribute Summary collapse

Attributes inherited from Entry

#id, #token, #usage_point_id

Instance Method Summary collapse

Methods included from Utilities

#attributes_to_hash, #class_from_name, #epoch_to_time, #first_sunday_of, #last_weekday_of, #normalize_epoch, #nth_weekday_of, #parse_datetime, #weekday_offset

Methods inherited from Entry

#initialize

Methods included from Fetchable

included

Constructor Details

This class inherits a constructor from GreenButtonData::Entry

Instance Attribute Details

#billing_periodObject (readonly)

Returns the value of attribute billing_period.



6
7
8
# File 'lib/green-button-data/usage_summary.rb', line 6

def billing_period
  @billing_period
end

#commodityObject



14
15
16
17
18
19
20
# File 'lib/green-button-data/usage_summary.rb', line 14

def commodity
  if @commodity.is_a? Numeric
    COMMODITY[@commodity]
  elsif @commodity.is_a? Symbol
    @commodity
  end
end

#cost_additional_detail_last_periodsObject (readonly)

Returns the value of attribute cost_additional_detail_last_periods.



6
7
8
# File 'lib/green-button-data/usage_summary.rb', line 6

def cost_additional_detail_last_periods
  @cost_additional_detail_last_periods
end

#overall_consumption_last_periodObject (readonly)

Returns the value of attribute overall_consumption_last_period.



6
7
8
# File 'lib/green-button-data/usage_summary.rb', line 6

def overall_consumption_last_period
  @overall_consumption_last_period
end

#quality_of_readingObject



22
23
24
25
26
27
28
# File 'lib/green-button-data/usage_summary.rb', line 22

def quality_of_reading
  if @quality_of_reading.is_a? Numeric
    QUALITY_OF_READING[@quality_of_reading]
  elsif @quality_of_reading.is_a? Symbol
    @quality_of_reading
  end
end

#tariffObject (readonly)

Returns the value of attribute tariff.



6
7
8
# File 'lib/green-button-data/usage_summary.rb', line 6

def tariff
  @tariff
end

Instance Method Details

#costObject



38
39
40
# File 'lib/green-button-data/usage_summary.rb', line 38

def cost
  @bill_last_period / 100_000.0
end

#status_timestamp(kwargs = {}) ⇒ Object



30
31
32
# File 'lib/green-button-data/usage_summary.rb', line 30

def status_timestamp(kwargs = {})
  epoch_to_time @status_time_stamp, kwargs
end

#to_sObject



34
35
36
# File 'lib/green-button-data/usage_summary.rb', line 34

def to_s
  "#{@billing_period}: #{@overall_consumption_last_period}"
end