mangopay 3.24.1 → 3.25.0
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 +5 -0
- data/lib/mangopay/version.rb +1 -1
- data/lib/mangopay.rb +16 -2
- 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: dfbda16f8ea316a00735545fa9c670f5ecbbe7dadc389ebecc37909a24c29be6
|
|
4
|
+
data.tar.gz: 774766d50d6351820e1b33dd6cc43beaba2b137756318ed4a22c0b079cd4fdac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e003221ba09f9358431c661d5bc85be4b6c0893ef7369b8e770a2d98a5a5a30ec73994037509519dcda0ee859af674610481c3dee5ec01109d97abc1000364cd
|
|
7
|
+
data.tar.gz: 3c42d1785055f226161c6aa728db75e40016fb9f08cf947b63f25862268c52b124ad076920cdc6faddfbf679c26ef80a67e7c70fc1f575780804c09b0cfcb611
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
## [3.25.0] - 2024-04-16
|
|
2
|
+
### Added
|
|
3
|
+
|
|
4
|
+
- Add trace header logging : Introduced the `log_trace_headers` boolean configuration key. Set it to true to enable logging of `x_mangopay_trace-id` and `IdempotencyKey` in the log of the http requests.
|
|
5
|
+
|
|
1
6
|
## [3.24.1] - 2024-04-10
|
|
2
7
|
### Fixed
|
|
3
8
|
|
data/lib/mangopay/version.rb
CHANGED
data/lib/mangopay.rb
CHANGED
|
@@ -5,6 +5,7 @@ require 'multi_json'
|
|
|
5
5
|
require 'benchmark'
|
|
6
6
|
require 'logger'
|
|
7
7
|
require 'time'
|
|
8
|
+
require 'securerandom'
|
|
8
9
|
|
|
9
10
|
# helpers
|
|
10
11
|
require 'mangopay/version'
|
|
@@ -55,7 +56,7 @@ module MangoPay
|
|
|
55
56
|
class Configuration
|
|
56
57
|
attr_accessor :preproduction, :root_url,
|
|
57
58
|
:client_id, :client_apiKey,
|
|
58
|
-
:temp_dir, :log_file, :http_timeout,
|
|
59
|
+
:temp_dir, :log_file, :log_trace_headers, :http_timeout,
|
|
59
60
|
:http_max_retries, :http_open_timeout,
|
|
60
61
|
:logger, :use_ssl, :uk_header_flag
|
|
61
62
|
|
|
@@ -65,6 +66,7 @@ module MangoPay
|
|
|
65
66
|
config.client_id = @client_id
|
|
66
67
|
config.client_apiKey = @client_apiKey
|
|
67
68
|
config.log_file = @log_file
|
|
69
|
+
config.log_trace_headers = @log_trace_headers
|
|
68
70
|
config.http_timeout = @http_timeout
|
|
69
71
|
config.http_max_retries = @http_max_retries
|
|
70
72
|
config.http_open_timeout = @http_open_timeout
|
|
@@ -101,6 +103,10 @@ module MangoPay
|
|
|
101
103
|
|
|
102
104
|
true
|
|
103
105
|
end
|
|
106
|
+
|
|
107
|
+
def log_trace_headers
|
|
108
|
+
@log_trace_headers || false
|
|
109
|
+
end
|
|
104
110
|
|
|
105
111
|
def uk_header_flag
|
|
106
112
|
@uk_header_flag || false
|
|
@@ -274,6 +280,9 @@ module MangoPay
|
|
|
274
280
|
'Authorization' => "#{auth_token['token_type']} #{auth_token['access_token']}",
|
|
275
281
|
'Content-Type' => 'application/json'
|
|
276
282
|
}
|
|
283
|
+
if configuration.log_trace_headers
|
|
284
|
+
headers.update('x_mangopay_trace-id' => SecureRandom.uuid)
|
|
285
|
+
end
|
|
277
286
|
begin
|
|
278
287
|
headers.update('x_mangopay_client_user_agent' => JSON.dump(user_agent))
|
|
279
288
|
rescue => e
|
|
@@ -292,7 +301,12 @@ module MangoPay
|
|
|
292
301
|
def do_request_with_log(http, req, uri)
|
|
293
302
|
res, time = nil, nil
|
|
294
303
|
params = FilterParameters.request(req.body)
|
|
295
|
-
|
|
304
|
+
if configuration.log_trace_headers
|
|
305
|
+
trace_headers = JSON.dump({ 'Idempotency-Key' => req['Idempotency-Key'] , 'x_mangopay_trace-id' => req['x_mangopay_trace-id'] })
|
|
306
|
+
line = "[#{Time.now.iso8601}] #{req.method.upcase} \"#{uri.to_s}\" #{params} #{trace_headers}"
|
|
307
|
+
else
|
|
308
|
+
line = "[#{Time.now.iso8601}] #{req.method.upcase} \"#{uri.to_s}\" #{params}"
|
|
309
|
+
end
|
|
296
310
|
begin
|
|
297
311
|
time = Benchmark.realtime {
|
|
298
312
|
begin
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mangopay
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.25.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Geoffroy Lorieux
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2024-04-
|
|
12
|
+
date: 2024-04-17 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: multi_json
|