Class: GreenButtonClasses::IntervalReading
- Inherits:
-
Object
- Object
- GreenButtonClasses::IntervalReading
- Defined in:
- lib/greenbutton/gb_classes.rb
Instance Method Summary collapse
- #duration ⇒ Object
- #end_time ⇒ Object
-
#initialize(reading_xml) ⇒ IntervalReading
constructor
A new instance of IntervalReading.
- #start_time ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(reading_xml) ⇒ IntervalReading
Returns a new instance of IntervalReading.
340 341 342 |
# File 'lib/greenbutton/gb_classes.rb', line 340 def initialize(reading_xml) @reading_xml = reading_xml end |
Instance Method Details
#duration ⇒ Object
352 353 354 |
# File 'lib/greenbutton/gb_classes.rb', line 352 def duration @reading_xml.xpath('./timePeriod/duration').text.to_i end |
#end_time ⇒ Object
356 357 358 |
# File 'lib/greenbutton/gb_classes.rb', line 356 def end_time start_time + duration end |
#start_time ⇒ Object
348 349 350 |
# File 'lib/greenbutton/gb_classes.rb', line 348 def start_time Time.at(@reading_xml.xpath('./timePeriod/start').text.to_i).utc end |
#value ⇒ Object
344 345 346 |
# File 'lib/greenbutton/gb_classes.rb', line 344 def value @reading_xml.xpath('./value').text.to_f end |