fintecture 0.5.0 → 0.5.1
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/Gemfile.lock +1 -1
- data/lib/fintecture/exceptions.rb +11 -38
- data/lib/fintecture/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: b35fbfdb87c9ffc11f3faa4bf87130b1d926f1e5ee2d3db0e43e7a5138b12d8d
|
|
4
|
+
data.tar.gz: 1d6b107a7cf07ca35d69a726b48b0c732323fc4d8271d7c1fd872509d68a0eac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ea46a0531764adecf7005404f80989a96da42a8f9a4c26b4b5e62e691741151c997893b2f2cc6d57270f440b67d6924116ae207cf7247ef0d1dd98da83c88209
|
|
7
|
+
data.tar.gz: 46571be0cd4697af398b668cf7595a59d24590c66db364b0a1edda23cb9f4b2767be3ebb75c5b61b40bad988d23c252b9f46cb3d67373c241495f6b9ad24f146
|
data/Gemfile.lock
CHANGED
|
@@ -12,61 +12,34 @@ module Fintecture
|
|
|
12
12
|
def error(res)
|
|
13
13
|
body = JSON.parse res.body
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
if body['code'] && body['log_id'] && body['errors']
|
|
17
|
-
raise _construct_message_errors(res, body)
|
|
18
|
-
# Single error
|
|
19
|
-
else
|
|
20
|
-
raise _construct_message_error(res, body)
|
|
21
|
-
end
|
|
15
|
+
raise construct_message_errors(res.status, body)
|
|
22
16
|
end
|
|
23
17
|
|
|
24
18
|
private
|
|
25
19
|
|
|
26
|
-
def
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
errors_array = body['errors']
|
|
20
|
+
def construct_message_errors(status, body)
|
|
21
|
+
code = body['code'].presence
|
|
22
|
+
log_id = body['log_id'].presence
|
|
23
|
+
errors_array = body['errors'].presence || body['meta'].presence || []
|
|
31
24
|
|
|
32
25
|
error_string = "\nFintecture server errors : "
|
|
33
|
-
error_string += "\n status: #{status} "
|
|
34
|
-
error_string += "\n code: #{code}"
|
|
35
|
-
error_string += "\n id : #{log_id}"
|
|
26
|
+
error_string += "\n status: #{status} " if status
|
|
27
|
+
error_string += "\n code: #{code}" if code
|
|
28
|
+
error_string += "\n id : #{log_id}" if log_id
|
|
36
29
|
|
|
37
|
-
errors_array.compact
|
|
30
|
+
errors_array.compact!
|
|
31
|
+
errors_array.each do |error|
|
|
38
32
|
formated_error = error
|
|
39
33
|
formated_error = error.map { |key, value| " #{key}: #{value}" }.join("\n") if error.is_a?(Hash)
|
|
40
34
|
error_string += "\n\n#{formated_error}"
|
|
41
35
|
end
|
|
42
|
-
error_string += "\n\n"
|
|
43
|
-
|
|
44
|
-
{
|
|
45
|
-
type: 'Fintecture api',
|
|
46
|
-
status: status,
|
|
47
|
-
errors: errors_array,
|
|
48
|
-
error_string: error_string
|
|
49
|
-
}.to_json
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def _construct_message_error(res, body)
|
|
53
|
-
status = res.status
|
|
54
|
-
error = body['meta']
|
|
55
|
-
|
|
56
|
-
error_string = "\nFintecture server errors : "
|
|
57
|
-
error_string += "\n status: #{status} "
|
|
58
|
-
|
|
59
|
-
formated_error = error
|
|
60
|
-
formated_error = error.map { |key, value| " #{key}: #{value}" }.join("\n") if error.is_a?(Hash)
|
|
61
|
-
|
|
62
|
-
error_string += "\n\n#{formated_error}"
|
|
63
36
|
|
|
64
37
|
error_string += "\n\n"
|
|
65
38
|
|
|
66
39
|
{
|
|
67
40
|
type: 'Fintecture api',
|
|
68
41
|
status: status,
|
|
69
|
-
errors:
|
|
42
|
+
errors: errors_array,
|
|
70
43
|
error_string: error_string
|
|
71
44
|
}.to_json
|
|
72
45
|
end
|
data/lib/fintecture/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fintecture
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Fintecture
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-06-
|
|
11
|
+
date: 2022-06-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|