Class: GreenButtonClasses::UsagePoint
- Inherits:
-
GreenButtonEntry
- Object
- GreenButtonEntry
- GreenButtonClasses::UsagePoint
- Defined in:
- lib/greenbutton/gb_classes.rb
Instance Attribute Summary collapse
-
#electric_power_quality_summaries ⇒ Object
Returns the value of attribute electric_power_quality_summaries.
-
#electric_power_usage_summaries ⇒ Object
Returns the value of attribute electric_power_usage_summaries.
-
#green_button ⇒ Object
Returns the value of attribute green_button.
-
#local_time_parameters ⇒ Object
Returns the value of attribute local_time_parameters.
-
#meter_readings ⇒ Object
Returns the value of attribute meter_readings.
Attributes inherited from GreenButtonEntry
#href, #id, #other_related, #parent_href, #published, #related_hrefs, #title, #updated
Instance Method Summary collapse
- #add_related(type, parser) ⇒ Object
- #additional_rules ⇒ Object
- #customer_id ⇒ Object
- #doc ⇒ Object
- #pre_rule_assignment(parent) ⇒ Object
Methods inherited from GreenButtonEntry
#assign_rules, #find_by_href, #find_related_entries, #initialize, #parse_related_entry
Constructor Details
This class inherits a constructor from GreenButtonClasses::GreenButtonEntry
Instance Attribute Details
#electric_power_quality_summaries ⇒ Object
Returns the value of attribute electric_power_quality_summaries.
130 131 132 |
# File 'lib/greenbutton/gb_classes.rb', line 130 def electric_power_quality_summaries @electric_power_quality_summaries end |
#electric_power_usage_summaries ⇒ Object
Returns the value of attribute electric_power_usage_summaries.
130 131 132 |
# File 'lib/greenbutton/gb_classes.rb', line 130 def electric_power_usage_summaries @electric_power_usage_summaries end |
#green_button ⇒ Object
Returns the value of attribute green_button.
130 131 132 |
# File 'lib/greenbutton/gb_classes.rb', line 130 def @green_button end |
#local_time_parameters ⇒ Object
Returns the value of attribute local_time_parameters.
130 131 132 |
# File 'lib/greenbutton/gb_classes.rb', line 130 def local_time_parameters @local_time_parameters end |
#meter_readings ⇒ Object
Returns the value of attribute meter_readings.
130 131 132 |
# File 'lib/greenbutton/gb_classes.rb', line 130 def meter_readings @meter_readings end |
Instance Method Details
#add_related(type, parser) ⇒ Object
144 145 146 147 148 149 150 151 152 153 |
# File 'lib/greenbutton/gb_classes.rb', line 144 def (type, parser) case type when 'local_time_parameters' self.local_time_parameters = parser when 'meter_reading', 'electric_power_usage_summary', 'electric_power_quality_summary' self.send(Helper.pluralize(type)) << parser else raise 'Not a recognized relation for UsagePoint: ' + type end end |
#additional_rules ⇒ Object
155 156 157 |
# File 'lib/greenbutton/gb_classes.rb', line 155 def additional_rules [ Rule.new(:service_kind, "//ServiceCategory/kind", :ServiceKind) ] end |
#customer_id ⇒ Object
159 160 161 162 163 164 165 |
# File 'lib/greenbutton/gb_classes.rb', line 159 def customer_id if @customer_id.nil? match = /\/([^\/]+)\/UsagePoint/i.match(self.href) @customer_id = match.nil? ? nil : match[1] end @customer_id end |
#doc ⇒ Object
140 141 142 |
# File 'lib/greenbutton/gb_classes.rb', line 140 def doc self..doc end |
#pre_rule_assignment(parent) ⇒ Object
133 134 135 136 137 138 |
# File 'lib/greenbutton/gb_classes.rb', line 133 def pre_rule_assignment(parent) self. = parent self.meter_readings = [] self.electric_power_quality_summaries = [] self.electric_power_usage_summaries = [] end |