This repository has been archived by the owner on Feb 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b1ca59
commit 0111eb8
Showing
2 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# You need use this code in to the main folder | ||
# Load the gem | ||
require 'Meli' | ||
|
||
api_instance = Meli::OAuth20Api.new | ||
opts = { | ||
grant_type: 'authorization_code', # Or 'refresh_token' if you need get one new token | ||
client_id: 'client_id_example', # Your client_id | ||
client_secret: 'client_secret_example', # Your client_secret | ||
redirect_uri: 'redirect_uri_example', # Your redirect_uri | ||
code: 'code_example', # The parameter CODE who was received in the query. | ||
refresh_token: 'refresh_token_example' # Your refresh_token | ||
} | ||
|
||
begin | ||
#Request Access Token | ||
result = api_instance.get_token(opts) | ||
p result | ||
rescue Meli::ApiError => e | ||
puts "Exception when calling OAuth20Api->get_token: #{e}" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# You need use this code in to the main folder | ||
# Load the gem | ||
require 'Meli' | ||
|
||
api_instance = Meli::RestClientApi.new | ||
resource = 'items' # A resource example like items, search, category, etc. | ||
access_token = 'access_token_example' # Your access token. | ||
body = { | ||
"title": "Item de test from ruby - No Ofertar", | ||
"category_id": "MLA5991", | ||
"price": "350", | ||
"currency_id": "ARS", | ||
"available_quantity": "12", | ||
"buying_mode": "buy_it_now", | ||
"listing_type_id": "bronze", | ||
"condition": "new", | ||
"description": "Item de Teste. Mercado Livre SDK", | ||
"video_id": "RXWn6kftTHY", | ||
"pictures": [ | ||
{ | ||
"source": "https://http2.mlstatic.com/storage/developers-site-cms-admin/openapi/319968615067-mp3.jpg" | ||
} | ||
], | ||
"attributes": [ | ||
{ | ||
"id": "DATA_STORAGE_CAPACITY", | ||
"name": "Capacidad de almacenamiento de datos", | ||
"value_id": "null", | ||
"value_name": "8 GB", | ||
"value_struct": { | ||
"number": 8, | ||
"unit": "GB" | ||
}, | ||
"values": [ | ||
{ | ||
"id": "null", | ||
"name": "8 GB", | ||
"struct": { | ||
"number": 8, | ||
"unit": "GB" | ||
} | ||
} | ||
], | ||
"attribute_group_id": "OTHERS", | ||
"attribute_group_name": "Otros" | ||
} | ||
], | ||
"variations": [ | ||
{ | ||
"price": 350, | ||
"attribute_combinations": [ | ||
{ | ||
"name": "Color", | ||
"value_id": "283165", | ||
"value_name": "Gris" | ||
} | ||
], | ||
"available_quantity": 2, | ||
"sold_quantity": 0, | ||
"picture_ids": [ | ||
"882629-MLA40983876214_032020" | ||
] | ||
} | ||
] | ||
} | ||
|
||
begin | ||
#Resourse path POST | ||
result = api_instance.resource_post(resource, access_token, body) | ||
p result | ||
rescue Meli::ApiError => e | ||
puts "Exception when calling RestClientApi->resource_post: #{e}" | ||
end |