Class: InvestecOpenApi::Client
- Inherits:
-
Object
- Object
- InvestecOpenApi::Client
- Defined in:
- lib/investec_open_api/client.rb
Constant Summary collapse
- INVESTEC_API_URL =
"https://openapi.investec.com/"
Instance Method Summary collapse
Instance Method Details
#accounts ⇒ Object
15 16 17 18 19 20 |
# File 'lib/investec_open_api/client.rb', line 15 def accounts response = connection.get("za/pb/v1/accounts") response.body["data"]["accounts"].map do |account_raw| InvestecOpenApi::Models::Account.from_api(account_raw) end end |
#authenticate! ⇒ Object
11 12 13 |
# File 'lib/investec_open_api/client.rb', line 11 def authenticate! @token = get_oauth_token["access_token"] end |
#transactions(account_id, options = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/investec_open_api/client.rb', line 22 def transactions(account_id, = {}) endpoint_url = "za/pb/v1/accounts/#{account_id}/transactions" unless .empty? query_string = URI.encode_www_form(.camelize) endpoint_url += "?#{query_string}" end response = connection.get(endpoint_url) response.body["data"]["transactions"].map do |transaction_raw| InvestecOpenApi::Models::Transaction.from_api(transaction_raw) end end |