Class: CandidApiClient::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefundCreate

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/non_insurance_payer_refunds/v_1/types/non_insurance_payer_refund_create.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(non_insurance_payer_id:, amount_cents:, allocations:, invoice_id: OMIT, refund_timestamp: OMIT, refund_note: OMIT, check_number: OMIT, refund_reason: OMIT, additional_properties: nil) ⇒ CandidApiClient::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefundCreate

Parameters:

  • non_insurance_payer_id (String)
  • invoice_id (String) (defaults to: OMIT)
  • amount_cents (Integer)
  • refund_timestamp (DateTime) (defaults to: OMIT)
  • refund_note (String) (defaults to: OMIT)
  • check_number (String) (defaults to: OMIT)
  • allocations (Array<CandidApiClient::Financials::Types::AllocationCreate>)
  • refund_reason (CandidApiClient::Financials::Types::RefundReason) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/candidhealth/non_insurance_payer_refunds/v_1/types/non_insurance_payer_refund_create.rb', line 48

def initialize(non_insurance_payer_id:, amount_cents:, allocations:, invoice_id: OMIT, refund_timestamp: OMIT,
               refund_note: OMIT, check_number: OMIT, refund_reason: OMIT, additional_properties: nil)
  @non_insurance_payer_id = non_insurance_payer_id
  @invoice_id = invoice_id if invoice_id != OMIT
  @amount_cents = amount_cents
  @refund_timestamp = refund_timestamp if refund_timestamp != OMIT
  @refund_note = refund_note if refund_note != OMIT
  @check_number = check_number if check_number != OMIT
  @allocations = allocations
  @refund_reason = refund_reason if refund_reason != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "non_insurance_payer_id": non_insurance_payer_id,
    "invoice_id": invoice_id,
    "amount_cents": amount_cents,
    "refund_timestamp": refund_timestamp,
    "refund_note": refund_note,
    "check_number": check_number,
    "allocations": allocations,
    "refund_reason": refund_reason
  }.reject do |_k, v|
    v == OMIT
  end
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



31
32
33
# File 'lib/candidhealth/non_insurance_payer_refunds/v_1/types/non_insurance_payer_refund_create.rb', line 31

def additional_properties
  @additional_properties
end

#allocationsArray<CandidApiClient::Financials::Types::AllocationCreate> (readonly)



27
28
29
# File 'lib/candidhealth/non_insurance_payer_refunds/v_1/types/non_insurance_payer_refund_create.rb', line 27

def allocations
  @allocations
end

#amount_centsInteger (readonly)

Returns:

  • (Integer)


19
20
21
# File 'lib/candidhealth/non_insurance_payer_refunds/v_1/types/non_insurance_payer_refund_create.rb', line 19

def amount_cents
  @amount_cents
end

#check_numberString (readonly)

Returns:

  • (String)


25
26
27
# File 'lib/candidhealth/non_insurance_payer_refunds/v_1/types/non_insurance_payer_refund_create.rb', line 25

def check_number
  @check_number
end

#invoice_idString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/candidhealth/non_insurance_payer_refunds/v_1/types/non_insurance_payer_refund_create.rb', line 17

def invoice_id
  @invoice_id
end

#non_insurance_payer_idString (readonly)

Returns:

  • (String)


15
16
17
# File 'lib/candidhealth/non_insurance_payer_refunds/v_1/types/non_insurance_payer_refund_create.rb', line 15

def non_insurance_payer_id
  @non_insurance_payer_id
end

#refund_noteString (readonly)

Returns:

  • (String)


23
24
25
# File 'lib/candidhealth/non_insurance_payer_refunds/v_1/types/non_insurance_payer_refund_create.rb', line 23

def refund_note
  @refund_note
end

#refund_reasonCandidApiClient::Financials::Types::RefundReason (readonly)



29
30
31
# File 'lib/candidhealth/non_insurance_payer_refunds/v_1/types/non_insurance_payer_refund_create.rb', line 29

def refund_reason
  @refund_reason
end

#refund_timestampDateTime (readonly)

Returns:

  • (DateTime)


21
22
23
# File 'lib/candidhealth/non_insurance_payer_refunds/v_1/types/non_insurance_payer_refund_create.rb', line 21

def refund_timestamp
  @refund_timestamp
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefundCreate

Deserialize a JSON object to an instance of NonInsurancePayerRefundCreate



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/candidhealth/non_insurance_payer_refunds/v_1/types/non_insurance_payer_refund_create.rb', line 77

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  non_insurance_payer_id = struct["non_insurance_payer_id"]
  invoice_id = struct["invoice_id"]
  amount_cents = struct["amount_cents"]
  refund_timestamp = unless parsed_json["refund_timestamp"].nil?
                       DateTime.parse(parsed_json["refund_timestamp"])
                     end
  refund_note = struct["refund_note"]
  check_number = struct["check_number"]
  allocations = parsed_json["allocations"]&.map do |item|
    item = item.to_json
    CandidApiClient::Financials::Types::AllocationCreate.from_json(json_object: item)
  end
  refund_reason = struct["refund_reason"]
  new(
    non_insurance_payer_id: non_insurance_payer_id,
    invoice_id: invoice_id,
    amount_cents: amount_cents,
    refund_timestamp: refund_timestamp,
    refund_note: refund_note,
    check_number: check_number,
    allocations: allocations,
    refund_reason: refund_reason,
    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)


119
120
121
122
123
124
125
126
127
128
# File 'lib/candidhealth/non_insurance_payer_refunds/v_1/types/non_insurance_payer_refund_create.rb', line 119

def self.validate_raw(obj:)
  obj.non_insurance_payer_id.is_a?(String) != false || raise("Passed value for field obj.non_insurance_payer_id is not the expected type, validation failed.")
  obj.invoice_id&.is_a?(String) != false || raise("Passed value for field obj.invoice_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.")
  obj.refund_timestamp&.is_a?(DateTime) != false || raise("Passed value for field obj.refund_timestamp is not the expected type, validation failed.")
  obj.refund_note&.is_a?(String) != false || raise("Passed value for field obj.refund_note is not the expected type, validation failed.")
  obj.check_number&.is_a?(String) != false || raise("Passed value for field obj.check_number 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.")
  obj.refund_reason&.is_a?(CandidApiClient::Financials::Types::RefundReason) != false || raise("Passed value for field obj.refund_reason is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of NonInsurancePayerRefundCreate to a JSON object

Returns:

  • (String)


109
110
111
# File 'lib/candidhealth/non_insurance_payer_refunds/v_1/types/non_insurance_payer_refund_create.rb', line 109

def to_json(*_args)
  @_field_set&.to_json
end