old_plaid 1.7.1 → 2.7.1
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 +4 -4
- data/lib/old_plaid/models/account.rb +8 -3
- data/lib/old_plaid/models/balances.rb +11 -0
- data/lib/old_plaid/models/transaction.rb +5 -5
- data/lib/old_plaid/version.rb +1 -1
- data/spec/old_plaid_spec.rb +2 -2
- data/spec/plaid/models/account_spec.rb +2 -2
- data/spec/plaid/models/transaction_spec.rb +3 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36274de6eb5e4a9916baee6e63d24e473df4a20a
|
4
|
+
data.tar.gz: f225c2501334a72b1f0ea2bd9cfa66df8a5694c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
@
|
14
|
-
|
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"
|
@@ -1,21 +1,21 @@
|
|
1
1
|
module OldPlaid
|
2
2
|
class Transaction
|
3
|
-
attr_accessor :
|
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
|
-
@
|
7
|
-
@
|
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
|
-
@
|
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
|
-
@
|
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']
|
data/lib/old_plaid/version.rb
CHANGED
data/spec/old_plaid_spec.rb
CHANGED
@@ -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(&:
|
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(&:
|
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.
|
21
|
-
with_results('balance' => { 'current' => 200.00 } ) do it { expect(subject.
|
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.
|
15
|
-
with_results('_account' => 'acct') do it { expect(subject.
|
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' => '
|
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:
|
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-
|
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
|