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_from_parent, #other_related, #related_hrefs

Instance Method Summary collapse

Methods inherited from GreenButtonEntry

#add_related_entry, #add_related_link, #all_rules, #assign_rule, #create_attributes, #doc, #entry_node, #find_by_href, #get_related_links, #initialize

Constructor Details

This class inherits a constructor from GreenButtonClasses::GreenButtonEntry

Instance Attribute Details

#usage_pointObject

Returns the value of attribute usage_point


248
249
250
# File 'lib/greenbutton/gb_classes.rb', line 248

def usage_point
  @usage_point
end

Instance Method Details

#additional_rulesObject


256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/greenbutton/gb_classes.rb', line 256

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

#pre_rule_assignment(parent) ⇒ Object


252
253
254
# File 'lib/greenbutton/gb_classes.rb', line 252

def pre_rule_assignment(parent)
  self.usage_point = parent
end