Class: NewDemoApiClient::ConcentrationEndpointCdfDetail

Inherits:
Object
  • Object
show all
Defined in:
lib/test_sdk/types/concentration_endpoint_cdf_detail.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method:, amount:, cdf_users: OMIT, cdf_amount: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::ConcentrationEndpointCdfDetail

Parameters:

  • method (String)

    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.

  • amount (Float)

    The amount for the CDF.

  • cdf_users (Float) (defaults to: OMIT)

    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

  • cdf_amount (Float) (defaults to: OMIT)

    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.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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

#amountFloat (readonly)

Returns The amount for the CDF.

Returns:

  • (Float)

    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_amountFloat (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.

Returns:

  • (Float)

    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_usersFloat (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.

Returns:

  • (Float)

    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

#methodString (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.

Returns:

  • (String)

    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

Parameters:

  • json_object (String)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (String)


79
80
81
# File 'lib/test_sdk/types/concentration_endpoint_cdf_detail.rb', line 79

def to_json(*_args)
  @_field_set&.to_json
end