Class: TestPack1::DataPerCategoryResponse
- Defined in:
- lib/test_pack_1/models/data_per_category_response.rb
Overview
An object containing data grouped by contract category and aggregate.
Instance Attribute Summary collapse
-
#calculation ⇒ CalculationModeEnum
Which operation to use when aggregating data.
-
#data ⇒ List of DataPerCategoryItem
A list of objects: one per combination of * aggregate * contract category.
-
#data_signal ⇒ DataSignal
A 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(data_signal = nil, calculation = nil, data = nil) ⇒ DataPerCategoryResponse
constructor
A new instance of DataPerCategoryResponse.
Methods inherited from BaseModel
Constructor Details
#initialize(data_signal = nil, calculation = nil, data = nil) ⇒ DataPerCategoryResponse
Returns a new instance of DataPerCategoryResponse.
32 33 34 35 36 37 38 |
# File 'lib/test_pack_1/models/data_per_category_response.rb', line 32 def initialize(data_signal = nil, calculation = nil, data = nil) @data_signal = data_signal @calculation = calculation @data = data end |
Instance Attribute Details
#calculation ⇒ CalculationModeEnum
Which operation to use when aggregating data.
15 16 17 |
# File 'lib/test_pack_1/models/data_per_category_response.rb', line 15 def calculation @calculation end |
#data ⇒ List of DataPerCategoryItem
A list of objects: one per combination of
-
aggregate
-
contract category
21 22 23 |
# File 'lib/test_pack_1/models/data_per_category_response.rb', line 21 def data @data end |
#data_signal ⇒ DataSignal
A data signal.
11 12 13 |
# File 'lib/test_pack_1/models/data_per_category_response.rb', line 11 def data_signal @data_signal end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/test_pack_1/models/data_per_category_response.rb', line 41 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. data_signal = DataSignal.from_hash(hash['dataSignal']) if hash['dataSignal'] calculation = hash['calculation'] # Parameter is an array, so we need to iterate through it data = nil unless hash['data'].nil? data = [] hash['data'].each do |structure| data << (DataPerCategoryItem.from_hash(structure) if structure) end end # Create object from extracted values. DataPerCategoryResponse.new(data_signal, calculation, data) end |
.names ⇒ Object
A mapping from model property names to API property names.
24 25 26 27 28 29 30 |
# File 'lib/test_pack_1/models/data_per_category_response.rb', line 24 def self.names @_hash = {} if @_hash.nil? @_hash['data_signal'] = 'dataSignal' @_hash['calculation'] = 'calculation' @_hash['data'] = 'data' @_hash end |