Class: Candid::ImportInvoice::V1::Client
- Inherits:
-
Object
- Object
- Candid::ImportInvoice::V1::Client
- Defined in:
- lib/candid/import_invoice/v_1/client.rb
Instance Method Summary collapse
-
#get(request_options: {}, **params) ⇒ Candid::ImportInvoice::V1::Types::ImportInvoice
Retrieve and view an import invoice.
-
#get_multi(request_options: {}, **params) ⇒ Candid::ImportInvoice::V1::Types::ImportInvoicesPage
Returns all Invoices for the authenticated user’s organziation with all filters applied.
-
#import_invoice(request_options: {}, **params) ⇒ Candid::ImportInvoice::V1::Types::ImportInvoice
Import an existing invoice from a third party service to reflect state in Candid.
- #initialize(client:) ⇒ Candid::ImportInvoice::V1::Client constructor
-
#update(request_options: {}, **params) ⇒ Candid::ImportInvoice::V1::Types::ImportInvoice
Update the information on the imported invoice.
Constructor Details
#initialize(client:) ⇒ Candid::ImportInvoice::V1::Client
8 9 10 |
# File 'lib/candid/import_invoice/v_1/client.rb', line 8 def initialize(client:) @client = client end |
Instance Method Details
#get(request_options: {}, **params) ⇒ Candid::ImportInvoice::V1::Types::ImportInvoice
Retrieve and view an import invoice
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/candid/import_invoice/v_1/client.rb', line 69 def get(request_options: {}, **params) _request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || Candid::Environment::PRODUCTION, method: "GET", path: "/api/import-invoice/v1/#{params[:invoice_id]}" ) begin _response = @client.send(_request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = _response.code.to_i if code.between?(200, 299) Candid::ImportInvoice::V1::Types::ImportInvoice.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::ImportInvoice::V1::Types::ImportInvoicesPage
Returns all Invoices for the authenticated user’s organziation with all filters applied.
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 |
# File 'lib/candid/import_invoice/v_1/client.rb', line 39 def get_multi(request_options: {}, **params) params = Candid::Internal::Types::Utils.symbolize_keys(params) _query_param_names = i[patient_external_id encounter_external_id note due_date_before due_date_after status limit sort sort_direction page_token] _query = params.slice(*_query_param_names) params.except(*_query_param_names) _request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || Candid::Environment::PRODUCTION, method: "GET", path: "/api/import-invoice/v1", query: _query ) begin _response = @client.send(_request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = _response.code.to_i if code.between?(200, 299) Candid::ImportInvoice::V1::Types::ImportInvoicesPage.load(_response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(_response.body, code: code) end end |
#import_invoice(request_options: {}, **params) ⇒ Candid::ImportInvoice::V1::Types::ImportInvoice
Import an existing invoice from a third party service to reflect state in Candid.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/candid/import_invoice/v_1/client.rb', line 15 def import_invoice(request_options: {}, **params) _request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || Candid::Environment::PRODUCTION, method: "POST", path: "/api/import-invoice/v1", body: Candid::ImportInvoice::V1::Types::CreateImportInvoiceRequest.new(params).to_h ) begin _response = @client.send(_request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = _response.code.to_i if code.between?(200, 299) Candid::ImportInvoice::V1::Types::ImportInvoice.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::ImportInvoice::V1::Types::ImportInvoice
Update the information on the imported invoice
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/candid/import_invoice/v_1/client.rb', line 92 def update(request_options: {}, **params) _request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || Candid::Environment::PRODUCTION, method: "PATCH", path: "/api/import-invoice/v1/#{params[:invoice_id]}", body: Candid::ImportInvoice::V1::Types::ImportInvoiceUpdateRequest.new(params).to_h ) begin _response = @client.send(_request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = _response.code.to_i if code.between?(200, 299) Candid::ImportInvoice::V1::Types::ImportInvoice.load(_response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(_response.body, code: code) end end |