candidhealth 0.39.6 → 0.39.8

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 (46) hide show
  1. checksums.yaml +4 -4
  2. data/lib/candidhealth/commons/types/procedure_modifier.rb +1 -0
  3. data/lib/candidhealth/eligibility/v_2/client.rb +48 -6
  4. data/lib/candidhealth/fee_schedules/v_3/client.rb +16 -4
  5. data/lib/candidhealth/fee_schedules/v_3/types/dimension_match.rb +16 -2
  6. data/lib/candidhealth/fee_schedules/v_3/types/dimensions.rb +16 -2
  7. data/lib/candidhealth/fee_schedules/v_3/types/match_payer_plan_groups.rb +85 -0
  8. data/lib/candidhealth/fee_schedules/v_3/types/optional_dimensions.rb +15 -2
  9. data/lib/candidhealth/fee_schedules/v_3/types/payer_plan_group_does_not_match_rate_payer_error.rb +75 -0
  10. data/lib/candidhealth/fee_schedules/v_3/types/validation_error.rb +39 -14
  11. data/lib/candidhealth/organization_providers/v_2/types/license_type.rb +4 -0
  12. data/lib/candidhealth/pre_encounter/appointments/v_1/client.rb +98 -4
  13. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment.rb +2 -2
  14. data/lib/candidhealth/pre_encounter/appointments/v_1/types/mutable_appointment.rb +2 -2
  15. data/lib/candidhealth/pre_encounter/appointments/v_1/types/visit.rb +96 -0
  16. data/lib/candidhealth/pre_encounter/appointments/v_1/types/visits_page.rb +98 -0
  17. data/lib/candidhealth/pre_encounter/common/types/external_identifier.rb +87 -0
  18. data/lib/candidhealth/pre_encounter/common/types/external_provider.rb +10 -2
  19. data/lib/candidhealth/pre_encounter/coverages/v_1/client.rb +89 -4
  20. data/lib/candidhealth/pre_encounter/coverages/v_1/types/address.rb +118 -0
  21. data/lib/candidhealth/pre_encounter/coverages/v_1/types/benefits_related_entity.rb +11 -2
  22. data/lib/candidhealth/pre_encounter/coverages/v_1/types/coverages_page.rb +98 -0
  23. data/lib/candidhealth/pre_encounter/coverages/v_1/types/expanded_member_info.rb +133 -0
  24. data/lib/candidhealth/pre_encounter/coverages/v_1/types/insurance_plan.rb +10 -2
  25. data/lib/candidhealth/pre_encounter/coverages/v_1/types/insurance_type_code.rb +1 -0
  26. data/lib/candidhealth/pre_encounter/coverages/v_1/types/member_info.rb +93 -0
  27. data/lib/candidhealth/pre_encounter/coverages/v_1/types/plan_metadata.rb +38 -3
  28. data/lib/candidhealth/pre_encounter/eligibility_checks/client.rb +32 -0
  29. data/lib/candidhealth/pre_encounter/eligibility_checks/v_1/client.rb +124 -0
  30. data/lib/candidhealth/pre_encounter/eligibility_checks/v_1/types/eligibility_check.rb +119 -0
  31. data/lib/candidhealth/pre_encounter/eligibility_checks/v_1/types/eligibility_request.rb +135 -0
  32. data/lib/candidhealth/pre_encounter/eligibility_checks/v_1/types/eligibility_response.rb +15 -0
  33. data/lib/candidhealth/pre_encounter/eligibility_checks/v_1/types/encounter.rb +83 -0
  34. data/lib/candidhealth/pre_encounter/eligibility_checks/v_1/types/individual_provider.rb +81 -0
  35. data/lib/candidhealth/pre_encounter/eligibility_checks/v_1/types/organization_provider.rb +74 -0
  36. data/lib/candidhealth/pre_encounter/eligibility_checks/v_1/types/parsed_response.rb +99 -0
  37. data/lib/candidhealth/pre_encounter/eligibility_checks/v_1/types/provider.rb +66 -0
  38. data/lib/candidhealth/pre_encounter/eligibility_checks/v_1/types/request_correction.rb +79 -0
  39. data/lib/candidhealth/pre_encounter/lists/v_1/types/appointment_list_item.rb +5 -5
  40. data/lib/candidhealth/pre_encounter/patients/v_1/client.rb +70 -14
  41. data/lib/candidhealth/pre_encounter/patients/v_1/types/mutable_patient.rb +14 -2
  42. data/lib/candidhealth/pre_encounter/patients/v_1/types/mutable_patient_with_mrn.rb +14 -2
  43. data/lib/candidhealth/pre_encounter/patients/v_1/types/patient.rb +13 -1
  44. data/lib/requests.rb +2 -2
  45. data/lib/types_export.rb +18 -0
  46. metadata +22 -2
@@ -33,6 +33,8 @@ module CandidApiClient
33
33
  attr_reader :period
34
34
  # @return [String]
35
35
  attr_reader :insurance_card_image_locator
36
+ # @return [String] The ID of the Candid configured payer plan group associated with this coverage
37
+ attr_reader :payer_plan_group_id
36
38
  # @return [OpenStruct] Additional properties unmapped to the current class definition
37
39
  attr_reader :additional_properties
38
40
  # @return [Object]
@@ -51,10 +53,11 @@ module CandidApiClient
51
53
  # @param type [CandidApiClient::PreEncounter::Coverages::V1::Types::InsuranceTypeCode]
52
54
  # @param period [CandidApiClient::PreEncounter::Common::Types::Period]
53
55
  # @param insurance_card_image_locator [String]
56
+ # @param payer_plan_group_id [String] The ID of the Candid configured payer plan group associated with this coverage
54
57
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
55
58
  # @return [CandidApiClient::PreEncounter::Coverages::V1::Types::InsurancePlan]
56
59
  def initialize(member_id:, payer_id:, payer_name:, additional_payer_information: OMIT, group_number: OMIT,
57
- name: OMIT, plan_type: OMIT, type: OMIT, period: OMIT, insurance_card_image_locator: OMIT, additional_properties: nil)
60
+ name: OMIT, plan_type: OMIT, type: OMIT, period: OMIT, insurance_card_image_locator: OMIT, payer_plan_group_id: OMIT, additional_properties: nil)
58
61
  @member_id = member_id
59
62
  @payer_id = payer_id
60
63
  @payer_name = payer_name
@@ -65,6 +68,7 @@ module CandidApiClient
65
68
  @type = type if type != OMIT
66
69
  @period = period if period != OMIT
67
70
  @insurance_card_image_locator = insurance_card_image_locator if insurance_card_image_locator != OMIT
71
+ @payer_plan_group_id = payer_plan_group_id if payer_plan_group_id != OMIT
68
72
  @additional_properties = additional_properties
69
73
  @_field_set = {
70
74
  "member_id": member_id,
@@ -76,7 +80,8 @@ module CandidApiClient
76
80
  "plan_type": plan_type,
77
81
  "type": type,
78
82
  "period": period,
79
- "insurance_card_image_locator": insurance_card_image_locator
83
+ "insurance_card_image_locator": insurance_card_image_locator,
84
+ "payer_plan_group_id": payer_plan_group_id
80
85
  }.reject do |_k, v|
81
86
  v == OMIT
82
87
  end
@@ -109,6 +114,7 @@ module CandidApiClient
109
114
  period = CandidApiClient::PreEncounter::Common::Types::Period.from_json(json_object: period)
110
115
  end
111
116
  insurance_card_image_locator = struct["insurance_card_image_locator"]
117
+ payer_plan_group_id = struct["payer_plan_group_id"]
112
118
  new(
113
119
  member_id: member_id,
114
120
  payer_id: payer_id,
@@ -120,6 +126,7 @@ module CandidApiClient
120
126
  type: type,
121
127
  period: period,
122
128
  insurance_card_image_locator: insurance_card_image_locator,
129
+ payer_plan_group_id: payer_plan_group_id,
123
130
  additional_properties: struct
124
131
  )
125
132
  end
@@ -148,6 +155,7 @@ module CandidApiClient
148
155
  obj.type&.is_a?(CandidApiClient::PreEncounter::Coverages::V1::Types::InsuranceTypeCode) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
149
156
  obj.period.nil? || CandidApiClient::PreEncounter::Common::Types::Period.validate_raw(obj: obj.period)
150
157
  obj.insurance_card_image_locator&.is_a?(String) != false || raise("Passed value for field obj.insurance_card_image_locator is not the expected type, validation failed.")
158
+ obj.payer_plan_group_id&.is_a?(String) != false || raise("Passed value for field obj.payer_plan_group_id is not the expected type, validation failed.")
151
159
  end
152
160
  end
153
161
  end
@@ -66,6 +66,7 @@ module CandidApiClient
66
66
  CMV = "MV"
67
67
  COA = "OA"
68
68
  COT = "OT"
69
+ CPE = "PE"
69
70
  CPL = "PL"
70
71
  CPP = "PP"
71
72
  CPR = "PR"
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "date"
4
+ require "ostruct"
5
+ require "json"
6
+
7
+ module CandidApiClient
8
+ module PreEncounter
9
+ module Coverages
10
+ module V1
11
+ module Types
12
+ class MemberInfo
13
+ # @return [String]
14
+ attr_reader :member_id
15
+ # @return [String]
16
+ attr_reader :first_name
17
+ # @return [String]
18
+ attr_reader :last_name
19
+ # @return [Date]
20
+ attr_reader :date_of_birth
21
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
22
+ attr_reader :additional_properties
23
+ # @return [Object]
24
+ attr_reader :_field_set
25
+ protected :_field_set
26
+
27
+ OMIT = Object.new
28
+
29
+ # @param member_id [String]
30
+ # @param first_name [String]
31
+ # @param last_name [String]
32
+ # @param date_of_birth [Date]
33
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
34
+ # @return [CandidApiClient::PreEncounter::Coverages::V1::Types::MemberInfo]
35
+ def initialize(member_id:, first_name:, last_name:, date_of_birth:, additional_properties: nil)
36
+ @member_id = member_id
37
+ @first_name = first_name
38
+ @last_name = last_name
39
+ @date_of_birth = date_of_birth
40
+ @additional_properties = additional_properties
41
+ @_field_set = {
42
+ "member_id": member_id,
43
+ "first_name": first_name,
44
+ "last_name": last_name,
45
+ "date_of_birth": date_of_birth
46
+ }
47
+ end
48
+
49
+ # Deserialize a JSON object to an instance of MemberInfo
50
+ #
51
+ # @param json_object [String]
52
+ # @return [CandidApiClient::PreEncounter::Coverages::V1::Types::MemberInfo]
53
+ def self.from_json(json_object:)
54
+ struct = JSON.parse(json_object, object_class: OpenStruct)
55
+ parsed_json = JSON.parse(json_object)
56
+ member_id = struct["member_id"]
57
+ first_name = struct["first_name"]
58
+ last_name = struct["last_name"]
59
+ date_of_birth = (Date.parse(parsed_json["date_of_birth"]) unless parsed_json["date_of_birth"].nil?)
60
+ new(
61
+ member_id: member_id,
62
+ first_name: first_name,
63
+ last_name: last_name,
64
+ date_of_birth: date_of_birth,
65
+ additional_properties: struct
66
+ )
67
+ end
68
+
69
+ # Serialize an instance of MemberInfo to a JSON object
70
+ #
71
+ # @return [String]
72
+ def to_json(*_args)
73
+ @_field_set&.to_json
74
+ end
75
+
76
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
77
+ # hash and check each fields type against the current object's property
78
+ # definitions.
79
+ #
80
+ # @param obj [Object]
81
+ # @return [Void]
82
+ def self.validate_raw(obj:)
83
+ obj.member_id.is_a?(String) != false || raise("Passed value for field obj.member_id is not the expected type, validation failed.")
84
+ obj.first_name.is_a?(String) != false || raise("Passed value for field obj.first_name is not the expected type, validation failed.")
85
+ obj.last_name.is_a?(String) != false || raise("Passed value for field obj.last_name is not the expected type, validation failed.")
86
+ obj.date_of_birth.is_a?(Date) != false || raise("Passed value for field obj.date_of_birth is not the expected type, validation failed.")
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "date"
4
4
  require_relative "plan_date"
5
+ require_relative "expanded_member_info"
5
6
  require "ostruct"
6
7
  require "json"
7
8
 
@@ -11,6 +12,8 @@ module CandidApiClient
11
12
  module V1
12
13
  module Types
13
14
  class PlanMetadata
15
+ # @return [String]
16
+ attr_reader :payer_name
14
17
  # @return [String]
15
18
  attr_reader :insurance_type
16
19
  # @return [String]
@@ -27,6 +30,10 @@ module CandidApiClient
27
30
  attr_reader :end_date
28
31
  # @return [Array<CandidApiClient::PreEncounter::Coverages::V1::Types::PlanDate>]
29
32
  attr_reader :plan_dates
33
+ # @return [CandidApiClient::PreEncounter::Coverages::V1::Types::ExpandedMemberInfo]
34
+ attr_reader :subscriber
35
+ # @return [CandidApiClient::PreEncounter::Coverages::V1::Types::ExpandedMemberInfo]
36
+ attr_reader :dependent
30
37
  # @return [OpenStruct] Additional properties unmapped to the current class definition
31
38
  attr_reader :additional_properties
32
39
  # @return [Object]
@@ -35,6 +42,7 @@ module CandidApiClient
35
42
 
36
43
  OMIT = Object.new
37
44
 
45
+ # @param payer_name [String]
38
46
  # @param insurance_type [String]
39
47
  # @param insurance_type_code [String]
40
48
  # @param plan_name [String]
@@ -43,10 +51,13 @@ module CandidApiClient
43
51
  # @param start_date [Date]
44
52
  # @param end_date [Date]
45
53
  # @param plan_dates [Array<CandidApiClient::PreEncounter::Coverages::V1::Types::PlanDate>]
54
+ # @param subscriber [CandidApiClient::PreEncounter::Coverages::V1::Types::ExpandedMemberInfo]
55
+ # @param dependent [CandidApiClient::PreEncounter::Coverages::V1::Types::ExpandedMemberInfo]
46
56
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
47
57
  # @return [CandidApiClient::PreEncounter::Coverages::V1::Types::PlanMetadata]
48
- def initialize(insurance_type: OMIT, insurance_type_code: OMIT, plan_name: OMIT, member_id: OMIT,
49
- group_number: OMIT, start_date: OMIT, end_date: OMIT, plan_dates: OMIT, additional_properties: nil)
58
+ def initialize(payer_name: OMIT, insurance_type: OMIT, insurance_type_code: OMIT, plan_name: OMIT,
59
+ member_id: OMIT, group_number: OMIT, start_date: OMIT, end_date: OMIT, plan_dates: OMIT, subscriber: OMIT, dependent: OMIT, additional_properties: nil)
60
+ @payer_name = payer_name if payer_name != OMIT
50
61
  @insurance_type = insurance_type if insurance_type != OMIT
51
62
  @insurance_type_code = insurance_type_code if insurance_type_code != OMIT
52
63
  @plan_name = plan_name if plan_name != OMIT
@@ -55,8 +66,11 @@ module CandidApiClient
55
66
  @start_date = start_date if start_date != OMIT
56
67
  @end_date = end_date if end_date != OMIT
57
68
  @plan_dates = plan_dates if plan_dates != OMIT
69
+ @subscriber = subscriber if subscriber != OMIT
70
+ @dependent = dependent if dependent != OMIT
58
71
  @additional_properties = additional_properties
59
72
  @_field_set = {
73
+ "payer_name": payer_name,
60
74
  "insurance_type": insurance_type,
61
75
  "insurance_type_code": insurance_type_code,
62
76
  "plan_name": plan_name,
@@ -64,7 +78,9 @@ module CandidApiClient
64
78
  "group_number": group_number,
65
79
  "start_date": start_date,
66
80
  "end_date": end_date,
67
- "plan_dates": plan_dates
81
+ "plan_dates": plan_dates,
82
+ "subscriber": subscriber,
83
+ "dependent": dependent
68
84
  }.reject do |_k, v|
69
85
  v == OMIT
70
86
  end
@@ -77,6 +93,7 @@ module CandidApiClient
77
93
  def self.from_json(json_object:)
78
94
  struct = JSON.parse(json_object, object_class: OpenStruct)
79
95
  parsed_json = JSON.parse(json_object)
96
+ payer_name = struct["payer_name"]
80
97
  insurance_type = struct["insurance_type"]
81
98
  insurance_type_code = struct["insurance_type_code"]
82
99
  plan_name = struct["plan_name"]
@@ -88,7 +105,20 @@ module CandidApiClient
88
105
  item = item.to_json
89
106
  CandidApiClient::PreEncounter::Coverages::V1::Types::PlanDate.from_json(json_object: item)
90
107
  end
108
+ if parsed_json["subscriber"].nil?
109
+ subscriber = nil
110
+ else
111
+ subscriber = parsed_json["subscriber"].to_json
112
+ subscriber = CandidApiClient::PreEncounter::Coverages::V1::Types::ExpandedMemberInfo.from_json(json_object: subscriber)
113
+ end
114
+ if parsed_json["dependent"].nil?
115
+ dependent = nil
116
+ else
117
+ dependent = parsed_json["dependent"].to_json
118
+ dependent = CandidApiClient::PreEncounter::Coverages::V1::Types::ExpandedMemberInfo.from_json(json_object: dependent)
119
+ end
91
120
  new(
121
+ payer_name: payer_name,
92
122
  insurance_type: insurance_type,
93
123
  insurance_type_code: insurance_type_code,
94
124
  plan_name: plan_name,
@@ -97,6 +127,8 @@ module CandidApiClient
97
127
  start_date: start_date,
98
128
  end_date: end_date,
99
129
  plan_dates: plan_dates,
130
+ subscriber: subscriber,
131
+ dependent: dependent,
100
132
  additional_properties: struct
101
133
  )
102
134
  end
@@ -115,6 +147,7 @@ module CandidApiClient
115
147
  # @param obj [Object]
116
148
  # @return [Void]
117
149
  def self.validate_raw(obj:)
150
+ obj.payer_name&.is_a?(String) != false || raise("Passed value for field obj.payer_name is not the expected type, validation failed.")
118
151
  obj.insurance_type&.is_a?(String) != false || raise("Passed value for field obj.insurance_type is not the expected type, validation failed.")
119
152
  obj.insurance_type_code&.is_a?(String) != false || raise("Passed value for field obj.insurance_type_code is not the expected type, validation failed.")
120
153
  obj.plan_name&.is_a?(String) != false || raise("Passed value for field obj.plan_name is not the expected type, validation failed.")
@@ -123,6 +156,8 @@ module CandidApiClient
123
156
  obj.start_date&.is_a?(Date) != false || raise("Passed value for field obj.start_date is not the expected type, validation failed.")
124
157
  obj.end_date&.is_a?(Date) != false || raise("Passed value for field obj.end_date is not the expected type, validation failed.")
125
158
  obj.plan_dates&.is_a?(Array) != false || raise("Passed value for field obj.plan_dates is not the expected type, validation failed.")
159
+ obj.subscriber.nil? || CandidApiClient::PreEncounter::Coverages::V1::Types::ExpandedMemberInfo.validate_raw(obj: obj.subscriber)
160
+ obj.dependent.nil? || CandidApiClient::PreEncounter::Coverages::V1::Types::ExpandedMemberInfo.validate_raw(obj: obj.dependent)
126
161
  end
127
162
  end
128
163
  end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../requests"
4
+ require_relative "v_1/client"
5
+
6
+ module CandidApiClient
7
+ module PreEncounter
8
+ module EligibilityChecks
9
+ class Client
10
+ # @return [CandidApiClient::PreEncounter::EligibilityChecks::V1::V1Client]
11
+ attr_reader :v_1
12
+
13
+ # @param request_client [CandidApiClient::RequestClient]
14
+ # @return [CandidApiClient::PreEncounter::EligibilityChecks::Client]
15
+ def initialize(request_client:)
16
+ @v_1 = CandidApiClient::PreEncounter::EligibilityChecks::V1::V1Client.new(request_client: request_client)
17
+ end
18
+ end
19
+
20
+ class AsyncClient
21
+ # @return [CandidApiClient::PreEncounter::EligibilityChecks::V1::AsyncV1Client]
22
+ attr_reader :v_1
23
+
24
+ # @param request_client [CandidApiClient::AsyncRequestClient]
25
+ # @return [CandidApiClient::PreEncounter::EligibilityChecks::AsyncClient]
26
+ def initialize(request_client:)
27
+ @v_1 = CandidApiClient::PreEncounter::EligibilityChecks::V1::AsyncV1Client.new(request_client: request_client)
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,124 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../../requests"
4
+ require_relative "types/eligibility_request"
5
+ require_relative "types/eligibility_response"
6
+ require "async"
7
+
8
+ module CandidApiClient
9
+ module PreEncounter
10
+ module EligibilityChecks
11
+ module V1
12
+ class V1Client
13
+ # @return [CandidApiClient::RequestClient]
14
+ attr_reader :request_client
15
+
16
+ # @param request_client [CandidApiClient::RequestClient]
17
+ # @return [CandidApiClient::PreEncounter::EligibilityChecks::V1::V1Client]
18
+ def initialize(request_client:)
19
+ @request_client = request_client
20
+ end
21
+
22
+ # Sends real-time eligibility checks to payers through Stedi.
23
+ # <Warning>Please only send one concurrent request to this endpoint. Batch
24
+ # requests must be made in succession, otherwise, it will cause this service to
25
+ # fail. A batch endpoint is in development - please reach out to the Candid team
26
+ # for more information.</Warning>
27
+ #
28
+ # @param request [Hash] Request of type CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::EligibilityRequest, as a Hash
29
+ # * :payer_id (String)
30
+ # * :provider (Hash)
31
+ # * :subscriber (Hash)
32
+ # * :member_id (String)
33
+ # * :first_name (String)
34
+ # * :last_name (String)
35
+ # * :date_of_birth (Date)
36
+ # * :dependent (Hash)
37
+ # * :member_id (String)
38
+ # * :first_name (String)
39
+ # * :last_name (String)
40
+ # * :date_of_birth (Date)
41
+ # * :encounter (Hash)
42
+ # * :date_of_service (Date)
43
+ # * :service_type_codes (Array<String>)
44
+ # @param request_options [CandidApiClient::RequestOptions]
45
+ # @return [CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::ELIGIBILITY_RESPONSE]
46
+ # @example
47
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
48
+ # api.pre_encounter.eligibility_checks.v_1.post(request: { payer_id: "string", provider: { first_name: "string", last_name: "string", npi: "string" }, subscriber: { member_id: "string", first_name: "string", last_name: "string", date_of_birth: DateTime.parse(2023-01-15) }, dependent: { member_id: "string", first_name: "string", last_name: "string", date_of_birth: DateTime.parse(2023-01-15) }, encounter: { date_of_service: DateTime.parse(2023-01-15), service_type_codes: ["string"] } })
49
+ def post(request:, request_options: nil)
50
+ response = @request_client.conn.post do |req|
51
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
52
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
53
+ req.headers = {
54
+ **(req.headers || {}),
55
+ **@request_client.get_headers,
56
+ **(request_options&.additional_headers || {})
57
+ }.compact
58
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
59
+ req.url "#{@request_client.get_url(environment: PreEncounter,
60
+ request_options: request_options)}/eligibility-checks/v1"
61
+ end
62
+ CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::EligibilityCheck.from_json(json_object: response.body)
63
+ end
64
+ end
65
+
66
+ class AsyncV1Client
67
+ # @return [CandidApiClient::AsyncRequestClient]
68
+ attr_reader :request_client
69
+
70
+ # @param request_client [CandidApiClient::AsyncRequestClient]
71
+ # @return [CandidApiClient::PreEncounter::EligibilityChecks::V1::AsyncV1Client]
72
+ def initialize(request_client:)
73
+ @request_client = request_client
74
+ end
75
+
76
+ # Sends real-time eligibility checks to payers through Stedi.
77
+ # <Warning>Please only send one concurrent request to this endpoint. Batch
78
+ # requests must be made in succession, otherwise, it will cause this service to
79
+ # fail. A batch endpoint is in development - please reach out to the Candid team
80
+ # for more information.</Warning>
81
+ #
82
+ # @param request [Hash] Request of type CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::EligibilityRequest, as a Hash
83
+ # * :payer_id (String)
84
+ # * :provider (Hash)
85
+ # * :subscriber (Hash)
86
+ # * :member_id (String)
87
+ # * :first_name (String)
88
+ # * :last_name (String)
89
+ # * :date_of_birth (Date)
90
+ # * :dependent (Hash)
91
+ # * :member_id (String)
92
+ # * :first_name (String)
93
+ # * :last_name (String)
94
+ # * :date_of_birth (Date)
95
+ # * :encounter (Hash)
96
+ # * :date_of_service (Date)
97
+ # * :service_type_codes (Array<String>)
98
+ # @param request_options [CandidApiClient::RequestOptions]
99
+ # @return [CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::ELIGIBILITY_RESPONSE]
100
+ # @example
101
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
102
+ # api.pre_encounter.eligibility_checks.v_1.post(request: { payer_id: "string", provider: { first_name: "string", last_name: "string", npi: "string" }, subscriber: { member_id: "string", first_name: "string", last_name: "string", date_of_birth: DateTime.parse(2023-01-15) }, dependent: { member_id: "string", first_name: "string", last_name: "string", date_of_birth: DateTime.parse(2023-01-15) }, encounter: { date_of_service: DateTime.parse(2023-01-15), service_type_codes: ["string"] } })
103
+ def post(request:, request_options: nil)
104
+ Async do
105
+ response = @request_client.conn.post do |req|
106
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
107
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
108
+ req.headers = {
109
+ **(req.headers || {}),
110
+ **@request_client.get_headers,
111
+ **(request_options&.additional_headers || {})
112
+ }.compact
113
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
114
+ req.url "#{@request_client.get_url(environment: PreEncounter,
115
+ request_options: request_options)}/eligibility-checks/v1"
116
+ end
117
+ CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::EligibilityCheck.from_json(json_object: response.body)
118
+ end
119
+ end
120
+ end
121
+ end
122
+ end
123
+ end
124
+ end
@@ -0,0 +1,119 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "eligibility_request"
4
+ require_relative "parsed_response"
5
+ require_relative "request_correction"
6
+ require "ostruct"
7
+ require "json"
8
+
9
+ module CandidApiClient
10
+ module PreEncounter
11
+ module EligibilityChecks
12
+ module V1
13
+ module Types
14
+ class EligibilityCheck
15
+ # @return [Object]
16
+ attr_reader :errors
17
+ # @return [CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::EligibilityRequest]
18
+ attr_reader :request
19
+ # @return [Object]
20
+ attr_reader :response
21
+ # @return [CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::ParsedResponse]
22
+ attr_reader :parsed_response
23
+ # @return [Array<CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::RequestCorrection>]
24
+ attr_reader :request_corrections
25
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
26
+ attr_reader :additional_properties
27
+ # @return [Object]
28
+ attr_reader :_field_set
29
+ protected :_field_set
30
+
31
+ OMIT = Object.new
32
+
33
+ # @param errors [Object]
34
+ # @param request [CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::EligibilityRequest]
35
+ # @param response [Object]
36
+ # @param parsed_response [CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::ParsedResponse]
37
+ # @param request_corrections [Array<CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::RequestCorrection>]
38
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
39
+ # @return [CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::EligibilityCheck]
40
+ def initialize(response:, errors: OMIT, request: OMIT, parsed_response: OMIT, request_corrections: OMIT,
41
+ additional_properties: nil)
42
+ @errors = errors if errors != OMIT
43
+ @request = request if request != OMIT
44
+ @response = response
45
+ @parsed_response = parsed_response if parsed_response != OMIT
46
+ @request_corrections = request_corrections if request_corrections != OMIT
47
+ @additional_properties = additional_properties
48
+ @_field_set = {
49
+ "errors": errors,
50
+ "request": request,
51
+ "response": response,
52
+ "parsed_response": parsed_response,
53
+ "request_corrections": request_corrections
54
+ }.reject do |_k, v|
55
+ v == OMIT
56
+ end
57
+ end
58
+
59
+ # Deserialize a JSON object to an instance of EligibilityCheck
60
+ #
61
+ # @param json_object [String]
62
+ # @return [CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::EligibilityCheck]
63
+ def self.from_json(json_object:)
64
+ struct = JSON.parse(json_object, object_class: OpenStruct)
65
+ parsed_json = JSON.parse(json_object)
66
+ errors = struct["errors"]
67
+ if parsed_json["request"].nil?
68
+ request = nil
69
+ else
70
+ request = parsed_json["request"].to_json
71
+ request = CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::EligibilityRequest.from_json(json_object: request)
72
+ end
73
+ response = struct["response"]
74
+ if parsed_json["parsed_response"].nil?
75
+ parsed_response = nil
76
+ else
77
+ parsed_response = parsed_json["parsed_response"].to_json
78
+ parsed_response = CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::ParsedResponse.from_json(json_object: parsed_response)
79
+ end
80
+ request_corrections = parsed_json["request_corrections"]&.map do |item|
81
+ item = item.to_json
82
+ CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::RequestCorrection.from_json(json_object: item)
83
+ end
84
+ new(
85
+ errors: errors,
86
+ request: request,
87
+ response: response,
88
+ parsed_response: parsed_response,
89
+ request_corrections: request_corrections,
90
+ additional_properties: struct
91
+ )
92
+ end
93
+
94
+ # Serialize an instance of EligibilityCheck to a JSON object
95
+ #
96
+ # @return [String]
97
+ def to_json(*_args)
98
+ @_field_set&.to_json
99
+ end
100
+
101
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
102
+ # hash and check each fields type against the current object's property
103
+ # definitions.
104
+ #
105
+ # @param obj [Object]
106
+ # @return [Void]
107
+ def self.validate_raw(obj:)
108
+ obj.errors&.is_a?(Object) != false || raise("Passed value for field obj.errors is not the expected type, validation failed.")
109
+ obj.request.nil? || CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::EligibilityRequest.validate_raw(obj: obj.request)
110
+ obj.response.is_a?(Object) != false || raise("Passed value for field obj.response is not the expected type, validation failed.")
111
+ obj.parsed_response.nil? || CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::ParsedResponse.validate_raw(obj: obj.parsed_response)
112
+ obj.request_corrections&.is_a?(Array) != false || raise("Passed value for field obj.request_corrections is not the expected type, validation failed.")
113
+ end
114
+ end
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end