Class: XtractSDK::HTTPClient
- Inherits:
-
Object
- Object
- XtractSDK::HTTPClient
- Defined in:
- lib/xtract_sdk/http_client.rb
Constant Summary collapse
- API_URL =
'https://api.xtract.app/api/v1'.freeze
Class Method Summary collapse
- .invoice(id, api_key) ⇒ Object
- .invoices(api_key, params) ⇒ Object
- .update_invoice(id, params, api_key) ⇒ Object
- .update_invoices(ids, params, api_key) ⇒ Object
Class Method Details
.invoice(id, api_key) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/xtract_sdk/http_client.rb', line 16 def invoice(id, api_key) HTTP.get( "#{API_URL}/invoices/#{id}", headers: build_headers(api_key) ) end |
.invoices(api_key, params) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/xtract_sdk/http_client.rb', line 8 def invoices(api_key, params) HTTP.get( "#{API_URL}/invoices", params: params, headers: build_headers(api_key) ) end |
.update_invoice(id, params, api_key) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/xtract_sdk/http_client.rb', line 23 def update_invoice(id, params, api_key) HTTP.put( "#{API_URL}/invoices/#{id}", body: params.to_json, headers: build_headers(api_key) ) end |
.update_invoices(ids, params, api_key) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/xtract_sdk/http_client.rb', line 31 def update_invoices(ids, params, api_key) HTTP.put( "#{API_URL}/invoices/batch_update", body: params.merge(invoice_ids: ids).to_json, headers: build_headers(api_key) ) end |