Class: CandidApiClient::Claims::Types::Claim

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/claims/types/claim.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(claim_id:, status:, service_lines:, eras:, clearinghouse: OMIT, clearinghouse_claim_id: OMIT, payer_claim_id: OMIT, clia_number: OMIT, additional_properties: nil) ⇒ CandidApiClient::Claims::Types::Claim

Parameters:



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

def initialize(claim_id:, status:, service_lines:, eras:, clearinghouse: OMIT, clearinghouse_claim_id: OMIT, payer_claim_id: OMIT,
               clia_number: OMIT, additional_properties: nil)
  @claim_id = claim_id
  @status = status
  @clearinghouse = clearinghouse if clearinghouse != OMIT
  @clearinghouse_claim_id = clearinghouse_claim_id if clearinghouse_claim_id != OMIT
  @payer_claim_id = payer_claim_id if payer_claim_id != OMIT
  @clia_number = clia_number if clia_number != OMIT
  @service_lines = service_lines
  @eras = eras
  @additional_properties = additional_properties
  @_field_set = {
    "claim_id": claim_id,
    "status": status,
    "clearinghouse": clearinghouse,
    "clearinghouse_claim_id": clearinghouse_claim_id,
    "payer_claim_id": payer_claim_id,
    "clia_number": clia_number,
    "service_lines": service_lines,
    "eras": eras
  }.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



30
31
32
# File 'lib/candidhealth/claims/types/claim.rb', line 30

def additional_properties
  @additional_properties
end

#claim_idString (readonly)

Returns:

  • (String)


14
15
16
# File 'lib/candidhealth/claims/types/claim.rb', line 14

def claim_id
  @claim_id
end

#clearinghouseString (readonly)

Returns:

  • (String)


18
19
20
# File 'lib/candidhealth/claims/types/claim.rb', line 18

def clearinghouse
  @clearinghouse
end

#clearinghouse_claim_idString (readonly)

Returns:

  • (String)


20
21
22
# File 'lib/candidhealth/claims/types/claim.rb', line 20

def clearinghouse_claim_id
  @clearinghouse_claim_id
end

#clia_numberString (readonly)

Returns:

  • (String)


24
25
26
# File 'lib/candidhealth/claims/types/claim.rb', line 24

def clia_number
  @clia_number
end

#erasArray<CandidApiClient::Era::Types::Era> (readonly)



28
29
30
# File 'lib/candidhealth/claims/types/claim.rb', line 28

def eras
  @eras
end

#payer_claim_idString (readonly)

Returns:

  • (String)


22
23
24
# File 'lib/candidhealth/claims/types/claim.rb', line 22

def payer_claim_id
  @payer_claim_id
end

#service_linesArray<CandidApiClient::ServiceLines::V2::Types::ServiceLine> (readonly)



26
27
28
# File 'lib/candidhealth/claims/types/claim.rb', line 26

def service_lines
  @service_lines
end

#statusCandidApiClient::Claims::Types::ClaimStatus (readonly)



16
17
18
# File 'lib/candidhealth/claims/types/claim.rb', line 16

def status
  @status
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::Claims::Types::Claim

Deserialize a JSON object to an instance of Claim

Parameters:

  • json_object (String)

Returns:



76
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/claims/types/claim.rb', line 76

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"]
  status = struct["status"]
  clearinghouse = struct["clearinghouse"]
  clearinghouse_claim_id = struct["clearinghouse_claim_id"]
  payer_claim_id = struct["payer_claim_id"]
  clia_number = struct["clia_number"]
  service_lines = parsed_json["service_lines"]&.map do |item|
    item = item.to_json
    CandidApiClient::ServiceLines::V2::Types::ServiceLine.from_json(json_object: item)
  end
  eras = parsed_json["eras"]&.map do |item|
    item = item.to_json
    CandidApiClient::Era::Types::Era.from_json(json_object: item)
  end
  new(
    claim_id: claim_id,
    status: status,
    clearinghouse: clearinghouse,
    clearinghouse_claim_id: clearinghouse_claim_id,
    payer_claim_id: payer_claim_id,
    clia_number: clia_number,
    service_lines: service_lines,
    eras: eras,
    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/claims/types/claim.rb', line 119

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.status.is_a?(CandidApiClient::Claims::Types::ClaimStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
  obj.clearinghouse&.is_a?(String) != false || raise("Passed value for field obj.clearinghouse is not the expected type, validation failed.")
  obj.clearinghouse_claim_id&.is_a?(String) != false || raise("Passed value for field obj.clearinghouse_claim_id is not the expected type, validation failed.")
  obj.payer_claim_id&.is_a?(String) != false || raise("Passed value for field obj.payer_claim_id is not the expected type, validation failed.")
  obj.clia_number&.is_a?(String) != false || raise("Passed value for field obj.clia_number is not the expected type, validation failed.")
  obj.service_lines.is_a?(Array) != false || raise("Passed value for field obj.service_lines is not the expected type, validation failed.")
  obj.eras.is_a?(Array) != false || raise("Passed value for field obj.eras is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of Claim to a JSON object

Returns:

  • (String)


109
110
111
# File 'lib/candidhealth/claims/types/claim.rb', line 109

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