defra_ruby_govpay 0.2.2 → 0.2.4
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/CHANGELOG.md +53 -3
- data/Gemfile.lock +3 -2
- data/lib/defra_ruby_govpay/api.rb +24 -13
- data/lib/defra_ruby_govpay/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6040a654f7b5f443c957b0aae87e874d050986040c730544b2ea5edd0378a176
|
|
4
|
+
data.tar.gz: 97a4d9020a1390e37a4d20fd797f876f1fc73fd2991c1634b9f2332642da428b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f5a78da8b85f0d06bd92933428b676d3b1b3df7a260999ff0c717d1b577d89d5d4d1b3887e58120b21931574c0c17ae386fde16d6200645eccbc72e466e12200
|
|
7
|
+
data.tar.gz: f75230f02be4a3e347a78e1b7aaecdf7d06dea04c8d1f8164ed7d02332a4c32729e7b115206295b5ac03a2ed4082bd88c76b6ca20e1e9259ad2a5a5504739e2d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
|
-
|
|
1
|
+
# Changelog
|
|
2
2
|
|
|
3
|
-
## [
|
|
3
|
+
## [Unreleased](https://github.com/DEFRA/defra-ruby-govpay/tree/HEAD)
|
|
4
4
|
|
|
5
|
-
-
|
|
5
|
+
[Full Changelog](https://github.com/DEFRA/defra-ruby-govpay/compare/v0.2.3...HEAD)
|
|
6
|
+
|
|
7
|
+
**Fixed bugs:**
|
|
8
|
+
|
|
9
|
+
- fix DefraRubyGovpay config [\#9](https://github.com/DEFRA/defra-ruby-govpay/pull/9) ([PaulDoyle-DEFRA](https://github.com/PaulDoyle-DEFRA))
|
|
10
|
+
|
|
11
|
+
**Merged pull requests:**
|
|
12
|
+
|
|
13
|
+
- Bump rake from 13.0.6 to 13.1.0 [\#6](https://github.com/DEFRA/defra-ruby-govpay/pull/6) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
14
|
+
|
|
15
|
+
## [v0.2.3](https://github.com/DEFRA/defra-ruby-govpay/tree/v0.2.3) (2023-11-07)
|
|
16
|
+
|
|
17
|
+
[Full Changelog](https://github.com/DEFRA/defra-ruby-govpay/compare/v0.2.2...v0.2.3)
|
|
18
|
+
|
|
19
|
+
**Implemented enhancements:**
|
|
20
|
+
|
|
21
|
+
- Chore/ruby 2769 enhance govpay logging [\#8](https://github.com/DEFRA/defra-ruby-govpay/pull/8) ([PaulDoyle-DEFRA](https://github.com/PaulDoyle-DEFRA))
|
|
22
|
+
|
|
23
|
+
## [v0.2.2](https://github.com/DEFRA/defra-ruby-govpay/tree/v0.2.2) (2023-11-06)
|
|
24
|
+
|
|
25
|
+
[Full Changelog](https://github.com/DEFRA/defra-ruby-govpay/compare/v0.2.1...v0.2.2)
|
|
26
|
+
|
|
27
|
+
**Implemented enhancements:**
|
|
28
|
+
|
|
29
|
+
- gem version 0.2.2 [\#7](https://github.com/DEFRA/defra-ruby-govpay/pull/7) ([PaulDoyle-DEFRA](https://github.com/PaulDoyle-DEFRA))
|
|
30
|
+
- Chore/ruby 2769 enhance govpay logging [\#5](https://github.com/DEFRA/defra-ruby-govpay/pull/5) ([PaulDoyle-DEFRA](https://github.com/PaulDoyle-DEFRA))
|
|
31
|
+
|
|
32
|
+
## [v0.2.1](https://github.com/DEFRA/defra-ruby-govpay/tree/v0.2.1) (2023-10-03)
|
|
33
|
+
|
|
34
|
+
[Full Changelog](https://github.com/DEFRA/defra-ruby-govpay/compare/v0.2.0...v0.2.1)
|
|
35
|
+
|
|
36
|
+
## [v0.2.0](https://github.com/DEFRA/defra-ruby-govpay/tree/v0.2.0) (2023-09-26)
|
|
37
|
+
|
|
38
|
+
[Full Changelog](https://github.com/DEFRA/defra-ruby-govpay/compare/v0.1.2...v0.2.0)
|
|
39
|
+
|
|
40
|
+
## [v0.1.2](https://github.com/DEFRA/defra-ruby-govpay/tree/v0.1.2) (2023-09-18)
|
|
41
|
+
|
|
42
|
+
[Full Changelog](https://github.com/DEFRA/defra-ruby-govpay/compare/v0.1.1...v0.1.2)
|
|
43
|
+
|
|
44
|
+
**Merged pull requests:**
|
|
45
|
+
|
|
46
|
+
- release/v0.1.2 [\#4](https://github.com/DEFRA/defra-ruby-govpay/pull/4) ([jjromeo](https://github.com/jjromeo))
|
|
47
|
+
- gem version 0.1.0 [\#1](https://github.com/DEFRA/defra-ruby-govpay/pull/1) ([jjromeo](https://github.com/jjromeo))
|
|
48
|
+
|
|
49
|
+
## [v0.1.1](https://github.com/DEFRA/defra-ruby-govpay/tree/v0.1.1) (2023-09-18)
|
|
50
|
+
|
|
51
|
+
[Full Changelog](https://github.com/DEFRA/defra-ruby-govpay/compare/1bd9ccaffdb51137f980d553336b5dddf2f4901d...v0.1.1)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
defra_ruby_govpay (0.2.
|
|
4
|
+
defra_ruby_govpay (0.2.4)
|
|
5
5
|
rest-client (~> 2.1)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
@@ -111,7 +111,7 @@ GEM
|
|
|
111
111
|
public_suffix (5.0.3)
|
|
112
112
|
racc (1.7.2)
|
|
113
113
|
rainbow (3.1.1)
|
|
114
|
-
rake (13.0
|
|
114
|
+
rake (13.1.0)
|
|
115
115
|
regexp_parser (2.8.2)
|
|
116
116
|
rest-client (2.1.0)
|
|
117
117
|
http-accept (>= 1.7.0, < 2.0)
|
|
@@ -176,6 +176,7 @@ GEM
|
|
|
176
176
|
PLATFORMS
|
|
177
177
|
x86_64-darwin-21
|
|
178
178
|
x86_64-darwin-22
|
|
179
|
+
x86_64-linux
|
|
179
180
|
|
|
180
181
|
DEPENDENCIES
|
|
181
182
|
byebug
|
|
@@ -13,13 +13,8 @@ module DefraRubyGovpay
|
|
|
13
13
|
# The API class is responsible for making requests to the Govpay API.
|
|
14
14
|
# It handles the construction of request URLs, headers, and payload,
|
|
15
15
|
# and also deals with any errors that occur during the API request.
|
|
16
|
+
|
|
16
17
|
class API
|
|
17
|
-
def initialize(config = DefraRubyGovpay.configuration)
|
|
18
|
-
@config = config
|
|
19
|
-
@is_back_office = config.host_is_back_office
|
|
20
|
-
@front_office_token = config.govpay_front_office_api_token
|
|
21
|
-
@back_office_token = config.govpay_back_office_api_token
|
|
22
|
-
end
|
|
23
18
|
|
|
24
19
|
def send_request(method:, path:, params: nil, is_moto: false)
|
|
25
20
|
@is_moto = is_moto
|
|
@@ -55,21 +50,37 @@ module DefraRubyGovpay
|
|
|
55
50
|
|
|
56
51
|
def handle_error(error, method, path, params)
|
|
57
52
|
error_message = "Error sending request to govpay (#{method} #{path}, params: #{params}), " \
|
|
58
|
-
"response body #{
|
|
53
|
+
"response body: #{error.response&.body}: #{error}"
|
|
59
54
|
DefraRubyGovpay.logger.error error_message
|
|
60
55
|
raise GovpayApiError, error_message
|
|
61
56
|
end
|
|
62
57
|
|
|
58
|
+
def govpay_url
|
|
59
|
+
@govpay_url ||= DefraRubyGovpay.configuration.govpay_url
|
|
60
|
+
end
|
|
61
|
+
|
|
63
62
|
def url(path)
|
|
64
|
-
"#{
|
|
63
|
+
"#{govpay_url}#{path}"
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def back_office_app
|
|
67
|
+
@back_office_app ||= DefraRubyGovpay.configuration.host_is_back_office
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def front_office_token
|
|
71
|
+
@front_office_token ||= DefraRubyGovpay.configuration.govpay_front_office_api_token
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def back_office_token
|
|
75
|
+
@back_office_token ||= DefraRubyGovpay.configuration.govpay_back_office_api_token
|
|
65
76
|
end
|
|
66
77
|
|
|
67
78
|
def bearer_token
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
if back_office_app
|
|
80
|
+
@is_moto ? back_office_token : front_office_token
|
|
81
|
+
else
|
|
82
|
+
front_office_token
|
|
83
|
+
end
|
|
73
84
|
end
|
|
74
85
|
|
|
75
86
|
def payload(params)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: defra_ruby_govpay
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jerome Pratt
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-11-
|
|
11
|
+
date: 2023-11-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rest-client
|