plaid 2.1.0 → 2.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 275751fae8bd5e8b06ab3b12d577fb9287663fbd
4
- data.tar.gz: 5b079f65196433ea7edfe0d27e5bcc917d4bc4f0
3
+ metadata.gz: 23f868bb29f987801f40bb8666471898caa9a51b
4
+ data.tar.gz: 2acc57e2e3f6e7df16b336078b26c0f85032f1c6
5
5
  SHA512:
6
- metadata.gz: a2da99035165898c5634a704a12ee0a47f021df841e33a1172c7503b219a66451b60f6fb1bbf39f6c833ea450eeb00c13d0302dca56a8a3526b60a64126a6e6c
7
- data.tar.gz: 53d4916be3b84f6833add1df715fad9de680391d13c4ff46969a1680d276507e46232a513f935d195a9e6515f2fa172a24e9b943c851846e02612caa7cb217ed
6
+ metadata.gz: 76a97718db8ed7e5072c5ed55ccaf0bc9c281d412d6806b6f1da972bd0b3f46e86fde3fb62eebb6e511e568241f38d6b3fa0fc6ec488f0183cbc3688113439f1
7
+ data.tar.gz: 50a9f87dd4fb6f77cd6af0ebefaec70c20ef9d2d0b3266bb4e00da7f03a7b3e19d91b7e46fe98799fb22aab506d5f6e6307ec166369e150569c90721b10621aa
@@ -1,3 +1,8 @@
1
+ # 2.2.0. 03-Nov-2016
2
+
3
+ * Add `Transaction#reference_number` (@ericbirdsall).
4
+ * Fix webhook codes and add risk and income webhooks.
5
+
1
6
  # 2.1.0. 19-Oct-2016
2
7
 
3
8
  * Documentation fixes (@ishmael).
@@ -74,6 +74,10 @@ module Plaid
74
74
  # E.g. "13005000".
75
75
  attr_reader :category_id
76
76
 
77
+ # Public: A String attribute that is used by the bank/payment
78
+ # processor to identify transactions — where applicable.
79
+ attr_reader :reference_number
80
+
77
81
  # Public: The String ID of a posted transaction's associated
78
82
  # pending transaction - where applicable.
79
83
  attr_reader :pending_transaction_id
@@ -91,6 +95,7 @@ module Plaid
91
95
  @meta = Plaid.symbolize_hash(fields['meta'])
92
96
  @location = (@meta && @meta[:location]) || {}
93
97
  @pending = fields['pending']
98
+ @reference_number = fields['_reference_number']
94
99
  @pending_transaction_id = fields['_pendingTransaction']
95
100
  @score = Plaid.symbolize_hash(fields['score'])
96
101
 
@@ -1,3 +1,3 @@
1
1
  module Plaid
2
- VERSION = '2.1.0'.freeze
2
+ VERSION = '2.2.0'.freeze
3
3
  end
@@ -78,6 +78,20 @@ module Plaid
78
78
  code == Webhook::USER_WEBHOOK_UPDATED
79
79
  end
80
80
 
81
+ # Public: Detect if the webhook is Income. Occurs when Income data is ready.
82
+ #
83
+ # Returns true if it is.
84
+ def income?
85
+ code == Webhook::INCOME
86
+ end
87
+
88
+ # Public: Detect if the webhook is Risk. Occurs when Risk data is ready.
89
+ #
90
+ # Returns true if it is.
91
+ def risk?
92
+ code == Webhook::RISK
93
+ end
94
+
81
95
  # Public: Detect if the webhook is Error Response Webhook. Triggered when
82
96
  # an error has occurred. Includes the relevant Plaid error code with
83
97
  # details on both the error type and steps for error resolution.
@@ -118,12 +132,21 @@ module Plaid
118
132
 
119
133
  private
120
134
 
121
- Webhook::ERROR_RESPONSE = -1
135
+ ERROR_RESPONSE = -1
136
+
122
137
  codex = {}
123
- ['initial transaction', 'historical transaction', 'normal transaction', 'removed transaction', 'user webhook updated'].each_with_index do |event, idx|
138
+ {
139
+ 'initial transaction' => 0,
140
+ 'historical transaction' => 1,
141
+ 'normal transaction' => 2,
142
+ 'removed transaction' => 3,
143
+ 'user webhook updated' => 4,
144
+ 'income' => 10,
145
+ 'risk' => 20
146
+ }.each do |event, idx|
124
147
  name = event.split.map(&:upcase).join('_')
125
- codex[idx + 1] = name
126
- const_set name, idx + 1
148
+ codex[idx] = name
149
+ const_set name, idx
127
150
  end
128
151
  CODEX = codex.freeze
129
152
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plaid
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Dashevskii
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-19 00:00:00.000000000 Z
11
+ date: 2016-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json