Class: NewDemoApiClient::ConcentrationEndpointCdfDetail
- Inherits:
-
Object
- Object
- NewDemoApiClient::ConcentrationEndpointCdfDetail
- Defined in:
- lib/test_sdk/types/concentration_endpoint_cdf_detail.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#amount ⇒ Float
readonly
The amount for the CDF.
-
#cdf_amount ⇒ Float
readonly
The cumulative distribution function of the amount, sorted smallest to largest.
-
#cdf_users ⇒ Float
readonly
The cumulative distribution function of the users, sorted smallest to largest.
-
#method ⇒ String
readonly
The method used.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ NewDemoApiClient::ConcentrationEndpointCdfDetail
Deserialize a JSON object to an instance of ConcentrationEndpointCdfDetail.
-
.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(method:, amount:, cdf_users: OMIT, cdf_amount: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::ConcentrationEndpointCdfDetail constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ConcentrationEndpointCdfDetail to a JSON object.
Constructor Details
#initialize(method:, amount:, cdf_users: OMIT, cdf_amount: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::ConcentrationEndpointCdfDetail
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/test_sdk/types/concentration_endpoint_cdf_detail.rb', line 40 def initialize(method:, amount:, cdf_users: OMIT, cdf_amount: OMIT, additional_properties: nil) @method = method @amount = amount @cdf_users = cdf_users if cdf_users != OMIT @cdf_amount = cdf_amount if cdf_amount != OMIT @additional_properties = additional_properties @_field_set = { "method": method, "amount": amount, "cdf_users": cdf_users, "cdf_amount": cdf_amount }.reject do |_k, v| v == OMIT end 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/concentration_endpoint_cdf_detail.rb', line 22 def additional_properties @additional_properties end |
#amount ⇒ Float (readonly)
Returns The amount for the CDF.
13 14 15 |
# File 'lib/test_sdk/types/concentration_endpoint_cdf_detail.rb', line 13 def amount @amount end |
#cdf_amount ⇒ Float (readonly)
Returns The cumulative distribution function of the amount, sorted smallest to largest. This tells us what percentage of all amount is held by the bottom x% of users.
20 21 22 |
# File 'lib/test_sdk/types/concentration_endpoint_cdf_detail.rb', line 20 def cdf_amount @cdf_amount end |
#cdf_users ⇒ Float (readonly)
Returns The cumulative distribution function of the users, sorted smallest to largest. This evenly weights users by count, and represents (1 - top quantile) of the user.
17 18 19 |
# File 'lib/test_sdk/types/concentration_endpoint_cdf_detail.rb', line 17 def cdf_users @cdf_users end |
#method ⇒ String (readonly)
Returns The method used. When ‘top_user’, the value represents the CDF at the exact value of a top user. When ‘distribution_quantile’, the value represents the CDF at an approximately evenly spaced quantile.
11 12 13 |
# File 'lib/test_sdk/types/concentration_endpoint_cdf_detail.rb', line 11 def method @method end |
Class Method Details
.from_json(json_object:) ⇒ NewDemoApiClient::ConcentrationEndpointCdfDetail
Deserialize a JSON object to an instance of ConcentrationEndpointCdfDetail
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/test_sdk/types/concentration_endpoint_cdf_detail.rb', line 60 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) method = parsed_json["method"] amount = parsed_json["amount"] cdf_users = parsed_json["cdf_users"] cdf_amount = parsed_json["cdf_amount"] new( method: method, amount: amount, cdf_users: cdf_users, cdf_amount: cdf_amount, 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.
89 90 91 92 93 94 |
# File 'lib/test_sdk/types/concentration_endpoint_cdf_detail.rb', line 89 def self.validate_raw(obj:) obj.method.is_a?(String) != false || raise("Passed value for field obj.method is not the expected type, validation failed.") obj.amount.is_a?(Float) != false || raise("Passed value for field obj.amount is not the expected type, validation failed.") obj.cdf_users&.is_a?(Float) != false || raise("Passed value for field obj.cdf_users is not the expected type, validation failed.") obj.cdf_amount&.is_a?(Float) != false || raise("Passed value for field obj.cdf_amount is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ConcentrationEndpointCdfDetail to a JSON object
79 80 81 |
# File 'lib/test_sdk/types/concentration_endpoint_cdf_detail.rb', line 79 def to_json(*_args) @_field_set&.to_json end |