old_plaid 1.7.1 → 2.7.1

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: e23d2716fc03c0effd63bce96fc15cbb22e8eae1
4
- data.tar.gz: 6151243d04e3526aede1dc2230ac7dbfd7a5c0f8
3
+ metadata.gz: 36274de6eb5e4a9916baee6e63d24e473df4a20a
4
+ data.tar.gz: f225c2501334a72b1f0ea2bd9cfa66df8a5694c4
5
5
  SHA512:
6
- metadata.gz: 5f3756351df4b41b7f3618a88b6a6d7bd06eac8145f2e8451c9f6722f4eba3f44eeb8438b85d9528d1c70fc29e244e859c8fd3cea35bec0e3a3378fddd87f2d2
7
- data.tar.gz: f5c5ea2875da40efbee3755d9dd909ea7284f8c0e44e9fca9672d15143c874051c8e6bd7a092fa959d90a4ed7fa5ac12f5b3eac8b2e8d937b94fde9016dc7bb2
6
+ metadata.gz: 9b3faa89ce65d031e8d8b39421f095d2e9154fdc6a6c3a1a8da355052dfcfe46f2dac77cbe4087e9cee8e14fef748f62916e40385174b00bcbeda0db7d4c1a0d
7
+ data.tar.gz: 946a2f36913083239155eab77d4c10470d229fa0be8abe16fa7a0d7a74d30c2c7e5a04f1ea9c2d1efa5599adcf8941912522dd0b536910feac820d03c10bea09
@@ -1,17 +1,22 @@
1
+ require_relative 'balances'
2
+
1
3
  module OldPlaid
2
4
  class Account
3
- attr_accessor :available_balance, :current_balance, :institution_type, :meta, :transactions, :numbers, :name, :id, :type, :subtype
5
+ attr_accessor :available_balance, :current_balance, :institution_type, :mask, :meta, :transactions, :numbers, :name, :id, :type, :subtype, :balances
4
6
 
5
7
  def initialize(hash)
6
8
  @id = hash['_id']
7
9
  @name = hash['meta']['name'] if hash['meta']
8
10
  @type = hash['type']
9
11
  @meta = hash['meta']
12
+ @mask = hash['meta']['number'] if hash['meta']
10
13
  @institution_type = hash['institution_type']
11
14
 
12
15
  if hash['balance']
13
- @available_balance = hash['balance']['available']
14
- @current_balance = hash['balance']['current']
16
+ @balances = Balances.new(
17
+ available: hash['balance']['available'],
18
+ current: hash['balance']['current']
19
+ )
15
20
  end
16
21
 
17
22
  # Depository account only, "checkings" or "savings"
@@ -0,0 +1,11 @@
1
+ module OldPlaid
2
+ class Balances
3
+
4
+ attr_accessor :available, :current
5
+
6
+ def initialize(hash)
7
+ @available = hash[:available]
8
+ @current = hash[:current]
9
+ end
10
+ end
11
+ end
@@ -1,21 +1,21 @@
1
1
  module OldPlaid
2
2
  class Transaction
3
- attr_accessor :id, :account, :date, :amount, :name, :meta, :location, :pending, :score, :cat, :type, :category, :category_id, :pending_transaction
3
+ attr_accessor :transaction_id, :account_id, :date, :amount, :name, :meta, :location, :pending, :score, :cat, :transaction_type, :category, :category_id, :pending_transaction_id
4
4
 
5
5
  def initialize(fields = {})
6
- @id = fields['_id']
7
- @account = fields['_account']
6
+ @transaction_id = fields['_id']
7
+ @account_id = fields['_account']
8
8
  @date = fields['date']
9
9
  @amount = fields['amount']
10
10
  @name = fields['name']
11
11
  @location = fields['meta'].nil? ? {} : fields['meta']['location']
12
12
  @pending = fields['pending']
13
- @pending_transaction = fields['_pendingTransaction']
13
+ @pending_transaction_id = fields['_pendingTransaction']
14
14
  @score = fields['score']
15
15
  @cat = Category.new({ 'id' => fields['category_id'], 'hierarchy' => fields['category'], 'type' => fields['type'] })
16
16
 
17
17
  # Here for backwards compatibility only.
18
- @type = fields['type']
18
+ @transaction_type = fields['type']['primary'] if fields['type']
19
19
  @category = fields['category']
20
20
  @category_id = fields['category_id']
21
21
  @meta = fields['meta']
@@ -1,3 +1,3 @@
1
1
  module OldPlaid
2
- VERSION = '1.7.1'
2
+ VERSION = '2.7.1'
3
3
  end
@@ -230,7 +230,7 @@ describe OldPlaid do
230
230
  end
231
231
 
232
232
  it 'return only transactions from the requested account' do
233
- expect(subject.transactions.map(&:account).uniq).to eql([account])
233
+ expect(subject.transactions.map(&:account_id).uniq).to eql([account])
234
234
  end
235
235
  end
236
236
 
@@ -256,7 +256,7 @@ describe OldPlaid do
256
256
 
257
257
  it 'returns only transactions from the requested account and date range' do
258
258
  expect(subject.transactions.map(&:date).uniq).to eql(['2014-07-24'])
259
- expect(subject.transactions.map(&:account).uniq).to eql([account])
259
+ expect(subject.transactions.map(&:account_id).uniq).to eql([account])
260
260
  end
261
261
  end
262
262
  end
@@ -17,8 +17,8 @@ describe OldPlaid::Account do
17
17
  with_results('meta' => nil) do it { expect(subject.meta).to be_nil } end
18
18
  with_results('meta' => {}) do it { expect(subject.meta).to eql({}) } end
19
19
 
20
- with_results('balance' => { 'available' => 100.00 } ) do it { expect(subject.available_balance).to eql(100.00) } end
21
- with_results('balance' => { 'current' => 200.00 } ) do it { expect(subject.current_balance).to eql(200.00) } end
20
+ with_results('balance' => { 'available' => 100.00 } ) do it { expect(subject.balances.available).to eql(100.00) } end
21
+ with_results('balance' => { 'current' => 200.00 } ) do it { expect(subject.balances.current).to eql(200.00) } end
22
22
 
23
23
  with_results('institution_type' => 'Type') do it { expect(subject.institution_type).to eql('Type') } end
24
24
 
@@ -11,8 +11,8 @@ describe OldPlaid::Transaction do
11
11
  end
12
12
  end
13
13
 
14
- with_results('_id' => 'ID') do it { expect(subject.id).to eql('ID') } end
15
- with_results('_account' => 'acct') do it { expect(subject.account).to eql('acct') } end
14
+ with_results('_id' => 'ID') do it { expect(subject.transaction_id).to eql('ID') } end
15
+ with_results('_account' => 'acct') do it { expect(subject.account_id).to eql('acct') } end
16
16
  with_results('date' => '00/00/00') do it { expect(subject.date).to eql('00/00/00') } end
17
17
  with_results('amount' => 100.00) do it { expect(subject.amount).to eql(100.00) } end
18
18
  with_results('name' => 'Name') do it { expect(subject.name).to eql('Name') } end
@@ -20,7 +20,7 @@ describe OldPlaid::Transaction do
20
20
  with_results('meta' => {'location' => 'Location'}) do it { expect(subject.location).to eql('Location') } end
21
21
  with_results('pending' => true) do it { expect(subject.pending).to eql(true) } end
22
22
  with_results('score' => 200) do it { expect(subject.score).to eql(200) } end
23
- with_results('type' => 'Type') do it { expect(subject.type).to eql('Type') } end
23
+ with_results('type' => {'primary' => 'place'}) do it { expect(subject.transaction_type).to eql('place') } end
24
24
 
25
25
  with_results('category' => 'Category') do it { expect(subject.category).to eql('Category') } end
26
26
  with_results('category_id' => 100) do it { expect(subject.category_id).to eql(100) } end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: old_plaid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 2.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Crites
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-21 00:00:00.000000000 Z
11
+ date: 2018-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -115,6 +115,7 @@ files:
115
115
  - lib/old_plaid/connection.rb
116
116
  - lib/old_plaid/errors.rb
117
117
  - lib/old_plaid/models/account.rb
118
+ - lib/old_plaid/models/balances.rb
118
119
  - lib/old_plaid/models/category.rb
119
120
  - lib/old_plaid/models/exchange_token_response.rb
120
121
  - lib/old_plaid/models/info.rb