Class: Truelayer::AccountsRepository

Inherits:
BaseRepository show all
Defined in:
lib/truelayer/accounts_repository.rb

Instance Method Summary collapse

Methods inherited from BaseRepository

#initialize

Constructor Details

This class inherits a constructor from Truelayer::BaseRepository

Instance Method Details

#all_accounts(webhook_uri: nil) ⇒ Object



11
12
13
14
15
# File 'lib/truelayer/accounts_repository.rb', line 11

def all_accounts(webhook_uri: nil)
  response = get('/data/v1/accounts', params: async_params(webhook_uri))

  Response.build_with_results(json: response.body, results_class: Account)
end

#current_balance(account_id, webhook_uri: nil) ⇒ Object



24
25
26
27
28
29
# File 'lib/truelayer/accounts_repository.rb', line 24

def current_balance(, webhook_uri: nil)
  url = format_url('/data/v1/accounts/:account_id/balance', account_id: )
  response = get(url, params: async_params(webhook_uri))

  Response.build_with_results(json: response.body, results_class: Balance)
end

#find_account(account_id, webhook_uri: nil) ⇒ Object



17
18
19
20
21
22
# File 'lib/truelayer/accounts_repository.rb', line 17

def (, webhook_uri: nil)
  url = format_url('/data/v1/accounts/:account_id', account_id: )
  response = get(url, params: async_params(webhook_uri))

  Response.build_with_results(json: response.body, results_class: Account)
end

#transactions(account_id, from: nil, to: nil, webhook_uri: nil) ⇒ Object



31
32
33
34
35
36
# File 'lib/truelayer/accounts_repository.rb', line 31

def transactions(, from: nil, to: nil, webhook_uri: nil)
  url = format_url('/data/v1/accounts/:account_id/transactions', account_id: )
  response = get(url, params: { from: from, to: to }.merge(async_params(webhook_uri)))

  Response.build_with_results(json: response.body, results_class: Transaction)
end