Sha256: b4a4d680077899dd73b2694385872d5cdc4b554c968833b122a43545f6ab3613
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
module BanksterClient class Client include HTTParty def initialize @options = { base_uri: BanksterClient.configuration.api, headers: { 'Api-Key' => BanksterClient.configuration.api_key, 'Bank-Credentials' => Base64.urlsafe_encode64(BanksterClient.configuration.credentials.to_json) } } end def transactions(account, from, to) response = self.class.get('/transactions', @options.merge(query: { account: account, start: from, end: to })) raise(response.body) unless response.ok? JSON.parse(response.body) end # FIXME : Parameter lists longer # rubocop:disable Metrics/ParameterLists, Metrics/MethodLength def transfer(sending_account, receiving_account, amount_cents, purpose, reference, identification = nil) attributes = @options.merge( body: { sending_account: sending_account.to_h, receiving_account: receiving_account.to_h, purpose: purpose, amount_cents: amount_cents, reference: reference, identification: identification } ) response = self.class.post('/transfers', attributes) raise(response.body) unless response.ok? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bankster-client-0.0.5 | lib/bankster_client/client.rb |