candidhealth 0.27.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/candidhealth/pre_encounter/appointments/client.rb +32 -0
  3. data/lib/candidhealth/pre_encounter/appointments/v_1/client.rb +607 -0
  4. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment.rb +257 -0
  5. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment_reason.rb +19 -0
  6. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment_sort_field.rb +16 -0
  7. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment_type.rb +17 -0
  8. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment_work_queue.rb +17 -0
  9. data/lib/candidhealth/pre_encounter/appointments/v_1/types/mutable_appointment.rb +203 -0
  10. data/lib/candidhealth/pre_encounter/appointments/v_1/types/service.rb +82 -0
  11. data/lib/candidhealth/pre_encounter/appointments/v_1/types/universal_service_identifier.rb +18 -0
  12. data/lib/candidhealth/pre_encounter/common/types/external_provider.rb +11 -2
  13. data/lib/candidhealth/pre_encounter/common/types/external_provider_type.rb +1 -0
  14. data/lib/candidhealth/pre_encounter/common/types/resource_page.rb +72 -0
  15. data/lib/candidhealth/pre_encounter/common/types/sort_direction.rb +14 -0
  16. data/lib/candidhealth/pre_encounter/coverages/v_1/client.rb +267 -8
  17. data/lib/candidhealth/pre_encounter/coverages/v_1/types/coverage.rb +31 -3
  18. data/lib/candidhealth/pre_encounter/coverages/v_1/types/coverage_benefits.rb +88 -0
  19. data/lib/candidhealth/pre_encounter/coverages/v_1/types/coverage_eligibility_check_response.rb +94 -0
  20. data/lib/candidhealth/pre_encounter/coverages/v_1/types/coverage_value.rb +74 -0
  21. data/lib/candidhealth/pre_encounter/coverages/v_1/types/eligibility_check.rb +62 -0
  22. data/lib/candidhealth/pre_encounter/coverages/v_1/types/eligibility_check_metadata.rb +103 -0
  23. data/lib/candidhealth/pre_encounter/coverages/v_1/types/eligibility_check_status.rb +19 -0
  24. data/lib/candidhealth/pre_encounter/coverages/v_1/types/insurance_type_code.rb +0 -1
  25. data/lib/candidhealth/pre_encounter/coverages/v_1/types/mutable_coverage.rb +31 -3
  26. data/lib/candidhealth/pre_encounter/coverages/v_1/types/plan_coverage.rb +86 -0
  27. data/lib/candidhealth/pre_encounter/coverages/v_1/types/plan_coverage_details.rb +124 -0
  28. data/lib/candidhealth/pre_encounter/coverages/v_1/types/service_coverage.rb +98 -0
  29. data/lib/candidhealth/pre_encounter/coverages/v_1/types/service_coverage_details.rb +124 -0
  30. data/lib/candidhealth/pre_encounter/coverages/v_1/types/service_type_code.rb +203 -0
  31. data/lib/candidhealth/pre_encounter/patients/v_1/client.rb +108 -24
  32. data/lib/candidhealth/pre_encounter/patients/v_1/types/contact.rb +11 -2
  33. data/lib/candidhealth/pre_encounter/patients/v_1/types/patient.rb +4 -2
  34. data/lib/candidhealth/pre_encounter/patients/v_1/types/patient_page.rb +90 -0
  35. data/lib/requests.rb +2 -2
  36. data/lib/types_export.rb +22 -0
  37. metadata +26 -2
@@ -25,6 +25,8 @@ module CandidApiClient
25
25
  attr_reader :addresses
26
26
  # @return [CandidApiClient::PreEncounter::Common::Types::Period]
27
27
  attr_reader :period
28
+ # @return [String]
29
+ attr_reader :canonical_id
28
30
  # @return [OpenStruct] Additional properties unmapped to the current class definition
29
31
  attr_reader :additional_properties
30
32
  # @return [Object]
@@ -39,15 +41,18 @@ module CandidApiClient
39
41
  # @param telecoms [Array<CandidApiClient::PreEncounter::Common::Types::ContactPoint>]
40
42
  # @param addresses [Array<CandidApiClient::PreEncounter::Common::Types::Address>]
41
43
  # @param period [CandidApiClient::PreEncounter::Common::Types::Period]
44
+ # @param canonical_id [String]
42
45
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
43
46
  # @return [CandidApiClient::PreEncounter::Common::Types::ExternalProvider]
44
- def initialize(name:, telecoms:, addresses:, type: OMIT, npi: OMIT, period: OMIT, additional_properties: nil)
47
+ def initialize(name:, telecoms:, addresses:, type: OMIT, npi: OMIT, period: OMIT, canonical_id: OMIT,
48
+ additional_properties: nil)
45
49
  @name = name
46
50
  @type = type if type != OMIT
47
51
  @npi = npi if npi != OMIT
48
52
  @telecoms = telecoms
49
53
  @addresses = addresses
50
54
  @period = period if period != OMIT
55
+ @canonical_id = canonical_id if canonical_id != OMIT
51
56
  @additional_properties = additional_properties
52
57
  @_field_set = {
53
58
  "name": name,
@@ -55,7 +60,8 @@ module CandidApiClient
55
60
  "npi": npi,
56
61
  "telecoms": telecoms,
57
62
  "addresses": addresses,
58
- "period": period
63
+ "period": period,
64
+ "canonical_id": canonical_id
59
65
  }.reject do |_k, v|
60
66
  v == OMIT
61
67
  end
@@ -90,6 +96,7 @@ module CandidApiClient
90
96
  period = parsed_json["period"].to_json
91
97
  period = CandidApiClient::PreEncounter::Common::Types::Period.from_json(json_object: period)
92
98
  end
99
+ canonical_id = struct["canonical_id"]
93
100
  new(
94
101
  name: name,
95
102
  type: type,
@@ -97,6 +104,7 @@ module CandidApiClient
97
104
  telecoms: telecoms,
98
105
  addresses: addresses,
99
106
  period: period,
107
+ canonical_id: canonical_id,
100
108
  additional_properties: struct
101
109
  )
102
110
  end
@@ -121,6 +129,7 @@ module CandidApiClient
121
129
  obj.telecoms.is_a?(Array) != false || raise("Passed value for field obj.telecoms is not the expected type, validation failed.")
122
130
  obj.addresses.is_a?(Array) != false || raise("Passed value for field obj.addresses is not the expected type, validation failed.")
123
131
  obj.period.nil? || CandidApiClient::PreEncounter::Common::Types::Period.validate_raw(obj: obj.period)
132
+ obj.canonical_id&.is_a?(String) != false || raise("Passed value for field obj.canonical_id is not the expected type, validation failed.")
124
133
  end
125
134
  end
126
135
  end
@@ -7,6 +7,7 @@ module CandidApiClient
7
7
  class ExternalProviderType
8
8
  PRIMARY = "PRIMARY"
9
9
  REFERRING = "REFERRING"
10
+ ATTENDING = "ATTENDING"
10
11
  end
11
12
  end
12
13
  end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module CandidApiClient
7
+ module PreEncounter
8
+ module Common
9
+ module Types
10
+ class ResourcePage
11
+ # @return [String]
12
+ attr_reader :next_page_token
13
+ # @return [String]
14
+ attr_reader :prev_page_token
15
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
16
+ attr_reader :additional_properties
17
+ # @return [Object]
18
+ attr_reader :_field_set
19
+ protected :_field_set
20
+
21
+ OMIT = Object.new
22
+
23
+ # @param next_page_token [String]
24
+ # @param prev_page_token [String]
25
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
26
+ # @return [CandidApiClient::PreEncounter::Common::Types::ResourcePage]
27
+ def initialize(next_page_token: OMIT, prev_page_token: OMIT, additional_properties: nil)
28
+ @next_page_token = next_page_token if next_page_token != OMIT
29
+ @prev_page_token = prev_page_token if prev_page_token != OMIT
30
+ @additional_properties = additional_properties
31
+ @_field_set = { "next_page_token": next_page_token, "prev_page_token": prev_page_token }.reject do |_k, v|
32
+ v == OMIT
33
+ end
34
+ end
35
+
36
+ # Deserialize a JSON object to an instance of ResourcePage
37
+ #
38
+ # @param json_object [String]
39
+ # @return [CandidApiClient::PreEncounter::Common::Types::ResourcePage]
40
+ def self.from_json(json_object:)
41
+ struct = JSON.parse(json_object, object_class: OpenStruct)
42
+ next_page_token = struct["next_page_token"]
43
+ prev_page_token = struct["prev_page_token"]
44
+ new(
45
+ next_page_token: next_page_token,
46
+ prev_page_token: prev_page_token,
47
+ additional_properties: struct
48
+ )
49
+ end
50
+
51
+ # Serialize an instance of ResourcePage to a JSON object
52
+ #
53
+ # @return [String]
54
+ def to_json(*_args)
55
+ @_field_set&.to_json
56
+ end
57
+
58
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
59
+ # hash and check each fields type against the current object's property
60
+ # definitions.
61
+ #
62
+ # @param obj [Object]
63
+ # @return [Void]
64
+ def self.validate_raw(obj:)
65
+ obj.next_page_token&.is_a?(String) != false || raise("Passed value for field obj.next_page_token is not the expected type, validation failed.")
66
+ obj.prev_page_token&.is_a?(String) != false || raise("Passed value for field obj.prev_page_token is not the expected type, validation failed.")
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CandidApiClient
4
+ module PreEncounter
5
+ module Common
6
+ module Types
7
+ class SortDirection
8
+ ASC = "asc"
9
+ DESC = "desc"
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -5,6 +5,9 @@ require_relative "types/mutable_coverage"
5
5
  require_relative "types/coverage"
6
6
  require "json"
7
7
  require "date"
8
+ require_relative "types/service_type_code"
9
+ require_relative "types/eligibility_check_metadata"
10
+ require_relative "types/coverage_eligibility_check_response"
8
11
  require "async"
9
12
 
10
13
  module CandidApiClient
@@ -54,11 +57,43 @@ module CandidApiClient
54
57
  # * :end_ (Date)
55
58
  # * :insurance_card_image_locator (String)
56
59
  # * :verified (Boolean)
60
+ # * :eligibility_checks (Array<CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityCheckMetadata>)
61
+ # * :benefits (Hash)
62
+ # * :plan_coverage (Hash)
63
+ # * :in_network (Hash)
64
+ # * :deductible (Hash)
65
+ # * :family (Integer)
66
+ # * :individual (Integer)
67
+ # * :deductible_remaining (Hash)
68
+ # * :family (Integer)
69
+ # * :individual (Integer)
70
+ # * :oop_max (Hash)
71
+ # * :family (Integer)
72
+ # * :individual (Integer)
73
+ # * :oop_max_remaining (Hash)
74
+ # * :family (Integer)
75
+ # * :individual (Integer)
76
+ # * :additional_notes (String)
77
+ # * :out_of_network (Hash)
78
+ # * :deductible (Hash)
79
+ # * :family (Integer)
80
+ # * :individual (Integer)
81
+ # * :deductible_remaining (Hash)
82
+ # * :family (Integer)
83
+ # * :individual (Integer)
84
+ # * :oop_max (Hash)
85
+ # * :family (Integer)
86
+ # * :individual (Integer)
87
+ # * :oop_max_remaining (Hash)
88
+ # * :family (Integer)
89
+ # * :individual (Integer)
90
+ # * :additional_notes (String)
91
+ # * :service_specific_coverage (Array<CandidApiClient::PreEncounter::Coverages::V1::Types::ServiceCoverage>)
57
92
  # @param request_options [CandidApiClient::RequestOptions]
58
93
  # @return [CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage]
59
94
  # @example
60
95
  # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
61
- # api.pre_encounter.coverages.v_1.create(request: { status: ACTIVE, subscriber: { name: { }, date_of_birth: DateTime.parse(2023-01-15), biological_sex: FEMALE }, relationship: SELF, patient: "string", insurance_plan: { member_id: "string", payer_id: "string", payer_name: "string", group_number: "string", name: "string", plan_type: SELF_PAY, type: C_01, period: { }, insurance_card_image_locator: "string" }, verified: true })
96
+ # api.pre_encounter.coverages.v_1.create(request: { status: ACTIVE, subscriber: { name: { }, date_of_birth: DateTime.parse(2023-01-15), biological_sex: FEMALE }, relationship: SELF, patient: "string", insurance_plan: { member_id: "string", payer_id: "string", payer_name: "string", group_number: "string", name: "string", plan_type: SELF_PAY, type: C_01, period: { }, insurance_card_image_locator: "string" }, verified: true, eligibility_checks: [{ check_id: "string", service_code: MEDICAL_CARE, status: CREATED, initiated_by: "string", initiated_at: DateTime.parse(2024-01-15T09:30:00.000Z) }], benefits: { plan_coverage: { }, service_specific_coverage: [{ }] } })
62
97
  def create(request:, request_options: nil)
63
98
  response = @request_client.conn.post do |req|
64
99
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -76,7 +111,7 @@ module CandidApiClient
76
111
  end
77
112
 
78
113
  # Updates a Coverage. The path must contain the most recent version to prevent
79
- # races. Updating historic versions is not supported.
114
+ # race conditions. Updating historic versions is not supported.
80
115
  #
81
116
  # @param id [String]
82
117
  # @param version [String]
@@ -107,6 +142,38 @@ module CandidApiClient
107
142
  # * :end_ (Date)
108
143
  # * :insurance_card_image_locator (String)
109
144
  # * :verified (Boolean)
145
+ # * :eligibility_checks (Array<CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityCheckMetadata>)
146
+ # * :benefits (Hash)
147
+ # * :plan_coverage (Hash)
148
+ # * :in_network (Hash)
149
+ # * :deductible (Hash)
150
+ # * :family (Integer)
151
+ # * :individual (Integer)
152
+ # * :deductible_remaining (Hash)
153
+ # * :family (Integer)
154
+ # * :individual (Integer)
155
+ # * :oop_max (Hash)
156
+ # * :family (Integer)
157
+ # * :individual (Integer)
158
+ # * :oop_max_remaining (Hash)
159
+ # * :family (Integer)
160
+ # * :individual (Integer)
161
+ # * :additional_notes (String)
162
+ # * :out_of_network (Hash)
163
+ # * :deductible (Hash)
164
+ # * :family (Integer)
165
+ # * :individual (Integer)
166
+ # * :deductible_remaining (Hash)
167
+ # * :family (Integer)
168
+ # * :individual (Integer)
169
+ # * :oop_max (Hash)
170
+ # * :family (Integer)
171
+ # * :individual (Integer)
172
+ # * :oop_max_remaining (Hash)
173
+ # * :family (Integer)
174
+ # * :individual (Integer)
175
+ # * :additional_notes (String)
176
+ # * :service_specific_coverage (Array<CandidApiClient::PreEncounter::Coverages::V1::Types::ServiceCoverage>)
110
177
  # @param request_options [CandidApiClient::RequestOptions]
111
178
  # @return [CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage]
112
179
  # @example
@@ -114,7 +181,7 @@ module CandidApiClient
114
181
  # api.pre_encounter.coverages.v_1.update(
115
182
  # id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
116
183
  # version: "string",
117
- # request: { status: ACTIVE, subscriber: { name: { }, date_of_birth: DateTime.parse(2023-01-15), biological_sex: FEMALE }, relationship: SELF, patient: "string", insurance_plan: { member_id: "string", payer_id: "string", payer_name: "string", group_number: "string", name: "string", plan_type: SELF_PAY, type: C_01, period: { }, insurance_card_image_locator: "string" }, verified: true }
184
+ # request: { status: ACTIVE, subscriber: { name: { }, date_of_birth: DateTime.parse(2023-01-15), biological_sex: FEMALE }, relationship: SELF, patient: "string", insurance_plan: { member_id: "string", payer_id: "string", payer_name: "string", group_number: "string", name: "string", plan_type: SELF_PAY, type: C_01, period: { }, insurance_card_image_locator: "string" }, verified: true, eligibility_checks: [{ check_id: "string", service_code: MEDICAL_CARE, status: CREATED, initiated_by: "string", initiated_at: DateTime.parse(2024-01-15T09:30:00.000Z) }], benefits: { plan_coverage: { }, service_specific_coverage: [{ }] } }
118
185
  # )
119
186
  def update(id:, version:, request:, request_options: nil)
120
187
  response = @request_client.conn.put do |req|
@@ -183,7 +250,7 @@ module CandidApiClient
183
250
  end
184
251
  end
185
252
 
186
- # returns a list of Coverages based on the search criteria
253
+ # Returns a list of Coverages based on the search criteria.
187
254
  #
188
255
  # @param patient_id [String]
189
256
  # @param request_options [CandidApiClient::RequestOptions]
@@ -239,6 +306,68 @@ module CandidApiClient
239
306
  CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage.from_json(json_object: item)
240
307
  end
241
308
  end
309
+
310
+ # Initiates an eligibility check. Returns the metadata of the check if
311
+ # successfully initiated.
312
+ #
313
+ # @param id [String]
314
+ # @param service_code [CandidApiClient::PreEncounter::Coverages::V1::Types::ServiceTypeCode]
315
+ # @param date_of_service [Date]
316
+ # @param npi [String]
317
+ # @param request_options [CandidApiClient::RequestOptions]
318
+ # @return [CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityCheckMetadata]
319
+ # @example
320
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
321
+ # api.pre_encounter.coverages.v_1.check_eligibility(
322
+ # id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
323
+ # service_code: MEDICAL_CARE,
324
+ # date_of_service: DateTime.parse(2023-01-15),
325
+ # npi: "string"
326
+ # )
327
+ def check_eligibility(id:, service_code:, date_of_service:, npi:, request_options: nil)
328
+ response = @request_client.conn.post do |req|
329
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
330
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
331
+ req.headers = {
332
+ **(req.headers || {}),
333
+ **@request_client.get_headers,
334
+ **(request_options&.additional_headers || {})
335
+ }.compact
336
+ req.body = {
337
+ **(request_options&.additional_body_parameters || {}),
338
+ service_code: service_code,
339
+ date_of_service: date_of_service,
340
+ npi: npi
341
+ }.compact
342
+ req.url "#{@request_client.get_url(environment: PreEncounter,
343
+ request_options: request_options)}/coverages/v1/#{id}/eligibility"
344
+ end
345
+ CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityCheckMetadata.from_json(json_object: response.body)
346
+ end
347
+
348
+ # Gets the eligibility of a patient for a specific coverage if successful.
349
+ #
350
+ # @param id [String]
351
+ # @param check_id [String]
352
+ # @param request_options [CandidApiClient::RequestOptions]
353
+ # @return [CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageEligibilityCheckResponse]
354
+ # @example
355
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
356
+ # api.pre_encounter.coverages.v_1.get_eligibility(id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", check_id: "string")
357
+ def get_eligibility(id:, check_id:, request_options: nil)
358
+ response = @request_client.conn.get do |req|
359
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
360
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
361
+ req.headers = {
362
+ **(req.headers || {}),
363
+ **@request_client.get_headers,
364
+ **(request_options&.additional_headers || {})
365
+ }.compact
366
+ req.url "#{@request_client.get_url(environment: PreEncounter,
367
+ request_options: request_options)}/coverages/v1/#{id}/eligibility/#{check_id}"
368
+ end
369
+ CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageEligibilityCheckResponse.from_json(json_object: response.body)
370
+ end
242
371
  end
243
372
 
244
373
  class AsyncV1Client
@@ -284,11 +413,43 @@ module CandidApiClient
284
413
  # * :end_ (Date)
285
414
  # * :insurance_card_image_locator (String)
286
415
  # * :verified (Boolean)
416
+ # * :eligibility_checks (Array<CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityCheckMetadata>)
417
+ # * :benefits (Hash)
418
+ # * :plan_coverage (Hash)
419
+ # * :in_network (Hash)
420
+ # * :deductible (Hash)
421
+ # * :family (Integer)
422
+ # * :individual (Integer)
423
+ # * :deductible_remaining (Hash)
424
+ # * :family (Integer)
425
+ # * :individual (Integer)
426
+ # * :oop_max (Hash)
427
+ # * :family (Integer)
428
+ # * :individual (Integer)
429
+ # * :oop_max_remaining (Hash)
430
+ # * :family (Integer)
431
+ # * :individual (Integer)
432
+ # * :additional_notes (String)
433
+ # * :out_of_network (Hash)
434
+ # * :deductible (Hash)
435
+ # * :family (Integer)
436
+ # * :individual (Integer)
437
+ # * :deductible_remaining (Hash)
438
+ # * :family (Integer)
439
+ # * :individual (Integer)
440
+ # * :oop_max (Hash)
441
+ # * :family (Integer)
442
+ # * :individual (Integer)
443
+ # * :oop_max_remaining (Hash)
444
+ # * :family (Integer)
445
+ # * :individual (Integer)
446
+ # * :additional_notes (String)
447
+ # * :service_specific_coverage (Array<CandidApiClient::PreEncounter::Coverages::V1::Types::ServiceCoverage>)
287
448
  # @param request_options [CandidApiClient::RequestOptions]
288
449
  # @return [CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage]
289
450
  # @example
290
451
  # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
291
- # api.pre_encounter.coverages.v_1.create(request: { status: ACTIVE, subscriber: { name: { }, date_of_birth: DateTime.parse(2023-01-15), biological_sex: FEMALE }, relationship: SELF, patient: "string", insurance_plan: { member_id: "string", payer_id: "string", payer_name: "string", group_number: "string", name: "string", plan_type: SELF_PAY, type: C_01, period: { }, insurance_card_image_locator: "string" }, verified: true })
452
+ # api.pre_encounter.coverages.v_1.create(request: { status: ACTIVE, subscriber: { name: { }, date_of_birth: DateTime.parse(2023-01-15), biological_sex: FEMALE }, relationship: SELF, patient: "string", insurance_plan: { member_id: "string", payer_id: "string", payer_name: "string", group_number: "string", name: "string", plan_type: SELF_PAY, type: C_01, period: { }, insurance_card_image_locator: "string" }, verified: true, eligibility_checks: [{ check_id: "string", service_code: MEDICAL_CARE, status: CREATED, initiated_by: "string", initiated_at: DateTime.parse(2024-01-15T09:30:00.000Z) }], benefits: { plan_coverage: { }, service_specific_coverage: [{ }] } })
292
453
  def create(request:, request_options: nil)
293
454
  Async do
294
455
  response = @request_client.conn.post do |req|
@@ -308,7 +469,7 @@ module CandidApiClient
308
469
  end
309
470
 
310
471
  # Updates a Coverage. The path must contain the most recent version to prevent
311
- # races. Updating historic versions is not supported.
472
+ # race conditions. Updating historic versions is not supported.
312
473
  #
313
474
  # @param id [String]
314
475
  # @param version [String]
@@ -339,6 +500,38 @@ module CandidApiClient
339
500
  # * :end_ (Date)
340
501
  # * :insurance_card_image_locator (String)
341
502
  # * :verified (Boolean)
503
+ # * :eligibility_checks (Array<CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityCheckMetadata>)
504
+ # * :benefits (Hash)
505
+ # * :plan_coverage (Hash)
506
+ # * :in_network (Hash)
507
+ # * :deductible (Hash)
508
+ # * :family (Integer)
509
+ # * :individual (Integer)
510
+ # * :deductible_remaining (Hash)
511
+ # * :family (Integer)
512
+ # * :individual (Integer)
513
+ # * :oop_max (Hash)
514
+ # * :family (Integer)
515
+ # * :individual (Integer)
516
+ # * :oop_max_remaining (Hash)
517
+ # * :family (Integer)
518
+ # * :individual (Integer)
519
+ # * :additional_notes (String)
520
+ # * :out_of_network (Hash)
521
+ # * :deductible (Hash)
522
+ # * :family (Integer)
523
+ # * :individual (Integer)
524
+ # * :deductible_remaining (Hash)
525
+ # * :family (Integer)
526
+ # * :individual (Integer)
527
+ # * :oop_max (Hash)
528
+ # * :family (Integer)
529
+ # * :individual (Integer)
530
+ # * :oop_max_remaining (Hash)
531
+ # * :family (Integer)
532
+ # * :individual (Integer)
533
+ # * :additional_notes (String)
534
+ # * :service_specific_coverage (Array<CandidApiClient::PreEncounter::Coverages::V1::Types::ServiceCoverage>)
342
535
  # @param request_options [CandidApiClient::RequestOptions]
343
536
  # @return [CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage]
344
537
  # @example
@@ -346,7 +539,7 @@ module CandidApiClient
346
539
  # api.pre_encounter.coverages.v_1.update(
347
540
  # id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
348
541
  # version: "string",
349
- # request: { status: ACTIVE, subscriber: { name: { }, date_of_birth: DateTime.parse(2023-01-15), biological_sex: FEMALE }, relationship: SELF, patient: "string", insurance_plan: { member_id: "string", payer_id: "string", payer_name: "string", group_number: "string", name: "string", plan_type: SELF_PAY, type: C_01, period: { }, insurance_card_image_locator: "string" }, verified: true }
542
+ # request: { status: ACTIVE, subscriber: { name: { }, date_of_birth: DateTime.parse(2023-01-15), biological_sex: FEMALE }, relationship: SELF, patient: "string", insurance_plan: { member_id: "string", payer_id: "string", payer_name: "string", group_number: "string", name: "string", plan_type: SELF_PAY, type: C_01, period: { }, insurance_card_image_locator: "string" }, verified: true, eligibility_checks: [{ check_id: "string", service_code: MEDICAL_CARE, status: CREATED, initiated_by: "string", initiated_at: DateTime.parse(2024-01-15T09:30:00.000Z) }], benefits: { plan_coverage: { }, service_specific_coverage: [{ }] } }
350
543
  # )
351
544
  def update(id:, version:, request:, request_options: nil)
352
545
  Async do
@@ -421,7 +614,7 @@ module CandidApiClient
421
614
  end
422
615
  end
423
616
 
424
- # returns a list of Coverages based on the search criteria
617
+ # Returns a list of Coverages based on the search criteria.
425
618
  #
426
619
  # @param patient_id [String]
427
620
  # @param request_options [CandidApiClient::RequestOptions]
@@ -484,6 +677,72 @@ module CandidApiClient
484
677
  end
485
678
  end
486
679
  end
680
+
681
+ # Initiates an eligibility check. Returns the metadata of the check if
682
+ # successfully initiated.
683
+ #
684
+ # @param id [String]
685
+ # @param service_code [CandidApiClient::PreEncounter::Coverages::V1::Types::ServiceTypeCode]
686
+ # @param date_of_service [Date]
687
+ # @param npi [String]
688
+ # @param request_options [CandidApiClient::RequestOptions]
689
+ # @return [CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityCheckMetadata]
690
+ # @example
691
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
692
+ # api.pre_encounter.coverages.v_1.check_eligibility(
693
+ # id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
694
+ # service_code: MEDICAL_CARE,
695
+ # date_of_service: DateTime.parse(2023-01-15),
696
+ # npi: "string"
697
+ # )
698
+ def check_eligibility(id:, service_code:, date_of_service:, npi:, request_options: nil)
699
+ Async do
700
+ response = @request_client.conn.post do |req|
701
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
702
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
703
+ req.headers = {
704
+ **(req.headers || {}),
705
+ **@request_client.get_headers,
706
+ **(request_options&.additional_headers || {})
707
+ }.compact
708
+ req.body = {
709
+ **(request_options&.additional_body_parameters || {}),
710
+ service_code: service_code,
711
+ date_of_service: date_of_service,
712
+ npi: npi
713
+ }.compact
714
+ req.url "#{@request_client.get_url(environment: PreEncounter,
715
+ request_options: request_options)}/coverages/v1/#{id}/eligibility"
716
+ end
717
+ CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityCheckMetadata.from_json(json_object: response.body)
718
+ end
719
+ end
720
+
721
+ # Gets the eligibility of a patient for a specific coverage if successful.
722
+ #
723
+ # @param id [String]
724
+ # @param check_id [String]
725
+ # @param request_options [CandidApiClient::RequestOptions]
726
+ # @return [CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageEligibilityCheckResponse]
727
+ # @example
728
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
729
+ # api.pre_encounter.coverages.v_1.get_eligibility(id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", check_id: "string")
730
+ def get_eligibility(id:, check_id:, request_options: nil)
731
+ Async do
732
+ response = @request_client.conn.get do |req|
733
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
734
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
735
+ req.headers = {
736
+ **(req.headers || {}),
737
+ **@request_client.get_headers,
738
+ **(request_options&.additional_headers || {})
739
+ }.compact
740
+ req.url "#{@request_client.get_url(environment: PreEncounter,
741
+ request_options: request_options)}/coverages/v1/#{id}/eligibility/#{check_id}"
742
+ end
743
+ CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageEligibilityCheckResponse.from_json(json_object: response.body)
744
+ end
745
+ end
487
746
  end
488
747
  end
489
748
  end
@@ -5,6 +5,8 @@ require_relative "coverage_status"
5
5
  require_relative "subscriber"
6
6
  require_relative "../../../common/types/relationship"
7
7
  require_relative "insurance_plan"
8
+ require_relative "eligibility_check_metadata"
9
+ require_relative "coverage_benefits"
8
10
  require "ostruct"
9
11
  require "json"
10
12
 
@@ -44,6 +46,10 @@ module CandidApiClient
44
46
  attr_reader :insurance_plan
45
47
  # @return [Boolean] A boolean indicating if the coverage has been verified by a user.
46
48
  attr_reader :verified
49
+ # @return [Array<CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityCheckMetadata>] A list of eligibility check metadata that have been initiated on this coverage.
50
+ attr_reader :eligibility_checks
51
+ # @return [CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageBenefits] The eligibility of the patient for the coverage, manually verified by users.
52
+ attr_reader :benefits
47
53
  # @return [OpenStruct] Additional properties unmapped to the current class definition
48
54
  attr_reader :additional_properties
49
55
  # @return [Object]
@@ -69,10 +75,12 @@ module CandidApiClient
69
75
  # @param patient [String] The patient who benefits from the insurance coverage
70
76
  # @param insurance_plan [CandidApiClient::PreEncounter::Coverages::V1::Types::InsurancePlan]
71
77
  # @param verified [Boolean] A boolean indicating if the coverage has been verified by a user.
78
+ # @param eligibility_checks [Array<CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityCheckMetadata>] A list of eligibility check metadata that have been initiated on this coverage.
79
+ # @param benefits [CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageBenefits] The eligibility of the patient for the coverage, manually verified by users.
72
80
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
73
81
  # @return [CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage]
74
82
  def initialize(id:, organization_id:, deactivated:, version:, updated_at:, updating_user_id:, status:,
75
- subscriber:, relationship:, patient:, insurance_plan:, verified:, additional_properties: nil)
83
+ subscriber:, relationship:, patient:, insurance_plan:, verified:, eligibility_checks: OMIT, benefits: OMIT, additional_properties: nil)
76
84
  @id = id
77
85
  @organization_id = organization_id
78
86
  @deactivated = deactivated
@@ -85,6 +93,8 @@ module CandidApiClient
85
93
  @patient = patient
86
94
  @insurance_plan = insurance_plan
87
95
  @verified = verified
96
+ @eligibility_checks = eligibility_checks if eligibility_checks != OMIT
97
+ @benefits = benefits if benefits != OMIT
88
98
  @additional_properties = additional_properties
89
99
  @_field_set = {
90
100
  "id": id,
@@ -98,8 +108,12 @@ module CandidApiClient
98
108
  "relationship": relationship,
99
109
  "patient": patient,
100
110
  "insurance_plan": insurance_plan,
101
- "verified": verified
102
- }
111
+ "verified": verified,
112
+ "eligibility_checks": eligibility_checks,
113
+ "benefits": benefits
114
+ }.reject do |_k, v|
115
+ v == OMIT
116
+ end
103
117
  end
104
118
 
105
119
  # Deserialize a JSON object to an instance of Coverage
@@ -131,6 +145,16 @@ module CandidApiClient
131
145
  insurance_plan = CandidApiClient::PreEncounter::Coverages::V1::Types::InsurancePlan.from_json(json_object: insurance_plan)
132
146
  end
133
147
  verified = struct["verified"]
148
+ eligibility_checks = parsed_json["eligibility_checks"]&.map do |item|
149
+ item = item.to_json
150
+ CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityCheckMetadata.from_json(json_object: item)
151
+ end
152
+ if parsed_json["benefits"].nil?
153
+ benefits = nil
154
+ else
155
+ benefits = parsed_json["benefits"].to_json
156
+ benefits = CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageBenefits.from_json(json_object: benefits)
157
+ end
134
158
  new(
135
159
  id: id,
136
160
  organization_id: organization_id,
@@ -144,6 +168,8 @@ module CandidApiClient
144
168
  patient: patient,
145
169
  insurance_plan: insurance_plan,
146
170
  verified: verified,
171
+ eligibility_checks: eligibility_checks,
172
+ benefits: benefits,
147
173
  additional_properties: struct
148
174
  )
149
175
  end
@@ -174,6 +200,8 @@ module CandidApiClient
174
200
  obj.patient.is_a?(String) != false || raise("Passed value for field obj.patient is not the expected type, validation failed.")
175
201
  CandidApiClient::PreEncounter::Coverages::V1::Types::InsurancePlan.validate_raw(obj: obj.insurance_plan)
176
202
  obj.verified.is_a?(Boolean) != false || raise("Passed value for field obj.verified is not the expected type, validation failed.")
203
+ obj.eligibility_checks&.is_a?(Array) != false || raise("Passed value for field obj.eligibility_checks is not the expected type, validation failed.")
204
+ obj.benefits.nil? || CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageBenefits.validate_raw(obj: obj.benefits)
177
205
  end
178
206
  end
179
207
  end