easy_meli 0.6.6 → 0.6.7
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 +3 -0
- data/README.md +3 -3
- data/lib/easy_meli/api_client.rb +7 -2
- data/lib/easy_meli/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: b1338e416eb7581a2e568c8621f77789507d271bd0212936fa6c8d8ee7292025
|
4
|
+
data.tar.gz: fb5936ef060651fe095269d173dcda3a25ae97ae84d6bfc1386bec73d1d055d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bf7cddd43e511f2b55bed1f68c5905e0362821a7c825bb1a8f5ce7d6dd3dc4892e5dc9fb1d8499a42d17cc30a3a117194ace8cc734899a8cbeef7d58ac974ed
|
7
|
+
data.tar.gz: a56c55e73b131f1f36bef43a3db22f5c68c92cd611cc2f448a7e9486a2d302c5489669e8aa87f19755f7ceb3858c502ea11fca97922444321390606b2d31b55f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## V 0.6.7
|
4
|
+
- Send `access_token` in the Authorization Header instead of the query params [See Official Documentation](https://developers.mercadolibre.com.ar/es_ar/desarrollo-seguro#header)
|
5
|
+
|
3
6
|
## V 0.6.6
|
4
7
|
- Classify status code 401 as EasyMeli::InvalidTokenError.
|
5
8
|
|
data/README.md
CHANGED
@@ -63,7 +63,7 @@ You can also pass a logger to any methods that make remote calls. The logger cla
|
|
63
63
|
|
64
64
|
```ruby
|
65
65
|
EasyMeli.create_token('the_code_in_the_redirect', 'the_same_redirect_url_as_above', logger: my_logger)
|
66
|
-
EasyMeli.api_client(
|
66
|
+
EasyMeli.api_client(access_token: access_token, logger: my_logger)
|
67
67
|
```
|
68
68
|
|
69
69
|
### Example of how to retrieve a user profile
|
@@ -73,8 +73,8 @@ EasyMeli.configure do |config|
|
|
73
73
|
config.secret_key = "your_secret_key"
|
74
74
|
end
|
75
75
|
|
76
|
-
|
77
|
-
response =
|
76
|
+
client = EasyMeli.api_client(access_token: access_token)
|
77
|
+
response = client.get('/users/me')
|
78
78
|
|
79
79
|
```
|
80
80
|
|
data/lib/easy_meli/api_client.rb
CHANGED
@@ -6,7 +6,6 @@ class EasyMeli::ApiClient
|
|
6
6
|
API_ROOT_URL = 'https://api.mercadolibre.com'
|
7
7
|
|
8
8
|
base_uri API_ROOT_URL
|
9
|
-
headers EasyMeli::DEFAULT_HEADERS
|
10
9
|
format :json
|
11
10
|
|
12
11
|
attr_reader :logger, :access_token
|
@@ -36,7 +35,7 @@ class EasyMeli::ApiClient
|
|
36
35
|
|
37
36
|
def send_request(verb, path = '', params = {})
|
38
37
|
query = params[:query] || params['query'] || {}
|
39
|
-
|
38
|
+
params[:headers] = EasyMeli::DEFAULT_HEADERS.merge(authorization_header)
|
40
39
|
|
41
40
|
self.class.send(verb, path, params.merge(query)).tap do |response|
|
42
41
|
logger&.log response
|
@@ -62,4 +61,10 @@ class EasyMeli::ApiClient
|
|
62
61
|
raise exception.new(response)
|
63
62
|
end
|
64
63
|
end
|
64
|
+
|
65
|
+
def authorization_header
|
66
|
+
return {} unless access_token
|
67
|
+
|
68
|
+
{ Authorization: "Bearer #{access_token}" }
|
69
|
+
end
|
65
70
|
end
|
data/lib/easy_meli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_meli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Northam
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|