finicity 0.1.2 → 0.1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3bdd449e8495e55c19dba35b84698f9ecdd3881d
4
- data.tar.gz: a2d7276438ddb21b0401e5c55cd29763a10975bf
3
+ metadata.gz: 9b3be7fb06d75de49e424102c9294f0af58ef843
4
+ data.tar.gz: 34082cab8784ccebff332c8257d4c6223a49aa6a
5
5
  SHA512:
6
- metadata.gz: 826f60559ea6e003196b151d3a0502482d2af3676f76fe3c237adc3f4456f24ed631d35f37439ef852509d272ae315de32a69db85cea0da9f0e1a30b9d430c01
7
- data.tar.gz: 9eebfd4a6f96d929b7981aef2a197c984c18038ec8c680f9495123823820cb446954ce590addc035611d8b7604dc72384108ae4f61ebe1defa9c944183f5dd35
6
+ metadata.gz: 67a7c6663069a3ee002bc994ff6015cced7f2d3412e7e2ff2b08defe187c3b8c3e77cbf9d0c9bfd913304f1e11063bf1f277d6bedcf86061040300fe93c881b4
7
+ data.tar.gz: 3157c40b03bde2c3c3922017d4b2857c80f23bd16458c084280b48ea847ba5fc69c7ec3f08c5ddf95a00d6221ace27bf2f76762f2f70250aa56b404f530f32eb
data/README.md CHANGED
@@ -19,10 +19,10 @@ You can configure the finicity gem with the following initializer
19
19
 
20
20
  ```Ruby
21
21
  Finicity::V1.configure do |config|
22
- config.base_url = "https://finicity.com"
23
- config.partner_key = "key"
24
- config.username = "moneydesktop"
25
- config.password = "password"
22
+ config.base_url = "https://api.finicity.com/aggregation/"
23
+ config.partner_id = 1
24
+ config.partner_secret = "1234"
25
+ config.app_key = "5678"
26
26
  end
27
27
  ```
28
28
 
@@ -42,28 +42,28 @@ will contain a token that is valid for a limited time.
42
42
  Creating a session can be done by making a new client and then authenticating
43
43
 
44
44
  ```Ruby
45
- client = Finicity::V1::Client.new
45
+ client = Finicity::Client.new
46
46
  client.authenticate!
47
47
  ```
48
48
 
49
49
  If you have an existing session, you can re-open your existing session
50
50
 
51
51
  ```Ruby
52
- client = Finicity::V1::Client.new("token-123")
52
+ client = Finicity::Client.new("token-123")
53
53
  ```
54
54
 
55
55
  If you have an existing session, and also need to re-open a mfa session,
56
56
  you can pass both tokens into the client when you create it
57
57
 
58
58
  ```Ruby
59
- client = Finicity::V1::Client.new("token-123", "mfa_session-123")
59
+ client = Finicity::Client.new("token-123", "mfa_session-123")
60
60
  ```
61
61
 
62
62
  Once you have established a session, you can begin to issue commands to the API
63
63
  using your finicity client
64
64
 
65
65
  ```Ruby
66
- client.get_institutions_by_name("Chase")
66
+ client.get_institutions("Chase")
67
67
  ```
68
68
 
69
69
  TODO: link to docs to list all API commands we support
@@ -374,7 +374,13 @@ module Finicity
374
374
  error_code = nil
375
375
  end
376
376
 
377
- fail ::Finicity::GenericError.new(error_message, response.status_code, error_code)
377
+ # Finicity API uses 500 status code, with a 103 code in the body to communicate
378
+ # that the credentials are invalid.
379
+ if response.status_code == 500 && error_code == 103
380
+ fail ::Finicity::InvalidCredentialsError.new(103)
381
+ else
382
+ fail ::Finicity::GenericError.new(error_message, response.status_code, error_code)
383
+ end
378
384
  end
379
385
 
380
386
  end
@@ -1,3 +1,3 @@
1
1
  module Finicity
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -22,6 +22,15 @@ describe ::Finicity::Client do
22
22
  :content_type => "text/plain"
23
23
  )
24
24
  }
25
+ let(:aggregation_error) {
26
+ instance_double(
27
+ ::HTTP::Message,
28
+ :ok? => false,
29
+ :status_code => 500,
30
+ :body => '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><error><code>103</code><message>Aggregation error.</message></error>',
31
+ :content_type => "application/xml"
32
+ )
33
+ }
25
34
 
26
35
  describe "#activate_accounts" do
27
36
  context "when the response is successful" do
@@ -222,6 +231,15 @@ describe ::Finicity::Client do
222
231
  expect { subject.discover_accounts(123, 1, []) }.to raise_error(::Finicity::GenericError)
223
232
  end
224
233
  end
234
+
235
+ context "when the response is an aggregation error" do
236
+ it "fails with InvalidCredentials" do
237
+ allow_any_instance_of(::Finicity::V1::Request::DiscoverAccounts).to(
238
+ receive(:discover_accounts).and_return(aggregation_error)
239
+ )
240
+ expect { subject.discover_accounts(123, 1, []) }.to raise_error(::Finicity::InvalidCredentialsError)
241
+ end
242
+ end
225
243
  end
226
244
 
227
245
  describe "#discover_accounts_with_mfa" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finicity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moneydesktop
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-10 00:00:00.000000000 Z
11
+ date: 2014-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient