govuk-pay-api-client 0.1.4 → 0.1.5

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: f8d9e34ea815e1be4a30028072cae8f83d748d2f
4
- data.tar.gz: 633d2327c1dfbf1ae0befd694e8ad8e0a6dc9552
3
+ metadata.gz: 94dec22c7baf76b7de5475bef245a455b69cdfcb
4
+ data.tar.gz: 57808e790dd92015a8996bcd860054bf22ba6e59
5
5
  SHA512:
6
- metadata.gz: aab0024014592b69112100ccdd736298df06f988eb76c6a7a5d03189c56dcfe06734281ba9b56609548bf6ee27e2143ec6be80b68f6aedb4f7640363a13c6296
7
- data.tar.gz: 76798a404f3c0184bbb1dee6ec3839c2abbfa5b6faa593f3349ebfd2e1eb08b85e6c75fa315366f6c781906184c1559e7e4bad63f62b5447a8b4368ae9894603
6
+ metadata.gz: 14aa3535dfcda122c83b5b71e879b33989e2b377286c302a663e2310a7527d6c3890903d70b841ca20a9523d8b818f989061955558f53a9d10694dedf31d25fc
7
+ data.tar.gz: 5484010963cb8302545373569836c353b8811358f542ebb1ff4204239f2d9ff1c2acf4484314763de9982f7c5efd45930a17c9159da3deb1181942267b5446c1
@@ -11,23 +11,21 @@ module GovukPayApiClient
11
11
  end
12
12
 
13
13
  def post
14
- @post ||=
15
- client.post(path: endpoint, body: request_body.to_json).tap { |resp|
16
- # Only timeouts and network issues raise errors.
17
- handle_response_errors(resp)
18
- @body = resp.body
19
- }
14
+ client("#{api_url}#{endpoint}").post(body: request_body.to_json).tap { |resp|
15
+ # Only timeouts and network issues raise errors.
16
+ handle_response_errors(resp)
17
+ @body = resp.body
18
+ }
20
19
  rescue Excon::Error => e
21
20
  raise Unavailable, e
22
21
  end
23
22
 
24
23
  def get
25
- @get ||=
26
- client.get(path: endpoint).tap { |resp|
27
- # Only timeouts and network issues raise errors.
28
- handle_response_errors(resp)
29
- @body = resp.body
30
- }
24
+ client("#{api_url}#{endpoint}").get.tap { |resp|
25
+ # Only timeouts and network issues raise errors.
26
+ handle_response_errors(resp)
27
+ @body = resp.body
28
+ }
31
29
  rescue Excon::Error => e
32
30
  raise Unavailable, e
33
31
  end
@@ -46,9 +44,13 @@ module GovukPayApiClient
46
44
  end
47
45
  end
48
46
 
49
- def client
50
- @client ||= Excon.new(
51
- ENV.fetch('GOVUK_PAY_API_URL'),
47
+ def api_url
48
+ ENV.fetch('GOVUK_PAY_API_URL')
49
+ end
50
+
51
+ def client(uri)
52
+ Excon.new(
53
+ uri,
52
54
  headers: {
53
55
  'Authorization' => "Bearer #{ENV.fetch('GOVUK_PAY_API_KEY')}",
54
56
  'Content-Type' => 'application/json',
@@ -1,3 +1,3 @@
1
1
  module GovukPayApiClient
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk-pay-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Tyree
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-09 00:00:00.000000000 Z
11
+ date: 2016-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
210
  version: '0'
211
211
  requirements: []
212
212
  rubyforge_project:
213
- rubygems_version: 2.6.6
213
+ rubygems_version: 2.5.1
214
214
  signing_key:
215
215
  specification_version: 4
216
216
  summary: An API client to handle Govuk Pay interactions