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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3aff87096dc525f1caa87ff5dcdc139b60639a6
4
- data.tar.gz: c43eeca819612307e63e294aa31559ab6c3c30dc
3
+ metadata.gz: b9bf4ec19e2da82f5ff3114258e7c373567180fc
4
+ data.tar.gz: 55191d9c1d486996ed859297f382156773541b18
5
5
  SHA512:
6
- metadata.gz: a27f02557a1b4979866f6ff0838cb2a931dda180863ba13bc265130a1da173097ef1c4adc1c8386822561522e86024023b35bacec69afcf73059c867c12f0538
7
- data.tar.gz: 6ba2e1df0596322db41773e7dffd7980fd6fa7bfe421c254b5cda399f10a0842f362513a310ee018e3fabe5805d31309c3259fae9388a439136406e53b3d0f7d
6
+ metadata.gz: 402815c55a6a994ea35e7b61b45ff4077cba9aae4cf2a6d73b7bf1b96f8eab85b113bae2ae0c318acf5c6967273131634674231dc8d84f80f485dda0cb7067ae
7
+ data.tar.gz: cd2091fa421f9338c87dfdedb7ed7d6362ce810ebdceb1fa65e22ea6245c86f5d1fbbb963d6c7d9f37908827d703d4fd0ba1812857900065921f451ba0410f51
@@ -15,8 +15,10 @@ module PromisePay
15
15
  def execute
16
16
  begin
17
17
  response = request.execute
18
- rescue RestClient::Unauthorized, RestClient::BadRequest => e
19
- raise RequestError, e.message
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 RequestError < StandardError; end
64
+ class BadRequestError < StandardError; end
65
+ class UnauthorizedRequestError < StandardError; end
63
66
  end
@@ -1,3 +1,3 @@
1
1
  module PromisePay
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -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::RequestError
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::RequestError
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::RequestError
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.6
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-19 00:00:00.000000000 Z
11
+ date: 2015-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler