pin_up 1.4.2 → 1.4.3
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/.travis.yml +1 -1
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/lib/pin_up/pin_errors.rb +5 -0
- data/pin_up.gemspec +1 -1
- data/spec/bank_accounts_spec.rb +1 -1
- data/spec/errors_spec.rb +1 -1
- data/spec/plan_spec.rb +6 -2
- data/spec/recipients_spec.rb +1 -1
- data/spec/subscription_spec.rb +26 -23
- data/spec/transfers_spec.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e164965651e50f81fdc85cb4b21a4f4717428244c72f868cbdeda2b971841312
|
|
4
|
+
data.tar.gz: 4c5b20e30b65d3eafe442a71a53705ec5163c13571cc872564047da2abe956f9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5db2600657d67aa262c3aef1ee3715ad3d6c3c75029ff7ac75ec0058384728a6e046233cbbef7b37cc8dfd08db7d53dabfd9a4c90a1735600fdf2589cc4ed08b
|
|
7
|
+
data.tar.gz: fb81889c9bfd3de39550f85a9fe1954e73ef5cc17d80bcccdf9ba2fbcfafe80dfd4b73861e0b47bbc1be1a28ad525bf857b9ff5b21794879b600abbe1e34fa48
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.4.
|
|
1
|
+
1.4.3
|
data/lib/pin_up/pin_errors.rb
CHANGED
|
@@ -36,6 +36,8 @@ module Pin
|
|
|
36
36
|
when 422
|
|
37
37
|
message = handle_bad_response(response)
|
|
38
38
|
raise Pin::InvalidResource.new(response, message)
|
|
39
|
+
else
|
|
40
|
+
raise Pin::Unknown.new(response, "Unknown error with status code #{http_status}")
|
|
39
41
|
end
|
|
40
42
|
end
|
|
41
43
|
|
|
@@ -72,6 +74,9 @@ module Pin
|
|
|
72
74
|
end
|
|
73
75
|
end
|
|
74
76
|
|
|
77
|
+
class Unknown < SimpleError
|
|
78
|
+
end
|
|
79
|
+
|
|
75
80
|
class Unauthorized < SimpleError
|
|
76
81
|
end
|
|
77
82
|
|
data/pin_up.gemspec
CHANGED
data/spec/bank_accounts_spec.rb
CHANGED
|
@@ -6,7 +6,7 @@ describe Pin::BankAccounts, :vcr do
|
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
it 'creates a bank account token and returns its details' do
|
|
9
|
-
options = { name: 'Roland Robot', bsb: '
|
|
9
|
+
options = { name: 'Roland Robot', bsb: '012984', number: '987654321' }
|
|
10
10
|
expect(Pin::BankAccounts.create(options)['token']).to match(/^[a-z]{2}[_]/)
|
|
11
11
|
end
|
|
12
12
|
end
|
data/spec/errors_spec.rb
CHANGED
|
@@ -339,7 +339,7 @@ describe 'Errors', :vcr, class: Pin::PinError do
|
|
|
339
339
|
deleted_subscription_token = Pin::Subscription.delete(subscription_1_token)['token']
|
|
340
340
|
expect { Pin::Subscription.delete(deleted_subscription_token) }.to raise_error do |error|
|
|
341
341
|
expect(error).to be_a Pin::InvalidResource
|
|
342
|
-
expect(error.message).to eq 'Cannot cancel subscription when state is
|
|
342
|
+
expect(error.message).to eq 'Cannot cancel subscription when state is cancelling'
|
|
343
343
|
expect(error.response).to be_a Hash
|
|
344
344
|
end
|
|
345
345
|
end
|
data/spec/plan_spec.rb
CHANGED
|
@@ -114,8 +114,12 @@ describe 'Plan', :vcr, class: Pin::Plan do
|
|
|
114
114
|
"created_at"=>match(/\d/),
|
|
115
115
|
"customer_permissions"=>["cancel"],
|
|
116
116
|
"token"=>match(/(plan)[_]([\w-]{22})/),
|
|
117
|
-
"
|
|
118
|
-
|
|
117
|
+
"subscription_counts" => {
|
|
118
|
+
"trial"=>0,
|
|
119
|
+
"active"=>0,
|
|
120
|
+
"cancelling"=>0,
|
|
121
|
+
"cancelled"=>0
|
|
122
|
+
})
|
|
119
123
|
end
|
|
120
124
|
|
|
121
125
|
it 'should return a paginated list of all plans' do
|
data/spec/recipients_spec.rb
CHANGED
data/spec/subscription_spec.rb
CHANGED
|
@@ -173,27 +173,30 @@ describe 'Subscription', :vcr, class: Pin::Subscription do
|
|
|
173
173
|
expect(Pin::Subscription.reactivate(deactivated['token'])['state']).to eq('active')
|
|
174
174
|
end
|
|
175
175
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
176
|
+
## History no longer exists as an endpoint
|
|
177
|
+
## Leaving this in for reference
|
|
178
|
+
|
|
179
|
+
# it 'should fetch history for a subscription given a token' do
|
|
180
|
+
# expect(Pin::Subscription.history(subscription_2_token)).to_not eq []
|
|
181
|
+
# end
|
|
182
|
+
|
|
183
|
+
# it 'should go to a specific page when page parameter is passed' do
|
|
184
|
+
# request = Pin::Subscription.history(subscription_2_token, 20, true)
|
|
185
|
+
# expect(request[:pagination]['current']).to eq 20
|
|
186
|
+
# end
|
|
187
|
+
|
|
188
|
+
# it 'should list subscriptions on a page given a page' do
|
|
189
|
+
# request = Pin::Subscription.history(subscription_2_token, 1, true)
|
|
190
|
+
# expect(request[:response]).to_not eq []
|
|
191
|
+
# end
|
|
192
|
+
|
|
193
|
+
# it 'should return pagination if true is passed for pagination' do
|
|
194
|
+
# request = Pin::Subscription.history(subscription_2_token, 1, true)
|
|
195
|
+
# request[:pagination].key?(%W('current previous next per_page pages count))
|
|
196
|
+
# end
|
|
197
|
+
|
|
198
|
+
# it 'should not list subscriptions for a given page if there are no subscriptions' do
|
|
199
|
+
# request = Pin::Subscription.history(subscription_2_token, 25, true)
|
|
200
|
+
# expect(request[:response]).to eq []
|
|
201
|
+
# end
|
|
199
202
|
end
|
data/spec/transfers_spec.rb
CHANGED
|
@@ -5,7 +5,7 @@ describe Pin::Transfer, :vcr do
|
|
|
5
5
|
{ email: 'test@example.com',
|
|
6
6
|
name: 'Roland Robot',
|
|
7
7
|
bank_account: { name: 'Roland Robot',
|
|
8
|
-
bsb: '
|
|
8
|
+
bsb: '012984',
|
|
9
9
|
number: 987654321 } }
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -55,5 +55,5 @@ describe Pin::Transfer, :vcr do
|
|
|
55
55
|
|
|
56
56
|
it 'should list transfers for search on a page given a page' do
|
|
57
57
|
expect(Pin::Transfer.search(1, query: 'Pay day')).to_not eq []
|
|
58
|
-
end
|
|
58
|
+
end
|
|
59
59
|
end
|