aggcat 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +3 -0
- data/lib/aggcat/base.rb +3 -1
- data/lib/aggcat/client.rb +49 -15
- data/lib/aggcat/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -59,6 +59,9 @@ Aggcat.scope(customer1).account(account_id)
|
|
59
59
|
# get all aggregated accounts
|
60
60
|
Aggcat.accounts
|
61
61
|
|
62
|
+
# update login credentials
|
63
|
+
Aggcat.update_login(institution_id, login_id, new_username, new_password)
|
64
|
+
|
62
65
|
# delete account
|
63
66
|
Aggcat.delete_account(account_id)
|
64
67
|
|
data/lib/aggcat/base.rb
CHANGED
@@ -15,7 +15,9 @@ module Aggcat
|
|
15
15
|
|
16
16
|
SAML_URL = 'https://oauth.intuit.com/oauth/v1/get_access_token_by_saml'
|
17
17
|
|
18
|
-
|
18
|
+
LOGIN_NAMESPACE = 'http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1'
|
19
|
+
CHALLENGE_NAMESPACE = 'http://schema.intuit.com/platform/fdatafeed/challenge/v1'
|
20
|
+
|
19
21
|
TIME_FORMAT = '%Y-%m-%dT%T.%LZ'
|
20
22
|
DATE_FORMAT = '%Y-%m-%d'
|
21
23
|
|
data/lib/aggcat/client.rb
CHANGED
@@ -25,6 +25,12 @@ module Aggcat
|
|
25
25
|
post("/institutions/#{institution_id}/logins", body)
|
26
26
|
end
|
27
27
|
|
28
|
+
def account_confirmation(institution_id, challenge_session_id, challenge_node_id, answer)
|
29
|
+
validate(institution_id: institution_id, challenge_node_id: challenge_session_id, challenge_node_id: challenge_node_id, answer: answer)
|
30
|
+
headers = {challengeSessionId: challenge_session_id, challengeNodeId: challenge_node_id}
|
31
|
+
post("/institutions/#{institution_id}/logins", challenge_answer(answer), headers)
|
32
|
+
end
|
33
|
+
|
28
34
|
def accounts
|
29
35
|
get('/accounts')
|
30
36
|
end
|
@@ -43,6 +49,18 @@ module Aggcat
|
|
43
49
|
get(uri)
|
44
50
|
end
|
45
51
|
|
52
|
+
def update_login(institution_id, login_id, username, password)
|
53
|
+
validate(institution_id: institution_id, login_id: login_id, username: username, password: password)
|
54
|
+
body = credentials(institution_id, username, password)
|
55
|
+
put("/logins/#{login_id}?refresh=true", body)
|
56
|
+
end
|
57
|
+
|
58
|
+
def update_login_confirmation(login_id, challenge_session_id, challenge_node_id, answer)
|
59
|
+
validate(login_id: login_id, challenge_node_id: challenge_session_id, challenge_node_id: challenge_node_id, answer: answer)
|
60
|
+
headers = {challengeSessionId: challenge_session_id, challengeNodeId: challenge_node_id}
|
61
|
+
put("/logins/#{login_id}?refresh=true", challenge_answer(answer), headers)
|
62
|
+
end
|
63
|
+
|
46
64
|
def delete_account(account_id)
|
47
65
|
validate(account_id: account_id)
|
48
66
|
delete("/accounts/#{account_id}")
|
@@ -54,13 +72,26 @@ module Aggcat
|
|
54
72
|
|
55
73
|
protected
|
56
74
|
|
57
|
-
def get(uri)
|
58
|
-
|
59
|
-
|
75
|
+
def get(uri, headers = {})
|
76
|
+
request(:get, uri, headers)
|
77
|
+
end
|
78
|
+
|
79
|
+
def post(uri, body, headers = {})
|
80
|
+
request(:post, uri, body, headers.merge({'Content-Type' => 'application/xml'}))
|
81
|
+
end
|
82
|
+
|
83
|
+
def put(uri, body, headers = {})
|
84
|
+
request(:put, uri, body, headers.merge({'Content-Type' => 'application/xml'}))
|
85
|
+
end
|
86
|
+
|
87
|
+
def delete(uri, headers = {})
|
88
|
+
request(:delete, uri, headers.merge({'Content-Type' => 'application/xml'}))
|
60
89
|
end
|
61
90
|
|
62
|
-
|
63
|
-
|
91
|
+
private
|
92
|
+
|
93
|
+
def request(method, uri, *options)
|
94
|
+
response = access_token.send(method.to_sym, BASE_URL + uri, *options)
|
64
95
|
result = {:response_code => response.code, :response => parse_xml(response.body)}
|
65
96
|
if response['challengeSessionId']
|
66
97
|
result[:challenge_session_id] = response['challengeSessionId']
|
@@ -69,13 +100,6 @@ module Aggcat
|
|
69
100
|
result
|
70
101
|
end
|
71
102
|
|
72
|
-
def delete(uri)
|
73
|
-
response = access_token.delete("#{BASE_URL}#{uri}")
|
74
|
-
{:response_code => response.code, :response => parse_xml(response.body)}
|
75
|
-
end
|
76
|
-
|
77
|
-
private
|
78
|
-
|
79
103
|
def validate(args)
|
80
104
|
args.each do |name, value|
|
81
105
|
if value.nil? || value.to_s.empty?
|
@@ -93,10 +117,10 @@ module Aggcat
|
|
93
117
|
}
|
94
118
|
|
95
119
|
xml = Builder::XmlMarkup.new
|
96
|
-
xml.InstitutionLogin('xmlns' =>
|
97
|
-
login.credentials('xmlns:ns1' =>
|
120
|
+
xml.InstitutionLogin('xmlns' => LOGIN_NAMESPACE) do |login|
|
121
|
+
login.credentials('xmlns:ns1' => LOGIN_NAMESPACE) do
|
98
122
|
hash.each do |key, value|
|
99
|
-
xml.tag!('ns1:credential', {'xmlns:ns2' =>
|
123
|
+
xml.tag!('ns1:credential', {'xmlns:ns2' => LOGIN_NAMESPACE}) do
|
100
124
|
xml.tag!('ns2:name', key)
|
101
125
|
xml.tag!('ns2:value', value)
|
102
126
|
end
|
@@ -104,6 +128,16 @@ module Aggcat
|
|
104
128
|
end
|
105
129
|
end
|
106
130
|
end
|
131
|
+
|
132
|
+
def challenge_answer(answer)
|
133
|
+
xml = Builder::XmlMarkup.new
|
134
|
+
xml.InstitutionLogin('xmlns:v1' => LOGIN_NAMESPACE) do |login|
|
135
|
+
login.challengeResponses do |challenge|
|
136
|
+
challenge.response(answer, 'xmlns:v11' => CHALLENGE_NAMESPACE)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
107
140
|
end
|
108
141
|
end
|
109
142
|
|
143
|
+
|
data/lib/aggcat/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aggcat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: oauth
|