Class: GreenButtonClasses::ElectricPowerUsageSummary

Inherits:
GreenButtonEntry show all
Defined in:
lib/greenbutton/gb_classes.rb

Constant Summary collapse

ATTRS =
['billLastPeriod', 'billToDate', 'costAdditionalLastPeriod', 'currency', 
'qualityOfReading', 'statusTimeStamp']

Instance Attribute Summary collapse

Attributes inherited from GreenButtonEntry

#href, #id, #other_related, #parent_href, #published, #related_hrefs, #title, #updated

Instance Method Summary collapse

Methods inherited from GreenButtonEntry

#add_related, #assign_rules, #doc, #find_by_href, #find_related_entries, #initialize, #parse_related_entry

Constructor Details

This class inherits a constructor from GreenButtonClasses::GreenButtonEntry

Instance Attribute Details

#usage_pointObject

Returns the value of attribute usage_point.



212
213
214
# File 'lib/greenbutton/gb_classes.rb', line 212

def usage_point
  @usage_point
end

Instance Method Details

#additional_rulesObject



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# File 'lib/greenbutton/gb_classes.rb', line 220

def additional_rules
  rules = [
    Rule.new(:bill_duration, ".//duration", :integer),
    Rule.new(:bill_start, ".//start", :unix_time),
    Rule.new(:last_power_ten, ".//overallConsumptionLastPeriod/powerOfTenMultiplier", :integer),
    Rule.new(:last_uom, ".//overallConsumptionLastPeriod/uom", :integer),
    Rule.new(:last_value, ".//overallConsumptionLastPeriod/value", :integer),
    Rule.new(:current_power_ten, ".//currentBillingPeriodOverAllConsumption/powerOfTenMultiplier", :integer),
    Rule.new(:current_uom, ".//currentBillingPeriodOverAllConsumption/uom", :integer),
    Rule.new(:current_value, ".//currentBillingPeriodOverAllConsumption/value", :integer),   
    Rule.new(:current_timestamp, ".//currentBillingPeriodOverAllConsumption/timeStamp", :unix_time)   
  ]
  ATTRS.each do |attr|
    rules << Rule.new( Helper.underscore(attr).to_sym, '//'+attr, :integer )
  end
  rules
end

#pre_rule_assignment(parent) ⇒ Object



216
217
218
# File 'lib/greenbutton/gb_classes.rb', line 216

def pre_rule_assignment(parent)
  self.usage_point = parent
end