Class: InvestecOpenApi::Client

Inherits:
Object
  • Object
show all
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

#accountsObject


13
14
15
16
17
18
# File 'lib/investec_open_api/client.rb', line 13

def accounts
  response = connection.get("za/pb/v1/accounts")
  response.body["data"]["accounts"].map do ||
    InvestecOpenApi::Models::Account.from_api()
  end
end

#authenticate!Object


9
10
11
# File 'lib/investec_open_api/client.rb', line 9

def authenticate!
  @token = get_oauth_token["access_token"]
end

#transactions(account_id) ⇒ Object


20
21
22
23
24
25
# File 'lib/investec_open_api/client.rb', line 20

def transactions()
  response = connection.get("za/pb/v1/accounts/#{}/transactions")
  response.body["data"]["transactions"].map do |transaction_raw|
    InvestecOpenApi::Models::Transaction.from_api(transaction_raw)
  end
end