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
15
16
|
# 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[:oauth_url] ||= SAML_URL
options[:base_url] ||= BASE_URL
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
43
44
45
46
|
# File 'lib/aggcat/client.rb', line 43
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
33
34
35
36
37
|
# File 'lib/aggcat/client.rb', line 33
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
48
49
50
51
52
53
54
55
|
# File 'lib/aggcat/client.rb', line 48
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
39
40
41
|
# File 'lib/aggcat/client.rb', line 39
def accounts
get('/accounts')
end
|
#delete_account(account_id) ⇒ Object
79
80
81
82
|
# File 'lib/aggcat/client.rb', line 79
def delete_account(account_id)
validate(account_id: account_id)
delete("/accounts/#{account_id}")
end
|
#delete_customer ⇒ Object
84
85
86
87
88
89
90
|
# File 'lib/aggcat/client.rb', line 84
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
27
28
29
30
31
|
# File 'lib/aggcat/client.rb', line 27
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
22
23
24
25
|
# File 'lib/aggcat/client.rb', line 22
def institution(institution_id)
validate(institution_id: institution_id)
get("/institutions/#{institution_id}")
end
|
#institutions ⇒ Object
18
19
20
|
# File 'lib/aggcat/client.rb', line 18
def institutions
get('/institutions')
end
|
#investment_positions(account_id) ⇒ Object
92
93
94
95
|
# File 'lib/aggcat/client.rb', line 92
def investment_positions(account_id)
validate(account_id: account_id)
get("/accounts/#{account_id}/positions")
end
|
#login_accounts(login_id) ⇒ Object
57
58
59
60
|
# File 'lib/aggcat/client.rb', line 57
def login_accounts(login_id)
validate(login_id: login_id)
get("/logins/#{login_id}/accounts")
end
|
#update_account_type(account_id, type) ⇒ Object
74
75
76
77
|
# File 'lib/aggcat/client.rb', line 74
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
62
63
64
65
66
|
# File 'lib/aggcat/client.rb', line 62
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
68
69
70
71
72
|
# File 'lib/aggcat/client.rb', line 68
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
|