Class: KaChing::ApiV1::Saldo
- Inherits:
-
Object
- Object
- KaChing::ApiV1::Saldo
- Extended by:
- Forwardable
- Defined in:
- lib/ka_ching/api_v1/saldo.rb
Overview
Saldo Endpoint for the KaChing API V1
Instance Method Summary collapse
-
#current(tenant_account_id:) {|Faraday::Response| ... } ⇒ Hash
Get the current saldo (in cents).
-
#initialize(conn:, api_url:) ⇒ Saldo
constructor
A new instance of Saldo.
Constructor Details
#initialize(conn:, api_url:) ⇒ Saldo
Returns a new instance of Saldo.
13 14 15 16 |
# File 'lib/ka_ching/api_v1/saldo.rb', line 13 def initialize(conn:, api_url:) @conn = conn @api_url = api_url end |
Instance Method Details
#current(tenant_account_id:) {|Faraday::Response| ... } ⇒ Hash
Get the current saldo (in cents)
27 28 29 30 31 32 33 |
# File 'lib/ka_ching/api_v1/saldo.rb', line 27 def current(tenant_account_id:) res = get(build_url(tenant_account_id: tenant_account_id)) do |req| req.headers['Content-Type'] = 'application/json' end yield res if block_given? JSON.parse(res.body) end |