Class: Candid::NonInsurancePayerRefunds::V1::Client
- Inherits:
-
Object
- Object
- Candid::NonInsurancePayerRefunds::V1::Client
- Defined in:
- lib/candid/non_insurance_payer_refunds/v_1/client.rb
Instance Method Summary collapse
-
#create(request_options: {}, **params) ⇒ Candid::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefund
Creates a new non-insurance payer refund record and returns the newly created ‘NonInsurancePayerRefund` object.
-
#delete(request_options: {}, **params) ⇒ untyped
Deletes the non-insurance payer refund record matching the provided ‘non_insurance_payer_refund_id`.
-
#get(request_options: {}, **params) ⇒ Candid::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefund
Retrieves a previously created non-insurance payer refund by its ‘non_insurance_payer_refund_id`.
-
#get_multi(request_options: {}, **params) ⇒ Candid::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefundsPage
Returns all non-insurance payer refunds satisfying the search criteria.
- #initialize(client:, base_url: nil, environment: nil) ⇒ void constructor
-
#update(request_options: {}, **params) ⇒ Candid::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefund
Updates the non-insurance payer refund record matching the provided non_insurance_payer_refund_id.
Constructor Details
#initialize(client:, base_url: nil, environment: nil) ⇒ void
12 13 14 15 16 |
# File 'lib/candid/non_insurance_payer_refunds/v_1/client.rb', line 12 def initialize(client:, base_url: nil, environment: nil) @client = client @base_url = base_url @environment = environment end |
Instance Method Details
#create(request_options: {}, **params) ⇒ Candid::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefund
Creates a new non-insurance payer refund record and returns the newly created ‘NonInsurancePayerRefund` object. The allocations can describe whether the refund is being applied toward a specific service line, claim, or billing provider.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/candid/non_insurance_payer_refunds/v_1/client.rb', line 118 def create(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(:candid_api), method: "POST", path: "/api/non-insurance-payer-refunds/v1", body: Candid::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefundCreate.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::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefund.load(response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete(request_options: {}, **params) ⇒ untyped
Deletes the non-insurance payer refund record matching the provided ‘non_insurance_payer_refund_id`.
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/candid/non_insurance_payer_refunds/v_1/client.rb', line 194 def delete(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(:candid_api), method: "DELETE", path: "/api/non-insurance-payer-refunds/v1/#{params[:non_insurance_payer_refund_id]}", 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 |
#get(request_options: {}, **params) ⇒ Candid::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefund
Retrieves a previously created non-insurance payer refund by its ‘non_insurance_payer_refund_id`.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/candid/non_insurance_payer_refunds/v_1/client.rb', line 82 def get(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(:candid_api), method: "GET", path: "/api/non-insurance-payer-refunds/v1/#{params[:non_insurance_payer_refund_id]}", 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::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefund.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::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefundsPage
Returns all non-insurance payer refunds satisfying the search criteria
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/candid/non_insurance_payer_refunds/v_1/client.rb', line 36 def get_multi(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[limit non_insurance_payer_id check_number invoice_id sort sort_direction page_token] query_params = {} query_params["limit"] = params[:limit] if params.key?(:limit) query_params["non_insurance_payer_id"] = params[:non_insurance_payer_id] if params.key?(:non_insurance_payer_id) query_params["check_number"] = params[:check_number] if params.key?(:check_number) query_params["invoice_id"] = params[:invoice_id] if params.key?(:invoice_id) query_params["sort"] = params[:sort] if params.key?(:sort) query_params["sort_direction"] = params[:sort_direction] if params.key?(:sort_direction) query_params["page_token"] = params[:page_token] if params.key?(:page_token) params.except(*query_param_names) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:candid_api), method: "GET", path: "/api/non-insurance-payer-refunds/v1", 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::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefundsPage.load(response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#update(request_options: {}, **params) ⇒ Candid::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefund
Updates the non-insurance payer refund record matching the provided non_insurance_payer_refund_id. If updating the refund amount, then the allocations must be appropriately updated as well.
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/candid/non_insurance_payer_refunds/v_1/client.rb', line 155 def update(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) request_data = Candid::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefundUpdate.new(params).to_h non_body_param_names = ["non_insurance_payer_refund_id"] body = request_data.except(*non_body_param_names) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:candid_api), method: "PATCH", path: "/api/non-insurance-payer-refunds/v1/#{params[:non_insurance_payer_refund_id]}", body: body, 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::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefund.load(response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |