Class: AMON::Entity

Inherits:
Document show all
Defined in:
lib/amon/entity.rb

Overview

An AMON entity, such as a house, business park, or building floor

Instance Attribute Summary

Attributes inherited from Document

#session

Attributes included from JSONHelper

#json

Instance Method Summary collapse

Methods inherited from Document

#==, #initialize

Constructor Details

This class inherits a constructor from AMON::Document

Instance Method Details

#device_idsArray<String>

Returns The ids of all the devices associated with this entity.

Returns:

  • (Array<String>)

    The ids of all the devices associated with this entity



8
# File 'lib/amon/entity.rb', line 8

field :device_ids,          :name => 'deviceIds',                  :default => []

#devicesArray<Device>

Returns The devices associated with this entity.

Returns:

  • (Array<Device>)

    The devices associated with this entity



15
16
17
# File 'lib/amon/entity.rb', line 15

def devices
  @devices ||= device_ids.map { |device_id| session.device(id, device_id) }
end

#idString

Returns The id for this entity.

Returns:

  • (String)

    The id for this entity



5
# File 'lib/amon/entity.rb', line 5

field :id,                 :name => 'entityId'

#metering_point_idsArray<String>

TODO:

Rename to qualified_metering_point_ids

Returns The qualified ids of all the metering points associated with this entity.

Returns:

  • (Array<String>)

    The qualified ids of all the metering points associated with this entity



12
# File 'lib/amon/entity.rb', line 12

field :metering_point_ids, :name => 'qualifiedMeteringPointIds', :default => []

#metering_pointsArray<MeteringPoint>

Returns The metering points associated with this entity.

Returns:

  • (Array<MeteringPoint>)

    The metering points associated with this entity



20
21
22
# File 'lib/amon/entity.rb', line 20

def metering_points
  @metering_points ||= metering_point_ids.map { |id| session.metering_point(id) }
end