Class: AEMO::Meter
- Inherits:
-
Object
- Object
- AEMO::Meter
- Defined in:
- lib/aemo/meter.rb
Overview
AEMO::Meter represents a meter under a NMI
Instance Attribute Summary collapse
-
#installation_type_code ⇒ Object
Returns the value of attribute installation_type_code.
-
#next_scheduled_read_date ⇒ Object
Returns the value of attribute next_scheduled_read_date.
-
#read_type_code ⇒ Object
Returns the value of attribute read_type_code.
-
#registers ⇒ Object
Returns the value of attribute registers.
-
#serial_number ⇒ Object
Returns the value of attribute serial_number.
-
#status ⇒ Object
Returns the value of attribute status.
Class Method Summary collapse
-
.from_hash(meter) ⇒ AEMO::Meter
Initialize a new meter from an MSATS hash.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ AEMO::Meter
constructor
Initialize a meter.
Constructor Details
#initialize(opts = {}) ⇒ AEMO::Meter
Initialize a meter
13 14 15 16 17 18 19 20 |
# File 'lib/aemo/meter.rb', line 13 def initialize(opts = {}) @installation_type_code = opts[:installation_type_code] @next_scheduled_read_date = opts[:next_scheduled_read_date] @read_type_code = opts[:read_type_code] @registers = opts[:registers] || [] @serial_number = opts[:serial_number] @status = opts[:status] end |
Instance Attribute Details
#installation_type_code ⇒ Object
Returns the value of attribute installation_type_code.
6 7 8 |
# File 'lib/aemo/meter.rb', line 6 def installation_type_code @installation_type_code end |
#next_scheduled_read_date ⇒ Object
Returns the value of attribute next_scheduled_read_date.
6 7 8 |
# File 'lib/aemo/meter.rb', line 6 def next_scheduled_read_date @next_scheduled_read_date end |
#read_type_code ⇒ Object
Returns the value of attribute read_type_code.
6 7 8 |
# File 'lib/aemo/meter.rb', line 6 def read_type_code @read_type_code end |
#registers ⇒ Object
Returns the value of attribute registers.
6 7 8 |
# File 'lib/aemo/meter.rb', line 6 def registers @registers end |
#serial_number ⇒ Object
Returns the value of attribute serial_number.
6 7 8 |
# File 'lib/aemo/meter.rb', line 6 def serial_number @serial_number end |
#status ⇒ Object
Returns the value of attribute status.
6 7 8 |
# File 'lib/aemo/meter.rb', line 6 def status @status end |
Class Method Details
.from_hash(meter) ⇒ AEMO::Meter
Initialize a new meter from an MSATS hash
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/aemo/meter.rb', line 26 def self.from_hash(meter) AEMO::Meter.new( installation_type_code: meter['InstallationTypeCode'], next_scheduled_read_date: meter['NextScheduledReadDate'], read_type_code: meter['ReadTypeCode'], registers: [], serial_number: meter['SerialNumber'], status: meter['Status'] ) end |