aggcat 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-gemset +1 -1
- data/lib/aggcat/base.rb +11 -0
- data/lib/aggcat/client.rb +29 -0
- data/lib/aggcat/version.rb +1 -1
- data/test/aggcat/client_test.rb +18 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53cf34048a4dad698095d1a1af343fc51f070b9b
|
4
|
+
data.tar.gz: 8ffd86b01d7477cb9837ccc13bb5f762b1a3cb7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36cf492344ff144de921b4e97361d7de303d9f038229acb90f5fffb056758a6f7736d4062b181f6466e3b56296c3bad66bc658b265fa772f9a8c89bba6452df2
|
7
|
+
data.tar.gz: 090e35b93e4a4f95c2091b658d1197326191f76636e71c056384eadb644f498344dbbf42ce11efb31c5c0fe13a654b4541ed2c4084f395c24e071aafff3c37a5
|
data/.ruby-gemset
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
aggcat
|
data/lib/aggcat/base.rb
CHANGED
@@ -6,6 +6,7 @@ require 'net/https'
|
|
6
6
|
require 'oauth'
|
7
7
|
require 'openssl'
|
8
8
|
require 'securerandom'
|
9
|
+
require 'set'
|
9
10
|
require 'xmlhasher'
|
10
11
|
require 'uri'
|
11
12
|
|
@@ -16,6 +17,16 @@ module Aggcat
|
|
16
17
|
|
17
18
|
LOGIN_NAMESPACE = 'http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1'
|
18
19
|
CHALLENGE_NAMESPACE = 'http://schema.intuit.com/platform/fdatafeed/challenge/v1'
|
20
|
+
BANKING_ACCOUNT_NAMESPACE = 'http://schema.intuit.com/platform/fdatafeed/bankingaccount/v1'
|
21
|
+
CREDIT_ACCOUNT_NAMESPACE = 'http://schema.intuit.com/platform/fdatafeed/creditaccount/v1'
|
22
|
+
LOAN_NAMESPACE = 'http://schema.intuit.com/platform/fdatafeed/loan/v1'
|
23
|
+
INVESTMENT_ACCOUNT_NAMESPACE = 'http://schema.intuit.com/platform/fdatafeed/investmentaccount/v1'
|
24
|
+
REWARD_ACCOUNT_NAMESPACE = 'http://schema.intuit.com/platform/fdatafeed/rewardsaccount/v1'
|
25
|
+
|
26
|
+
BANKING_TYPES = Set.new %w(CHECKING SAVINGS MONEYMRKT RECURRINGDEPOSIT CD CASHMANAGEMENT OVERDRAFT)
|
27
|
+
CREDIT_TYPES = Set.new %w(CREDITCARD LINEOFCREDIT OTHER)
|
28
|
+
LOAN_TYPES = Set.new %w(LOAN AUTO COMMERCIAL CONSTR CONSUMER HOMEEQUITY MILITARY MORTGAGE SMB STUDENT)
|
29
|
+
INVESTMENT_TYPES = Set.new %w(TAXABLE 401K BROKERAGE IRA 403B KEOGH TRUST TDA SIMPLE NORMAL SARSEP UGMA OTHER)
|
19
30
|
|
20
31
|
TIME_FORMAT = '%Y-%m-%dT%T.%LZ'
|
21
32
|
DATE_FORMAT = '%Y-%m-%d'
|
data/lib/aggcat/client.rb
CHANGED
@@ -69,6 +69,11 @@ module Aggcat
|
|
69
69
|
put("/logins/#{login_id}?refresh=true", challenge_answers(answers), headers)
|
70
70
|
end
|
71
71
|
|
72
|
+
def update_account_type(account_id, type)
|
73
|
+
validate(account_id: account_id, type: type)
|
74
|
+
put("/accounts/#{account_id}", account_type(type))
|
75
|
+
end
|
76
|
+
|
72
77
|
def delete_account(account_id)
|
73
78
|
validate(account_id: account_id)
|
74
79
|
delete("/accounts/#{account_id}")
|
@@ -161,6 +166,30 @@ module Aggcat
|
|
161
166
|
end
|
162
167
|
end
|
163
168
|
|
169
|
+
def account_type(type)
|
170
|
+
xml = Builder::XmlMarkup.new
|
171
|
+
if BANKING_TYPES.include?(type)
|
172
|
+
xml.tag!('ns4:BankingAccount', {'xmlns:ns4' => BANKING_ACCOUNT_NAMESPACE}) do
|
173
|
+
xml.tag!('ns4:bankingAccountType', type)
|
174
|
+
end
|
175
|
+
elsif CREDIT_TYPES.include?(type)
|
176
|
+
xml.tag!('ns4:CreditAccount', {'xmlns:ns4' => CREDIT_ACCOUNT_NAMESPACE}) do
|
177
|
+
xml.tag!('ns4:creditAccountType', type)
|
178
|
+
end
|
179
|
+
elsif LOAN_TYPES.include?(type)
|
180
|
+
xml.tag!('ns4:Loan', {'xmlns:ns4' => LOAN_NAMESPACE}) do
|
181
|
+
xml.tag!('ns4:loanType', type)
|
182
|
+
end
|
183
|
+
elsif INVESTMENT_TYPES.include?(type)
|
184
|
+
xml.tag!('ns4:InvestmentAccount', {'xmlns:ns4' => INVESTMENT_ACCOUNT_NAMESPACE}) do
|
185
|
+
xml.tag!('ns4:investmentAccountType', type)
|
186
|
+
end
|
187
|
+
else
|
188
|
+
xml.tag!('ns4:RewardAccount', {'xmlns:ns4' => REWARD_ACCOUNT_NAMESPACE}) do
|
189
|
+
xml.tag!('ns4:rewardAccountType')
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
164
193
|
end
|
165
194
|
end
|
166
195
|
|
data/lib/aggcat/version.rb
CHANGED
data/test/aggcat/client_test.rb
CHANGED
@@ -128,6 +128,24 @@ class ClientTest < Test::Unit::TestCase
|
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
|
+
def test_update_account_type
|
132
|
+
account_id = '000000000001'
|
133
|
+
type = 'ANOTHER'
|
134
|
+
stub_put("/accounts/#{account_id}").to_return(:status => 200)
|
135
|
+
response = @client.update_account_type(account_id, type)
|
136
|
+
assert_equal '200', response[:status_code]
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_update_account_type_bad_args
|
140
|
+
[nil, ''].each do |arg|
|
141
|
+
exception = assert_raise(ArgumentError) { @client.update_account_type(arg, 'CREDITCARD') }
|
142
|
+
assert_equal('account_id is required', exception.message)
|
143
|
+
|
144
|
+
exception = assert_raise(ArgumentError) { @client.update_account_type(1, arg) }
|
145
|
+
assert_equal('type is required', exception.message)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
131
149
|
def test_delete_account
|
132
150
|
account_id = '000000000001'
|
133
151
|
stub_delete("/accounts/#{account_id}").to_return(:status => 200)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aggcat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gene Drabkin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth
|