promise_pay 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/promise_pay/request.rb +6 -3
- data/lib/promise_pay/version.rb +1 -1
- data/spec/promise_pay/request_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9bf4ec19e2da82f5ff3114258e7c373567180fc
|
4
|
+
data.tar.gz: 55191d9c1d486996ed859297f382156773541b18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 402815c55a6a994ea35e7b61b45ff4077cba9aae4cf2a6d73b7bf1b96f8eab85b113bae2ae0c318acf5c6967273131634674231dc8d84f80f485dda0cb7067ae
|
7
|
+
data.tar.gz: cd2091fa421f9338c87dfdedb7ed7d6362ce810ebdceb1fa65e22ea6245c86f5d1fbbb963d6c7d9f37908827d703d4fd0ba1812857900065921f451ba0410f51
|
data/lib/promise_pay/request.rb
CHANGED
@@ -15,8 +15,10 @@ module PromisePay
|
|
15
15
|
def execute
|
16
16
|
begin
|
17
17
|
response = request.execute
|
18
|
-
rescue RestClient::Unauthorized
|
19
|
-
raise
|
18
|
+
rescue RestClient::Unauthorized => e
|
19
|
+
raise UnauthorizedRequestError, e.message
|
20
|
+
rescue RestClient::BadRequest => e
|
21
|
+
raise BadRequestError, e.message
|
20
22
|
end
|
21
23
|
|
22
24
|
response
|
@@ -59,5 +61,6 @@ module PromisePay
|
|
59
61
|
attr_reader :request
|
60
62
|
end
|
61
63
|
|
62
|
-
class
|
64
|
+
class BadRequestError < StandardError; end
|
65
|
+
class UnauthorizedRequestError < StandardError; end
|
63
66
|
end
|
data/lib/promise_pay/version.rb
CHANGED
@@ -53,19 +53,19 @@ describe PromisePay::Request do
|
|
53
53
|
rest_client_request = request.send(:request)
|
54
54
|
allow(rest_client_request).to receive(:execute) { raise RestClient::Unauthorized }
|
55
55
|
|
56
|
-
expect { request.execute }.to raise_error PromisePay::
|
56
|
+
expect { request.execute }.to raise_error PromisePay::UnauthorizedRequestError
|
57
57
|
end
|
58
58
|
|
59
59
|
it "re-raises RestClient::BadRequest exceptions" do
|
60
60
|
rest_client_request = request.send(:request)
|
61
61
|
allow(rest_client_request).to receive(:execute) { raise RestClient::BadRequest }
|
62
62
|
|
63
|
-
expect { request.execute }.to raise_error PromisePay::
|
63
|
+
expect { request.execute }.to raise_error PromisePay::BadRequestError
|
64
64
|
end
|
65
65
|
|
66
66
|
it "raises exception when no api credentials are present" do
|
67
67
|
PromisePay.api_user = nil
|
68
|
-
expect { request.execute }.to raise_error PromisePay::
|
68
|
+
expect { request.execute }.to raise_error PromisePay::UnauthorizedRequestError
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: promise_pay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Liam Norton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|