lib/bankster/client.rb in bankster-client-0.0.2 vs lib/bankster/client.rb in bankster-client-0.0.3
- old
+ new
@@ -4,26 +4,25 @@
module Bankster
class Client
include HTTParty
attr_reader :credentials
- base_uri "localhost:9292"
-
def initialize(credentials, api_key)
@credentials = credentials
@api_key = api_key
@options = {
+ base_uri: BANKSTER_BASE_URI || 'https://api.bankster.io',
headers: {
'Api-Key' => api_key,
'Bank-Credentials' => Base64.encode64(credentials.to_json)
}
}
end
def transactions(account, from, to)
response = self.class.get("/transactions", @options.merge(query: {account: account, start: from, end: to}))
if response.ok?
- JSON.parse(response.body) if response.ok?
+ JSON.parse(response.body)
else
raise(response.body)
end
end
end