Class: CandidApiClient::WriteOffs::V1::Types::InsuranceWriteOff
- Inherits:
-
Object
- Object
- CandidApiClient::WriteOffs::V1::Types::InsuranceWriteOff
- Defined in:
- lib/candidhealth/write_offs/v_1/types/insurance_write_off.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #amount_cents ⇒ Integer readonly
- #payer ⇒ CandidApiClient::Payers::V3::Types::Payer readonly
- #reverted_by_write_off_id ⇒ String readonly
- #reverts_write_off_id ⇒ String readonly
- #write_off_id ⇒ String readonly
- #write_off_note ⇒ String readonly
- #write_off_reason ⇒ CandidApiClient::WriteOffs::V1::Types::InsuranceWriteOffReason readonly
- #write_off_target ⇒ CandidApiClient::WriteOffs::V1::Types::InsuranceWriteOffTarget readonly
- #write_off_timestamp ⇒ DateTime readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::WriteOffs::V1::Types::InsuranceWriteOff
Deserialize a JSON object to an instance of InsuranceWriteOff.
-
.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(write_off_id:, payer:, write_off_target:, write_off_timestamp:, write_off_reason:, amount_cents:, write_off_note: OMIT, reverts_write_off_id: OMIT, reverted_by_write_off_id: OMIT, additional_properties: nil) ⇒ CandidApiClient::WriteOffs::V1::Types::InsuranceWriteOff constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of InsuranceWriteOff to a JSON object.
Constructor Details
#initialize(write_off_id:, payer:, write_off_target:, write_off_timestamp:, write_off_reason:, amount_cents:, write_off_note: OMIT, reverts_write_off_id: OMIT, reverted_by_write_off_id: OMIT, additional_properties: nil) ⇒ CandidApiClient::WriteOffs::V1::Types::InsuranceWriteOff
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/candidhealth/write_offs/v_1/types/insurance_write_off.rb', line 52 def initialize(write_off_id:, payer:, write_off_target:, write_off_timestamp:, write_off_reason:, amount_cents:, write_off_note: OMIT, reverts_write_off_id: OMIT, reverted_by_write_off_id: OMIT, additional_properties: nil) @write_off_id = write_off_id @payer = payer @write_off_target = write_off_target @write_off_timestamp = @write_off_note = write_off_note if write_off_note != OMIT @write_off_reason = write_off_reason @reverts_write_off_id = reverts_write_off_id if reverts_write_off_id != OMIT @reverted_by_write_off_id = reverted_by_write_off_id if reverted_by_write_off_id != OMIT @amount_cents = amount_cents @additional_properties = additional_properties @_field_set = { "write_off_id": write_off_id, "payer": payer, "write_off_target": write_off_target, "write_off_timestamp": , "write_off_note": write_off_note, "write_off_reason": write_off_reason, "reverts_write_off_id": reverts_write_off_id, "reverted_by_write_off_id": reverted_by_write_off_id, "amount_cents": amount_cents }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
34 35 36 |
# File 'lib/candidhealth/write_offs/v_1/types/insurance_write_off.rb', line 34 def additional_properties @additional_properties end |
#amount_cents ⇒ Integer (readonly)
32 33 34 |
# File 'lib/candidhealth/write_offs/v_1/types/insurance_write_off.rb', line 32 def amount_cents @amount_cents end |
#payer ⇒ CandidApiClient::Payers::V3::Types::Payer (readonly)
18 19 20 |
# File 'lib/candidhealth/write_offs/v_1/types/insurance_write_off.rb', line 18 def payer @payer end |
#reverted_by_write_off_id ⇒ String (readonly)
30 31 32 |
# File 'lib/candidhealth/write_offs/v_1/types/insurance_write_off.rb', line 30 def reverted_by_write_off_id @reverted_by_write_off_id end |
#reverts_write_off_id ⇒ String (readonly)
28 29 30 |
# File 'lib/candidhealth/write_offs/v_1/types/insurance_write_off.rb', line 28 def reverts_write_off_id @reverts_write_off_id end |
#write_off_id ⇒ String (readonly)
16 17 18 |
# File 'lib/candidhealth/write_offs/v_1/types/insurance_write_off.rb', line 16 def write_off_id @write_off_id end |
#write_off_note ⇒ String (readonly)
24 25 26 |
# File 'lib/candidhealth/write_offs/v_1/types/insurance_write_off.rb', line 24 def write_off_note @write_off_note end |
#write_off_reason ⇒ CandidApiClient::WriteOffs::V1::Types::InsuranceWriteOffReason (readonly)
26 27 28 |
# File 'lib/candidhealth/write_offs/v_1/types/insurance_write_off.rb', line 26 def write_off_reason @write_off_reason end |
#write_off_target ⇒ CandidApiClient::WriteOffs::V1::Types::InsuranceWriteOffTarget (readonly)
20 21 22 |
# File 'lib/candidhealth/write_offs/v_1/types/insurance_write_off.rb', line 20 def write_off_target @write_off_target end |
#write_off_timestamp ⇒ DateTime (readonly)
22 23 24 |
# File 'lib/candidhealth/write_offs/v_1/types/insurance_write_off.rb', line 22 def @write_off_timestamp end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::WriteOffs::V1::Types::InsuranceWriteOff
Deserialize a JSON object to an instance of InsuranceWriteOff
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/candidhealth/write_offs/v_1/types/insurance_write_off.rb', line 83 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) write_off_id = struct["write_off_id"] if parsed_json["payer"].nil? payer = nil else payer = parsed_json["payer"].to_json payer = CandidApiClient::Payers::V3::Types::Payer.from_json(json_object: payer) end if parsed_json["write_off_target"].nil? write_off_target = nil else write_off_target = parsed_json["write_off_target"].to_json write_off_target = CandidApiClient::WriteOffs::V1::Types::InsuranceWriteOffTarget.from_json(json_object: write_off_target) end = unless parsed_json["write_off_timestamp"].nil? DateTime.parse(parsed_json["write_off_timestamp"]) end write_off_note = struct["write_off_note"] write_off_reason = struct["write_off_reason"] reverts_write_off_id = struct["reverts_write_off_id"] reverted_by_write_off_id = struct["reverted_by_write_off_id"] amount_cents = struct["amount_cents"] new( write_off_id: write_off_id, payer: payer, write_off_target: write_off_target, write_off_timestamp: , write_off_note: write_off_note, write_off_reason: write_off_reason, reverts_write_off_id: reverts_write_off_id, reverted_by_write_off_id: reverted_by_write_off_id, amount_cents: amount_cents, 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.
134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/candidhealth/write_offs/v_1/types/insurance_write_off.rb', line 134 def self.validate_raw(obj:) obj.write_off_id.is_a?(String) != false || raise("Passed value for field obj.write_off_id is not the expected type, validation failed.") CandidApiClient::Payers::V3::Types::Payer.validate_raw(obj: obj.payer) CandidApiClient::WriteOffs::V1::Types::InsuranceWriteOffTarget.validate_raw(obj: obj.write_off_target) obj..is_a?(DateTime) != false || raise("Passed value for field obj.write_off_timestamp is not the expected type, validation failed.") obj.write_off_note&.is_a?(String) != false || raise("Passed value for field obj.write_off_note is not the expected type, validation failed.") obj.write_off_reason.is_a?(CandidApiClient::WriteOffs::V1::Types::InsuranceWriteOffReason) != false || raise("Passed value for field obj.write_off_reason is not the expected type, validation failed.") obj.reverts_write_off_id&.is_a?(String) != false || raise("Passed value for field obj.reverts_write_off_id is not the expected type, validation failed.") obj.reverted_by_write_off_id&.is_a?(String) != false || raise("Passed value for field obj.reverted_by_write_off_id is not the expected type, validation failed.") obj.amount_cents.is_a?(Integer) != false || raise("Passed value for field obj.amount_cents is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of InsuranceWriteOff to a JSON object
124 125 126 |
# File 'lib/candidhealth/write_offs/v_1/types/insurance_write_off.rb', line 124 def to_json(*_args) @_field_set&.to_json end |