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 +4 -4
- data/lib/govuk_pay_api_client/api.rb +17 -15
- data/lib/govuk_pay_api_client/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94dec22c7baf76b7de5475bef245a455b69cdfcb
|
4
|
+
data.tar.gz: 57808e790dd92015a8996bcd860054bf22ba6e59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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
|
50
|
-
|
51
|
-
|
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',
|
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
|
+
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-
|
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.
|
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
|