Class: Aggcat::Client
- Inherits:
-
Base
- Object
- Base
- Aggcat::Client
show all
- Defined in:
- lib/aggcat/client.rb
Constant Summary
collapse
- BASE_URL =
'https://financialdatafeed.platform.intuit.com/rest-war/v1'
Constants inherited
from Base
Base::BANKING_ACCOUNT_NAMESPACE, Base::BANKING_TYPES, Base::CHALLENGE_NAMESPACE, Base::CREDIT_ACCOUNT_NAMESPACE, Base::CREDIT_TYPES, Base::DATE_FORMAT, Base::INVESTMENT_ACCOUNT_NAMESPACE, Base::INVESTMENT_TYPES, Base::LOAN_NAMESPACE, Base::LOAN_TYPES, Base::LOGIN_NAMESPACE, Base::OPEN_TIMEOUT, Base::READ_TIMEOUT, Base::REWARD_ACCOUNT_NAMESPACE, Base::SAML_URL, Base::TIME_FORMAT
Instance Method Summary
collapse
-
#account(account_id) ⇒ Object
-
#account_confirmation(institution_id, challenge_session_id, challenge_node_id, answers) ⇒ Object
-
#account_transactions(account_id, start_date, end_date = nil) ⇒ Object
-
#accounts ⇒ Object
-
#delete_account(account_id) ⇒ Object
-
#delete_customer ⇒ Object
-
#discover_and_add_accounts(institution_id, *login_credentials) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
-
#institution(institution_id) ⇒ Object
-
#institutions ⇒ Object
-
#investment_positions(account_id) ⇒ Object
-
#login_accounts(login_id) ⇒ Object
-
#update_account_type(account_id, type) ⇒ Object
-
#update_login(institution_id, login_id, *login_credentials) ⇒ Object
-
#update_login_confirmation(login_id, challenge_session_id, challenge_node_id, answers) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
6
7
8
9
10
11
12
13
14
|
# File 'lib/aggcat/client.rb', line 6
def initialize(options={})
raise ArgumentError.new('customer_id is required for scoping all requests') if options[:customer_id].nil? || options[:customer_id].to_s.empty?
options[:open_timeout] ||= OPEN_TIMEOUT
options[:read_timeout] ||= READ_TIMEOUT
options[:verbose] ||= false
Aggcat::Configurable::KEYS.each do |key|
instance_variable_set(:"@#{key}", !options[key].nil? ? options[key] : Aggcat.instance_variable_get(:"@#{key}"))
end
end
|
Instance Method Details
#account(account_id) ⇒ Object
41
42
43
44
|
# File 'lib/aggcat/client.rb', line 41
def account(account_id)
validate(account_id: account_id)
get("/accounts/#{account_id}")
end
|
#account_confirmation(institution_id, challenge_session_id, challenge_node_id, answers) ⇒ Object
31
32
33
34
35
|
# File 'lib/aggcat/client.rb', line 31
def account_confirmation(institution_id, challenge_session_id, challenge_node_id, answers)
validate(institution_id: institution_id, challenge_session_id: challenge_session_id, challenge_node_id: challenge_node_id, answers: answers)
= {'challengeSessionId' => challenge_session_id, 'challengeNodeId' => challenge_node_id}
post("/institutions/#{institution_id}/logins", challenge_answers(answers), )
end
|
#account_transactions(account_id, start_date, end_date = nil) ⇒ Object
46
47
48
49
50
51
52
53
|
# File 'lib/aggcat/client.rb', line 46
def account_transactions(account_id, start_date, end_date = nil)
validate(account_id: account_id, start_date: start_date)
path = "/accounts/#{account_id}/transactions?txnStartDate=#{start_date.strftime(DATE_FORMAT)}"
if end_date
path += "&txnEndDate=#{end_date.strftime(DATE_FORMAT)}"
end
get(path)
end
|
#accounts ⇒ Object
37
38
39
|
# File 'lib/aggcat/client.rb', line 37
def accounts
get('/accounts')
end
|
#delete_account(account_id) ⇒ Object
77
78
79
80
|
# File 'lib/aggcat/client.rb', line 77
def delete_account(account_id)
validate(account_id: account_id)
delete("/accounts/#{account_id}")
end
|
#delete_customer ⇒ Object
82
83
84
85
86
87
88
|
# File 'lib/aggcat/client.rb', line 82
def delete_customer
result = delete('/customers')
if result[:status_code] == '200'
@oauth_token = nil
end
result
end
|
#discover_and_add_accounts(institution_id, *login_credentials) ⇒ Object
25
26
27
28
29
|
# File 'lib/aggcat/client.rb', line 25
def discover_and_add_accounts(institution_id, *login_credentials)
validate(institution_id: institution_id, username: login_credentials[0], password: login_credentials[1])
body = credentials(institution_id, login_credentials)
post("/institutions/#{institution_id}/logins", body)
end
|
#institution(institution_id) ⇒ Object
20
21
22
23
|
# File 'lib/aggcat/client.rb', line 20
def institution(institution_id)
validate(institution_id: institution_id)
get("/institutions/#{institution_id}")
end
|
#institutions ⇒ Object
16
17
18
|
# File 'lib/aggcat/client.rb', line 16
def institutions
get('/institutions')
end
|
#investment_positions(account_id) ⇒ Object
90
91
92
93
|
# File 'lib/aggcat/client.rb', line 90
def investment_positions(account_id)
validate(account_id: account_id)
get("/accounts/#{account_id}/positions")
end
|
#login_accounts(login_id) ⇒ Object
55
56
57
58
|
# File 'lib/aggcat/client.rb', line 55
def login_accounts(login_id)
validate(login_id: login_id)
get("/logins/#{login_id}/accounts")
end
|
#update_account_type(account_id, type) ⇒ Object
72
73
74
75
|
# File 'lib/aggcat/client.rb', line 72
def update_account_type(account_id, type)
validate(account_id: account_id, type: type)
put("/accounts/#{account_id}", account_type(type))
end
|
#update_login(institution_id, login_id, *login_credentials) ⇒ Object
60
61
62
63
64
|
# File 'lib/aggcat/client.rb', line 60
def update_login(institution_id, login_id, *login_credentials)
validate(institution_id: institution_id, login_id: login_id, username: login_credentials[0], password: login_credentials[1])
body = credentials(institution_id, login_credentials)
put("/logins/#{login_id}?refresh=true", body)
end
|
#update_login_confirmation(login_id, challenge_session_id, challenge_node_id, answers) ⇒ Object
66
67
68
69
70
|
# File 'lib/aggcat/client.rb', line 66
def update_login_confirmation(login_id, challenge_session_id, challenge_node_id, answers)
validate(login_id: login_id, challenge_session_id: challenge_session_id, challenge_node_id: challenge_node_id, answers: answers)
= {'challengeSessionId' => challenge_session_id, 'challengeNodeId' => challenge_node_id}
put("/logins/#{login_id}?refresh=true", challenge_answers(answers), )
end
|