Class: CandidApiClient::NonInsurancePayerRefunds::V1::V1Client

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/non_insurance_payer_refunds/v_1/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ CandidApiClient::NonInsurancePayerRefunds::V1::V1Client

Parameters:



24
25
26
# File 'lib/candidhealth/non_insurance_payer_refunds/v_1/client.rb', line 24

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientCandidApiClient::RequestClient (readonly)



20
21
22
# File 'lib/candidhealth/non_insurance_payer_refunds/v_1/client.rb', line 20

def request_client
  @request_client
end

Instance Method Details

#create(request:, request_options: nil) ⇒ CandidApiClient::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.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.non_insurance_payer_refunds.v_1.create(request: { non_insurance_payer_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", amount_cents: 1, allocations: [{ amount_cents: 1 }, { amount_cents: 1 }] })

Parameters:

  • request (Hash)

    Request of type CandidApiClient::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefundCreate, as a Hash

    • :non_insurance_payer_id (String)

    • :invoice_id (String)

    • :amount_cents (Integer)

    • :refund_timestamp (DateTime)

    • :refund_note (String)

    • :check_number (String)

    • :allocations (Array<CandidApiClient::Financials::Types::AllocationCreate>)

    • :refund_reason (CandidApiClient::Financials::Types::RefundReason)

  • request_options (CandidApiClient::RequestOptions) (defaults to: nil)

Returns:



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/candidhealth/non_insurance_payer_refunds/v_1/client.rb', line 112

def create(request:, request_options: nil)
  response = @request_client.conn.post do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
    req.url "#{@request_client.get_url(environment: CandidApi,
                                       request_options: request_options)}/api/non-insurance-payer-refunds/v1"
  end
  CandidApiClient::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefund.from_json(json_object: response.body)
end

#delete(non_insurance_payer_refund_id:, request_options: nil) ⇒ Void

Deletes the non-insurance payer refund record matching the provided

`non_insurance_payer_refund_id`.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.non_insurance_payer_refunds.v_1.delete(non_insurance_payer_refund_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")

Parameters:

Returns:

  • (Void)


174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/candidhealth/non_insurance_payer_refunds/v_1/client.rb', line 174

def delete(non_insurance_payer_refund_id:, request_options: nil)
  @request_client.conn.delete do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.url "#{@request_client.get_url(environment: CandidApi,
                                       request_options: request_options)}/api/non-insurance-payer-refunds/v1/#{non_insurance_payer_refund_id}"
  end
end

#get(non_insurance_payer_refund_id:, request_options: nil) ⇒ CandidApiClient::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefund

Retrieves a previously created non-insurance payer refund by its

`non_insurance_payer_refund_id`.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.non_insurance_payer_refunds.v_1.get(non_insurance_payer_refund_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")

Parameters:

Returns:



77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/candidhealth/non_insurance_payer_refunds/v_1/client.rb', line 77

def get(non_insurance_payer_refund_id:, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.url "#{@request_client.get_url(environment: CandidApi,
                                       request_options: request_options)}/api/non-insurance-payer-refunds/v1/#{non_insurance_payer_refund_id}"
  end
  CandidApiClient::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefund.from_json(json_object: response.body)
end

#get_multi(limit: nil, non_insurance_payer_id: nil, check_number: nil, invoice_id: nil, sort: nil, sort_direction: nil, page_token: nil, request_options: nil) ⇒ CandidApiClient::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefundsPage

Returns all non-insurance payer refunds satisfying the search criteria

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.non_insurance_payer_refunds.v_1.get_multi

Parameters:

Returns:



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
# File 'lib/candidhealth/non_insurance_payer_refunds/v_1/client.rb', line 42

def get_multi(limit: nil, non_insurance_payer_id: nil, check_number: nil, invoice_id: nil, sort: nil,
              sort_direction: nil, page_token: nil, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.params = {
      **(request_options&.additional_query_parameters || {}),
      "limit": limit,
      "non_insurance_payer_id": non_insurance_payer_id,
      "check_number": check_number,
      "invoice_id": invoice_id,
      "sort": sort,
      "sort_direction": sort_direction,
      "page_token": page_token
    }.compact
    req.url "#{@request_client.get_url(environment: CandidApi,
                                       request_options: request_options)}/api/non-insurance-payer-refunds/v1"
  end
  CandidApiClient::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefundsPage.from_json(json_object: response.body)
end

#update(non_insurance_payer_refund_id:, refund_timestamp: nil, refund_note: nil, refund_reason: nil, invoice_id: nil, request_options: nil) ⇒ CandidApiClient::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.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.non_insurance_payer_refunds.v_1.update(non_insurance_payer_refund_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")

Parameters:

Returns:



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/candidhealth/non_insurance_payer_refunds/v_1/client.rb', line 142

def update(non_insurance_payer_refund_id:, refund_timestamp: nil, refund_note: nil, refund_reason: nil,
           invoice_id: nil, request_options: nil)
  response = @request_client.conn.patch do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.body = {
      **(request_options&.additional_body_parameters || {}),
      refund_timestamp: refund_timestamp,
      refund_note: refund_note,
      refund_reason: refund_reason,
      invoice_id: invoice_id
    }.compact
    req.url "#{@request_client.get_url(environment: CandidApi,
                                       request_options: request_options)}/api/non-insurance-payer-refunds/v1/#{non_insurance_payer_refund_id}"
  end
  CandidApiClient::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefund.from_json(json_object: response.body)
end