Class: EmuPower::Notifications::BlockPriceDetail

Inherits:
Notification
  • Object
show all
Defined in:
lib/emu_power/notifications.rb

Constant Summary

Constants inherited from Notification

Notification::UNIX_TIME_OFFSET

Instance Attribute Summary collapse

Attributes inherited from Notification

#device_mac, #meter_mac, #raw, #timestamp

Instance Method Summary collapse

Methods inherited from Notification

#initialize, #parse_amount, #parse_bool, #parse_hex, #parse_timestamp, root_name, subclasses, #to_s

Constructor Details

This class inherits a constructor from EmuPower::Notifications::Notification

Instance Attribute Details

#block_consumptionObject

Returns the value of attribute block_consumption.



352
353
354
# File 'lib/emu_power/notifications.rb', line 352

def block_consumption
  @block_consumption
end

#currency_codeObject

Returns the value of attribute currency_code.



354
355
356
# File 'lib/emu_power/notifications.rb', line 354

def currency_code
  @currency_code
end

#current_durationObject

Returns the value of attribute current_duration.



351
352
353
# File 'lib/emu_power/notifications.rb', line 351

def current_duration
  @current_duration
end

#current_startObject

Returns the value of attribute current_start.



350
351
352
# File 'lib/emu_power/notifications.rb', line 350

def current_start
  @current_start
end

#number_of_blocksObject

Returns the value of attribute number_of_blocks.



353
354
355
# File 'lib/emu_power/notifications.rb', line 353

def number_of_blocks
  @number_of_blocks
end

#trailing_digitsObject

Returns the value of attribute trailing_digits.



355
356
357
# File 'lib/emu_power/notifications.rb', line 355

def trailing_digits
  @trailing_digits
end

Instance Method Details

#build(hash) ⇒ Object



357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
# File 'lib/emu_power/notifications.rb', line 357

def build(hash)
	self.current_start = parse_timestamp('CurrentStart')
	self.current_duration = parse_hex('CurrentDuration')
	self.block_consumption = parse_amount(
			'BlockPeriodConsumption',
			'BlockPeriodConsumptionMultiplier',
			'BlockPeriodConsumptionDivisor'
	)

	# Note: Not sure if multiplier/divisor are supposed to tie in here
	self.number_of_blocks = parse_amount('NumberOfBlocks')

	self.currency_code = parse_hex('Currency')
	self.trailing_digits = parse_hex('TrailingDigits')

end