defra_ruby_govpay 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +53 -3
- data/Gemfile +2 -0
- data/Gemfile.lock +85 -2
- data/lib/defra_ruby_govpay/api.rb +23 -12
- 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
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,16 +1,53 @@
|
|
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
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
+
activesupport (7.1.1)
|
11
|
+
base64
|
12
|
+
bigdecimal
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
+
connection_pool (>= 2.2.5)
|
15
|
+
drb
|
16
|
+
i18n (>= 1.6, < 2)
|
17
|
+
minitest (>= 5.1)
|
18
|
+
mutex_m
|
19
|
+
tzinfo (~> 2.0)
|
10
20
|
addressable (2.8.5)
|
11
21
|
public_suffix (>= 2.0.2, < 6.0)
|
12
22
|
ast (2.4.2)
|
23
|
+
async (2.6.5)
|
24
|
+
console (~> 1.10)
|
25
|
+
fiber-annotation
|
26
|
+
io-event (~> 1.1)
|
27
|
+
timers (~> 4.1)
|
28
|
+
async-http (0.61.0)
|
29
|
+
async (>= 1.25)
|
30
|
+
async-io (>= 1.28)
|
31
|
+
async-pool (>= 0.2)
|
32
|
+
protocol-http (~> 0.25.0)
|
33
|
+
protocol-http1 (~> 0.16.0)
|
34
|
+
protocol-http2 (~> 0.15.0)
|
35
|
+
traces (>= 0.10.0)
|
36
|
+
async-http-faraday (0.12.0)
|
37
|
+
async-http (~> 0.42)
|
38
|
+
faraday
|
39
|
+
async-io (1.36.1)
|
40
|
+
async
|
41
|
+
async-pool (0.4.0)
|
42
|
+
async (>= 1.25)
|
43
|
+
base64 (0.1.1)
|
44
|
+
bigdecimal (3.1.4)
|
13
45
|
byebug (11.1.3)
|
46
|
+
concurrent-ruby (1.2.2)
|
47
|
+
connection_pool (2.4.1)
|
48
|
+
console (1.23.2)
|
49
|
+
fiber-annotation
|
50
|
+
fiber-local
|
14
51
|
crack (0.4.5)
|
15
52
|
rexml
|
16
53
|
defra_ruby_style (0.4.0)
|
@@ -21,24 +58,60 @@ GEM
|
|
21
58
|
diff-lcs (1.5.0)
|
22
59
|
domain_name (0.5.20190701)
|
23
60
|
unf (>= 0.0.5, < 1.0.0)
|
61
|
+
drb (2.1.1)
|
62
|
+
ruby2_keywords
|
63
|
+
faraday (2.7.11)
|
64
|
+
base64
|
65
|
+
faraday-net_http (>= 2.0, < 3.1)
|
66
|
+
ruby2_keywords (>= 0.0.4)
|
67
|
+
faraday-http-cache (2.5.0)
|
68
|
+
faraday (>= 0.8)
|
69
|
+
faraday-net_http (3.0.2)
|
70
|
+
fiber-annotation (0.2.0)
|
71
|
+
fiber-local (1.0.0)
|
72
|
+
github_changelog_generator (1.16.4)
|
73
|
+
activesupport
|
74
|
+
async (>= 1.25.0)
|
75
|
+
async-http-faraday
|
76
|
+
faraday-http-cache
|
77
|
+
multi_json
|
78
|
+
octokit (~> 4.6)
|
79
|
+
rainbow (>= 2.2.1)
|
80
|
+
rake (>= 10.0)
|
24
81
|
hashdiff (1.0.1)
|
25
82
|
http-accept (1.7.0)
|
26
83
|
http-cookie (1.0.5)
|
27
84
|
domain_name (~> 0.5)
|
85
|
+
i18n (1.14.1)
|
86
|
+
concurrent-ruby (~> 1.0)
|
87
|
+
io-event (1.3.3)
|
28
88
|
json (2.6.3)
|
29
89
|
language_server-protocol (3.17.0.3)
|
30
90
|
mime-types (3.5.1)
|
31
91
|
mime-types-data (~> 3.2015)
|
32
92
|
mime-types-data (3.2023.0808)
|
93
|
+
minitest (5.20.0)
|
94
|
+
multi_json (1.15.0)
|
95
|
+
mutex_m (0.1.2)
|
33
96
|
netrc (0.11.0)
|
97
|
+
octokit (4.25.1)
|
98
|
+
faraday (>= 1, < 3)
|
99
|
+
sawyer (~> 0.9)
|
34
100
|
parallel (1.23.0)
|
35
101
|
parser (3.2.2.4)
|
36
102
|
ast (~> 2.4.1)
|
37
103
|
racc
|
104
|
+
protocol-hpack (1.4.2)
|
105
|
+
protocol-http (0.25.0)
|
106
|
+
protocol-http1 (0.16.0)
|
107
|
+
protocol-http (~> 0.22)
|
108
|
+
protocol-http2 (0.15.1)
|
109
|
+
protocol-hpack (~> 1.4)
|
110
|
+
protocol-http (~> 0.18)
|
38
111
|
public_suffix (5.0.3)
|
39
112
|
racc (1.7.2)
|
40
113
|
rainbow (3.1.1)
|
41
|
-
rake (13.0
|
114
|
+
rake (13.1.0)
|
42
115
|
regexp_parser (2.8.2)
|
43
116
|
rest-client (2.1.0)
|
44
117
|
http-accept (>= 1.7.0, < 2.0)
|
@@ -83,6 +156,14 @@ GEM
|
|
83
156
|
rubocop-capybara (~> 2.17)
|
84
157
|
rubocop-factory_bot (~> 2.22)
|
85
158
|
ruby-progressbar (1.13.0)
|
159
|
+
ruby2_keywords (0.0.5)
|
160
|
+
sawyer (0.9.2)
|
161
|
+
addressable (>= 2.3.5)
|
162
|
+
faraday (>= 0.17.3, < 3)
|
163
|
+
timers (4.3.5)
|
164
|
+
traces (0.11.1)
|
165
|
+
tzinfo (2.0.6)
|
166
|
+
concurrent-ruby (~> 1.0)
|
86
167
|
unf (0.1.4)
|
87
168
|
unf_ext
|
88
169
|
unf_ext (0.0.8.2)
|
@@ -95,11 +176,13 @@ GEM
|
|
95
176
|
PLATFORMS
|
96
177
|
x86_64-darwin-21
|
97
178
|
x86_64-darwin-22
|
179
|
+
x86_64-linux
|
98
180
|
|
99
181
|
DEPENDENCIES
|
100
182
|
byebug
|
101
183
|
defra_ruby_govpay!
|
102
184
|
defra_ruby_style (~> 0.4)
|
185
|
+
github_changelog_generator
|
103
186
|
rake (~> 13.0)
|
104
187
|
rspec (~> 3.0)
|
105
188
|
rubocop (~> 1.21)
|
@@ -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
|
@@ -60,16 +55,32 @@ module DefraRubyGovpay
|
|
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
|