Class: NewDemoApiClient::ConcentrationEndpointTopUsersDetail
- Inherits:
-
Object
- Object
- NewDemoApiClient::ConcentrationEndpointTopUsersDetail
- Defined in:
- lib/test_sdk/types/concentration_endpoint_top_users_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 user.
-
#amount_percent ⇒ Float
readonly
The pdf of the total amount for the user.
-
#user_id ⇒ String
readonly
The user identifier.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ NewDemoApiClient::ConcentrationEndpointTopUsersDetail
Deserialize a JSON object to an instance of ConcentrationEndpointTopUsersDetail.
-
.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(user_id:, amount:, amount_percent:, additional_properties: nil) ⇒ NewDemoApiClient::ConcentrationEndpointTopUsersDetail constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ConcentrationEndpointTopUsersDetail to a JSON object.
Constructor Details
#initialize(user_id:, amount:, amount_percent:, additional_properties: nil) ⇒ NewDemoApiClient::ConcentrationEndpointTopUsersDetail
27 28 29 30 31 32 33 |
# File 'lib/test_sdk/types/concentration_endpoint_top_users_detail.rb', line 27 def initialize(user_id:, amount:, amount_percent:, additional_properties: nil) @user_id = user_id @amount = amount @amount_percent = amount_percent @additional_properties = additional_properties @_field_set = { "user_id": user_id, "amount": amount, "amount_percent": amount_percent } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
15 16 17 |
# File 'lib/test_sdk/types/concentration_endpoint_top_users_detail.rb', line 15 def additional_properties @additional_properties end |
#amount ⇒ Float (readonly)
Returns The amount for the user.
11 12 13 |
# File 'lib/test_sdk/types/concentration_endpoint_top_users_detail.rb', line 11 def amount @amount end |
#amount_percent ⇒ Float (readonly)
Returns The pdf of the total amount for the user.
13 14 15 |
# File 'lib/test_sdk/types/concentration_endpoint_top_users_detail.rb', line 13 def amount_percent @amount_percent end |
#user_id ⇒ String (readonly)
Returns The user identifier.
9 10 11 |
# File 'lib/test_sdk/types/concentration_endpoint_top_users_detail.rb', line 9 def user_id @user_id end |
Class Method Details
.from_json(json_object:) ⇒ NewDemoApiClient::ConcentrationEndpointTopUsersDetail
Deserialize a JSON object to an instance of ConcentrationEndpointTopUsersDetail
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/test_sdk/types/concentration_endpoint_top_users_detail.rb', line 39 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) user_id = parsed_json["user_id"] amount = parsed_json["amount"] amount_percent = parsed_json["amount_percent"] new( user_id: user_id, amount: amount, amount_percent: amount_percent, 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.
66 67 68 69 70 |
# File 'lib/test_sdk/types/concentration_endpoint_top_users_detail.rb', line 66 def self.validate_raw(obj:) obj.user_id.is_a?(String) != false || raise("Passed value for field obj.user_id 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.amount_percent.is_a?(Float) != false || raise("Passed value for field obj.amount_percent is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ConcentrationEndpointTopUsersDetail to a JSON object
56 57 58 |
# File 'lib/test_sdk/types/concentration_endpoint_top_users_detail.rb', line 56 def to_json(*_args) @_field_set&.to_json end |