plaid_rails 0.4.0 → 0.5.0

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: de35214c4950877d21fe26e73df733462b2e047f
4
- data.tar.gz: 7845f1e4bac8b37fb5dec185b4608c6f243db918
3
+ metadata.gz: 7d20288ae52a3c55735e45555b58da6ef3086e1f
4
+ data.tar.gz: e8b1a5ea03b763be1a188c9be56a42a724d2f7a6
5
5
  SHA512:
6
- metadata.gz: 638b199bf4b3eb151920383f3c5492e9421001ffdb88e4a2d2d2789a2131eec360c02167fb794344ac41c73058bc2bbbb649916f3b594186ba8c13d90bc03415
7
- data.tar.gz: a4246246455405916327cf843db82bb5a692a78119a26363e1f282149039f80fe240d4a192a35037fd4019e0e5245ba2bb5de29f6cf4ad5bea340b5bbbfc3fcf
6
+ metadata.gz: 6081b6bf3de23372e2988b1de4e9580477d13c5cf3b7fd06c5062a9b56eeb93db642f6747bece54ceb28ffd6d668d37ae375deb92b8251654eda09935fbee4f9
7
+ data.tar.gz: 8c23aee3dbbc54619f470d3231203d23069450dba0a7806e748b5645a816db4e344ab14360ea244b5e4a07594db042218ec4da1ca52eb00993a0cf89e3c71a76
@@ -9,9 +9,10 @@ module PlaidRails
9
9
 
10
10
  # display list of accounts for authenticated user
11
11
  def new
12
- @user = Plaid.set_user(account_params[:access_token], ['connect'])
13
- # Retrieve the user's accounts
14
- #@user.get('auth')
12
+ account_params["access_token"]
13
+ @user = Plaid::User.load(:connect, account_params["access_token"])
14
+ @user.transactions
15
+ puts "@user #{@user.inspect}"
15
16
  @accounts = @user.accounts
16
17
  end
17
18
 
@@ -5,7 +5,7 @@ module PlaidRails
5
5
 
6
6
  def authenticate
7
7
  begin
8
- @exchange_token = Plaid.exchange_token(link_params[:public_token])
8
+ @exchange_token = Plaid::User.exchange_token(link_params[:public_token])
9
9
 
10
10
  @params = link_params.merge!(token: link_params[:public_token])
11
11
 
@@ -18,7 +18,7 @@ module PlaidRails
18
18
 
19
19
  def update
20
20
  begin
21
- exchange_token = Plaid.exchange_token(link_params[:public_token])
21
+ exchange_token = Plaid::User.exchange_token(link_params[:public_token])
22
22
 
23
23
  @accounts =PlaidRails::Account.where(owner_type: link_params[:owner_type],
24
24
  owner_id: link_params[:owner_id])
@@ -16,7 +16,8 @@ module PlaidRails
16
16
  token = self.access_token
17
17
  begin
18
18
  if PlaidRails::Account.where(access_token: token).size == 1
19
- Plaid::Connection.delete('connect', { access_token: token})
19
+ user = Plaid::User.load(:connect, token)
20
+ user.delete
20
21
  end
21
22
  rescue => e
22
23
  message = "Unable to delete token #{token}"
@@ -5,7 +5,9 @@ module PlaidRails
5
5
  def self.call(account_params)
6
6
  account_params["account_ids"].each do |id|
7
7
  # set Plaid::User
8
- user = Plaid.set_user(account_params["access_token"],['connect'])
8
+ user = Plaid::User.load(:connect, account_params["access_token"])
9
+ # get all the info, make plaid /connect/get call
10
+ user.transactions
9
11
  #find the account by account_id
10
12
  account = user.accounts.find{|a| a.id==id}
11
13
  PlaidRails::Account.create!(
@@ -13,7 +15,7 @@ module PlaidRails
13
15
  token: account_params["token"],
14
16
  plaid_type: account_params["type"],
15
17
  name: account.name,
16
- bank_name: Plaid.institution.find{|i| i.type==account_params["type"]}.name,
18
+ bank_name: Plaid::LongTailInstitution.get(account_params["type"]).name,
17
19
  number: account.meta["number"],
18
20
  owner_id: account_params["owner_id"],
19
21
  owner_type: account_params["owner_type"],
@@ -1,3 +1,3 @@
1
1
  module PlaidRails
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -5,7 +5,7 @@ module PlaidRails
5
5
  routes { PlaidRails::Engine.routes }
6
6
  let(:account){create(:account)}
7
7
  let(:public_token){'test,wells,connected'}
8
- let(:user){Plaid.set_user('test_wells', ['auth'])}
8
+ let(:user){Plaid::User.load(:connect, 'test_wells').upgrade(:info)}
9
9
 
10
10
  it "get index" do
11
11
  get :index, account:{owner_id: 1}
@@ -16,7 +16,7 @@ module PlaidRails
16
16
  owner_id: "1", owner_type: "User"
17
17
  expect(response).to_not be_success
18
18
  expect(response.status).to eq 500
19
- expect(response.body).to eq "unauthorized product"
19
+ expect(response.body).to include "unauthorized product"
20
20
  end
21
21
 
22
22
  it "update with public token" do