finapps 5.0.5 → 5.0.6

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
  SHA256:
3
- metadata.gz: db44bf32241ed4d54bf29dce14836832397136256eb5fe28821a245c16c7b4d6
4
- data.tar.gz: ff07e6b644f1f7465b359086037069017b9c3b4d16852729dafafbcf706c9423
3
+ metadata.gz: 7a1641f0fe296f8026dbe5423f23b0c521bb0dd7722657f7c46bdeb06fa2fbf2
4
+ data.tar.gz: 818dd5f516d402ce3ffada206dac6a48531de84b998a031d7b466b9e89d8f5cc
5
5
  SHA512:
6
- metadata.gz: 041f8b7b3bd9412a8cc712ba996f727bb78a93128c9fbe384f17460bad73b920f13b7c3063e860a6bf3798616fa406cca6505ee12dab76f0b130b9adef5f4f32
7
- data.tar.gz: 78fed6e1e88b09e79794ae492bbde7368123c0bfbe0ce790d4f24f849bcd62abf9c76b9cabf958ee01b7dcdc59cfd195b45385cc0f0ff4f1741558f243df47c4
6
+ metadata.gz: 8088f973f6d1841f1d67b654811a91e795347198fd05c7ec7d82d69d816ff09d09b48ea02d646ffd659a76fef57d88d85f9c0a62f396a442103b127193c79126
7
+ data.tar.gz: 4391a7c8b7851baa3ffd4338522277d00f00c24964d04b93b1743cb58edab98992e7dbcbfea7f70db1546941d7d959f47e3aa7a0e1433164e08070e5128094d6
data/lib/finapps.rb CHANGED
@@ -31,6 +31,7 @@ require 'finapps/rest/portfolios_consumers'
31
31
  require 'finapps/rest/consumers_portfolios'
32
32
  require 'finapps/rest/portfolio_reports'
33
33
 
34
+ require 'finapps/rest/plaid/plaid_resources'
34
35
  require 'finapps/rest/plaid/plaid_webhooks'
35
36
  require 'finapps/rest/plaid/plaid_consumer_institutions'
36
37
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module FinApps
4
4
  module REST
5
- class PlaidConsumerInstitutions < FinAppsCore::REST::Resources # :nodoc:
5
+ class PlaidConsumerInstitutions < PlaidResources # :nodoc:
6
6
  def create(params)
7
7
  super(params, 'p/institution/consumer')
8
8
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FinApps
4
+ module REST
5
+ class PlaidResources < FinAppsCore::REST::Resources # :nodoc:
6
+ protected
7
+
8
+ def end_point
9
+ super.gsub!('plaid', 'p/')
10
+ end
11
+ end
12
+ end
13
+ end
@@ -2,9 +2,9 @@
2
2
 
3
3
  module FinApps
4
4
  module REST
5
- class PlaidWebhooks < FinAppsCore::REST::Resources # :nodoc:
6
- def create
7
- super({}, 'p/webhook')
5
+ class PlaidWebhooks < PlaidResources # :nodoc:
6
+ def show
7
+ send_request_for_id 'p/webhook', :get, nil
8
8
  end
9
9
  end
10
10
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FinApps
4
- VERSION = '5.0.5'
4
+ VERSION = '5.0.6'
5
5
  end
@@ -6,22 +6,22 @@ RSpec.describe FinApps::REST::PlaidWebhooks do
6
6
  include SpecHelpers::Client
7
7
 
8
8
  let(:api_client) { client }
9
- subject(:create) { FinApps::REST::PlaidWebhooks.new(api_client).create }
9
+ subject(:show) { FinApps::REST::PlaidWebhooks.new(api_client).show }
10
10
 
11
- describe '#create' do
11
+ describe '#show' do
12
12
  RSpec.shared_examples 'an API request' do |_parameter|
13
- it { expect { subject }.not_to raise_error }
14
- it('returns an array') { expect(subject).to be_a(Array) }
13
+ it { expect { show }.not_to raise_error }
14
+ it('returns an array') { expect(show).to be_a(Array) }
15
15
  end
16
16
 
17
17
  context 'when valid tenant token is provided' do
18
18
  it_behaves_like 'an API request'
19
19
 
20
20
  it('performs a post and returns the webhook url') do
21
- expect(create[RESULTS]).to have_key(:url)
21
+ expect(show[RESULTS]).to have_key(:url)
22
22
  end
23
23
  it('returns no error messages') do
24
- expect(create[ERROR_MESSAGES]).to be_empty
24
+ expect(show[ERROR_MESSAGES]).to be_empty
25
25
  end
26
26
  end
27
27
 
@@ -29,10 +29,11 @@ RSpec.describe FinApps::REST::PlaidWebhooks do
29
29
  let(:api_client) { client(:invalid_tenant_token) }
30
30
 
31
31
  it_behaves_like 'an API request'
32
- it('results is nil') { expect(create[RESULTS]).to be_nil }
32
+
33
+ it('results is nil') { expect(show[RESULTS]).to be_nil }
33
34
  it('error messages array is populated') do
34
- expect(create[ERROR_MESSAGES].first.downcase).to eq(
35
- 'resource not found'
35
+ expect(show[ERROR_MESSAGES].first.downcase).to eq(
36
+ 'invalid tenant api key or secret'
36
37
  )
37
38
  end
38
39
  end
@@ -16,10 +16,10 @@ class FakeApi < Sinatra::Base
16
16
  delete("/#{version}/resources/:id") { status 202 }
17
17
 
18
18
  # plaid_webhook
19
- post("/#{version}/p/webhook") do
19
+ get("/#{version}/p/webhook") do
20
20
  tenant_token = request.env['HTTP_X_TENANT_TOKEN']
21
21
  if tenant_token == 'invalid_tenant_token'
22
- json_response 404, 'resource_not_found.json'
22
+ json_response 404, 'invalid_tenant_credentials.json'
23
23
  else
24
24
  json_response 200, 'plaid/webhook.json'
25
25
  end
@@ -0,0 +1,5 @@
1
+ {
2
+ "messages": [
3
+ "Invalid Tenant API Key or Secret"
4
+ ]
5
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finapps
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.5
4
+ version: 5.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erich Quintero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-01 00:00:00.000000000 Z
11
+ date: 2019-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: finapps_core
@@ -313,6 +313,7 @@ files:
313
313
  - lib/finapps/rest/orders.rb
314
314
  - lib/finapps/rest/password_resets.rb
315
315
  - lib/finapps/rest/plaid/plaid_consumer_institutions.rb
316
+ - lib/finapps/rest/plaid/plaid_resources.rb
316
317
  - lib/finapps/rest/plaid/plaid_webhooks.rb
317
318
  - lib/finapps/rest/portfolio_reports.rb
318
319
  - lib/finapps/rest/portfolios.rb
@@ -365,6 +366,7 @@ files:
365
366
  - spec/support/fixtures/error.json
366
367
  - spec/support/fixtures/fake_pdf_statement.json
367
368
  - spec/support/fixtures/invalid_request_body.json
369
+ - spec/support/fixtures/invalid_tenant_credentials.json
368
370
  - spec/support/fixtures/invalid_user_id.json
369
371
  - spec/support/fixtures/invalid_user_institution_id.json
370
372
  - spec/support/fixtures/mfa_timeout.json