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

Instance Method Summary collapse

Methods included from Utilities

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

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



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

def commodity
  if @commodity.is_a? Numeric
    COMMODITY[@commodity]
  elsif @commodity.is_a? Symbol
    @commodity
  end
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



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

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

Instance Method Details

#status_timestamp(kwargs = {}) ⇒ Object



28
29
30
# File 'lib/green-button-data/usage_summary.rb', line 28

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

#to_sObject



32
33
34
# File 'lib/green-button-data/usage_summary.rb', line 32

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