aggcat 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53cf34048a4dad698095d1a1af343fc51f070b9b
4
- data.tar.gz: 8ffd86b01d7477cb9837ccc13bb5f762b1a3cb7d
3
+ metadata.gz: e76c9be70762e7631e51a4d2a8d9d5f7929e7b35
4
+ data.tar.gz: 5b028818231cb8023a7b77a8763e54f584e3a947
5
5
  SHA512:
6
- metadata.gz: 36cf492344ff144de921b4e97361d7de303d9f038229acb90f5fffb056758a6f7736d4062b181f6466e3b56296c3bad66bc658b265fa772f9a8c89bba6452df2
7
- data.tar.gz: 090e35b93e4a4f95c2091b658d1197326191f76636e71c056384eadb644f498344dbbf42ce11efb31c5c0fe13a654b4541ed2c4084f395c24e071aafff3c37a5
6
+ metadata.gz: e66e62910a2b0054439010754af5bb91f956644a8ed1049d7d05e05014d6ff0db182907ab49f1178976593d8068e3fb914a9e34ff779a02a7c0f1b17f6796cc2
7
+ data.tar.gz: fea8cdc454ecfd3f2647c8a88668c0c7a40d2199f2d5c83a44627952b2483b8d04a14558c1bbb72a0d3da2af2e45ca2b7be043a0234f8f7801ed0a5d69a8a6c9
data/README.md CHANGED
@@ -77,11 +77,14 @@ start_date = Date.today - 30
77
77
  end_date = Date.today # optional
78
78
  client.account_transactions(account_id, start_date, end_date)
79
79
 
80
+ # update account type
81
+ client.update_account_type(account_id, 'CREDITCARD')
82
+
80
83
  # update login credentials
81
84
  client.update_login(institution_id, login_id, new_username, new_password)
82
85
 
83
86
  # in case MFA is required
84
- client.update_login_confirmation(institution_id, challenge_session_id, challenge_node_id, answers)
87
+ client.update_login_confirmation(login_id, challenge_session_id, challenge_node_id, answers)
85
88
 
86
89
  # you can set scope inline for any request
87
90
  Aggcat.scope(customer_id).account(account_id)
@@ -22,9 +22,9 @@ module Aggcat
22
22
  get("/institutions/#{institution_id}")
23
23
  end
24
24
 
25
- def discover_and_add_accounts(institution_id, username, password)
26
- validate(institution_id: institution_id, username: username, password: password)
27
- body = credentials(institution_id, username, password)
25
+ def discover_and_add_accounts(institution_id, *login_credentials)
26
+ validate(institution_id: institution_id, username: login_credentials[0], password: login_credentials[1])
27
+ body = credentials(institution_id, login_credentials)
28
28
  post("/institutions/#{institution_id}/logins", body)
29
29
  end
30
30
 
@@ -57,9 +57,9 @@ module Aggcat
57
57
  get("/logins/#{login_id}/accounts")
58
58
  end
59
59
 
60
- def update_login(institution_id, login_id, username, password)
61
- validate(institution_id: institution_id, login_id: login_id, username: username, password: password)
62
- body = credentials(institution_id, username, password)
60
+ def update_login(institution_id, login_id, *login_credentials)
61
+ validate(institution_id: institution_id, login_id: login_id, username: login_credentials[0], password: login_credentials[1])
62
+ body = credentials(institution_id, login_credentials)
63
63
  put("/logins/#{login_id}?refresh=true", body)
64
64
  end
65
65
 
@@ -133,14 +133,19 @@ module Aggcat
133
133
  end
134
134
  end
135
135
 
136
- def credentials(institution_id, username, password)
136
+ def credentials(institution_id, login_credentials)
137
137
  institution = institution(institution_id)
138
138
  raise ArgumentError.new("institution_id #{institution_id} is invalid") if institution.nil? || institution[:result][:institution_detail].nil?
139
- keys = institution[:result][:institution_detail][:keys][:key].sort { |a, b| a[:display_order].to_i <=> b[:display_order].to_i }
140
- hash = {
141
- keys[0][:name] => username,
142
- keys[1][:name] => password
143
- }
139
+ institution_login_keys = institution[:result][:institution_detail][:keys][:key].sort { |a, b| a[:display_order].to_i <=> b[:display_order].to_i }
140
+
141
+ if institution_login_keys.length != login_credentials.length
142
+ raise ArgumentError.new("institution_id #{institution_id} requires #{institution_login_keys.length} credential fields but was only given #{login_credentials.length} to authenticate with.")
143
+ end
144
+
145
+ hash = {}
146
+ institution_login_keys.each_with_index do |institution_login_key, index|
147
+ hash[institution_login_key[:name]] = login_credentials[index].to_s
148
+ end
144
149
 
145
150
  xml = Builder::XmlMarkup.new
146
151
  xml.InstitutionLogin('xmlns' => LOGIN_NAMESPACE) do |login|
@@ -1,3 +1,3 @@
1
1
  module Aggcat
2
- VERSION = '0.3.3'
2
+ VERSION = '0.3.4'
3
3
  end
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.3
4
+ version: 0.3.4
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-12-13 00:00:00.000000000 Z
11
+ date: 2014-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  version: 1.3.6
149
149
  requirements: []
150
150
  rubyforge_project:
151
- rubygems_version: 2.1.11
151
+ rubygems_version: 2.2.2
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: Ruby client for Intuit Customer Account Data APIs