Class: NewDemoApiClient::ScaleModel
- Inherits:
-
Object
- Object
- NewDemoApiClient::ScaleModel
- Defined in:
- lib/test_sdk/types/scale_model.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#bands ⇒ Array<NewDemoApiClient::BandResponse>
readonly
Bands representing the range of the scaling model.
-
#pred ⇒ Array<Hash{String => Float}>
readonly
Predicted center trend line of the scaling model.
-
#raw_data ⇒ Array<Hash{String => Float}>
readonly
Raw data points used to generate the scaling model.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ NewDemoApiClient::ScaleModel
Deserialize a JSON object to an instance of ScaleModel.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(raw_data:, pred:, bands:, additional_properties: nil) ⇒ NewDemoApiClient::ScaleModel constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ScaleModel to a JSON object.
Constructor Details
#initialize(raw_data:, pred:, bands:, additional_properties: nil) ⇒ NewDemoApiClient::ScaleModel
32 33 34 35 36 37 38 |
# File 'lib/test_sdk/types/scale_model.rb', line 32 def initialize(raw_data:, pred:, bands:, additional_properties: nil) @raw_data = raw_data @pred = pred @bands = bands @additional_properties = additional_properties @_field_set = { "raw_data": raw_data, "pred": pred, "bands": bands } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
18 19 20 |
# File 'lib/test_sdk/types/scale_model.rb', line 18 def additional_properties @additional_properties end |
#bands ⇒ Array<NewDemoApiClient::BandResponse> (readonly)
Returns Bands representing the range of the scaling model.
16 17 18 |
# File 'lib/test_sdk/types/scale_model.rb', line 16 def bands @bands end |
#pred ⇒ Array<Hash{String => Float}> (readonly)
Returns Predicted center trend line of the scaling model. Dictioary of the two metrics, x then y.
14 15 16 |
# File 'lib/test_sdk/types/scale_model.rb', line 14 def pred @pred end |
#raw_data ⇒ Array<Hash{String => Float}> (readonly)
Returns Raw data points used to generate the scaling model. Dictionary of the two metrics, x then y.
11 12 13 |
# File 'lib/test_sdk/types/scale_model.rb', line 11 def raw_data @raw_data end |
Class Method Details
.from_json(json_object:) ⇒ NewDemoApiClient::ScaleModel
Deserialize a JSON object to an instance of ScaleModel
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/test_sdk/types/scale_model.rb', line 44 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) raw_data = parsed_json["raw_data"] pred = parsed_json["pred"] bands = parsed_json["bands"]&.map do |item| item = item.to_json NewDemoApiClient::BandResponse.from_json(json_object: item) end new( raw_data: raw_data, pred: pred, bands: bands, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
74 75 76 77 78 |
# File 'lib/test_sdk/types/scale_model.rb', line 74 def self.validate_raw(obj:) obj.raw_data.is_a?(Array) != false || raise("Passed value for field obj.raw_data is not the expected type, validation failed.") obj.pred.is_a?(Array) != false || raise("Passed value for field obj.pred is not the expected type, validation failed.") obj.bands.is_a?(Array) != false || raise("Passed value for field obj.bands is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ScaleModel to a JSON object
64 65 66 |
# File 'lib/test_sdk/types/scale_model.rb', line 64 def to_json(*_args) @_field_set&.to_json end |