Class: CandidApiClient::InsuranceAdjudications::V1::Types::ClaimAdjudication

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/insurance_adjudications/v_1/types/claim_adjudication.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(claim_id:, service_lines:, carcs:, insurance_allowed_amount_cents: OMIT, insurance_paid_amount_cents: OMIT, charge_amount_cents: OMIT, payer_claim_number: OMIT, additional_properties: nil) ⇒ CandidApiClient::InsuranceAdjudications::V1::Types::ClaimAdjudication

Parameters:

  • claim_id (String)
  • insurance_allowed_amount_cents (Integer) (defaults to: OMIT)
  • insurance_paid_amount_cents (Integer) (defaults to: OMIT)
  • charge_amount_cents (Integer) (defaults to: OMIT)
  • service_lines (Hash{String => Array})
  • payer_claim_number (String) (defaults to: OMIT)
  • carcs (Array<CandidApiClient::X12::V1::Types::ClaimAdjustmentReasonCode>)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/candidhealth/insurance_adjudications/v_1/types/claim_adjudication.rb', line 43

def initialize(claim_id:, service_lines:, carcs:, insurance_allowed_amount_cents: OMIT, insurance_paid_amount_cents: OMIT,
               charge_amount_cents: OMIT, payer_claim_number: OMIT, additional_properties: nil)
  @claim_id = claim_id
  @insurance_allowed_amount_cents = insurance_allowed_amount_cents if insurance_allowed_amount_cents != OMIT
  @insurance_paid_amount_cents = insurance_paid_amount_cents if insurance_paid_amount_cents != OMIT
  @charge_amount_cents = charge_amount_cents if charge_amount_cents != OMIT
  @service_lines = service_lines
  @payer_claim_number = payer_claim_number if payer_claim_number != OMIT
  @carcs = carcs
  @additional_properties = additional_properties
  @_field_set = {
    "claim_id": claim_id,
    "insurance_allowed_amount_cents": insurance_allowed_amount_cents,
    "insurance_paid_amount_cents": insurance_paid_amount_cents,
    "charge_amount_cents": charge_amount_cents,
    "service_lines": service_lines,
    "payer_claim_number": payer_claim_number,
    "carcs": carcs
  }.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



27
28
29
# File 'lib/candidhealth/insurance_adjudications/v_1/types/claim_adjudication.rb', line 27

def additional_properties
  @additional_properties
end

#carcsArray<CandidApiClient::X12::V1::Types::ClaimAdjustmentReasonCode> (readonly)



25
26
27
# File 'lib/candidhealth/insurance_adjudications/v_1/types/claim_adjudication.rb', line 25

def carcs
  @carcs
end

#charge_amount_centsInteger (readonly)

Returns:

  • (Integer)


19
20
21
# File 'lib/candidhealth/insurance_adjudications/v_1/types/claim_adjudication.rb', line 19

def charge_amount_cents
  @charge_amount_cents
end

#claim_idString (readonly)

Returns:

  • (String)


13
14
15
# File 'lib/candidhealth/insurance_adjudications/v_1/types/claim_adjudication.rb', line 13

def claim_id
  @claim_id
end

#insurance_allowed_amount_centsInteger (readonly)

Returns:

  • (Integer)


15
16
17
# File 'lib/candidhealth/insurance_adjudications/v_1/types/claim_adjudication.rb', line 15

def insurance_allowed_amount_cents
  @insurance_allowed_amount_cents
end

#insurance_paid_amount_centsInteger (readonly)

Returns:

  • (Integer)


17
18
19
# File 'lib/candidhealth/insurance_adjudications/v_1/types/claim_adjudication.rb', line 17

def insurance_paid_amount_cents
  @insurance_paid_amount_cents
end

#payer_claim_numberString (readonly)

Returns:

  • (String)


23
24
25
# File 'lib/candidhealth/insurance_adjudications/v_1/types/claim_adjudication.rb', line 23

def payer_claim_number
  @payer_claim_number
end

#service_linesHash{String => Array} (readonly)

Returns:

  • (Hash{String => Array})


21
22
23
# File 'lib/candidhealth/insurance_adjudications/v_1/types/claim_adjudication.rb', line 21

def service_lines
  @service_lines
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::InsuranceAdjudications::V1::Types::ClaimAdjudication

Deserialize a JSON object to an instance of ClaimAdjudication

Parameters:

  • json_object (String)

Returns:



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/candidhealth/insurance_adjudications/v_1/types/claim_adjudication.rb', line 70

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  claim_id = struct["claim_id"]
  insurance_allowed_amount_cents = struct["insurance_allowed_amount_cents"]
  insurance_paid_amount_cents = struct["insurance_paid_amount_cents"]
  charge_amount_cents = struct["charge_amount_cents"]
  service_lines = parsed_json["service_lines"]&.transform_values do |value|
    value&.map do |item|
      item = item.to_json
      CandidApiClient::InsuranceAdjudications::V1::Types::ServiceLineAdjudication.from_json(json_object: item)
    end
  end
  payer_claim_number = struct["payer_claim_number"]
  carcs = parsed_json["carcs"]&.map do |item|
    item = item.to_json
    CandidApiClient::X12::V1::Types::ClaimAdjustmentReasonCode.from_json(json_object: item)
  end
  new(
    claim_id: claim_id,
    insurance_allowed_amount_cents: insurance_allowed_amount_cents,
    insurance_paid_amount_cents: insurance_paid_amount_cents,
    charge_amount_cents: charge_amount_cents,
    service_lines: service_lines,
    payer_claim_number: payer_claim_number,
    carcs: carcs,
    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)


113
114
115
116
117
118
119
120
121
# File 'lib/candidhealth/insurance_adjudications/v_1/types/claim_adjudication.rb', line 113

def self.validate_raw(obj:)
  obj.claim_id.is_a?(String) != false || raise("Passed value for field obj.claim_id is not the expected type, validation failed.")
  obj.insurance_allowed_amount_cents&.is_a?(Integer) != false || raise("Passed value for field obj.insurance_allowed_amount_cents is not the expected type, validation failed.")
  obj.insurance_paid_amount_cents&.is_a?(Integer) != false || raise("Passed value for field obj.insurance_paid_amount_cents is not the expected type, validation failed.")
  obj.charge_amount_cents&.is_a?(Integer) != false || raise("Passed value for field obj.charge_amount_cents is not the expected type, validation failed.")
  obj.service_lines.is_a?(Hash) != false || raise("Passed value for field obj.service_lines is not the expected type, validation failed.")
  obj.payer_claim_number&.is_a?(String) != false || raise("Passed value for field obj.payer_claim_number is not the expected type, validation failed.")
  obj.carcs.is_a?(Array) != false || raise("Passed value for field obj.carcs is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of ClaimAdjudication to a JSON object

Returns:

  • (String)


103
104
105
# File 'lib/candidhealth/insurance_adjudications/v_1/types/claim_adjudication.rb', line 103

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