Class: GreenButtonClasses::IntervalReading

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

Instance Method Summary collapse

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

#durationObject



352
353
354
# File 'lib/greenbutton/gb_classes.rb', line 352

def duration
  @reading_xml.xpath('./timePeriod/duration').text.to_i
end

#end_timeObject



356
357
358
# File 'lib/greenbutton/gb_classes.rb', line 356

def end_time
  start_time + duration
end

#start_timeObject



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

#valueObject



344
345
346
# File 'lib/greenbutton/gb_classes.rb', line 344

def value
  @reading_xml.xpath('./value').text.to_f
end