Class: CandidApiClient::InsurancePayments::V1::Types::InsurancePaymentCreate
- Inherits:
-
Object
- Object
- CandidApiClient::InsurancePayments::V1::Types::InsurancePaymentCreate
- Defined in:
- lib/candidhealth/insurance_payments/v_1/types/insurance_payment_create.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #allocations ⇒ Array<CandidApiClient::Financials::Types::AllocationCreate> readonly
- #amount_cents ⇒ Integer readonly
- #payer_identifier ⇒ CandidApiClient::Payers::V3::Types::PayerIdentifier readonly
- #payment_note ⇒ String readonly
- #payment_timestamp ⇒ DateTime readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::InsurancePayments::V1::Types::InsurancePaymentCreate
Deserialize a JSON object to an instance of InsurancePaymentCreate.
-
.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(payer_identifier:, amount_cents:, allocations:, payment_timestamp: OMIT, payment_note: OMIT, additional_properties: nil) ⇒ CandidApiClient::InsurancePayments::V1::Types::InsurancePaymentCreate constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of InsurancePaymentCreate to a JSON object.
Constructor Details
#initialize(payer_identifier:, amount_cents:, allocations:, payment_timestamp: OMIT, payment_note: OMIT, additional_properties: nil) ⇒ CandidApiClient::InsurancePayments::V1::Types::InsurancePaymentCreate
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/candidhealth/insurance_payments/v_1/types/insurance_payment_create.rb', line 39 def initialize(payer_identifier:, amount_cents:, allocations:, payment_timestamp: OMIT, payment_note: OMIT, additional_properties: nil) @payer_identifier = payer_identifier @amount_cents = amount_cents @payment_timestamp = if != OMIT @payment_note = payment_note if payment_note != OMIT @allocations = allocations @additional_properties = additional_properties @_field_set = { "payer_identifier": payer_identifier, "amount_cents": amount_cents, "payment_timestamp": , "payment_note": payment_note, "allocations": allocations }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
25 26 27 |
# File 'lib/candidhealth/insurance_payments/v_1/types/insurance_payment_create.rb', line 25 def additional_properties @additional_properties end |
#allocations ⇒ Array<CandidApiClient::Financials::Types::AllocationCreate> (readonly)
23 24 25 |
# File 'lib/candidhealth/insurance_payments/v_1/types/insurance_payment_create.rb', line 23 def allocations @allocations end |
#amount_cents ⇒ Integer (readonly)
17 18 19 |
# File 'lib/candidhealth/insurance_payments/v_1/types/insurance_payment_create.rb', line 17 def amount_cents @amount_cents end |
#payer_identifier ⇒ CandidApiClient::Payers::V3::Types::PayerIdentifier (readonly)
15 16 17 |
# File 'lib/candidhealth/insurance_payments/v_1/types/insurance_payment_create.rb', line 15 def payer_identifier @payer_identifier end |
#payment_note ⇒ String (readonly)
21 22 23 |
# File 'lib/candidhealth/insurance_payments/v_1/types/insurance_payment_create.rb', line 21 def payment_note @payment_note end |
#payment_timestamp ⇒ DateTime (readonly)
19 20 21 |
# File 'lib/candidhealth/insurance_payments/v_1/types/insurance_payment_create.rb', line 19 def @payment_timestamp end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::InsurancePayments::V1::Types::InsurancePaymentCreate
Deserialize a JSON object to an instance of InsurancePaymentCreate
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/candidhealth/insurance_payments/v_1/types/insurance_payment_create.rb', line 62 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["payer_identifier"].nil? payer_identifier = nil else payer_identifier = parsed_json["payer_identifier"].to_json payer_identifier = CandidApiClient::Payers::V3::Types::PayerIdentifier.from_json(json_object: payer_identifier) end amount_cents = struct["amount_cents"] = unless parsed_json["payment_timestamp"].nil? DateTime.parse(parsed_json["payment_timestamp"]) end payment_note = struct["payment_note"] allocations = parsed_json["allocations"]&.map do |item| item = item.to_json CandidApiClient::Financials::Types::AllocationCreate.from_json(json_object: item) end new( payer_identifier: payer_identifier, amount_cents: amount_cents, payment_timestamp: , payment_note: payment_note, allocations: allocations, 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.
103 104 105 106 107 108 109 |
# File 'lib/candidhealth/insurance_payments/v_1/types/insurance_payment_create.rb', line 103 def self.validate_raw(obj:) CandidApiClient::Payers::V3::Types::PayerIdentifier.validate_raw(obj: obj.payer_identifier) obj.amount_cents.is_a?(Integer) != false || raise("Passed value for field obj.amount_cents is not the expected type, validation failed.") obj.&.is_a?(DateTime) != false || raise("Passed value for field obj.payment_timestamp is not the expected type, validation failed.") obj.payment_note&.is_a?(String) != false || raise("Passed value for field obj.payment_note is not the expected type, validation failed.") obj.allocations.is_a?(Array) != false || raise("Passed value for field obj.allocations is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of InsurancePaymentCreate to a JSON object
93 94 95 |
# File 'lib/candidhealth/insurance_payments/v_1/types/insurance_payment_create.rb', line 93 def to_json(*_args) @_field_set&.to_json end |