Class: NewDemoApiClient::TradeoffModel
- Inherits:
-
Object
- Object
- NewDemoApiClient::TradeoffModel
- Defined in:
- lib/test_sdk/types/tradeoff_model.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#areas ⇒ Array<NewDemoApiClient::Area>
readonly
Areas representing the range of the scaling model.
-
#discarded_raw_data ⇒ Array<Hash{String => Float}>
readonly
Additional raw data points which were not used in the model fit due to oulier status.
-
#raw_data ⇒ Array<Hash{String => Float}>
readonly
Raw data points used to generate the scaling model.
-
#scale ⇒ NewDemoApiClient::Scale
readonly
Describes the revenue range of the data whose points represent the trade off.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ NewDemoApiClient::TradeoffModel
Deserialize a JSON object to an instance of TradeoffModel.
-
.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(scale:, raw_data:, discarded_raw_data:, areas:, additional_properties: nil) ⇒ NewDemoApiClient::TradeoffModel constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of TradeoffModel to a JSON object.
Constructor Details
#initialize(scale:, raw_data:, discarded_raw_data:, areas:, additional_properties: nil) ⇒ NewDemoApiClient::TradeoffModel
38 39 40 41 42 43 44 45 |
# File 'lib/test_sdk/types/tradeoff_model.rb', line 38 def initialize(scale:, raw_data:, discarded_raw_data:, areas:, additional_properties: nil) @scale = scale @raw_data = raw_data @discarded_raw_data = discarded_raw_data @areas = areas @additional_properties = additional_properties @_field_set = { "scale": scale, "raw_data": raw_data, "discarded_raw_data": discarded_raw_data, "areas": areas } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
22 23 24 |
# File 'lib/test_sdk/types/tradeoff_model.rb', line 22 def additional_properties @additional_properties end |
#areas ⇒ Array<NewDemoApiClient::Area> (readonly)
Returns Areas representing the range of the scaling model. The x-y coordinates describe a surface containing 1 - alpha share of the data points.
20 21 22 |
# File 'lib/test_sdk/types/tradeoff_model.rb', line 20 def areas @areas end |
#discarded_raw_data ⇒ Array<Hash{String => Float}> (readonly)
Returns Additional raw data points which were not used in the model fit due to oulier status. Dictionary of the two metrics, x then y.
17 18 19 |
# File 'lib/test_sdk/types/tradeoff_model.rb', line 17 def discarded_raw_data @discarded_raw_data 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.
14 15 16 |
# File 'lib/test_sdk/types/tradeoff_model.rb', line 14 def raw_data @raw_data end |
#scale ⇒ NewDemoApiClient::Scale (readonly)
Returns Describes the revenue range of the data whose points represent the trade off.
11 12 13 |
# File 'lib/test_sdk/types/tradeoff_model.rb', line 11 def scale @scale end |
Class Method Details
.from_json(json_object:) ⇒ NewDemoApiClient::TradeoffModel
Deserialize a JSON object to an instance of TradeoffModel
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/test_sdk/types/tradeoff_model.rb', line 51 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["scale"].nil? scale = nil else scale = parsed_json["scale"].to_json scale = NewDemoApiClient::Scale.from_json(json_object: scale) end raw_data = parsed_json["raw_data"] discarded_raw_data = parsed_json["discarded_raw_data"] areas = parsed_json["areas"]&.map do |item| item = item.to_json NewDemoApiClient::Area.from_json(json_object: item) end new( scale: scale, raw_data: raw_data, discarded_raw_data: discarded_raw_data, areas: areas, 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.
88 89 90 91 92 93 |
# File 'lib/test_sdk/types/tradeoff_model.rb', line 88 def self.validate_raw(obj:) NewDemoApiClient::Scale.validate_raw(obj: obj.scale) obj.raw_data.is_a?(Array) != false || raise("Passed value for field obj.raw_data is not the expected type, validation failed.") obj.discarded_raw_data.is_a?(Array) != false || raise("Passed value for field obj.discarded_raw_data is not the expected type, validation failed.") obj.areas.is_a?(Array) != false || raise("Passed value for field obj.areas is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of TradeoffModel to a JSON object
78 79 80 |
# File 'lib/test_sdk/types/tradeoff_model.rb', line 78 def to_json(*_args) @_field_set&.to_json end |