plaid_rails 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/plaid_rails/accounts_controller.rb +5 -5
- data/app/controllers/plaid_rails/link_controller.rb +2 -2
- data/app/views/plaid_rails/accounts/index.html.erb +1 -1
- data/lib/plaid_rails/version.rb +1 -1
- data/spec/controllers/plaid_rails/accounts_controller_spec.rb +5 -4
- data/spec/controllers/plaid_rails/link_controller_spec.rb +1 -1
- data/spec/dummy/log/test.log +1041 -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: 771ba4a90c8b9062f54c625fe4a278473141fab9
|
4
|
+
data.tar.gz: 2ad9623012e8ff176e3840e54e105fb4cb651542
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f3aa32864d39a3543a7f3ac47bc60ae3a895e2789a167314f4c0cd0992daae73716b26d1ea3f8a4f49d98a7004206facda5eec1baa205bd618d7d4f838576b7
|
7
|
+
data.tar.gz: 075d3c3c7bca35df5c5fc0016568e41c4d59b189c6c06f4b8f2844c6359480995ff31f46c243f21817998c18df3e3a28fae1193ae6d30751bdfa9a33818147a3
|
@@ -4,7 +4,7 @@ module PlaidRails
|
|
4
4
|
class AccountsController < ApplicationController
|
5
5
|
|
6
6
|
def index
|
7
|
-
@
|
7
|
+
@plaid_accounts =PlaidRails::Account.where(owner_id: account_params[:owner_id])
|
8
8
|
end
|
9
9
|
|
10
10
|
# display list of accounts for authenticated user
|
@@ -12,12 +12,12 @@ module PlaidRails
|
|
12
12
|
account_params["access_token"]
|
13
13
|
@user = Plaid::User.load(:connect, account_params["access_token"])
|
14
14
|
@user.transactions
|
15
|
-
@
|
15
|
+
@plaid_accounts = @user.accounts
|
16
16
|
end
|
17
17
|
|
18
18
|
#create new bank account and return all the accounts for the owner
|
19
19
|
def create
|
20
|
-
@
|
20
|
+
@plaid_accounts = PlaidRails::CreateAccountService.call(account_params)
|
21
21
|
end
|
22
22
|
|
23
23
|
def update
|
@@ -25,8 +25,8 @@ module PlaidRails
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def destroy
|
28
|
-
|
29
|
-
|
28
|
+
@plaid_account = PlaidRails::Account.find(params[:id])
|
29
|
+
@plaid_account.destroy
|
30
30
|
end
|
31
31
|
|
32
32
|
private
|
@@ -20,9 +20,9 @@ module PlaidRails
|
|
20
20
|
begin
|
21
21
|
exchange_token = Plaid::User.exchange_token(link_params[:public_token])
|
22
22
|
|
23
|
-
@
|
23
|
+
@plaid_accounts =PlaidRails::Account.where(owner_type: link_params[:owner_type],
|
24
24
|
owner_id: link_params[:owner_id])
|
25
|
-
@
|
25
|
+
@plaid_accounts.each do |account|
|
26
26
|
account.update(access_token: exchange_token.access_token)
|
27
27
|
end
|
28
28
|
flash[:success]="You have successfully updated your account(s)"
|
data/lib/plaid_rails/version.rb
CHANGED
@@ -10,7 +10,7 @@ module PlaidRails
|
|
10
10
|
it "get index" do
|
11
11
|
get :index, account:{owner_id: 1}
|
12
12
|
expect(response).to be_success
|
13
|
-
expect(assigns(:
|
13
|
+
expect(assigns(:plaid_accounts)).to eq [account]
|
14
14
|
|
15
15
|
end
|
16
16
|
|
@@ -18,7 +18,7 @@ module PlaidRails
|
|
18
18
|
get :new, account:{access_token: 'test_wells', name:'Wells Fargo', type: 'wells',
|
19
19
|
owner_id: "1", owner_type: "User"}
|
20
20
|
expect(response).to be_success
|
21
|
-
expect(assigns(:
|
21
|
+
expect(assigns(:plaid_accounts)).to_not be_nil
|
22
22
|
end
|
23
23
|
|
24
24
|
it "can create" do
|
@@ -27,13 +27,14 @@ module PlaidRails
|
|
27
27
|
name:'Wells Fargo', type: 'wells', owner_id: "1", owner_type: "User",
|
28
28
|
token: public_token}
|
29
29
|
expect(response).to be_success
|
30
|
-
expect(assigns(:
|
31
|
-
expect(assigns(:
|
30
|
+
expect(assigns(:plaid_accounts).size).to eq 4
|
31
|
+
expect(assigns(:plaid_accounts).first.bank_name).to eq 'Wells Fargo'
|
32
32
|
end
|
33
33
|
|
34
34
|
it "can destroy" do
|
35
35
|
delete :destroy, id: account.id
|
36
36
|
expect(response).to be_success
|
37
|
+
expect(assigns(:plaid_account)).to eq account
|
37
38
|
end
|
38
39
|
|
39
40
|
# it {
|
@@ -24,7 +24,7 @@ module PlaidRails
|
|
24
24
|
xhr :post, :update, public_token: 'test,wells,connected', name:'Wells Fargo', type: 'wells',
|
25
25
|
owner_id: "1", owner_type: "User"
|
26
26
|
expect(response).to be_success
|
27
|
-
expect(assigns(:
|
27
|
+
expect(assigns(:plaid_accounts)).to_not be_nil
|
28
28
|
expect(response).to render_template('plaid_rails/link/update')
|
29
29
|
end
|
30
30
|
it {
|