easy_meli 0.6.2 → 0.6.3
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 +4 -0
- data/lib/easy_meli/api_client.rb +3 -5
- data/lib/easy_meli/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55e9bca011c82596149caa2a4bbddbe3350aa239936c1687406172531d7ec62c
|
4
|
+
data.tar.gz: 25b16a878e1c1fb9a8f8d6e5cbe1df2171b69d7b41912e72bb45133a9cdfe8f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82a0a0178335a821c1113f775fffef25fb4f81eb8ae992f44308dd0f0d7d51fac92db23d56445e99c634dd17f86a959baeacd6237f91892358c4bf8511b9ae9d
|
7
|
+
data.tar.gz: 18da80bf6afefcb08394578f2a7e8c95220640c52b13bd2ff605648a90650d1376ba50f044b83f2a60089afbbaae3828ead52cadb0d42a6f013cc7ee3bddb036
|
data/CHANGELOG.md
CHANGED
data/lib/easy_meli/api_client.rb
CHANGED
@@ -7,7 +7,7 @@ class EasyMeli::ApiClient
|
|
7
7
|
|
8
8
|
ERROR_LIST = {
|
9
9
|
'Error validating grant' => EasyMeli::InvalidGrantError,
|
10
|
-
'
|
10
|
+
'The User ID must match the consultant\'s' => EasyMeli::ForbiddenError,
|
11
11
|
'invalid_token' => EasyMeli::InvalidTokenError,
|
12
12
|
'Malformed access_token' => EasyMeli::MalformedTokenError,
|
13
13
|
'too_many_requests' => EasyMeli::TooManyRequestsError
|
@@ -53,7 +53,7 @@ class EasyMeli::ApiClient
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def check_for_errors(response)
|
56
|
-
return unless response.parsed_response.is_a?
|
56
|
+
return unless response.parsed_response.is_a?(Hash) && !response.body.nil?
|
57
57
|
|
58
58
|
exception = error_class(response)
|
59
59
|
|
@@ -63,12 +63,10 @@ class EasyMeli::ApiClient
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def error_class(body)
|
66
|
-
ERROR_LIST.find { |key, _| error_message_from_body(body)
|
66
|
+
ERROR_LIST.find { |key, _| error_message_from_body(body)&.include?(key) }&.last
|
67
67
|
end
|
68
68
|
|
69
69
|
def error_message_from_body(response)
|
70
|
-
return if response.body.nil?
|
71
|
-
|
72
70
|
response['message'].to_s.empty? ? response['error'] : response['message']
|
73
71
|
end
|
74
72
|
end
|
data/lib/easy_meli/version.rb
CHANGED