Class: NewDemoApiClient::ConcentrationEndpointTopUsersDetail

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user_id:, amount:, amount_percent:, additional_properties: nil) ⇒ NewDemoApiClient::ConcentrationEndpointTopUsersDetail

Parameters:

  • user_id (String)

    The user identifier.

  • amount (Float)

    The amount for the user.

  • amount_percent (Float)

    The pdf of the total amount for the user.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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

#amountFloat (readonly)

Returns The amount for the user.

Returns:

  • (Float)

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

Returns The pdf of the total amount for the user.

Returns:

  • (Float)

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

Returns The user identifier.

Returns:

  • (String)

    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

Parameters:

  • json_object (String)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (String)


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