Class: AEMO::Meter

Inherits:
Object
  • Object
show all
Defined in:
lib/aemo/meter.rb

Overview

AEMO::Meter represents a meter under a NMI

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ AEMO::Meter

Initialize a meter

Parameters:

  • opts (Hash) (defaults to: {})

    {} the parameters to set



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_codeObject

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_dateObject

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_codeObject

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

#registersObject

Returns the value of attribute registers.



6
7
8
# File 'lib/aemo/meter.rb', line 6

def registers
  @registers
end

#serial_numberObject

Returns the value of attribute serial_number.



6
7
8
# File 'lib/aemo/meter.rb', line 6

def serial_number
  @serial_number
end

#statusObject

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

Parameters:

  • meter (Hash)

    the MSATS hash

Returns:



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