Class: Coyodlee::Facades::AccountsFacade

Inherits:
Object
  • Object
show all
Defined in:
lib/coyodlee/facades/accounts_facade.rb

Instance Method Summary collapse

Constructor Details

#initialize(request_facade) ⇒ AccountsFacade

Returns a new instance of AccountsFacade.



4
5
6
# File 'lib/coyodlee/facades/accounts_facade.rb', line 4

def initialize(request_facade)
  @request_facade = request_facade
end

Instance Method Details

#add_manually(body:) ⇒ Object



33
34
35
36
37
# File 'lib/coyodlee/facades/accounts_facade.rb', line 33

def add_manually(body:)
  headers = { 'Accept' => 'application/json', 'Content-Type' => 'application/json' }
  req = @request_facade.build(:post, 'accounts', headers: headers, body: body.to_json)
  @request_facade.execute(req)
end

#allObject



8
9
10
11
12
# File 'lib/coyodlee/facades/accounts_facade.rb', line 8

def all
  headers = { 'Accept' => 'application/json' }
  req = @request_facade.build(:get, 'accounts', headers: headers)
  @request_facade.execute(req)
end

#delete(account_id:) ⇒ Object



27
28
29
30
31
# File 'lib/coyodlee/facades/accounts_facade.rb', line 27

def delete(account_id:)
  headers = { 'Accept' => 'application/json' }
  req = @request_facade.build(:delete, "accounts/#{account_id}", headers: headers)
  @request_facade.execute(req)
end

#details(account_id:, container:) ⇒ Object



14
15
16
17
18
19
# File 'lib/coyodlee/facades/accounts_facade.rb', line 14

def details(account_id:, container:)
  headers = { 'Accept' => 'application/json' }
  params = { 'container' => container }
  req = @request_facade.build(:get, "accounts/#{account_id}", params: params, headers: headers)
  @request_facade.execute(req)
end

#historical_balances(params = {}) ⇒ Object



45
46
47
48
49
# File 'lib/coyodlee/facades/accounts_facade.rb', line 45

def historical_balances(params={})
  headers = { 'Accept' => 'application/json' }
  req = @request_facade.build(:get, 'accounts/historicalBalances', headers: headers, params: params)
  @request_facade.execute(req)
end

#investment_options(params = {}) ⇒ Object



39
40
41
42
43
# File 'lib/coyodlee/facades/accounts_facade.rb', line 39

def investment_options(params={})
  headers = { 'Accept' => 'application/json' }
  req = @request_facade.build(:get, 'accounts/investmentPlan/investmentOptions', headers: headers, params: params)
  @request_facade.execute(req)
end

#update(account_id:, body:) ⇒ Object



21
22
23
24
25
# File 'lib/coyodlee/facades/accounts_facade.rb', line 21

def update(account_id:, body:)
  headers = { 'Accept' => 'application/json', 'Content-Type' => 'application/json' }
  req = @request_facade.build(:put, "accounts/#{account_id}", headers: headers, body: body.to_json)
  @request_facade.execute(req)
end