Class: XpensifySDK::HTTPClient

Inherits:
Object
  • Object
show all
Defined in:
lib/xpensify_sdk/http_client.rb

Constant Summary collapse

API_URL =
'https://api.xpensify.app/api/v1'.freeze

Class Method Summary collapse

Class Method Details

.invoice(id, api_key) ⇒ Object



16
17
18
19
20
21
# File 'lib/xpensify_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/xpensify_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/xpensify_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