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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc240e7ae7a827cff6460162be1a9460f5e860676f3800a50d18ae3558f2976e
4
- data.tar.gz: 714503d3e3886b1d491d1ea579d72f1d74e2408d476b9ada5ee6446f0efbb467
3
+ metadata.gz: 55e9bca011c82596149caa2a4bbddbe3350aa239936c1687406172531d7ec62c
4
+ data.tar.gz: 25b16a878e1c1fb9a8f8d6e5cbe1df2171b69d7b41912e72bb45133a9cdfe8f0
5
5
  SHA512:
6
- metadata.gz: 7004c03b3ec4be44170bb4ea92c5ac2595ddd5d244a7e680a88e67d5bdc9eec0197ae7a7bd0970ac78d0912e42f04b9b44a65ee907e5333db479f569753853b2
7
- data.tar.gz: 139f426a07c7782b73ea52959283b70e068f8565d9c5e646790cd7f3373b51eed3f3e179d418a72ddf746012c13f4ea735a133c023b59da4c6d8d24aed38ab91
6
+ metadata.gz: 82a0a0178335a821c1113f775fffef25fb4f81eb8ae992f44308dd0f0d7d51fac92db23d56445e99c634dd17f86a959baeacd6237f91892358c4bf8511b9ae9d
7
+ data.tar.gz: 18da80bf6afefcb08394578f2a7e8c95220640c52b13bd2ff605648a90650d1376ba50f044b83f2a60089afbbaae3828ead52cadb0d42a6f013cc7ee3bddb036
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## V 0.6.3
4
+ - Fix error when the api response doesn't include error or message keys.
5
+ - Add right error message for forbidden error.
6
+
3
7
  ## V 0.6.2
4
8
  - Update Error classification mechanism to use error message as first option
5
9
 
@@ -7,7 +7,7 @@ class EasyMeli::ApiClient
7
7
 
8
8
  ERROR_LIST = {
9
9
  'Error validating grant' => EasyMeli::InvalidGrantError,
10
- 'forbidden' => EasyMeli::ForbiddenError,
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? Hash
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).include?(key) }&.last
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
@@ -1,3 +1,3 @@
1
1
  module EasyMeli
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_meli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Northam