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


377
378
379
# File 'lib/greenbutton/gb_classes.rb', line 377

def initialize(reading_xml)
  @reading_xml = reading_xml
end

Instance Method Details

#durationObject


389
390
391
# File 'lib/greenbutton/gb_classes.rb', line 389

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

#end_timeObject


393
394
395
# File 'lib/greenbutton/gb_classes.rb', line 393

def end_time
  start_time + duration
end

#start_timeObject


385
386
387
# File 'lib/greenbutton/gb_classes.rb', line 385

def start_time
  Time.at(@reading_xml.xpath('./timePeriod/start').text.to_i).utc
end

#valueObject


381
382
383
# File 'lib/greenbutton/gb_classes.rb', line 381

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