Class: TestPack1::DataPerCategoryItem
- Defined in:
- lib/test_pack_1/models/data_per_category_item.rb
Overview
Data for a single aggregate group and contract category combination.
Instance Attribute Summary collapse
-
#aggregate_id ⇒ Integer
The id of this aggregate group: device id, site id, or the constant -1 for portfolio.
-
#category_title ⇒ String
The ids of the devices in this aggregate group.
-
#contract_title ⇒ String
The ids of the devices in this aggregate group.
-
#device_ids ⇒ List of Integer
The ids of the devices in this aggregate group.
-
#duration ⇒ Float
The summed duration in seconds allocated to this contract category and aggregate group.
-
#value ⇒ Float
The aggregated value of the selected data signal.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(aggregate_id = nil, device_ids = nil, contract_title = nil, category_title = nil, value = nil, duration = nil) ⇒ DataPerCategoryItem
constructor
A new instance of DataPerCategoryItem.
Methods inherited from BaseModel
Constructor Details
#initialize(aggregate_id = nil, device_ids = nil, contract_title = nil, category_title = nil, value = nil, duration = nil) ⇒ DataPerCategoryItem
Returns a new instance of DataPerCategoryItem.
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/test_pack_1/models/data_per_category_item.rb', line 47 def initialize(aggregate_id = nil, device_ids = nil, contract_title = nil, category_title = nil, value = nil, duration = nil) @aggregate_id = aggregate_id @device_ids = device_ids @contract_title = contract_title @category_title = category_title @value = value @duration = duration end |
Instance Attribute Details
#aggregate_id ⇒ Integer
The id of this aggregate group: device id, site id, or the constant -1 for portfolio
12 13 14 |
# File 'lib/test_pack_1/models/data_per_category_item.rb', line 12 def aggregate_id @aggregate_id end |
#category_title ⇒ String
The ids of the devices in this aggregate group.
24 25 26 |
# File 'lib/test_pack_1/models/data_per_category_item.rb', line 24 def category_title @category_title end |
#contract_title ⇒ String
The ids of the devices in this aggregate group.
20 21 22 |
# File 'lib/test_pack_1/models/data_per_category_item.rb', line 20 def contract_title @contract_title end |
#device_ids ⇒ List of Integer
The ids of the devices in this aggregate group.
16 17 18 |
# File 'lib/test_pack_1/models/data_per_category_item.rb', line 16 def device_ids @device_ids end |
#duration ⇒ Float
The summed duration in seconds allocated to this contract category and aggregate group.
33 34 35 |
# File 'lib/test_pack_1/models/data_per_category_item.rb', line 33 def duration @duration end |
#value ⇒ Float
The aggregated value of the selected data signal.
28 29 30 |
# File 'lib/test_pack_1/models/data_per_category_item.rb', line 28 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/test_pack_1/models/data_per_category_item.rb', line 62 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. aggregate_id = hash['aggregateId'] device_ids = hash['deviceIds'] contract_title = hash['contractTitle'] category_title = hash['categoryTitle'] value = hash['value'] duration = hash['duration'] # Create object from extracted values. DataPerCategoryItem.new(aggregate_id, device_ids, contract_title, category_title, value, duration) end |
.names ⇒ Object
A mapping from model property names to API property names.
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/test_pack_1/models/data_per_category_item.rb', line 36 def self.names @_hash = {} if @_hash.nil? @_hash['aggregate_id'] = 'aggregateId' @_hash['device_ids'] = 'deviceIds' @_hash['contract_title'] = 'contractTitle' @_hash['category_title'] = 'categoryTitle' @_hash['value'] = 'value' @_hash['duration'] = 'duration' @_hash end |