Class: Candid::PreEncounter::EligibilityChecks::V1::Client
- Inherits:
-
Object
- Object
- Candid::PreEncounter::EligibilityChecks::V1::Client
- Defined in:
- lib/candid/pre_encounter/eligibility_checks/v_1/client.rb
Instance Method Summary collapse
-
#batch(request_options: {}, **params) ⇒ Candid::PreEncounter::EligibilityChecks::V1::Types::BatchEligibilityResponse
Sends a batch of eligibility checks to payers through Stedi.
-
#create_recommendation(request_options: {}, **params) ⇒ Candid::PreEncounter::EligibilityChecks::V1::Types::EligibilityRecommendation
Create an eligibiilty recommendation based on the request.
- #get_multi(request_options: {}, **params) ⇒ Candid::PreEncounter::EligibilityChecks::V1::Types::EligibilityCheckPage
- #initialize(client:, base_url: nil, environment: nil) ⇒ void constructor
-
#payer_search(request_options: {}, **params) ⇒ Candid::PreEncounter::EligibilityChecks::V1::Types::PayerSearchResponse
Searches for payers that match the query parameters.
-
#poll_batch(request_options: {}, **params) ⇒ Candid::PreEncounter::EligibilityChecks::V1::Types::EligibilityCheckPage
Polls the status of a batch eligibility check.
-
#post(request_options: {}, **params) ⇒ Candid::PreEncounter::EligibilityChecks::V1::Types::EligibilityCheck
Sends real-time eligibility checks to payers through Stedi.
-
#recommendation(request_options: {}, **params) ⇒ Array[Candid::PreEncounter::EligibilityChecks::V1::Types::EligibilityRecommendation]
Gets recommendation for eligibility checks based on filters.
-
#vote_recommendation(request_options: {}, **params) ⇒ Candid::PreEncounter::EligibilityChecks::V1::Types::EligibilityRecommendation
Submit user feedback on an eligibility recommendation.
Constructor Details
#initialize(client:, base_url: nil, environment: nil) ⇒ void
13 14 15 16 17 |
# File 'lib/candid/pre_encounter/eligibility_checks/v_1/client.rb', line 13 def initialize(client:, base_url: nil, environment: nil) @client = client @base_url = base_url @environment = environment end |
Instance Method Details
#batch(request_options: {}, **params) ⇒ Candid::PreEncounter::EligibilityChecks::V1::Types::BatchEligibilityResponse
Sends a batch of eligibility checks to payers through Stedi.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/candid/pre_encounter/eligibility_checks/v_1/client.rb', line 64 def batch(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:pre_encounter), method: "POST", path: "/eligibility-checks/v1/batch", body: params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Candid::PreEncounter::EligibilityChecks::V1::Types::BatchEligibilityResponse.load(response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#create_recommendation(request_options: {}, **params) ⇒ Candid::PreEncounter::EligibilityChecks::V1::Types::EligibilityRecommendation
Create an eligibiilty recommendation based on the request.
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/candid/pre_encounter/eligibility_checks/v_1/client.rb', line 224 def create_recommendation(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:pre_encounter), method: "POST", path: "/eligibility-checks/v1/recommendation", body: Candid::PreEncounter::EligibilityChecks::V1::Types::PostEligibilityRecommendationRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Candid::PreEncounter::EligibilityChecks::V1::Types::EligibilityRecommendation.load(response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_multi(request_options: {}, **params) ⇒ Candid::PreEncounter::EligibilityChecks::V1::Types::EligibilityCheckPage
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
# File 'lib/candid/pre_encounter/eligibility_checks/v_1/client.rb', line 302 def get_multi(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[page_token limit subscriber_member_id payer_id provider_npi date_of_service initiated_at_min initiated_at_max] query_params = {} query_params["page_token"] = params[:page_token] if params.key?(:page_token) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["subscriber_member_id"] = params[:subscriber_member_id] if params.key?(:subscriber_member_id) query_params["payer_id"] = params[:payer_id] if params.key?(:payer_id) query_params["provider_npi"] = params[:provider_npi] if params.key?(:provider_npi) query_params["date_of_service"] = params[:date_of_service] if params.key?(:date_of_service) query_params["initiated_at_min"] = params[:initiated_at_min] if params.key?(:initiated_at_min) query_params["initiated_at_max"] = params[:initiated_at_max] if params.key?(:initiated_at_max) params.except(*query_param_names) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:pre_encounter), method: "GET", path: "/eligibility-checks/v1/get-multi/", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Candid::PreEncounter::EligibilityChecks::V1::Types::EligibilityCheckPage.load(response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#payer_search(request_options: {}, **params) ⇒ Candid::PreEncounter::EligibilityChecks::V1::Types::PayerSearchResponse
Searches for payers that match the query parameters.
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/candid/pre_encounter/eligibility_checks/v_1/client.rb', line 142 def payer_search(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[page_size page_token query] query_params = {} query_params["page_size"] = params[:page_size] if params.key?(:page_size) query_params["page_token"] = params[:page_token] if params.key?(:page_token) query_params["query"] = params[:query] if params.key?(:query) params.except(*query_param_names) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:pre_encounter), method: "GET", path: "/eligibility-checks/v1/payer/search", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Candid::PreEncounter::EligibilityChecks::V1::Types::PayerSearchResponse.load(response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#poll_batch(request_options: {}, **params) ⇒ Candid::PreEncounter::EligibilityChecks::V1::Types::EligibilityCheckPage
Polls the status of a batch eligibility check.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/candid/pre_encounter/eligibility_checks/v_1/client.rb', line 100 def poll_batch(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[page_token] query_params = {} query_params["page_token"] = params[:page_token] if params.key?(:page_token) params = params.except(*query_param_names) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:pre_encounter), method: "GET", path: "/eligibility-checks/v1/batch/#{params[:batch_id]}", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Candid::PreEncounter::EligibilityChecks::V1::Types::EligibilityCheckPage.load(response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#post(request_options: {}, **params) ⇒ Candid::PreEncounter::EligibilityChecks::V1::Types::EligibilityCheck
Sends real-time eligibility checks to payers through Stedi.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/candid/pre_encounter/eligibility_checks/v_1/client.rb', line 30 def post(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:pre_encounter), method: "POST", path: "/eligibility-checks/v1", body: Candid::PreEncounter::EligibilityChecks::V1::Types::EligibilityRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Candid::PreEncounter::EligibilityChecks::V1::Types::EligibilityResponse.load(response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#recommendation(request_options: {}, **params) ⇒ Array[Candid::PreEncounter::EligibilityChecks::V1::Types::EligibilityRecommendation]
Gets recommendation for eligibility checks based on filters. This endpoint will retrieve all the latest eligibility recommendations for each eligibility recommendation type for the given filters. If you want to get a specific recommendation type, you can use the ‘type` query parameter.
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/candid/pre_encounter/eligibility_checks/v_1/client.rb', line 187 def recommendation(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[filters] query_params = {} query_params["filters"] = params[:filters] if params.key?(:filters) params.except(*query_param_names) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:pre_encounter), method: "GET", path: "/eligibility-checks/v1/recommendation", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = response.code.to_i return if code.between?(200, 299) error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end |
#vote_recommendation(request_options: {}, **params) ⇒ Candid::PreEncounter::EligibilityChecks::V1::Types::EligibilityRecommendation
Submit user feedback on an eligibility recommendation. The path must contain the next version number to prevent race conditions. For example, if the current version of the recommendation is n, you will need to send a request to this endpoint with ‘/recommendation_id/n+1/vote` to update the vote.
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/candid/pre_encounter/eligibility_checks/v_1/client.rb', line 262 def vote_recommendation(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:pre_encounter), method: "PUT", path: "/eligibility-checks/v1/recommendation/#{params[:recommendation_id]}/#{params[:version]}/vote", body: Candid::PreEncounter::EligibilityChecks::V1::Types::Vote.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Candid::PreEncounter::EligibilityChecks::V1::Types::EligibilityRecommendation.load(response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |