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



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)



22
23
24
# File 'lib/test_sdk/types/concentration_endpoint_cdf_detail.rb', line 22

def additional_properties
  @additional_properties
end

#amountFloat (readonly)



13
14
15
# File 'lib/test_sdk/types/concentration_endpoint_cdf_detail.rb', line 13

def amount
  @amount
end

#cdf_amountFloat (readonly)



20
21
22
# File 'lib/test_sdk/types/concentration_endpoint_cdf_detail.rb', line 20

def cdf_amount
  @cdf_amount
end

#cdf_usersFloat (readonly)



17
18
19
# File 'lib/test_sdk/types/concentration_endpoint_cdf_detail.rb', line 17

def cdf_users
  @cdf_users
end

#methodString (readonly)



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