diff --git a/.gitignore b/.gitignore
index 0cb6eeb..33c0f8a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,56 @@
-/.bundle/
-/.yardoc
-/Gemfile.lock
-/_yardoc/
+*.gem
+*.rbc
+/.config
/coverage/
-/doc/
+/InstalledFiles
/pkg/
/spec/reports/
+/spec/examples.txt
+/test/tmp/
+/test/version_tmp/
/tmp/
+
+# Used by dotenv library to load environment variables.
+# .env
+
+# Ignore Byebug command history file.
+.byebug_history
+
+## Specific to RubyMotion:
+.dat*
+.repl_history
+build/
+*.bridgesupport
+build-iPhoneOS/
+build-iPhoneSimulator/
+
+## Specific to RubyMotion (use of CocoaPods):
+#
+# We recommend against adding the Pods directory to your .gitignore. However
+# you should judge for yourself, the pros and cons are mentioned at:
+# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
+#
+# vendor/Pods/
+
+## Documentation cache and generated files:
+/.yardoc/
+/_yardoc/
+/doc/
+/rdoc/
+
+## Environment normalization:
+/.bundle/
+/vendor/bundle
+/lib/bundler/man/
+
+# for a library or gem, you might want to ignore these files since the code is
+# intended to run in multiple environments; otherwise, check them in:
+# Gemfile.lock
+# .ruby-version
+# .ruby-gemset
+
+# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
+.rvmrc
+
+# Used by RuboCop. Remote config files pulled in from inherit_from directive.
+# .rubocop-https?--*
\ No newline at end of file
diff --git a/.rspec b/.rspec
new file mode 100644
index 0000000..83e16f8
--- /dev/null
+++ b/.rspec
@@ -0,0 +1,2 @@
+--color
+--require spec_helper
diff --git a/.rubocop.yml b/.rubocop.yml
new file mode 100644
index 0000000..df46058
--- /dev/null
+++ b/.rubocop.yml
@@ -0,0 +1,148 @@
+# This file is based on https://github.com/rails/rails/blob/master/.rubocop.yml (MIT license)
+# Automatically generated by OpenAPI Generator (https://openapi-generator.tech)
+AllCops:
+ TargetRubyVersion: 2.4
+ # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
+ # to ignore them, so only the ones explicitly set in this file are enabled.
+ DisabledByDefault: true
+ Exclude:
+ - '**/templates/**/*'
+ - '**/vendor/**/*'
+ - 'actionpack/lib/action_dispatch/journey/parser.rb'
+
+# Prefer &&/|| over and/or.
+Style/AndOr:
+ Enabled: true
+
+# Align `when` with `case`.
+Layout/CaseIndentation:
+ Enabled: true
+
+# Align comments with method definitions.
+Layout/CommentIndentation:
+ Enabled: true
+
+Layout/ElseAlignment:
+ Enabled: true
+
+Layout/EmptyLineAfterMagicComment:
+ Enabled: true
+
+# In a regular class definition, no empty lines around the body.
+Layout/EmptyLinesAroundClassBody:
+ Enabled: true
+
+# In a regular method definition, no empty lines around the body.
+Layout/EmptyLinesAroundMethodBody:
+ Enabled: true
+
+# In a regular module definition, no empty lines around the body.
+Layout/EmptyLinesAroundModuleBody:
+ Enabled: true
+
+Layout/FirstArgumentIndentation:
+ Enabled: true
+
+# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
+Style/HashSyntax:
+ Enabled: false
+
+# Method definitions after `private` or `protected` isolated calls need one
+# extra level of indentation.
+Layout/IndentationConsistency:
+ Enabled: true
+ EnforcedStyle: indented_internal_methods
+
+# Two spaces, no tabs (for indentation).
+Layout/IndentationWidth:
+ Enabled: true
+
+Layout/LeadingCommentSpace:
+ Enabled: true
+
+Layout/SpaceAfterColon:
+ Enabled: true
+
+Layout/SpaceAfterComma:
+ Enabled: true
+
+Layout/SpaceAroundEqualsInParameterDefault:
+ Enabled: true
+
+Layout/SpaceAroundKeyword:
+ Enabled: true
+
+Layout/SpaceAroundOperators:
+ Enabled: true
+
+Layout/SpaceBeforeComma:
+ Enabled: true
+
+Layout/SpaceBeforeFirstArg:
+ Enabled: true
+
+Style/DefWithParentheses:
+ Enabled: true
+
+# Defining a method with parameters needs parentheses.
+Style/MethodDefParentheses:
+ Enabled: true
+
+Style/FrozenStringLiteralComment:
+ Enabled: false
+ EnforcedStyle: always
+
+# Use `foo {}` not `foo{}`.
+Layout/SpaceBeforeBlockBraces:
+ Enabled: true
+
+# Use `foo { bar }` not `foo {bar}`.
+Layout/SpaceInsideBlockBraces:
+ Enabled: true
+
+# Use `{ a: 1 }` not `{a:1}`.
+Layout/SpaceInsideHashLiteralBraces:
+ Enabled: true
+
+Layout/SpaceInsideParens:
+ Enabled: true
+
+# Check quotes usage according to lint rule below.
+#Style/StringLiterals:
+# Enabled: true
+# EnforcedStyle: single_quotes
+
+# Detect hard tabs, no hard tabs.
+Layout/Tab:
+ Enabled: true
+
+# Blank lines should not have any spaces.
+Layout/TrailingEmptyLines:
+ Enabled: true
+
+# No trailing whitespace.
+Layout/TrailingWhitespace:
+ Enabled: false
+
+# Use quotes for string literals when they are enough.
+Style/RedundantPercentQ:
+ Enabled: true
+
+# Align `end` with the matching keyword or starting expression except for
+# assignments, where it should be aligned with the LHS.
+Layout/EndAlignment:
+ Enabled: true
+ EnforcedStyleAlignWith: variable
+ AutoCorrect: true
+
+# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
+Lint/RequireParentheses:
+ Enabled: true
+
+Style/RedundantReturn:
+ Enabled: true
+ AllowMultipleReturnValues: true
+
+Style/Semicolon:
+ Enabled: true
+ AllowAsExpressionSeparator: true
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..0fde555
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,11 @@
+language: ruby
+cache: bundler
+rvm:
+ - 2.3
+ - 2.4
+ - 2.5
+script:
+ - bundle install --path vendor/bundle
+ - bundle exec rspec
+ - gem build Meli.gemspec
+ - gem install ./Meli-3.0.0.gem
diff --git a/Gemfile b/Gemfile
index b3b7acb..c2e3127 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,4 +1,9 @@
source 'https://rubygems.org'
-# Specify your gem's dependencies in meliz.gemspec
gemspec
+
+group :development, :test do
+ gem 'rake', '~> 13.0.1'
+ gem 'pry-byebug'
+ gem 'rubocop', '~> 0.66.0'
+end
diff --git a/README.md b/README.md
old mode 100755
new mode 100644
index fa1be19..2c5ac69
--- a/README.md
+++ b/README.md
@@ -1,133 +1,137 @@
-# MercadoLibre's Ruby SDK
-This is the official Ruby SDK for MercadoLibre's Platform.
+
+
+
+
+
+ MercadoLibre's Ruby SDK
+
+
-## How do I install it?
+This is the official Ruby SDK for MercadoLibre's Platform.
- clone repository
- https://github.com/mercadolibre/ruby-sdk.git
+## Installation
-## Using Bundler
+### Build a gem
-Add it to your Gemfile:
+To build the Ruby code into a gem:
- gem 'meli', '~> 1.0.2'
-
-And then install
-
- bundle install
-
-## How do I use it?
-
-The first thing to do is to instance a ```Meli``` class. You'll need to give a ```clientId``` and a ```clientSecret```. You can obtain both after creating your own application. For more information on this please read: [creating an application](http://developers.mercadolibre.com/application-manager/)
-
-### Including the Lib
-Include the lib meli in your project
-
-### Attention
-Don't forget to set the authentication URL of your country in file lib/config.yml
-
-```ruby
-require 'lib/meli'
+```shell
+gem build meli.gemspec
```
-Start the development!
-### Create an instance of Meli class
-Simple like this
-```ruby
-meli = Meli.new(1234, "a secret")
-```
-With this instance you can start working on MercadoLibre's APIs.
-
-There are some design considerations worth to mention.
-
-1. This SDK is just a thin layer on top of an http client to handle all the OAuth WebServer flow for you.
+Then either install the gem locally:
-2. There is JSON parsing. this SDK will include [json](http://rubygems.org/gems/json) gem for internal usage.
-
-3. If you already have the access_token and the refresh_token you can pass in the constructor
-
-```ruby
-meli = Meli.new(1234, "a secret", "Access_Token", "Refresh_Token")
+```shell
+gem install ./meli-3.0.0.gem
```
-## How do I redirect users to authorize my application?
+(for development, run `gem install --dev ./meli-3.0.0.gem` to install the development dependencies)
-This is a 2 step process.
+or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
-First get the link to redirect the user. This is very easy! Just:
+Finally add this to the Gemfile:
-```ruby
-redirectUrl = meli.auth_url("http://somecallbackurl")
-```
-
-This will give you the url to redirect the user. You need to specify a callback url which will be the one that the user will redirected after a successfull authrization process.
+ gem 'meli', '~> 3.0.0'
-Once the user is redirected to your callback url, you'll receive in the query string, a parameter named ```code```. You'll need this for the second part of the process.
+### Install from Git
-```ruby
-meli.authorize("the received code", "http://somecallbackurl")
-```
+If the Ruby gem is hosted at a git repository: [https://github.com/mercadolibre/ruby-sdk](https://github.com/mercadolibre/ruby-sdk), then add the following in the Gemfile:
-This will get an ```access_token``` and a ```refresh_token``` (is case your application has the ```offline_access```) for your application and your user.
+ gem 'meli', :git => 'https://github.com/mercadolibre/ruby-sdk.git'
-At this stage your are ready to make call to the API on behalf of the user.
+### Include the Ruby code directly
-#### Making GET calls
+Include the Ruby code directly using `-I` as follows:
-```ruby
-params = {:access_token => meli.access_token}
-response = meli.get("/users/me", params)
+```shell
+ruby -Ilib script.rb
```
-The response body will not be converted from json to Ruby hash
-
-Look this simple way to resolve this:
-
+## Usage
```ruby
- #convert json into a ruby hash
-resp_hash = JSON.parse response.body
-puts resp_hahs["KEY"]
+# Auth URLs Options by country
+
+# 1: "https://auth.mercadolibre.com.ar"
+# 2: "https://auth.mercadolivre.com.br"
+# 3: "https://auth.mercadolibre.com.co"
+# 4: "https://auth.mercadolibre.com.mx"
+# 5: "https://auth.mercadolibre.com.uy"
+# 6: "https://auth.mercadolibre.cl"
+# 7: "https://auth.mercadolibre.com.cr"
+# 8: "https://auth.mercadolibre.com.ec"
+# 9: "https://auth.mercadolibre.com.ve"
+# 10: "https://auth.mercadolibre.com.pa"
+# 11: "https://auth.mercadolibre.com.pe"
+# 12: "https://auth.mercadolibre.com.do"
+# 13: "https://auth.mercadolibre.com.bo"
+# 14: "https://auth.mercadolibre.com.py"
+
+# For example in your app
+client_id = "Your client_id"
+redirect_uri = "Your redirect uri"
+puts ''+ Authenticate + ''
```
+his will give you the url to redirect the user. You need to specify a callback url which will be the one that the user will redirected after a successfull authrization process.
-#### Making POST calls
+Once the user is redirected to your callback url, you'll receive in the query string, a parameter named code. You'll need this for the second part of the process
-```ruby
-params = {:access_token => meli.access_token}
-
- #we are cool, the sdk will convert this body into json for you
-body = {:foo => "bar", :bar => "foo"}
-
-response = meli.post("/items", body, params)
-```
-
-#### Making PUT calls
+## Examples for OAuth - get token
```ruby
-params = {:access_token => meli.access_token}
-
- #we are cool, the sdk will convert this body into json for you
-body = {:foo => "bar", :bar => "foo"}
-
-response = meli.put("/items/123", body, params)
+# load the gem
+require 'Meli'
+
+api_instance = Meli::OAuth20Api.new
+opts = {
+ grant_type: 'authorization_code', # String |
+ client_id: 'client_id_example', # String |
+ client_secret: 'client_secret_example', # String |
+ redirect_uri: 'redirect_uri_example', # String |
+ code: 'code_example', # String |
+ refresh_token: 'refresh_token_example' # String |
+}
+
+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
```
-#### Making DELETE calls
+
+## Example using the RestClient with a POST Item
```ruby
-params = {:access_token => meli.access_token}
-response = meli.delete("/questions/123", params)
+# load the gem
+require 'Meli'
+
+api_instance = Meli::RestClientApi.new
+resource = 'resource_example' # String |
+access_token = 'access_token_example' # String |
+body = nil # Object |
+
+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
```
-## Examples
-Don't forget to check out our examples codes in the folder [examples](https://github.com/mercadolibre/ruby-sdk/tree/master/examples)
+## Documentation & Important notes
-## Community
+##### The URIs are relative to https://api.mercadolibre.com
-You can contact us if you have questions using the standard communication channels described in the [developer's site](http://developers.mercadolibre.com/community/)
+##### The Authorization URLs:
+###### Remember set your correct country ID
+###### https://auth.mercadolibre.{country_domain}
-## I want to contribute!
+##### All docs for the library are located [here](https://github.com/mercadolibre/ruby-sdk/tree/master/docs)
-That is great! Just fork the project in github. Create a topic branch, write some code, and add some tests for your new code.
+##### Check out our examples codes in the folder [examples](https://github.com/mercadolibre/ruby-sdk/tree/master/examples)
-Thanks for helping!
+##### Don’t forget to check out our [developer site](https://developers.mercadolibre.com/)
diff --git a/Rakefile b/Rakefile
index 809eb56..c72ca30 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,2 +1,10 @@
require "bundler/gem_tasks"
+begin
+ require 'rspec/core/rake_task'
+
+ RSpec::Core::RakeTask.new(:spec)
+ task default: :spec
+rescue LoadError
+ # no rspec available
+end
diff --git a/docs/Attributes.md b/docs/Attributes.md
new file mode 100644
index 0000000..5123d21
--- /dev/null
+++ b/docs/Attributes.md
@@ -0,0 +1,31 @@
+# Meli::Attributes
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **String** | | [optional]
+**name** | **String** | | [optional]
+**value_id** | **String** | | [optional]
+**value_name** | **String** | | [optional]
+**value_struct** | [**AttributesValueStruct**](AttributesValueStruct.md) | | [optional]
+**values** | [**Array<AttributesValues>**](AttributesValues.md) | | [optional]
+**attribute_group_id** | **String** | | [optional]
+**attribute_group_name** | **String** | | [optional]
+
+## Code Sample
+
+```ruby
+require 'Meli'
+
+instance = Meli::Attributes.new(id: DATA_STORAGE_CAPACITY,
+ name: Capacidad de almacenamiento de datos,
+ value_id: null,
+ value_name: 8 GB,
+ value_struct: null,
+ values: null,
+ attribute_group_id: OTHERS,
+ attribute_group_name: Otros)
+```
+
+
diff --git a/docs/AttributesValueStruct.md b/docs/AttributesValueStruct.md
new file mode 100644
index 0000000..70baef2
--- /dev/null
+++ b/docs/AttributesValueStruct.md
@@ -0,0 +1,19 @@
+# Meli::AttributesValueStruct
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**number** | **Float** | | [optional]
+**unit** | **String** | | [optional]
+
+## Code Sample
+
+```ruby
+require 'Meli'
+
+instance = Meli::AttributesValueStruct.new(number: 8,
+ unit: GB)
+```
+
+
diff --git a/docs/AttributesValues.md b/docs/AttributesValues.md
new file mode 100644
index 0000000..b341249
--- /dev/null
+++ b/docs/AttributesValues.md
@@ -0,0 +1,21 @@
+# Meli::AttributesValues
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **String** | | [optional]
+**name** | **String** | | [optional]
+**struct** | [**AttributesValueStruct**](AttributesValueStruct.md) | | [optional]
+
+## Code Sample
+
+```ruby
+require 'Meli'
+
+instance = Meli::AttributesValues.new(id: null,
+ name: 8 GB,
+ struct: null)
+```
+
+
diff --git a/docs/CategoriesApi.md b/docs/CategoriesApi.md
new file mode 100644
index 0000000..66379ca
--- /dev/null
+++ b/docs/CategoriesApi.md
@@ -0,0 +1,150 @@
+# Meli::CategoriesApi
+
+All URIs are relative to *https://api.mercadolibre.com*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**categories_category_id_get**](CategoriesApi.md#categories_category_id_get) | **GET** /categories/{category_id} | Return by category.
+[**sites_site_id_categories_get**](CategoriesApi.md#sites_site_id_categories_get) | **GET** /sites/{site_id}/categories | Return a categories by site.
+[**sites_site_id_domain_discovery_search_get**](CategoriesApi.md#sites_site_id_domain_discovery_search_get) | **GET** /sites/{site_id}/domain_discovery/search | Predictor
+
+
+
+## categories_category_id_get
+
+> Object categories_category_id_get(category_id)
+
+Return by category.
+
+### Example
+
+```ruby
+# load the gem
+require 'Meli'
+
+api_instance = Meli::CategoriesApi.new
+category_id = 'category_id_example' # String |
+
+begin
+ #Return by category.
+ result = api_instance.categories_category_id_get(category_id)
+ p result
+rescue Meli::ApiError => e
+ puts "Exception when calling CategoriesApi->categories_category_id_get: #{e}"
+end
+```
+
+### Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **category_id** | **String**| |
+
+### Return type
+
+**Object**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/json
+
+
+## sites_site_id_categories_get
+
+> Object sites_site_id_categories_get(site_id)
+
+Return a categories by site.
+
+### Example
+
+```ruby
+# load the gem
+require 'Meli'
+
+api_instance = Meli::CategoriesApi.new
+site_id = 'site_id_example' # String |
+
+begin
+ #Return a categories by site.
+ result = api_instance.sites_site_id_categories_get(site_id)
+ p result
+rescue Meli::ApiError => e
+ puts "Exception when calling CategoriesApi->sites_site_id_categories_get: #{e}"
+end
+```
+
+### Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **site_id** | **String**| |
+
+### Return type
+
+**Object**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/json
+
+
+## sites_site_id_domain_discovery_search_get
+
+> Object sites_site_id_domain_discovery_search_get(site_id, q, limit)
+
+Predictor
+
+### Example
+
+```ruby
+# load the gem
+require 'Meli'
+
+api_instance = Meli::CategoriesApi.new
+site_id = 'site_id_example' # String |
+q = 'q_example' # String |
+limit = 'limit_example' # String |
+
+begin
+ #Predictor
+ result = api_instance.sites_site_id_domain_discovery_search_get(site_id, q, limit)
+ p result
+rescue Meli::ApiError => e
+ puts "Exception when calling CategoriesApi->sites_site_id_domain_discovery_search_get: #{e}"
+end
+```
+
+### Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **site_id** | **String**| |
+ **q** | **String**| |
+ **limit** | **String**| |
+
+### Return type
+
+**Object**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/json
+
diff --git a/docs/InlineObject.md b/docs/InlineObject.md
new file mode 100644
index 0000000..6ec3d16
--- /dev/null
+++ b/docs/InlineObject.md
@@ -0,0 +1,27 @@
+# Meli::InlineObject
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**grant_type** | **String** | | [optional]
+**client_id** | **String** | | [optional]
+**client_secret** | **String** | | [optional]
+**redirect_uri** | **String** | | [optional]
+**code** | **String** | | [optional]
+**refresh_token** | **String** | | [optional]
+
+## Code Sample
+
+```ruby
+require 'Meli'
+
+instance = Meli::InlineObject.new(grant_type: authorization_code,
+ client_id: null,
+ client_secret: null,
+ redirect_uri: null,
+ code: null,
+ refresh_token: null)
+```
+
+
diff --git a/docs/Item.md b/docs/Item.md
new file mode 100644
index 0000000..4c3d486
--- /dev/null
+++ b/docs/Item.md
@@ -0,0 +1,41 @@
+# Meli::Item
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**title** | **String** | |
+**category_id** | **String** | |
+**price** | **Integer** | |
+**currency_id** | **String** | |
+**available_quantity** | **String** | |
+**buying_mode** | **String** | |
+**listing_type_id** | **String** | |
+**condition** | **String** | |
+**description** | **String** | |
+**video_id** | **String** | |
+**pictures** | [**Array<ItemPictures>**](ItemPictures.md) | |
+**attributes** | [**Array<Attributes>**](Attributes.md) | | [optional]
+**variations** | [**Array<Variations>**](Variations.md) | | [optional]
+
+## Code Sample
+
+```ruby
+require 'Meli'
+
+instance = Meli::Item.new(title: Item de test - 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: null,
+ attributes: null,
+ variations: null)
+```
+
+
diff --git a/docs/ItemPictures.md b/docs/ItemPictures.md
new file mode 100644
index 0000000..b73fd77
--- /dev/null
+++ b/docs/ItemPictures.md
@@ -0,0 +1,17 @@
+# Meli::ItemPictures
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**source** | **String** | | [optional]
+
+## Code Sample
+
+```ruby
+require 'Meli'
+
+instance = Meli::ItemPictures.new(source: https://http2.mlstatic.com/storage/developers-site-cms-admin/openapi/319968615067-mp3.jpg)
+```
+
+
diff --git a/docs/ItemsApi.md b/docs/ItemsApi.md
new file mode 100644
index 0000000..d6775bc
--- /dev/null
+++ b/docs/ItemsApi.md
@@ -0,0 +1,152 @@
+# Meli::ItemsApi
+
+All URIs are relative to *https://api.mercadolibre.com*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**items_id_get**](ItemsApi.md#items_id_get) | **GET** /items/{id} | Return a Item.
+[**items_id_put**](ItemsApi.md#items_id_put) | **PUT** /items/{id} | Update a Item.
+[**items_post**](ItemsApi.md#items_post) | **POST** /items | Create a Item.
+
+
+
+## items_id_get
+
+> Object items_id_get(id)
+
+Return a Item.
+
+### Example
+
+```ruby
+# load the gem
+require 'Meli'
+
+api_instance = Meli::ItemsApi.new
+id = 'id_example' # String |
+
+begin
+ #Return a Item.
+ result = api_instance.items_id_get(id)
+ p result
+rescue Meli::ApiError => e
+ puts "Exception when calling ItemsApi->items_id_get: #{e}"
+end
+```
+
+### Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **id** | **String**| |
+
+### Return type
+
+**Object**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/json
+
+
+## items_id_put
+
+> Object items_id_put(id, access_token, item)
+
+Update a Item.
+
+### Example
+
+```ruby
+# load the gem
+require 'Meli'
+
+api_instance = Meli::ItemsApi.new
+id = 'id_example' # String |
+access_token = 'access_token_example' # String |
+item = Meli::Item.new # Item |
+
+begin
+ #Update a Item.
+ result = api_instance.items_id_put(id, access_token, item)
+ p result
+rescue Meli::ApiError => e
+ puts "Exception when calling ItemsApi->items_id_put: #{e}"
+end
+```
+
+### Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **id** | **String**| |
+ **access_token** | **String**| |
+ **item** | [**Item**](Item.md)| |
+
+### Return type
+
+**Object**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: application/json
+- **Accept**: application/json
+
+
+## items_post
+
+> Object items_post(access_token, item)
+
+Create a Item.
+
+### Example
+
+```ruby
+# load the gem
+require 'Meli'
+
+api_instance = Meli::ItemsApi.new
+access_token = 'access_token_example' # String |
+item = Meli::Item.new # Item |
+
+begin
+ #Create a Item.
+ result = api_instance.items_post(access_token, item)
+ p result
+rescue Meli::ApiError => e
+ puts "Exception when calling ItemsApi->items_post: #{e}"
+end
+```
+
+### Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **access_token** | **String**| |
+ **item** | [**Item**](Item.md)| |
+
+### Return type
+
+**Object**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: application/json
+- **Accept**: application/json
+
diff --git a/docs/ItemsHealthApi.md b/docs/ItemsHealthApi.md
new file mode 100644
index 0000000..249d78c
--- /dev/null
+++ b/docs/ItemsHealthApi.md
@@ -0,0 +1,150 @@
+# Meli::ItemsHealthApi
+
+All URIs are relative to *https://api.mercadolibre.com*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**items_id_health_actions_get**](ItemsHealthApi.md#items_id_health_actions_get) | **GET** /items/{id}/health/actions | Return item health actions by id.
+[**items_id_health_get**](ItemsHealthApi.md#items_id_health_get) | **GET** /items/{id}/health | Return health by id.
+[**sites_site_id_health_levels_get**](ItemsHealthApi.md#sites_site_id_health_levels_get) | **GET** /sites/{site_id}/health_levels | Return health levels.
+
+
+
+## items_id_health_actions_get
+
+> Object items_id_health_actions_get(id, access_token)
+
+Return item health actions by id.
+
+### Example
+
+```ruby
+# load the gem
+require 'Meli'
+
+api_instance = Meli::ItemsHealthApi.new
+id = 'id_example' # String |
+access_token = 'access_token_example' # String |
+
+begin
+ #Return item health actions by id.
+ result = api_instance.items_id_health_actions_get(id, access_token)
+ p result
+rescue Meli::ApiError => e
+ puts "Exception when calling ItemsHealthApi->items_id_health_actions_get: #{e}"
+end
+```
+
+### Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **id** | **String**| |
+ **access_token** | **String**| |
+
+### Return type
+
+**Object**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/json
+
+
+## items_id_health_get
+
+> Object items_id_health_get(id, access_token)
+
+Return health by id.
+
+### Example
+
+```ruby
+# load the gem
+require 'Meli'
+
+api_instance = Meli::ItemsHealthApi.new
+id = 'id_example' # String |
+access_token = 'access_token_example' # String |
+
+begin
+ #Return health by id.
+ result = api_instance.items_id_health_get(id, access_token)
+ p result
+rescue Meli::ApiError => e
+ puts "Exception when calling ItemsHealthApi->items_id_health_get: #{e}"
+end
+```
+
+### Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **id** | **String**| |
+ **access_token** | **String**| |
+
+### Return type
+
+**Object**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/json
+
+
+## sites_site_id_health_levels_get
+
+> Object sites_site_id_health_levels_get(site_id)
+
+Return health levels.
+
+### Example
+
+```ruby
+# load the gem
+require 'Meli'
+
+api_instance = Meli::ItemsHealthApi.new
+site_id = 'site_id_example' # String |
+
+begin
+ #Return health levels.
+ result = api_instance.sites_site_id_health_levels_get(site_id)
+ p result
+rescue Meli::ApiError => e
+ puts "Exception when calling ItemsHealthApi->sites_site_id_health_levels_get: #{e}"
+end
+```
+
+### Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **site_id** | **String**| |
+
+### Return type
+
+**Object**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/json
+
diff --git a/docs/OAuth20Api.md b/docs/OAuth20Api.md
new file mode 100644
index 0000000..464ea19
--- /dev/null
+++ b/docs/OAuth20Api.md
@@ -0,0 +1,117 @@
+# Meli::OAuth20Api
+
+All URIs are relative to *https://api.mercadolibre.com*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**auth**](OAuth20Api.md#auth) | **GET** /authorization | Authentication Endpoint
+[**get_token**](OAuth20Api.md#get_token) | **POST** /oauth/token | Request Access Token
+
+
+
+## auth
+
+> auth(response_type, client_id, redirect_uri)
+
+Authentication Endpoint
+
+### Example
+
+```ruby
+# load the gem
+require 'Meli'
+
+api_instance = Meli::OAuth20Api.new
+response_type = 'code' # String |
+client_id = 'client_id_example' # String |
+redirect_uri = 'redirect_uri_example' # String |
+
+begin
+ #Authentication Endpoint
+ api_instance.auth(response_type, client_id, redirect_uri)
+rescue Meli::ApiError => e
+ puts "Exception when calling OAuth20Api->auth: #{e}"
+end
+```
+
+### Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **response_type** | **String**| | [default to 'code']
+ **client_id** | **String**| |
+ **redirect_uri** | **String**| |
+
+### Return type
+
+nil (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/json
+
+
+## get_token
+
+> Object get_token(opts)
+
+Request Access Token
+
+Partner makes a request to the token endpoint by adding the following parameters described below
+
+### Example
+
+```ruby
+# load the gem
+require 'Meli'
+
+api_instance = Meli::OAuth20Api.new
+opts = {
+ grant_type: 'grant_type_example', # String |
+ client_id: 'client_id_example', # String |
+ client_secret: 'client_secret_example', # String |
+ redirect_uri: 'redirect_uri_example', # String |
+ code: 'code_example', # String |
+ refresh_token: 'refresh_token_example' # String |
+}
+
+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
+```
+
+### Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **grant_type** | **String**| | [optional]
+ **client_id** | **String**| | [optional]
+ **client_secret** | **String**| | [optional]
+ **redirect_uri** | **String**| | [optional]
+ **code** | **String**| | [optional]
+ **refresh_token** | **String**| | [optional]
+
+### Return type
+
+**Object**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: application/x-www-form-urlencoded
+- **Accept**: application/json
+
diff --git a/docs/RestClientApi.md b/docs/RestClientApi.md
new file mode 100644
index 0000000..763c449
--- /dev/null
+++ b/docs/RestClientApi.md
@@ -0,0 +1,204 @@
+# Meli::RestClientApi
+
+All URIs are relative to *https://api.mercadolibre.com*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**resource_delete**](RestClientApi.md#resource_delete) | **DELETE** /{resource} | Resource path DELETE
+[**resource_get**](RestClientApi.md#resource_get) | **GET** /{resource} | Resource path GET
+[**resource_post**](RestClientApi.md#resource_post) | **POST** /{resource} | Resourse path POST
+[**resource_put**](RestClientApi.md#resource_put) | **PUT** /{resource} | Resourse path PUT
+
+
+
+## resource_delete
+
+> Object resource_delete(resource, access_token)
+
+Resource path DELETE
+
+### Example
+
+```ruby
+# load the gem
+require 'Meli'
+
+api_instance = Meli::RestClientApi.new
+resource = 'resource_example' # String |
+access_token = 'access_token_example' # String |
+
+begin
+ #Resource path DELETE
+ result = api_instance.resource_delete(resource, access_token)
+ p result
+rescue Meli::ApiError => e
+ puts "Exception when calling RestClientApi->resource_delete: #{e}"
+end
+```
+
+### Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **resource** | **String**| |
+ **access_token** | **String**| |
+
+### Return type
+
+**Object**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/json
+
+
+## resource_get
+
+> Object resource_get(resource, access_token)
+
+Resource path GET
+
+### Example
+
+```ruby
+# load the gem
+require 'Meli'
+
+api_instance = Meli::RestClientApi.new
+resource = 'resource_example' # String |
+access_token = 'access_token_example' # String |
+
+begin
+ #Resource path GET
+ result = api_instance.resource_get(resource, access_token)
+ p result
+rescue Meli::ApiError => e
+ puts "Exception when calling RestClientApi->resource_get: #{e}"
+end
+```
+
+### Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **resource** | **String**| |
+ **access_token** | **String**| |
+
+### Return type
+
+**Object**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/json
+
+
+## resource_post
+
+> Object resource_post(resource, access_token, body)
+
+Resourse path POST
+
+### Example
+
+```ruby
+# load the gem
+require 'Meli'
+
+api_instance = Meli::RestClientApi.new
+resource = 'resource_example' # String |
+access_token = 'access_token_example' # String |
+body = nil # Object |
+
+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
+```
+
+### Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **resource** | **String**| |
+ **access_token** | **String**| |
+ **body** | **Object**| |
+
+### Return type
+
+**Object**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: application/json
+- **Accept**: application/json
+
+
+## resource_put
+
+> Object resource_put(resource, access_token, body)
+
+Resourse path PUT
+
+### Example
+
+```ruby
+# load the gem
+require 'Meli'
+
+api_instance = Meli::RestClientApi.new
+resource = 'resource_example' # String |
+access_token = 'access_token_example' # String |
+body = nil # Object |
+
+begin
+ #Resourse path PUT
+ result = api_instance.resource_put(resource, access_token, body)
+ p result
+rescue Meli::ApiError => e
+ puts "Exception when calling RestClientApi->resource_put: #{e}"
+end
+```
+
+### Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **resource** | **String**| |
+ **access_token** | **String**| |
+ **body** | **Object**| |
+
+### Return type
+
+**Object**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: application/json
+- **Accept**: application/json
+
diff --git a/docs/Variations.md b/docs/Variations.md
new file mode 100644
index 0000000..5a1a9ef
--- /dev/null
+++ b/docs/Variations.md
@@ -0,0 +1,25 @@
+# Meli::Variations
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**price** | **Integer** | | [optional]
+**attribute_combinations** | [**Array<VariationsAttributeCombinations>**](VariationsAttributeCombinations.md) | | [optional]
+**available_quantity** | **Integer** | | [optional]
+**sold_quantity** | **Integer** | | [optional]
+**picture_ids** | **Array<String>** | | [optional]
+
+## Code Sample
+
+```ruby
+require 'Meli'
+
+instance = Meli::Variations.new(price: 350,
+ attribute_combinations: null,
+ available_quantity: 2,
+ sold_quantity: 0,
+ picture_ids: null)
+```
+
+
diff --git a/docs/VariationsAttributeCombinations.md b/docs/VariationsAttributeCombinations.md
new file mode 100644
index 0000000..3cb99cc
--- /dev/null
+++ b/docs/VariationsAttributeCombinations.md
@@ -0,0 +1,21 @@
+# Meli::VariationsAttributeCombinations
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**name** | **String** | | [optional]
+**value_id** | **String** | | [optional]
+**value_name** | **String** | | [optional]
+
+## Code Sample
+
+```ruby
+require 'Meli'
+
+instance = Meli::VariationsAttributeCombinations.new(name: Color,
+ value_id: 283165,
+ value_name: Gris)
+```
+
+
diff --git a/lib/meli.rb b/lib/meli.rb
index ae79463..ffa3774 100644
--- a/lib/meli.rb
+++ b/lib/meli.rb
@@ -1,159 +1,52 @@
-# encoding: UTF-8
-
-require 'rubygems'
-require 'net/http'
-require 'net/https'
-require 'json'
-require 'uri'
-require 'yaml'
-
-class Meli
- attr_accessor :access_token, :refresh_token
- attr_reader :secret, :app_id, :https
-
- config = YAML.load_file(File.expand_path(File.dirname(__FILE__) + "/config.yml"))
- SDK_VERSION = config["config"]["sdk_version"]
- API_ROOT_URL = config["config"]["api_root_url"]
- AUTH_URL = config["config"]["auth_url"]
- OAUTH_URL = config["config"]["oauth_url"]
-
- #constructor
- def initialize(app_id = nil, secret = nil, access_token = nil, refresh_token = nil)
- @access_token = access_token
- @refresh_token = refresh_token
- @app_id = app_id
- @secret = secret
- api_url = URI.parse API_ROOT_URL
- @https = Net::HTTP.new(api_url.host, api_url.port)
- @https.use_ssl = true
- @https.verify_mode = OpenSSL::SSL::VERIFY_PEER
- @https.ssl_version = :TLSv1
- end
-
- #AUTH METHODS
- def auth_url(redirect_URI)
- params = {:client_id => @app_id, :response_type => 'code', :redirect_uri => redirect_URI}
- url = "#{AUTH_URL}?#{to_url_params(params)}"
- end
-
- def authorize(code, redirect_URI)
- params = { :grant_type => 'authorization_code', :client_id => @app_id, :client_secret => @secret, :code => code, :redirect_uri => redirect_URI}
-
- uri = make_path(OAUTH_URL, params)
-
- req = Net::HTTP::Post.new(uri.path)
- req['Accept'] = 'application/json'
- req['User-Agent'] = SDK_VERSION
- req['Content-Type'] = "application/x-www-form-urlencoded"
- req.set_form_data(params)
- response = @https.request(req)
-
- case response
- when Net::HTTPSuccess
- response_info = JSON.parse response.body
- #convert hash keys to symbol
- response_info = Hash[response_info.map{ |k, v| [k.to_sym, v] }]
-
- @access_token = response_info[:access_token]
- if response_info.has_key?(:refresh_token)
- @refresh_token = response_info[:refresh_token]
- else
- @refresh_token = '' # offline_access not set up
- end
- @access_token
- else
- # response code isn't a 200; raise an exception
- response.error!
- end
-
- end
-
- def get_refresh_token()
- if !@refresh_token.nil? and !@refresh_token.empty?
- params = {:grant_type => 'refresh_token', :client_id => @app_id, :client_secret => @secret, :refresh_token => @refresh_token}
-
- uri = make_path(OAUTH_URL, params)
-
- req = Net::HTTP::Post.new(uri.path)
- req['Accept'] = 'application/json'
- req['User-Agent'] = SDK_VERSION
- req['Content-Type'] = "application/x-www-form-urlencoded"
- req.set_form_data(params)
- response = @https.request(req)
-
- case response
- when Net::HTTPSuccess
- response_info = JSON.parse response.body
-
- #convert hash keys to symbol
- response_info = Hash[response_info.map{ |k, v| [k.to_sym, v] }]
-
- @access_token = response_info[:access_token]
- @refresh_token = response_info[:refresh_token]
- else
- # response code isn't a 200; raise an exception
- response.error!
- end
- else
- raise "Offline-Access is not allowed."
- end
- end
-
-
- #REQUEST METHODS
- def execute(req)
- req['Accept'] = 'application/json'
- req['User-Agent'] = SDK_VERSION
- req['Content-Type'] = 'application/json'
- response = @https.request(req)
- end
-
- def get(path, params = {})
- uri = make_path(path, params)
- req = Net::HTTP::Get.new("#{uri.path}?#{uri.query}")
- execute req
- end
-
- def post(path, body, params = {})
- uri = make_path(path, params)
- req = Net::HTTP::Post.new("#{uri.path}?#{uri.query}")
- req.set_form_data(params)
- req.body = body.to_json unless body.nil?
- execute req
- end
-
- def put(path, body, params = {})
- uri = make_path(path, params)
- req = Net::HTTP::Put.new("#{uri.path}?#{uri.query}")
- req.set_form_data(params)
- req.body = body.to_json unless body.nil?
- execute req
- end
-
- def delete(path, params = {})
- uri = make_path(path, params)
- req = Net::HTTP::Delete.new("#{uri.path}?#{uri.query}")
- execute req
- end
-
- def options(path, params = {})
- uri = make_path(path, params)
- req = Net::HTTP::Options.new("#{uri.path}?#{uri.query}")
- execute req
- end
-
-private
- def to_url_params(params)
- URI.escape(params.collect{|k,v| "#{k}=#{v}"}.join('&'))
- end
-
- def make_path(path, params = {})
- # Making Path and add a leading / if not exist
- path = "/#{path}" unless path =~ /^\//
- path = "#{API_ROOT_URL}#{path}"
-
- path = "#{path}?#{to_url_params(params)}" if params.keys.size > 0
- uri = URI.parse path
- end
-
-end #class
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+# Common files
+require 'Meli/api_client'
+require 'Meli/api_error'
+require 'Meli/version'
+require 'Meli/configuration'
+
+# Models
+require 'Meli/models/attributes'
+require 'Meli/models/attributes_value_struct'
+require 'Meli/models/attributes_values'
+require 'Meli/models/inline_object'
+require 'Meli/models/item'
+require 'Meli/models/item_pictures'
+require 'Meli/models/variations'
+require 'Meli/models/variations_attribute_combinations'
+
+# APIs
+require 'Meli/api/categories_api'
+require 'Meli/api/items_api'
+require 'Meli/api/items_health_api'
+require 'Meli/api/o_auth20_api'
+require 'Meli/api/rest_client_api'
+
+module Meli
+ class << self
+ # Customize default settings for the SDK using block.
+ # Meli.configure do |config|
+ # config.username = "xxx"
+ # config.password = "xxx"
+ # end
+ # If no block given, return the default Configuration object.
+ def configure
+ if block_given?
+ yield(Configuration.default)
+ else
+ Configuration.default
+ end
+ end
+ end
+end
diff --git a/lib/meli/api/categories_api.rb b/lib/meli/api/categories_api.rb
new file mode 100644
index 0000000..3bbe242
--- /dev/null
+++ b/lib/meli/api/categories_api.rb
@@ -0,0 +1,216 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'cgi'
+
+module Meli
+ class CategoriesApi
+ attr_accessor :api_client
+
+ def initialize(api_client = ApiClient.default)
+ @api_client = api_client
+ end
+ # Return by category.
+ # @param category_id [String]
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ def categories_category_id_get(category_id, opts = {})
+ data, _status_code, _headers = categories_category_id_get_with_http_info(category_id, opts)
+ data
+ end
+
+ # Return by category.
+ # @param category_id [String]
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
+ def categories_category_id_get_with_http_info(category_id, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: CategoriesApi.categories_category_id_get ...'
+ end
+ # verify the required parameter 'category_id' is set
+ if @api_client.config.client_side_validation && category_id.nil?
+ fail ArgumentError, "Missing the required parameter 'category_id' when calling CategoriesApi.categories_category_id_get"
+ end
+ # resource path
+ local_var_path = '/categories/{category_id}'.sub('{' + 'category_id' + '}', CGI.escape(category_id.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body]
+
+ # return_type
+ return_type = opts[:return_type] || 'Object'
+
+ # auth_names
+ auth_names = opts[:auth_names] || []
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: CategoriesApi#categories_category_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # Return a categories by site.
+ # @param site_id [String]
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ def sites_site_id_categories_get(site_id, opts = {})
+ data, _status_code, _headers = sites_site_id_categories_get_with_http_info(site_id, opts)
+ data
+ end
+
+ # Return a categories by site.
+ # @param site_id [String]
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
+ def sites_site_id_categories_get_with_http_info(site_id, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: CategoriesApi.sites_site_id_categories_get ...'
+ end
+ # verify the required parameter 'site_id' is set
+ if @api_client.config.client_side_validation && site_id.nil?
+ fail ArgumentError, "Missing the required parameter 'site_id' when calling CategoriesApi.sites_site_id_categories_get"
+ end
+ # resource path
+ local_var_path = '/sites/{site_id}/categories'.sub('{' + 'site_id' + '}', CGI.escape(site_id.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body]
+
+ # return_type
+ return_type = opts[:return_type] || 'Object'
+
+ # auth_names
+ auth_names = opts[:auth_names] || []
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: CategoriesApi#sites_site_id_categories_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # Predictor
+ # @param site_id [String]
+ # @param q [String]
+ # @param limit [String]
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ def sites_site_id_domain_discovery_search_get(site_id, q, limit, opts = {})
+ data, _status_code, _headers = sites_site_id_domain_discovery_search_get_with_http_info(site_id, q, limit, opts)
+ data
+ end
+
+ # Predictor
+ # @param site_id [String]
+ # @param q [String]
+ # @param limit [String]
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
+ def sites_site_id_domain_discovery_search_get_with_http_info(site_id, q, limit, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: CategoriesApi.sites_site_id_domain_discovery_search_get ...'
+ end
+ # verify the required parameter 'site_id' is set
+ if @api_client.config.client_side_validation && site_id.nil?
+ fail ArgumentError, "Missing the required parameter 'site_id' when calling CategoriesApi.sites_site_id_domain_discovery_search_get"
+ end
+ # verify the required parameter 'q' is set
+ if @api_client.config.client_side_validation && q.nil?
+ fail ArgumentError, "Missing the required parameter 'q' when calling CategoriesApi.sites_site_id_domain_discovery_search_get"
+ end
+ # verify the required parameter 'limit' is set
+ if @api_client.config.client_side_validation && limit.nil?
+ fail ArgumentError, "Missing the required parameter 'limit' when calling CategoriesApi.sites_site_id_domain_discovery_search_get"
+ end
+ # resource path
+ local_var_path = '/sites/{site_id}/domain_discovery/search'.sub('{' + 'site_id' + '}', CGI.escape(site_id.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+ query_params[:'q'] = q
+ query_params[:'limit'] = limit
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body]
+
+ # return_type
+ return_type = opts[:return_type] || 'Object'
+
+ # auth_names
+ auth_names = opts[:auth_names] || []
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: CategoriesApi#sites_site_id_domain_discovery_search_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+ end
+end
diff --git a/lib/meli/api/items_api.rb b/lib/meli/api/items_api.rb
new file mode 100644
index 0000000..19c1f4d
--- /dev/null
+++ b/lib/meli/api/items_api.rb
@@ -0,0 +1,226 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'cgi'
+
+module Meli
+ class ItemsApi
+ attr_accessor :api_client
+
+ def initialize(api_client = ApiClient.default)
+ @api_client = api_client
+ end
+ # Return a Item.
+ # @param id [String]
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ def items_id_get(id, opts = {})
+ data, _status_code, _headers = items_id_get_with_http_info(id, opts)
+ data
+ end
+
+ # Return a Item.
+ # @param id [String]
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
+ def items_id_get_with_http_info(id, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: ItemsApi.items_id_get ...'
+ end
+ # verify the required parameter 'id' is set
+ if @api_client.config.client_side_validation && id.nil?
+ fail ArgumentError, "Missing the required parameter 'id' when calling ItemsApi.items_id_get"
+ end
+ # resource path
+ local_var_path = '/items/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body]
+
+ # return_type
+ return_type = opts[:return_type] || 'Object'
+
+ # auth_names
+ auth_names = opts[:auth_names] || []
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: ItemsApi#items_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # Update a Item.
+ # @param id [String]
+ # @param access_token [String]
+ # @param item [Item]
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ def items_id_put(id, access_token, item, opts = {})
+ data, _status_code, _headers = items_id_put_with_http_info(id, access_token, item, opts)
+ data
+ end
+
+ # Update a Item.
+ # @param id [String]
+ # @param access_token [String]
+ # @param item [Item]
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
+ def items_id_put_with_http_info(id, access_token, item, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: ItemsApi.items_id_put ...'
+ end
+ # verify the required parameter 'id' is set
+ if @api_client.config.client_side_validation && id.nil?
+ fail ArgumentError, "Missing the required parameter 'id' when calling ItemsApi.items_id_put"
+ end
+ # verify the required parameter 'access_token' is set
+ if @api_client.config.client_side_validation && access_token.nil?
+ fail ArgumentError, "Missing the required parameter 'access_token' when calling ItemsApi.items_id_put"
+ end
+ # verify the required parameter 'item' is set
+ if @api_client.config.client_side_validation && item.nil?
+ fail ArgumentError, "Missing the required parameter 'item' when calling ItemsApi.items_id_put"
+ end
+ # resource path
+ local_var_path = '/items/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+ query_params[:'access_token'] = access_token
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+ # HTTP header 'Content-Type'
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body] || @api_client.object_to_http_body(item)
+
+ # return_type
+ return_type = opts[:return_type] || 'Object'
+
+ # auth_names
+ auth_names = opts[:auth_names] || []
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: ItemsApi#items_id_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # Create a Item.
+ # @param access_token [String]
+ # @param item [Item]
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ def items_post(access_token, item, opts = {})
+ data, _status_code, _headers = items_post_with_http_info(access_token, item, opts)
+ data
+ end
+
+ # Create a Item.
+ # @param access_token [String]
+ # @param item [Item]
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
+ def items_post_with_http_info(access_token, item, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: ItemsApi.items_post ...'
+ end
+ # verify the required parameter 'access_token' is set
+ if @api_client.config.client_side_validation && access_token.nil?
+ fail ArgumentError, "Missing the required parameter 'access_token' when calling ItemsApi.items_post"
+ end
+ # verify the required parameter 'item' is set
+ if @api_client.config.client_side_validation && item.nil?
+ fail ArgumentError, "Missing the required parameter 'item' when calling ItemsApi.items_post"
+ end
+ # resource path
+ local_var_path = '/items'
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+ query_params[:'access_token'] = access_token
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+ # HTTP header 'Content-Type'
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body] || @api_client.object_to_http_body(item)
+
+ # return_type
+ return_type = opts[:return_type] || 'Object'
+
+ # auth_names
+ auth_names = opts[:auth_names] || []
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: ItemsApi#items_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+ end
+end
diff --git a/lib/meli/api/items_health_api.rb b/lib/meli/api/items_health_api.rb
new file mode 100644
index 0000000..017459a
--- /dev/null
+++ b/lib/meli/api/items_health_api.rb
@@ -0,0 +1,216 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'cgi'
+
+module Meli
+ class ItemsHealthApi
+ attr_accessor :api_client
+
+ def initialize(api_client = ApiClient.default)
+ @api_client = api_client
+ end
+ # Return item health actions by id.
+ # @param id [String]
+ # @param access_token [String]
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ def items_id_health_actions_get(id, access_token, opts = {})
+ data, _status_code, _headers = items_id_health_actions_get_with_http_info(id, access_token, opts)
+ data
+ end
+
+ # Return item health actions by id.
+ # @param id [String]
+ # @param access_token [String]
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
+ def items_id_health_actions_get_with_http_info(id, access_token, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: ItemsHealthApi.items_id_health_actions_get ...'
+ end
+ # verify the required parameter 'id' is set
+ if @api_client.config.client_side_validation && id.nil?
+ fail ArgumentError, "Missing the required parameter 'id' when calling ItemsHealthApi.items_id_health_actions_get"
+ end
+ # verify the required parameter 'access_token' is set
+ if @api_client.config.client_side_validation && access_token.nil?
+ fail ArgumentError, "Missing the required parameter 'access_token' when calling ItemsHealthApi.items_id_health_actions_get"
+ end
+ # resource path
+ local_var_path = '/items/{id}/health/actions'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+ query_params[:'access_token'] = access_token
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body]
+
+ # return_type
+ return_type = opts[:return_type] || 'Object'
+
+ # auth_names
+ auth_names = opts[:auth_names] || []
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: ItemsHealthApi#items_id_health_actions_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # Return health by id.
+ # @param id [String]
+ # @param access_token [String]
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ def items_id_health_get(id, access_token, opts = {})
+ data, _status_code, _headers = items_id_health_get_with_http_info(id, access_token, opts)
+ data
+ end
+
+ # Return health by id.
+ # @param id [String]
+ # @param access_token [String]
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
+ def items_id_health_get_with_http_info(id, access_token, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: ItemsHealthApi.items_id_health_get ...'
+ end
+ # verify the required parameter 'id' is set
+ if @api_client.config.client_side_validation && id.nil?
+ fail ArgumentError, "Missing the required parameter 'id' when calling ItemsHealthApi.items_id_health_get"
+ end
+ # verify the required parameter 'access_token' is set
+ if @api_client.config.client_side_validation && access_token.nil?
+ fail ArgumentError, "Missing the required parameter 'access_token' when calling ItemsHealthApi.items_id_health_get"
+ end
+ # resource path
+ local_var_path = '/items/{id}/health'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+ query_params[:'access_token'] = access_token
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body]
+
+ # return_type
+ return_type = opts[:return_type] || 'Object'
+
+ # auth_names
+ auth_names = opts[:auth_names] || []
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: ItemsHealthApi#items_id_health_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # Return health levels.
+ # @param site_id [String]
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ def sites_site_id_health_levels_get(site_id, opts = {})
+ data, _status_code, _headers = sites_site_id_health_levels_get_with_http_info(site_id, opts)
+ data
+ end
+
+ # Return health levels.
+ # @param site_id [String]
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
+ def sites_site_id_health_levels_get_with_http_info(site_id, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: ItemsHealthApi.sites_site_id_health_levels_get ...'
+ end
+ # verify the required parameter 'site_id' is set
+ if @api_client.config.client_side_validation && site_id.nil?
+ fail ArgumentError, "Missing the required parameter 'site_id' when calling ItemsHealthApi.sites_site_id_health_levels_get"
+ end
+ # resource path
+ local_var_path = '/sites/{site_id}/health_levels'.sub('{' + 'site_id' + '}', CGI.escape(site_id.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body]
+
+ # return_type
+ return_type = opts[:return_type] || 'Object'
+
+ # auth_names
+ auth_names = opts[:auth_names] || []
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: ItemsHealthApi#sites_site_id_health_levels_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+ end
+end
diff --git a/lib/meli/api/o_auth20_api.rb b/lib/meli/api/o_auth20_api.rb
new file mode 100644
index 0000000..79a1343
--- /dev/null
+++ b/lib/meli/api/o_auth20_api.rb
@@ -0,0 +1,178 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'cgi'
+
+module Meli
+ class OAuth20Api
+ attr_accessor :api_client
+
+ def initialize(api_client = ApiClient.default)
+ @api_client = api_client
+ end
+ # Authentication Endpoint
+ # @param response_type [String]
+ # @param client_id [String]
+ # @param redirect_uri [String]
+ # @param [Hash] opts the optional parameters
+ # @return [nil]
+ def auth(response_type, client_id, redirect_uri, opts = {})
+ auth_with_http_info(response_type, client_id, redirect_uri, opts)
+ nil
+ end
+
+ # Authentication Endpoint
+ # @param response_type [String]
+ # @param client_id [String]
+ # @param redirect_uri [String]
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
+ def auth_with_http_info(response_type, client_id, redirect_uri, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: OAuth20Api.auth ...'
+ end
+ # verify the required parameter 'response_type' is set
+ if @api_client.config.client_side_validation && response_type.nil?
+ fail ArgumentError, "Missing the required parameter 'response_type' when calling OAuth20Api.auth"
+ end
+ # verify enum value
+ allowable_values = ["code"]
+ if @api_client.config.client_side_validation && !allowable_values.include?(response_type)
+ fail ArgumentError, "invalid value for \"response_type\", must be one of #{allowable_values}"
+ end
+ # verify the required parameter 'client_id' is set
+ if @api_client.config.client_side_validation && client_id.nil?
+ fail ArgumentError, "Missing the required parameter 'client_id' when calling OAuth20Api.auth"
+ end
+ # verify the required parameter 'redirect_uri' is set
+ if @api_client.config.client_side_validation && redirect_uri.nil?
+ fail ArgumentError, "Missing the required parameter 'redirect_uri' when calling OAuth20Api.auth"
+ end
+ # resource path
+ local_var_path = '/authorization'
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+ query_params[:'response_type'] = response_type
+ query_params[:'client_id'] = client_id
+ query_params[:'redirect_uri'] = redirect_uri
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body]
+
+ # return_type
+ return_type = opts[:return_type]
+
+ # auth_names
+ auth_names = opts[:auth_names] || []
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: OAuth20Api#auth\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # Request Access Token
+ # Partner makes a request to the token endpoint by adding the following parameters described below
+ # @param [Hash] opts the optional parameters
+ # @option opts [String] :grant_type
+ # @option opts [String] :client_id
+ # @option opts [String] :client_secret
+ # @option opts [String] :redirect_uri
+ # @option opts [String] :code
+ # @option opts [String] :refresh_token
+ # @return [Object]
+ def get_token(opts = {})
+ data, _status_code, _headers = get_token_with_http_info(opts)
+ data
+ end
+
+ # Request Access Token
+ # Partner makes a request to the token endpoint by adding the following parameters described below
+ # @param [Hash] opts the optional parameters
+ # @option opts [String] :grant_type
+ # @option opts [String] :client_id
+ # @option opts [String] :client_secret
+ # @option opts [String] :redirect_uri
+ # @option opts [String] :code
+ # @option opts [String] :refresh_token
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
+ def get_token_with_http_info(opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: OAuth20Api.get_token ...'
+ end
+ # resource path
+ local_var_path = '/oauth/token'
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+ # HTTP header 'Content-Type'
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+ form_params['grant_type'] = opts[:'grant_type'] if !opts[:'grant_type'].nil?
+ form_params['client_id'] = opts[:'client_id'] if !opts[:'client_id'].nil?
+ form_params['client_secret'] = opts[:'client_secret'] if !opts[:'client_secret'].nil?
+ form_params['redirect_uri'] = opts[:'redirect_uri'] if !opts[:'redirect_uri'].nil?
+ form_params['code'] = opts[:'code'] if !opts[:'code'].nil?
+ form_params['refresh_token'] = opts[:'refresh_token'] if !opts[:'refresh_token'].nil?
+
+ # http body (model)
+ post_body = opts[:body]
+
+ # return_type
+ return_type = opts[:return_type] || 'Object'
+
+ # auth_names
+ auth_names = opts[:auth_names] || []
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: OAuth20Api#get_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+ end
+end
diff --git a/lib/meli/api/rest_client_api.rb b/lib/meli/api/rest_client_api.rb
new file mode 100644
index 0000000..b4b4476
--- /dev/null
+++ b/lib/meli/api/rest_client_api.rb
@@ -0,0 +1,306 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'cgi'
+
+module Meli
+ class RestClientApi
+ attr_accessor :api_client
+
+ def initialize(api_client = ApiClient.default)
+ @api_client = api_client
+ end
+ # Resource path DELETE
+ # @param resource [String]
+ # @param access_token [String]
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ def resource_delete(resource, access_token, opts = {})
+ data, _status_code, _headers = resource_delete_with_http_info(resource, access_token, opts)
+ data
+ end
+
+ # Resource path DELETE
+ # @param resource [String]
+ # @param access_token [String]
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
+ def resource_delete_with_http_info(resource, access_token, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: RestClientApi.resource_delete ...'
+ end
+ # verify the required parameter 'resource' is set
+ if @api_client.config.client_side_validation && resource.nil?
+ fail ArgumentError, "Missing the required parameter 'resource' when calling RestClientApi.resource_delete"
+ end
+ # verify the required parameter 'access_token' is set
+ if @api_client.config.client_side_validation && access_token.nil?
+ fail ArgumentError, "Missing the required parameter 'access_token' when calling RestClientApi.resource_delete"
+ end
+ # resource path
+ local_var_path = '/{resource}'.sub('{' + 'resource' + '}', CGI.escape(resource.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+ query_params[:'access_token'] = access_token
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body]
+
+ # return_type
+ return_type = opts[:return_type] || 'Object'
+
+ # auth_names
+ auth_names = opts[:auth_names] || []
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: RestClientApi#resource_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # Resource path GET
+ # @param resource [String]
+ # @param access_token [String]
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ def resource_get(resource, access_token, opts = {})
+ data, _status_code, _headers = resource_get_with_http_info(resource, access_token, opts)
+ data
+ end
+
+ # Resource path GET
+ # @param resource [String]
+ # @param access_token [String]
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
+ def resource_get_with_http_info(resource, access_token, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: RestClientApi.resource_get ...'
+ end
+ # verify the required parameter 'resource' is set
+ if @api_client.config.client_side_validation && resource.nil?
+ fail ArgumentError, "Missing the required parameter 'resource' when calling RestClientApi.resource_get"
+ end
+ # verify the required parameter 'access_token' is set
+ if @api_client.config.client_side_validation && access_token.nil?
+ fail ArgumentError, "Missing the required parameter 'access_token' when calling RestClientApi.resource_get"
+ end
+ # resource path
+ local_var_path = '/{resource}'.sub('{' + 'resource' + '}', CGI.escape(resource.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+ query_params[:'access_token'] = access_token
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body]
+
+ # return_type
+ return_type = opts[:return_type] || 'Object'
+
+ # auth_names
+ auth_names = opts[:auth_names] || []
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: RestClientApi#resource_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # Resourse path POST
+ # @param resource [String]
+ # @param access_token [String]
+ # @param body [Object]
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ def resource_post(resource, access_token, body, opts = {})
+ data, _status_code, _headers = resource_post_with_http_info(resource, access_token, body, opts)
+ data
+ end
+
+ # Resourse path POST
+ # @param resource [String]
+ # @param access_token [String]
+ # @param body [Object]
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
+ def resource_post_with_http_info(resource, access_token, body, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: RestClientApi.resource_post ...'
+ end
+ # verify the required parameter 'resource' is set
+ if @api_client.config.client_side_validation && resource.nil?
+ fail ArgumentError, "Missing the required parameter 'resource' when calling RestClientApi.resource_post"
+ end
+ # verify the required parameter 'access_token' is set
+ if @api_client.config.client_side_validation && access_token.nil?
+ fail ArgumentError, "Missing the required parameter 'access_token' when calling RestClientApi.resource_post"
+ end
+ # verify the required parameter 'body' is set
+ if @api_client.config.client_side_validation && body.nil?
+ fail ArgumentError, "Missing the required parameter 'body' when calling RestClientApi.resource_post"
+ end
+ # resource path
+ local_var_path = '/{resource}'.sub('{' + 'resource' + '}', CGI.escape(resource.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+ query_params[:'access_token'] = access_token
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+ # HTTP header 'Content-Type'
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body] || @api_client.object_to_http_body(body)
+
+ # return_type
+ return_type = opts[:return_type] || 'Object'
+
+ # auth_names
+ auth_names = opts[:auth_names] || []
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: RestClientApi#resource_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # Resourse path PUT
+ # @param resource [String]
+ # @param access_token [String]
+ # @param body [Object]
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ def resource_put(resource, access_token, body, opts = {})
+ data, _status_code, _headers = resource_put_with_http_info(resource, access_token, body, opts)
+ data
+ end
+
+ # Resourse path PUT
+ # @param resource [String]
+ # @param access_token [String]
+ # @param body [Object]
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
+ def resource_put_with_http_info(resource, access_token, body, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: RestClientApi.resource_put ...'
+ end
+ # verify the required parameter 'resource' is set
+ if @api_client.config.client_side_validation && resource.nil?
+ fail ArgumentError, "Missing the required parameter 'resource' when calling RestClientApi.resource_put"
+ end
+ # verify the required parameter 'access_token' is set
+ if @api_client.config.client_side_validation && access_token.nil?
+ fail ArgumentError, "Missing the required parameter 'access_token' when calling RestClientApi.resource_put"
+ end
+ # verify the required parameter 'body' is set
+ if @api_client.config.client_side_validation && body.nil?
+ fail ArgumentError, "Missing the required parameter 'body' when calling RestClientApi.resource_put"
+ end
+ # resource path
+ local_var_path = '/{resource}'.sub('{' + 'resource' + '}', CGI.escape(resource.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+ query_params[:'access_token'] = access_token
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+ # HTTP header 'Content-Type'
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body] || @api_client.object_to_http_body(body)
+
+ # return_type
+ return_type = opts[:return_type] || 'Object'
+
+ # auth_names
+ auth_names = opts[:auth_names] || []
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: RestClientApi#resource_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+ end
+end
diff --git a/lib/meli/api_client.rb b/lib/meli/api_client.rb
new file mode 100644
index 0000000..7ee2980
--- /dev/null
+++ b/lib/meli/api_client.rb
@@ -0,0 +1,387 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'date'
+require 'json'
+require 'logger'
+require 'tempfile'
+require 'typhoeus'
+
+module Meli
+ class ApiClient
+ # The Configuration object holding settings to be used in the API client.
+ attr_accessor :config
+
+ # Defines the headers to be used in HTTP requests of all API calls by default.
+ #
+ # @return [Hash]
+ attr_accessor :default_headers
+
+ # Initializes the ApiClient
+ # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
+ def initialize(config = Configuration.default)
+ @config = config
+ @user_agent = "MELI-RUBY-SDK-3.0.0"
+ @default_headers = {
+ 'Content-Type' => 'application/json',
+ 'User-Agent' => @user_agent
+ }
+ end
+
+ def self.default
+ @@default ||= ApiClient.new
+ end
+
+ # Call an API with given options.
+ #
+ # @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
+ # the data deserialized from response body (could be nil), response status code and response headers.
+ def call_api(http_method, path, opts = {})
+ request = build_request(http_method, path, opts)
+ response = request.run
+
+ if @config.debugging
+ @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
+ end
+
+ unless response.success?
+ if response.timed_out?
+ fail ApiError.new('Connection timed out')
+ elsif response.code == 0
+ # Errors from libcurl will be made visible here
+ fail ApiError.new(:code => 0,
+ :message => response.return_message)
+ else
+ fail ApiError.new(:code => response.code,
+ :response_headers => response.headers,
+ :response_body => response.body),
+ response.status_message
+ end
+ end
+
+ if opts[:return_type]
+ data = deserialize(response, opts[:return_type])
+ else
+ data = nil
+ end
+ return data, response.code, response.headers
+ end
+
+ # Builds the HTTP request
+ #
+ # @param [String] http_method HTTP method/verb (e.g. POST)
+ # @param [String] path URL path (e.g. /account/new)
+ # @option opts [Hash] :header_params Header parameters
+ # @option opts [Hash] :query_params Query parameters
+ # @option opts [Hash] :form_params Query parameters
+ # @option opts [Object] :body HTTP body (JSON/XML)
+ # @return [Typhoeus::Request] A Typhoeus Request
+ def build_request(http_method, path, opts = {})
+ url = build_request_url(path)
+ http_method = http_method.to_sym.downcase
+
+ header_params = @default_headers.merge(opts[:header_params] || {})
+ query_params = opts[:query_params] || {}
+ form_params = opts[:form_params] || {}
+
+
+ # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
+ _verify_ssl_host = @config.verify_ssl_host ? 2 : 0
+
+ req_opts = {
+ :method => http_method,
+ :headers => header_params,
+ :params => query_params,
+ :params_encoding => @config.params_encoding,
+ :timeout => @config.timeout,
+ :ssl_verifypeer => @config.verify_ssl,
+ :ssl_verifyhost => _verify_ssl_host,
+ :sslcert => @config.cert_file,
+ :sslkey => @config.key_file,
+ :verbose => @config.debugging
+ }
+
+ # set custom cert, if provided
+ req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
+
+ if [:post, :patch, :put, :delete].include?(http_method)
+ req_body = build_request_body(header_params, form_params, opts[:body])
+ req_opts.update :body => req_body
+ if @config.debugging
+ @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
+ end
+ end
+
+ request = Typhoeus::Request.new(url, req_opts)
+ download_file(request) if opts[:return_type] == 'File'
+ request
+ end
+
+ # Builds the HTTP request body
+ #
+ # @param [Hash] header_params Header parameters
+ # @param [Hash] form_params Query parameters
+ # @param [Object] body HTTP body (JSON/XML)
+ # @return [String] HTTP body data in the form of string
+ def build_request_body(header_params, form_params, body)
+ # http form
+ if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
+ header_params['Content-Type'] == 'multipart/form-data'
+ data = {}
+ form_params.each do |key, value|
+ case value
+ when ::File, ::Array, nil
+ # let typhoeus handle File, Array and nil parameters
+ data[key] = value
+ else
+ data[key] = value.to_s
+ end
+ end
+ elsif body
+ data = body.is_a?(String) ? body : body.to_json
+ else
+ data = nil
+ end
+ data
+ end
+
+ # Check if the given MIME is a JSON MIME.
+ # JSON MIME examples:
+ # application/json
+ # application/json; charset=UTF8
+ # APPLICATION/JSON
+ # */*
+ # @param [String] mime MIME
+ # @return [Boolean] True if the MIME is application/json
+ def json_mime?(mime)
+ (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
+ end
+
+ # Deserialize the response to the given return type.
+ #
+ # @param [Response] response HTTP response
+ # @param [String] return_type some examples: "User", "Array", "Hash"
+ def deserialize(response, return_type)
+ body = response.body
+
+ # handle file downloading - return the File instance processed in request callbacks
+ # note that response body is empty when the file is written in chunks in request on_body callback
+ return @tempfile if return_type == 'File'
+
+ return nil if body.nil? || body.empty?
+
+ # return response body directly for String return type
+ return body if return_type == 'String'
+
+ # ensuring a default content type
+ content_type = response.headers['Content-Type'] || 'application/json'
+
+ fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
+
+ begin
+ data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
+ rescue JSON::ParserError => e
+ if %w(String Date DateTime).include?(return_type)
+ data = body
+ else
+ raise e
+ end
+ end
+
+ convert_to_type data, return_type
+ end
+
+ # Convert data to the given return type.
+ # @param [Object] data Data to be converted
+ # @param [String] return_type Return type
+ # @return [Mixed] Data in a particular type
+ def convert_to_type(data, return_type)
+ return nil if data.nil?
+ case return_type
+ when 'String'
+ data.to_s
+ when 'Integer'
+ data.to_i
+ when 'Float'
+ data.to_f
+ when 'Boolean'
+ data == true
+ when 'DateTime'
+ # parse date time (expecting ISO 8601 format)
+ DateTime.parse data
+ when 'Date'
+ # parse date time (expecting ISO 8601 format)
+ Date.parse data
+ when 'Object'
+ # generic object (usually a Hash), return directly
+ data
+ when /\AArray<(.+)>\z/
+ # e.g. Array
+ sub_type = $1
+ data.map { |item| convert_to_type(item, sub_type) }
+ when /\AHash\\z/
+ # e.g. Hash
+ sub_type = $1
+ {}.tap do |hash|
+ data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
+ end
+ else
+ # models, e.g. Pet
+ Meli.const_get(return_type).build_from_hash(data)
+ end
+ end
+
+ # Save response body into a file in (the defined) temporary folder, using the filename
+ # from the "Content-Disposition" header if provided, otherwise a random filename.
+ # The response body is written to the file in chunks in order to handle files which
+ # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
+ # process can use.
+ #
+ # @see Configuration#temp_folder_path
+ def download_file(request)
+ tempfile = nil
+ encoding = nil
+ request.on_headers do |response|
+ content_disposition = response.headers['Content-Disposition']
+ if content_disposition && content_disposition =~ /filename=/i
+ filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
+ prefix = sanitize_filename(filename)
+ else
+ prefix = 'download-'
+ end
+ prefix = prefix + '-' unless prefix.end_with?('-')
+ encoding = response.body.encoding
+ tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
+ @tempfile = tempfile
+ end
+ request.on_body do |chunk|
+ chunk.force_encoding(encoding)
+ tempfile.write(chunk)
+ end
+ request.on_complete do |response|
+ if tempfile
+ tempfile.close
+ @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
+ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
+ "will be deleted automatically with GC. It's also recommended to delete the temp file "\
+ "explicitly with `tempfile.delete`"
+ end
+ end
+ end
+
+ # Sanitize filename by removing path.
+ # e.g. ../../sun.gif becomes sun.gif
+ #
+ # @param [String] filename the filename to be sanitized
+ # @return [String] the sanitized filename
+ def sanitize_filename(filename)
+ filename.gsub(/.*[\/\\]/, '')
+ end
+
+ def build_request_url(path)
+ # Add leading and trailing slashes to path
+ path = "/#{path}".gsub(/\/+/, '/')
+ @config.base_url + path
+ end
+
+ # Update hearder and query params based on authentication settings.
+ #
+ # @param [Hash] header_params Header parameters
+ # @param [Hash] query_params Query parameters
+ # @param [String] auth_names Authentication scheme name
+ def update_params_for_auth!(header_params, query_params, auth_names)
+ Array(auth_names).each do |auth_name|
+ auth_setting = @config.auth_settings[auth_name]
+ next unless auth_setting
+ case auth_setting[:in]
+ when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
+ when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
+ else fail ArgumentError, 'Authentication token must be in `query` of `header`'
+ end
+ end
+ end
+
+ # Sets user agent in HTTP header
+ #
+ # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
+ def user_agent=(user_agent)
+ @user_agent = user_agent
+ @default_headers['User-Agent'] = @user_agent
+ end
+
+ # Return Accept header based on an array of accepts provided.
+ # @param [Array] accepts array for Accept
+ # @return [String] the Accept header (e.g. application/json)
+ def select_header_accept(accepts)
+ return nil if accepts.nil? || accepts.empty?
+ # use JSON when present, otherwise use all of the provided
+ json_accept = accepts.find { |s| json_mime?(s) }
+ json_accept || accepts.join(',')
+ end
+
+ # Return Content-Type header based on an array of content types provided.
+ # @param [Array] content_types array for Content-Type
+ # @return [String] the Content-Type header (e.g. application/json)
+ def select_header_content_type(content_types)
+ # use application/json by default
+ return 'application/json' if content_types.nil? || content_types.empty?
+ # use JSON when present, otherwise use the first one
+ json_content_type = content_types.find { |s| json_mime?(s) }
+ json_content_type || content_types.first
+ end
+
+ # Convert object (array, hash, object, etc) to JSON string.
+ # @param [Object] model object to be converted into JSON string
+ # @return [String] JSON string representation of the object
+ def object_to_http_body(model)
+ return model if model.nil? || model.is_a?(String)
+ local_body = nil
+ if model.is_a?(Array)
+ local_body = model.map { |m| object_to_hash(m) }
+ else
+ local_body = object_to_hash(model)
+ end
+ local_body.to_json
+ end
+
+ # Convert object(non-array) to hash.
+ # @param [Object] obj object to be converted into JSON string
+ # @return [String] JSON string representation of the object
+ def object_to_hash(obj)
+ if obj.respond_to?(:to_hash)
+ obj.to_hash
+ else
+ obj
+ end
+ end
+
+ # Build parameter value according to the given collection format.
+ # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
+ def build_collection_param(param, collection_format)
+ case collection_format
+ when :csv
+ param.join(',')
+ when :ssv
+ param.join(' ')
+ when :tsv
+ param.join("\t")
+ when :pipes
+ param.join('|')
+ when :multi
+ # return the array directly as typhoeus will handle it as expected
+ param
+ else
+ fail "unknown collection format: #{collection_format.inspect}"
+ end
+ end
+ end
+end
diff --git a/lib/meli/api_error.rb b/lib/meli/api_error.rb
new file mode 100644
index 0000000..4cadb9f
--- /dev/null
+++ b/lib/meli/api_error.rb
@@ -0,0 +1,57 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+module Meli
+ class ApiError < StandardError
+ attr_reader :code, :response_headers, :response_body
+
+ # Usage examples:
+ # ApiError.new
+ # ApiError.new("message")
+ # ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
+ # ApiError.new(:code => 404, :message => "Not Found")
+ def initialize(arg = nil)
+ if arg.is_a? Hash
+ if arg.key?(:message) || arg.key?('message')
+ super(arg[:message] || arg['message'])
+ else
+ super arg
+ end
+
+ arg.each do |k, v|
+ instance_variable_set "@#{k}", v
+ end
+ else
+ super arg
+ end
+ end
+
+ # Override to_s to display a friendly error message
+ def to_s
+ message
+ end
+
+ def message
+ if @message.nil?
+ msg = "Error message: the server returns an error"
+ else
+ msg = @message
+ end
+
+ msg += "\nHTTP status code: #{code}" if code
+ msg += "\nResponse headers: #{response_headers}" if response_headers
+ msg += "\nResponse body: #{response_body}" if response_body
+
+ msg
+ end
+ end
+end
diff --git a/lib/meli/configuration.rb b/lib/meli/configuration.rb
new file mode 100644
index 0000000..1db0ca0
--- /dev/null
+++ b/lib/meli/configuration.rb
@@ -0,0 +1,297 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+module Meli
+ class Configuration
+ # Defines url scheme
+ attr_accessor :scheme
+
+ # Defines url host
+ attr_accessor :host
+
+ # Defines url base path
+ attr_accessor :base_path
+
+ # Defines API keys used with API Key authentications.
+ #
+ # @return [Hash] key: parameter name, value: parameter value (API key)
+ #
+ # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
+ # config.api_key['api_key'] = 'xxx'
+ attr_accessor :api_key
+
+ # Defines API key prefixes used with API Key authentications.
+ #
+ # @return [Hash] key: parameter name, value: API key prefix
+ #
+ # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
+ # config.api_key_prefix['api_key'] = 'Token'
+ attr_accessor :api_key_prefix
+
+ # Defines the username used with HTTP basic authentication.
+ #
+ # @return [String]
+ attr_accessor :username
+
+ # Defines the password used with HTTP basic authentication.
+ #
+ # @return [String]
+ attr_accessor :password
+
+ # Defines the access token (Bearer) used with OAuth2.
+ attr_accessor :access_token
+
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
+ # details will be logged with `logger.debug` (see the `logger` attribute).
+ # Default to false.
+ #
+ # @return [true, false]
+ attr_accessor :debugging
+
+ # Defines the logger used for debugging.
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
+ #
+ # @return [#debug]
+ attr_accessor :logger
+
+ # Defines the temporary folder to store downloaded files
+ # (for API endpoints that have file response).
+ # Default to use `Tempfile`.
+ #
+ # @return [String]
+ attr_accessor :temp_folder_path
+
+ # The time limit for HTTP request in seconds.
+ # Default to 0 (never times out).
+ attr_accessor :timeout
+
+ # Set this to false to skip client side validation in the operation.
+ # Default to true.
+ # @return [true, false]
+ attr_accessor :client_side_validation
+
+ ### TLS/SSL setting
+ # Set this to false to skip verifying SSL certificate when calling API from https server.
+ # Default to true.
+ #
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
+ #
+ # @return [true, false]
+ attr_accessor :verify_ssl
+
+ ### TLS/SSL setting
+ # Set this to false to skip verifying SSL host name
+ # Default to true.
+ #
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
+ #
+ # @return [true, false]
+ attr_accessor :verify_ssl_host
+
+ ### TLS/SSL setting
+ # Set this to customize the certificate file to verify the peer.
+ #
+ # @return [String] the path to the certificate file
+ #
+ # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
+ # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
+ attr_accessor :ssl_ca_cert
+
+ ### TLS/SSL setting
+ # Client certificate file (for client certificate)
+ attr_accessor :cert_file
+
+ ### TLS/SSL setting
+ # Client private key file (for client certificate)
+ attr_accessor :key_file
+
+ # Set this to customize parameters encoding of array parameter with multi collectionFormat.
+ # Default to nil.
+ #
+ # @see The params_encoding option of Ethon. Related source code:
+ # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
+ attr_accessor :params_encoding
+
+ attr_accessor :inject_format
+
+ attr_accessor :force_ending_format
+
+ def initialize
+ @scheme = 'https'
+ @host = 'api.mercadolibre.com'
+ @base_path = ''
+ @api_key = {}
+ @api_key_prefix = {}
+ @timeout = 0
+ @client_side_validation = true
+ @verify_ssl = true
+ @verify_ssl_host = true
+ @params_encoding = nil
+ @cert_file = nil
+ @key_file = nil
+ @debugging = false
+ @inject_format = false
+ @force_ending_format = false
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
+
+ yield(self) if block_given?
+ end
+
+ # The default Configuration object.
+ def self.default
+ @@default ||= Configuration.new
+ end
+
+ def configure
+ yield(self) if block_given?
+ end
+
+ def scheme=(scheme)
+ # remove :// from scheme
+ @scheme = scheme.sub(/:\/\//, '')
+ end
+
+ def host=(host)
+ # remove http(s):// and anything after a slash
+ @host = host.sub(/https?:\/\//, '').split('/').first
+ end
+
+ def base_path=(base_path)
+ # Add leading and trailing slashes to base_path
+ @base_path = "/#{base_path}".gsub(/\/+/, '/')
+ @base_path = '' if @base_path == '/'
+ end
+
+ def base_url
+ "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
+ end
+
+ # Gets API key (with prefix if set).
+ # @param [String] param_name the parameter name of API key auth
+ def api_key_with_prefix(param_name)
+ if @api_key_prefix[param_name]
+ "#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
+ else
+ @api_key[param_name]
+ end
+ end
+
+ # Gets Basic Auth token string
+ def basic_auth_token
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
+ end
+
+ # Returns Auth Settings hash for api client.
+ def auth_settings
+ {
+ }
+ end
+
+ # Returns an array of Server setting
+ def server_settings
+ [
+ {
+ url: "https://api.mercadolibre.com",
+ description: "The Marketplace API Endpoint",
+ },
+ {
+ url: "https://auth.mercadolibre.com.ar",
+ description: "Authorization EndPoint for MLA",
+ },
+ {
+ url: "https://auth.mercadolivre.com.br",
+ description: "Authorization EndPoint for MLB",
+ },
+ {
+ url: "https://auth.mercadolibre.com.co",
+ description: "Authorization EndPoint for MCO",
+ },
+ {
+ url: "https://auth.mercadolibre.com.mx",
+ description: "Authorization EndPoint for MLM",
+ },
+ {
+ url: "https://auth.mercadolibre.com.uy",
+ description: "Authorization EndPoint for MLU",
+ },
+ {
+ url: "https://auth.mercadolibre.cl",
+ description: "Authorization EndPoint for MLC",
+ },
+ {
+ url: "https://auth.mercadolibre.com.cr",
+ description: "Authorization EndPoint for MCR",
+ },
+ {
+ url: "https://auth.mercadolibre.com.ec",
+ description: "Authorization EndPoint for MEC",
+ },
+ {
+ url: "https://auth.mercadolibre.com.ve",
+ description: "Authorization EndPoint for MLV",
+ },
+ {
+ url: "https://auth.mercadolibre.com.pa",
+ description: "Authorization EndPoint for MPA",
+ },
+ {
+ url: "https://auth.mercadolibre.com.pe",
+ description: "Authorization EndPoint for MLP",
+ },
+ {
+ url: "https://auth.mercadolibre.com.do",
+ description: "Authorization EndPoint for MRD",
+ },
+ {
+ url: "https://auth.mercadolibre.com.bo",
+ description: "Authorization EndPoint for MBO",
+ },
+ {
+ url: "https://auth.mercadolibre.com.py",
+ description: "Authorization EndPoint for MPY",
+ }
+ ]
+ end
+
+ # Returns URL based on server settings
+ #
+ # @param index array index of the server settings
+ # @param variables hash of variable and the corresponding value
+ def server_url(index, variables = {})
+ servers = server_settings
+
+ # check array index out of bound
+ if (index < 0 || index >= servers.size)
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
+ end
+
+ server = servers[index]
+ url = server[:url]
+
+ # go through variable and assign a value
+ server[:variables].each do |name, variable|
+ if variables.key?(name)
+ if (server[:variables][name][:enum_values].include? variables[name])
+ url.gsub! "{" + name.to_s + "}", variables[name]
+ else
+ fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
+ end
+ else
+ # use default value
+ url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
+ end
+ end
+
+ url
+ end
+ end
+end
diff --git a/lib/meli/models/attributes.rb b/lib/meli/models/attributes.rb
new file mode 100644
index 0000000..c1e2164
--- /dev/null
+++ b/lib/meli/models/attributes.rb
@@ -0,0 +1,273 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'date'
+
+module Meli
+ class Attributes
+ attr_accessor :id
+
+ attr_accessor :name
+
+ attr_accessor :value_id
+
+ attr_accessor :value_name
+
+ attr_accessor :value_struct
+
+ attr_accessor :values
+
+ attr_accessor :attribute_group_id
+
+ attr_accessor :attribute_group_name
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :'id' => :'id',
+ :'name' => :'name',
+ :'value_id' => :'value_id',
+ :'value_name' => :'value_name',
+ :'value_struct' => :'value_struct',
+ :'values' => :'values',
+ :'attribute_group_id' => :'attribute_group_id',
+ :'attribute_group_name' => :'attribute_group_name'
+ }
+ end
+
+ # Attribute type mapping.
+ def self.openapi_types
+ {
+ :'id' => :'String',
+ :'name' => :'String',
+ :'value_id' => :'String',
+ :'value_name' => :'String',
+ :'value_struct' => :'AttributesValueStruct',
+ :'values' => :'Array',
+ :'attribute_group_id' => :'String',
+ :'attribute_group_name' => :'String'
+ }
+ end
+
+ # List of attributes with nullable: true
+ def self.openapi_nullable
+ Set.new([
+ :'value_id',
+ :'value_struct',
+ ])
+ end
+
+ # Initializes the object
+ # @param [Hash] attributes Model attributes in the form of hash
+ def initialize(attributes = {})
+ if (!attributes.is_a?(Hash))
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Meli::Attributes` initialize method"
+ end
+
+ # check to see if the attribute exists and convert string to symbol for hash key
+ attributes = attributes.each_with_object({}) { |(k, v), h|
+ if (!self.class.attribute_map.key?(k.to_sym))
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Meli::Attributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
+ end
+ h[k.to_sym] = v
+ }
+
+ if attributes.key?(:'id')
+ self.id = attributes[:'id']
+ end
+
+ if attributes.key?(:'name')
+ self.name = attributes[:'name']
+ end
+
+ if attributes.key?(:'value_id')
+ self.value_id = attributes[:'value_id']
+ end
+
+ if attributes.key?(:'value_name')
+ self.value_name = attributes[:'value_name']
+ end
+
+ if attributes.key?(:'value_struct')
+ self.value_struct = attributes[:'value_struct']
+ end
+
+ if attributes.key?(:'values')
+ if (value = attributes[:'values']).is_a?(Array)
+ self.values = value
+ end
+ end
+
+ if attributes.key?(:'attribute_group_id')
+ self.attribute_group_id = attributes[:'attribute_group_id']
+ end
+
+ if attributes.key?(:'attribute_group_name')
+ self.attribute_group_name = attributes[:'attribute_group_name']
+ end
+ end
+
+ # Show invalid properties with the reasons. Usually used together with valid?
+ # @return Array for valid properties with the reasons
+ def list_invalid_properties
+ invalid_properties = Array.new
+ invalid_properties
+ end
+
+ # Check to see if the all the properties in the model are valid
+ # @return true if the model is valid
+ def valid?
+ true
+ end
+
+ # Checks equality by comparing each attribute.
+ # @param [Object] Object to be compared
+ def ==(o)
+ return true if self.equal?(o)
+ self.class == o.class &&
+ id == o.id &&
+ name == o.name &&
+ value_id == o.value_id &&
+ value_name == o.value_name &&
+ value_struct == o.value_struct &&
+ values == o.values &&
+ attribute_group_id == o.attribute_group_id &&
+ attribute_group_name == o.attribute_group_name
+ end
+
+ # @see the `==` method
+ # @param [Object] Object to be compared
+ def eql?(o)
+ self == o
+ end
+
+ # Calculates hash code according to all attributes.
+ # @return [Integer] Hash code
+ def hash
+ [id, name, value_id, value_name, value_struct, values, attribute_group_id, attribute_group_name].hash
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def self.build_from_hash(attributes)
+ new.build_from_hash(attributes)
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def build_from_hash(attributes)
+ return nil unless attributes.is_a?(Hash)
+ self.class.openapi_types.each_pair do |key, type|
+ if type =~ /\AArray<(.*)>/i
+ # check to ensure the input is an array given that the attribute
+ # is documented as an array but the input is not
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
+ end
+ elsif !attributes[self.class.attribute_map[key]].nil?
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
+ end
+
+ self
+ end
+
+ # Deserializes the data based on type
+ # @param string type Data type
+ # @param string value Value to be deserialized
+ # @return [Object] Deserialized data
+ def _deserialize(type, value)
+ case type.to_sym
+ when :DateTime
+ DateTime.parse(value)
+ when :Date
+ Date.parse(value)
+ when :String
+ value.to_s
+ when :Integer
+ value.to_i
+ when :Float
+ value.to_f
+ when :Boolean
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+ true
+ else
+ false
+ end
+ when :Object
+ # generic object (usually a Hash), return directly
+ value
+ when /\AArray<(?.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?.+?), (?.+)>\z/
+ k_type = Regexp.last_match[:k_type]
+ v_type = Regexp.last_match[:v_type]
+ {}.tap do |hash|
+ value.each do |k, v|
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+ end
+ end
+ else # model
+ Meli.const_get(type).build_from_hash(value)
+ end
+ end
+
+ # Returns the string representation of the object
+ # @return [String] String presentation of the object
+ def to_s
+ to_hash.to_s
+ end
+
+ # to_body is an alias to to_hash (backward compatibility)
+ # @return [Hash] Returns the object in the form of hash
+ def to_body
+ to_hash
+ end
+
+ # Returns the object in the form of hash
+ # @return [Hash] Returns the object in the form of hash
+ def to_hash
+ hash = {}
+ self.class.attribute_map.each_pair do |attr, param|
+ value = self.send(attr)
+ if value.nil?
+ is_nullable = self.class.openapi_nullable.include?(attr)
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
+ end
+
+ hash[param] = _to_hash(value)
+ end
+ hash
+ end
+
+ # Outputs non-array value in the form of hash
+ # For object, use to_hash. Otherwise, just return the value
+ # @param [Object] value Any valid value
+ # @return [Hash] Returns the value in the form of hash
+ def _to_hash(value)
+ if value.is_a?(Array)
+ value.compact.map { |v| _to_hash(v) }
+ elsif value.is_a?(Hash)
+ {}.tap do |hash|
+ value.each { |k, v| hash[k] = _to_hash(v) }
+ end
+ elsif value.respond_to? :to_hash
+ value.to_hash
+ else
+ value
+ end
+ end
+ end
+end
diff --git a/lib/meli/models/attributes_value_struct.rb b/lib/meli/models/attributes_value_struct.rb
new file mode 100644
index 0000000..257d6d7
--- /dev/null
+++ b/lib/meli/models/attributes_value_struct.rb
@@ -0,0 +1,215 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'date'
+
+module Meli
+ class AttributesValueStruct
+ attr_accessor :number
+
+ attr_accessor :unit
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :'number' => :'number',
+ :'unit' => :'unit'
+ }
+ end
+
+ # Attribute type mapping.
+ def self.openapi_types
+ {
+ :'number' => :'Float',
+ :'unit' => :'String'
+ }
+ end
+
+ # List of attributes with nullable: true
+ def self.openapi_nullable
+ Set.new([
+ ])
+ end
+
+ # Initializes the object
+ # @param [Hash] attributes Model attributes in the form of hash
+ def initialize(attributes = {})
+ if (!attributes.is_a?(Hash))
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Meli::AttributesValueStruct` initialize method"
+ end
+
+ # check to see if the attribute exists and convert string to symbol for hash key
+ attributes = attributes.each_with_object({}) { |(k, v), h|
+ if (!self.class.attribute_map.key?(k.to_sym))
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Meli::AttributesValueStruct`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
+ end
+ h[k.to_sym] = v
+ }
+
+ if attributes.key?(:'number')
+ self.number = attributes[:'number']
+ end
+
+ if attributes.key?(:'unit')
+ self.unit = attributes[:'unit']
+ end
+ end
+
+ # Show invalid properties with the reasons. Usually used together with valid?
+ # @return Array for valid properties with the reasons
+ def list_invalid_properties
+ invalid_properties = Array.new
+ invalid_properties
+ end
+
+ # Check to see if the all the properties in the model are valid
+ # @return true if the model is valid
+ def valid?
+ true
+ end
+
+ # Checks equality by comparing each attribute.
+ # @param [Object] Object to be compared
+ def ==(o)
+ return true if self.equal?(o)
+ self.class == o.class &&
+ number == o.number &&
+ unit == o.unit
+ end
+
+ # @see the `==` method
+ # @param [Object] Object to be compared
+ def eql?(o)
+ self == o
+ end
+
+ # Calculates hash code according to all attributes.
+ # @return [Integer] Hash code
+ def hash
+ [number, unit].hash
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def self.build_from_hash(attributes)
+ new.build_from_hash(attributes)
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def build_from_hash(attributes)
+ return nil unless attributes.is_a?(Hash)
+ self.class.openapi_types.each_pair do |key, type|
+ if type =~ /\AArray<(.*)>/i
+ # check to ensure the input is an array given that the attribute
+ # is documented as an array but the input is not
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
+ end
+ elsif !attributes[self.class.attribute_map[key]].nil?
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
+ end
+
+ self
+ end
+
+ # Deserializes the data based on type
+ # @param string type Data type
+ # @param string value Value to be deserialized
+ # @return [Object] Deserialized data
+ def _deserialize(type, value)
+ case type.to_sym
+ when :DateTime
+ DateTime.parse(value)
+ when :Date
+ Date.parse(value)
+ when :String
+ value.to_s
+ when :Integer
+ value.to_i
+ when :Float
+ value.to_f
+ when :Boolean
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+ true
+ else
+ false
+ end
+ when :Object
+ # generic object (usually a Hash), return directly
+ value
+ when /\AArray<(?.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?.+?), (?.+)>\z/
+ k_type = Regexp.last_match[:k_type]
+ v_type = Regexp.last_match[:v_type]
+ {}.tap do |hash|
+ value.each do |k, v|
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+ end
+ end
+ else # model
+ Meli.const_get(type).build_from_hash(value)
+ end
+ end
+
+ # Returns the string representation of the object
+ # @return [String] String presentation of the object
+ def to_s
+ to_hash.to_s
+ end
+
+ # to_body is an alias to to_hash (backward compatibility)
+ # @return [Hash] Returns the object in the form of hash
+ def to_body
+ to_hash
+ end
+
+ # Returns the object in the form of hash
+ # @return [Hash] Returns the object in the form of hash
+ def to_hash
+ hash = {}
+ self.class.attribute_map.each_pair do |attr, param|
+ value = self.send(attr)
+ if value.nil?
+ is_nullable = self.class.openapi_nullable.include?(attr)
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
+ end
+
+ hash[param] = _to_hash(value)
+ end
+ hash
+ end
+
+ # Outputs non-array value in the form of hash
+ # For object, use to_hash. Otherwise, just return the value
+ # @param [Object] value Any valid value
+ # @return [Hash] Returns the value in the form of hash
+ def _to_hash(value)
+ if value.is_a?(Array)
+ value.compact.map { |v| _to_hash(v) }
+ elsif value.is_a?(Hash)
+ {}.tap do |hash|
+ value.each { |k, v| hash[k] = _to_hash(v) }
+ end
+ elsif value.respond_to? :to_hash
+ value.to_hash
+ else
+ value
+ end
+ end
+ end
+end
diff --git a/lib/meli/models/attributes_values.rb b/lib/meli/models/attributes_values.rb
new file mode 100644
index 0000000..1d34c31
--- /dev/null
+++ b/lib/meli/models/attributes_values.rb
@@ -0,0 +1,226 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'date'
+
+module Meli
+ class AttributesValues
+ attr_accessor :id
+
+ attr_accessor :name
+
+ attr_accessor :struct
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :'id' => :'id',
+ :'name' => :'name',
+ :'struct' => :'struct'
+ }
+ end
+
+ # Attribute type mapping.
+ def self.openapi_types
+ {
+ :'id' => :'String',
+ :'name' => :'String',
+ :'struct' => :'AttributesValueStruct'
+ }
+ end
+
+ # List of attributes with nullable: true
+ def self.openapi_nullable
+ Set.new([
+ :'id',
+ :'struct'
+ ])
+ end
+
+ # Initializes the object
+ # @param [Hash] attributes Model attributes in the form of hash
+ def initialize(attributes = {})
+ if (!attributes.is_a?(Hash))
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Meli::AttributesValues` initialize method"
+ end
+
+ # check to see if the attribute exists and convert string to symbol for hash key
+ attributes = attributes.each_with_object({}) { |(k, v), h|
+ if (!self.class.attribute_map.key?(k.to_sym))
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Meli::AttributesValues`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
+ end
+ h[k.to_sym] = v
+ }
+
+ if attributes.key?(:'id')
+ self.id = attributes[:'id']
+ end
+
+ if attributes.key?(:'name')
+ self.name = attributes[:'name']
+ end
+
+ if attributes.key?(:'struct')
+ self.struct = attributes[:'struct']
+ end
+ end
+
+ # Show invalid properties with the reasons. Usually used together with valid?
+ # @return Array for valid properties with the reasons
+ def list_invalid_properties
+ invalid_properties = Array.new
+ invalid_properties
+ end
+
+ # Check to see if the all the properties in the model are valid
+ # @return true if the model is valid
+ def valid?
+ true
+ end
+
+ # Checks equality by comparing each attribute.
+ # @param [Object] Object to be compared
+ def ==(o)
+ return true if self.equal?(o)
+ self.class == o.class &&
+ id == o.id &&
+ name == o.name &&
+ struct == o.struct
+ end
+
+ # @see the `==` method
+ # @param [Object] Object to be compared
+ def eql?(o)
+ self == o
+ end
+
+ # Calculates hash code according to all attributes.
+ # @return [Integer] Hash code
+ def hash
+ [id, name, struct].hash
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def self.build_from_hash(attributes)
+ new.build_from_hash(attributes)
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def build_from_hash(attributes)
+ return nil unless attributes.is_a?(Hash)
+ self.class.openapi_types.each_pair do |key, type|
+ if type =~ /\AArray<(.*)>/i
+ # check to ensure the input is an array given that the attribute
+ # is documented as an array but the input is not
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
+ end
+ elsif !attributes[self.class.attribute_map[key]].nil?
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
+ end
+
+ self
+ end
+
+ # Deserializes the data based on type
+ # @param string type Data type
+ # @param string value Value to be deserialized
+ # @return [Object] Deserialized data
+ def _deserialize(type, value)
+ case type.to_sym
+ when :DateTime
+ DateTime.parse(value)
+ when :Date
+ Date.parse(value)
+ when :String
+ value.to_s
+ when :Integer
+ value.to_i
+ when :Float
+ value.to_f
+ when :Boolean
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+ true
+ else
+ false
+ end
+ when :Object
+ # generic object (usually a Hash), return directly
+ value
+ when /\AArray<(?.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?.+?), (?.+)>\z/
+ k_type = Regexp.last_match[:k_type]
+ v_type = Regexp.last_match[:v_type]
+ {}.tap do |hash|
+ value.each do |k, v|
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+ end
+ end
+ else # model
+ Meli.const_get(type).build_from_hash(value)
+ end
+ end
+
+ # Returns the string representation of the object
+ # @return [String] String presentation of the object
+ def to_s
+ to_hash.to_s
+ end
+
+ # to_body is an alias to to_hash (backward compatibility)
+ # @return [Hash] Returns the object in the form of hash
+ def to_body
+ to_hash
+ end
+
+ # Returns the object in the form of hash
+ # @return [Hash] Returns the object in the form of hash
+ def to_hash
+ hash = {}
+ self.class.attribute_map.each_pair do |attr, param|
+ value = self.send(attr)
+ if value.nil?
+ is_nullable = self.class.openapi_nullable.include?(attr)
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
+ end
+
+ hash[param] = _to_hash(value)
+ end
+ hash
+ end
+
+ # Outputs non-array value in the form of hash
+ # For object, use to_hash. Otherwise, just return the value
+ # @param [Object] value Any valid value
+ # @return [Hash] Returns the value in the form of hash
+ def _to_hash(value)
+ if value.is_a?(Array)
+ value.compact.map { |v| _to_hash(v) }
+ elsif value.is_a?(Hash)
+ {}.tap do |hash|
+ value.each { |k, v| hash[k] = _to_hash(v) }
+ end
+ elsif value.respond_to? :to_hash
+ value.to_hash
+ else
+ value
+ end
+ end
+ end
+end
diff --git a/lib/meli/models/inline_object.rb b/lib/meli/models/inline_object.rb
new file mode 100644
index 0000000..7c28a16
--- /dev/null
+++ b/lib/meli/models/inline_object.rb
@@ -0,0 +1,251 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'date'
+
+module Meli
+ class InlineObject
+ attr_accessor :grant_type
+
+ attr_accessor :client_id
+
+ attr_accessor :client_secret
+
+ attr_accessor :redirect_uri
+
+ attr_accessor :code
+
+ attr_accessor :refresh_token
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :'grant_type' => :'grant_type',
+ :'client_id' => :'client_id',
+ :'client_secret' => :'client_secret',
+ :'redirect_uri' => :'redirect_uri',
+ :'code' => :'code',
+ :'refresh_token' => :'refresh_token'
+ }
+ end
+
+ # Attribute type mapping.
+ def self.openapi_types
+ {
+ :'grant_type' => :'String',
+ :'client_id' => :'String',
+ :'client_secret' => :'String',
+ :'redirect_uri' => :'String',
+ :'code' => :'String',
+ :'refresh_token' => :'String'
+ }
+ end
+
+ # List of attributes with nullable: true
+ def self.openapi_nullable
+ Set.new([
+ ])
+ end
+
+ # Initializes the object
+ # @param [Hash] attributes Model attributes in the form of hash
+ def initialize(attributes = {})
+ if (!attributes.is_a?(Hash))
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Meli::InlineObject` initialize method"
+ end
+
+ # check to see if the attribute exists and convert string to symbol for hash key
+ attributes = attributes.each_with_object({}) { |(k, v), h|
+ if (!self.class.attribute_map.key?(k.to_sym))
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Meli::InlineObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
+ end
+ h[k.to_sym] = v
+ }
+
+ if attributes.key?(:'grant_type')
+ self.grant_type = attributes[:'grant_type']
+ end
+
+ if attributes.key?(:'client_id')
+ self.client_id = attributes[:'client_id']
+ end
+
+ if attributes.key?(:'client_secret')
+ self.client_secret = attributes[:'client_secret']
+ end
+
+ if attributes.key?(:'redirect_uri')
+ self.redirect_uri = attributes[:'redirect_uri']
+ end
+
+ if attributes.key?(:'code')
+ self.code = attributes[:'code']
+ end
+
+ if attributes.key?(:'refresh_token')
+ self.refresh_token = attributes[:'refresh_token']
+ end
+ end
+
+ # Show invalid properties with the reasons. Usually used together with valid?
+ # @return Array for valid properties with the reasons
+ def list_invalid_properties
+ invalid_properties = Array.new
+ invalid_properties
+ end
+
+ # Check to see if the all the properties in the model are valid
+ # @return true if the model is valid
+ def valid?
+ true
+ end
+
+ # Checks equality by comparing each attribute.
+ # @param [Object] Object to be compared
+ def ==(o)
+ return true if self.equal?(o)
+ self.class == o.class &&
+ grant_type == o.grant_type &&
+ client_id == o.client_id &&
+ client_secret == o.client_secret &&
+ redirect_uri == o.redirect_uri &&
+ code == o.code &&
+ refresh_token == o.refresh_token
+ end
+
+ # @see the `==` method
+ # @param [Object] Object to be compared
+ def eql?(o)
+ self == o
+ end
+
+ # Calculates hash code according to all attributes.
+ # @return [Integer] Hash code
+ def hash
+ [grant_type, client_id, client_secret, redirect_uri, code, refresh_token].hash
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def self.build_from_hash(attributes)
+ new.build_from_hash(attributes)
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def build_from_hash(attributes)
+ return nil unless attributes.is_a?(Hash)
+ self.class.openapi_types.each_pair do |key, type|
+ if type =~ /\AArray<(.*)>/i
+ # check to ensure the input is an array given that the attribute
+ # is documented as an array but the input is not
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
+ end
+ elsif !attributes[self.class.attribute_map[key]].nil?
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
+ end
+
+ self
+ end
+
+ # Deserializes the data based on type
+ # @param string type Data type
+ # @param string value Value to be deserialized
+ # @return [Object] Deserialized data
+ def _deserialize(type, value)
+ case type.to_sym
+ when :DateTime
+ DateTime.parse(value)
+ when :Date
+ Date.parse(value)
+ when :String
+ value.to_s
+ when :Integer
+ value.to_i
+ when :Float
+ value.to_f
+ when :Boolean
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+ true
+ else
+ false
+ end
+ when :Object
+ # generic object (usually a Hash), return directly
+ value
+ when /\AArray<(?.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?.+?), (?.+)>\z/
+ k_type = Regexp.last_match[:k_type]
+ v_type = Regexp.last_match[:v_type]
+ {}.tap do |hash|
+ value.each do |k, v|
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+ end
+ end
+ else # model
+ Meli.const_get(type).build_from_hash(value)
+ end
+ end
+
+ # Returns the string representation of the object
+ # @return [String] String presentation of the object
+ def to_s
+ to_hash.to_s
+ end
+
+ # to_body is an alias to to_hash (backward compatibility)
+ # @return [Hash] Returns the object in the form of hash
+ def to_body
+ to_hash
+ end
+
+ # Returns the object in the form of hash
+ # @return [Hash] Returns the object in the form of hash
+ def to_hash
+ hash = {}
+ self.class.attribute_map.each_pair do |attr, param|
+ value = self.send(attr)
+ if value.nil?
+ is_nullable = self.class.openapi_nullable.include?(attr)
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
+ end
+
+ hash[param] = _to_hash(value)
+ end
+ hash
+ end
+
+ # Outputs non-array value in the form of hash
+ # For object, use to_hash. Otherwise, just return the value
+ # @param [Object] value Any valid value
+ # @return [Hash] Returns the value in the form of hash
+ def _to_hash(value)
+ if value.is_a?(Array)
+ value.compact.map { |v| _to_hash(v) }
+ elsif value.is_a?(Hash)
+ {}.tap do |hash|
+ value.each { |k, v| hash[k] = _to_hash(v) }
+ end
+ elsif value.respond_to? :to_hash
+ value.to_hash
+ else
+ value
+ end
+ end
+ end
+end
diff --git a/lib/meli/models/item.rb b/lib/meli/models/item.rb
new file mode 100644
index 0000000..c9e075f
--- /dev/null
+++ b/lib/meli/models/item.rb
@@ -0,0 +1,375 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'date'
+
+module Meli
+ class Item
+ attr_accessor :title
+
+ attr_accessor :category_id
+
+ attr_accessor :price
+
+ attr_accessor :currency_id
+
+ attr_accessor :available_quantity
+
+ attr_accessor :buying_mode
+
+ attr_accessor :listing_type_id
+
+ attr_accessor :condition
+
+ attr_accessor :description
+
+ attr_accessor :video_id
+
+ attr_accessor :pictures
+
+ attr_accessor :attributes
+
+ attr_accessor :variations
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :'title' => :'title',
+ :'category_id' => :'category_id',
+ :'price' => :'price',
+ :'currency_id' => :'currency_id',
+ :'available_quantity' => :'available_quantity',
+ :'buying_mode' => :'buying_mode',
+ :'listing_type_id' => :'listing_type_id',
+ :'condition' => :'condition',
+ :'description' => :'description',
+ :'video_id' => :'video_id',
+ :'pictures' => :'pictures',
+ :'attributes' => :'attributes',
+ :'variations' => :'variations'
+ }
+ end
+
+ # Attribute type mapping.
+ def self.openapi_types
+ {
+ :'title' => :'String',
+ :'category_id' => :'String',
+ :'price' => :'Integer',
+ :'currency_id' => :'String',
+ :'available_quantity' => :'String',
+ :'buying_mode' => :'String',
+ :'listing_type_id' => :'String',
+ :'condition' => :'String',
+ :'description' => :'String',
+ :'video_id' => :'String',
+ :'pictures' => :'Array',
+ :'attributes' => :'Array',
+ :'variations' => :'Array'
+ }
+ end
+
+ # List of attributes with nullable: true
+ def self.openapi_nullable
+ Set.new([
+ ])
+ end
+
+ # Initializes the object
+ # @param [Hash] attributes Model attributes in the form of hash
+ def initialize(attributes = {})
+ if (!attributes.is_a?(Hash))
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Meli::Item` initialize method"
+ end
+
+ # check to see if the attribute exists and convert string to symbol for hash key
+ attributes = attributes.each_with_object({}) { |(k, v), h|
+ if (!self.class.attribute_map.key?(k.to_sym))
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Meli::Item`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
+ end
+ h[k.to_sym] = v
+ }
+
+ if attributes.key?(:'title')
+ self.title = attributes[:'title']
+ end
+
+ if attributes.key?(:'category_id')
+ self.category_id = attributes[:'category_id']
+ end
+
+ if attributes.key?(:'price')
+ self.price = attributes[:'price']
+ end
+
+ if attributes.key?(:'currency_id')
+ self.currency_id = attributes[:'currency_id']
+ end
+
+ if attributes.key?(:'available_quantity')
+ self.available_quantity = attributes[:'available_quantity']
+ end
+
+ if attributes.key?(:'buying_mode')
+ self.buying_mode = attributes[:'buying_mode']
+ end
+
+ if attributes.key?(:'listing_type_id')
+ self.listing_type_id = attributes[:'listing_type_id']
+ end
+
+ if attributes.key?(:'condition')
+ self.condition = attributes[:'condition']
+ end
+
+ if attributes.key?(:'description')
+ self.description = attributes[:'description']
+ end
+
+ if attributes.key?(:'video_id')
+ self.video_id = attributes[:'video_id']
+ end
+
+ if attributes.key?(:'pictures')
+ if (value = attributes[:'pictures']).is_a?(Array)
+ self.pictures = value
+ end
+ end
+
+ if attributes.key?(:'attributes')
+ if (value = attributes[:'attributes']).is_a?(Array)
+ self.attributes = value
+ end
+ end
+
+ if attributes.key?(:'variations')
+ if (value = attributes[:'variations']).is_a?(Array)
+ self.variations = value
+ end
+ end
+ end
+
+ # Show invalid properties with the reasons. Usually used together with valid?
+ # @return Array for valid properties with the reasons
+ def list_invalid_properties
+ invalid_properties = Array.new
+ if @title.nil?
+ invalid_properties.push('invalid value for "title", title cannot be nil.')
+ end
+
+ if @category_id.nil?
+ invalid_properties.push('invalid value for "category_id", category_id cannot be nil.')
+ end
+
+ if @price.nil?
+ invalid_properties.push('invalid value for "price", price cannot be nil.')
+ end
+
+ if @currency_id.nil?
+ invalid_properties.push('invalid value for "currency_id", currency_id cannot be nil.')
+ end
+
+ if @available_quantity.nil?
+ invalid_properties.push('invalid value for "available_quantity", available_quantity cannot be nil.')
+ end
+
+ if @buying_mode.nil?
+ invalid_properties.push('invalid value for "buying_mode", buying_mode cannot be nil.')
+ end
+
+ if @listing_type_id.nil?
+ invalid_properties.push('invalid value for "listing_type_id", listing_type_id cannot be nil.')
+ end
+
+ if @condition.nil?
+ invalid_properties.push('invalid value for "condition", condition cannot be nil.')
+ end
+
+ if @description.nil?
+ invalid_properties.push('invalid value for "description", description cannot be nil.')
+ end
+
+ if @video_id.nil?
+ invalid_properties.push('invalid value for "video_id", video_id cannot be nil.')
+ end
+
+ if @pictures.nil?
+ invalid_properties.push('invalid value for "pictures", pictures cannot be nil.')
+ end
+
+ invalid_properties
+ end
+
+ # Check to see if the all the properties in the model are valid
+ # @return true if the model is valid
+ def valid?
+ return false if @title.nil?
+ return false if @category_id.nil?
+ return false if @price.nil?
+ return false if @currency_id.nil?
+ return false if @available_quantity.nil?
+ return false if @buying_mode.nil?
+ return false if @listing_type_id.nil?
+ return false if @condition.nil?
+ return false if @description.nil?
+ return false if @video_id.nil?
+ return false if @pictures.nil?
+ true
+ end
+
+ # Checks equality by comparing each attribute.
+ # @param [Object] Object to be compared
+ def ==(o)
+ return true if self.equal?(o)
+ self.class == o.class &&
+ title == o.title &&
+ category_id == o.category_id &&
+ price == o.price &&
+ currency_id == o.currency_id &&
+ available_quantity == o.available_quantity &&
+ buying_mode == o.buying_mode &&
+ listing_type_id == o.listing_type_id &&
+ condition == o.condition &&
+ description == o.description &&
+ video_id == o.video_id &&
+ pictures == o.pictures &&
+ attributes == o.attributes &&
+ variations == o.variations
+ end
+
+ # @see the `==` method
+ # @param [Object] Object to be compared
+ def eql?(o)
+ self == o
+ end
+
+ # Calculates hash code according to all attributes.
+ # @return [Integer] Hash code
+ def hash
+ [title, category_id, price, currency_id, available_quantity, buying_mode, listing_type_id, condition, description, video_id, pictures, attributes, variations].hash
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def self.build_from_hash(attributes)
+ new.build_from_hash(attributes)
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def build_from_hash(attributes)
+ return nil unless attributes.is_a?(Hash)
+ self.class.openapi_types.each_pair do |key, type|
+ if type =~ /\AArray<(.*)>/i
+ # check to ensure the input is an array given that the attribute
+ # is documented as an array but the input is not
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
+ end
+ elsif !attributes[self.class.attribute_map[key]].nil?
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
+ end
+
+ self
+ end
+
+ # Deserializes the data based on type
+ # @param string type Data type
+ # @param string value Value to be deserialized
+ # @return [Object] Deserialized data
+ def _deserialize(type, value)
+ case type.to_sym
+ when :DateTime
+ DateTime.parse(value)
+ when :Date
+ Date.parse(value)
+ when :String
+ value.to_s
+ when :Integer
+ value.to_i
+ when :Float
+ value.to_f
+ when :Boolean
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+ true
+ else
+ false
+ end
+ when :Object
+ # generic object (usually a Hash), return directly
+ value
+ when /\AArray<(?.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?.+?), (?.+)>\z/
+ k_type = Regexp.last_match[:k_type]
+ v_type = Regexp.last_match[:v_type]
+ {}.tap do |hash|
+ value.each do |k, v|
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+ end
+ end
+ else # model
+ Meli.const_get(type).build_from_hash(value)
+ end
+ end
+
+ # Returns the string representation of the object
+ # @return [String] String presentation of the object
+ def to_s
+ to_hash.to_s
+ end
+
+ # to_body is an alias to to_hash (backward compatibility)
+ # @return [Hash] Returns the object in the form of hash
+ def to_body
+ to_hash
+ end
+
+ # Returns the object in the form of hash
+ # @return [Hash] Returns the object in the form of hash
+ def to_hash
+ hash = {}
+ self.class.attribute_map.each_pair do |attr, param|
+ value = self.send(attr)
+ if value.nil?
+ is_nullable = self.class.openapi_nullable.include?(attr)
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
+ end
+
+ hash[param] = _to_hash(value)
+ end
+ hash
+ end
+
+ # Outputs non-array value in the form of hash
+ # For object, use to_hash. Otherwise, just return the value
+ # @param [Object] value Any valid value
+ # @return [Hash] Returns the value in the form of hash
+ def _to_hash(value)
+ if value.is_a?(Array)
+ value.compact.map { |v| _to_hash(v) }
+ elsif value.is_a?(Hash)
+ {}.tap do |hash|
+ value.each { |k, v| hash[k] = _to_hash(v) }
+ end
+ elsif value.respond_to? :to_hash
+ value.to_hash
+ else
+ value
+ end
+ end
+ end
+end
diff --git a/lib/meli/models/item_pictures.rb b/lib/meli/models/item_pictures.rb
new file mode 100644
index 0000000..4a2daa0
--- /dev/null
+++ b/lib/meli/models/item_pictures.rb
@@ -0,0 +1,206 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'date'
+
+module Meli
+ class ItemPictures
+ attr_accessor :source
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :'source' => :'source'
+ }
+ end
+
+ # Attribute type mapping.
+ def self.openapi_types
+ {
+ :'source' => :'String'
+ }
+ end
+
+ # List of attributes with nullable: true
+ def self.openapi_nullable
+ Set.new([
+ ])
+ end
+
+ # Initializes the object
+ # @param [Hash] attributes Model attributes in the form of hash
+ def initialize(attributes = {})
+ if (!attributes.is_a?(Hash))
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Meli::ItemPictures` initialize method"
+ end
+
+ # check to see if the attribute exists and convert string to symbol for hash key
+ attributes = attributes.each_with_object({}) { |(k, v), h|
+ if (!self.class.attribute_map.key?(k.to_sym))
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Meli::ItemPictures`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
+ end
+ h[k.to_sym] = v
+ }
+
+ if attributes.key?(:'source')
+ self.source = attributes[:'source']
+ end
+ end
+
+ # Show invalid properties with the reasons. Usually used together with valid?
+ # @return Array for valid properties with the reasons
+ def list_invalid_properties
+ invalid_properties = Array.new
+ invalid_properties
+ end
+
+ # Check to see if the all the properties in the model are valid
+ # @return true if the model is valid
+ def valid?
+ true
+ end
+
+ # Checks equality by comparing each attribute.
+ # @param [Object] Object to be compared
+ def ==(o)
+ return true if self.equal?(o)
+ self.class == o.class &&
+ source == o.source
+ end
+
+ # @see the `==` method
+ # @param [Object] Object to be compared
+ def eql?(o)
+ self == o
+ end
+
+ # Calculates hash code according to all attributes.
+ # @return [Integer] Hash code
+ def hash
+ [source].hash
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def self.build_from_hash(attributes)
+ new.build_from_hash(attributes)
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def build_from_hash(attributes)
+ return nil unless attributes.is_a?(Hash)
+ self.class.openapi_types.each_pair do |key, type|
+ if type =~ /\AArray<(.*)>/i
+ # check to ensure the input is an array given that the attribute
+ # is documented as an array but the input is not
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
+ end
+ elsif !attributes[self.class.attribute_map[key]].nil?
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
+ end
+
+ self
+ end
+
+ # Deserializes the data based on type
+ # @param string type Data type
+ # @param string value Value to be deserialized
+ # @return [Object] Deserialized data
+ def _deserialize(type, value)
+ case type.to_sym
+ when :DateTime
+ DateTime.parse(value)
+ when :Date
+ Date.parse(value)
+ when :String
+ value.to_s
+ when :Integer
+ value.to_i
+ when :Float
+ value.to_f
+ when :Boolean
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+ true
+ else
+ false
+ end
+ when :Object
+ # generic object (usually a Hash), return directly
+ value
+ when /\AArray<(?.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?.+?), (?.+)>\z/
+ k_type = Regexp.last_match[:k_type]
+ v_type = Regexp.last_match[:v_type]
+ {}.tap do |hash|
+ value.each do |k, v|
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+ end
+ end
+ else # model
+ Meli.const_get(type).build_from_hash(value)
+ end
+ end
+
+ # Returns the string representation of the object
+ # @return [String] String presentation of the object
+ def to_s
+ to_hash.to_s
+ end
+
+ # to_body is an alias to to_hash (backward compatibility)
+ # @return [Hash] Returns the object in the form of hash
+ def to_body
+ to_hash
+ end
+
+ # Returns the object in the form of hash
+ # @return [Hash] Returns the object in the form of hash
+ def to_hash
+ hash = {}
+ self.class.attribute_map.each_pair do |attr, param|
+ value = self.send(attr)
+ if value.nil?
+ is_nullable = self.class.openapi_nullable.include?(attr)
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
+ end
+
+ hash[param] = _to_hash(value)
+ end
+ hash
+ end
+
+ # Outputs non-array value in the form of hash
+ # For object, use to_hash. Otherwise, just return the value
+ # @param [Object] value Any valid value
+ # @return [Hash] Returns the value in the form of hash
+ def _to_hash(value)
+ if value.is_a?(Array)
+ value.compact.map { |v| _to_hash(v) }
+ elsif value.is_a?(Hash)
+ {}.tap do |hash|
+ value.each { |k, v| hash[k] = _to_hash(v) }
+ end
+ elsif value.respond_to? :to_hash
+ value.to_hash
+ else
+ value
+ end
+ end
+ end
+end
diff --git a/lib/meli/models/variations.rb b/lib/meli/models/variations.rb
new file mode 100644
index 0000000..2c92753
--- /dev/null
+++ b/lib/meli/models/variations.rb
@@ -0,0 +1,246 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'date'
+
+module Meli
+ class Variations
+ attr_accessor :price
+
+ attr_accessor :attribute_combinations
+
+ attr_accessor :available_quantity
+
+ attr_accessor :sold_quantity
+
+ attr_accessor :picture_ids
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :'price' => :'price',
+ :'attribute_combinations' => :'attribute_combinations',
+ :'available_quantity' => :'available_quantity',
+ :'sold_quantity' => :'sold_quantity',
+ :'picture_ids' => :'picture_ids'
+ }
+ end
+
+ # Attribute type mapping.
+ def self.openapi_types
+ {
+ :'price' => :'Integer',
+ :'attribute_combinations' => :'Array',
+ :'available_quantity' => :'Integer',
+ :'sold_quantity' => :'Integer',
+ :'picture_ids' => :'Array'
+ }
+ end
+
+ # List of attributes with nullable: true
+ def self.openapi_nullable
+ Set.new([
+ ])
+ end
+
+ # Initializes the object
+ # @param [Hash] attributes Model attributes in the form of hash
+ def initialize(attributes = {})
+ if (!attributes.is_a?(Hash))
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Meli::Variations` initialize method"
+ end
+
+ # check to see if the attribute exists and convert string to symbol for hash key
+ attributes = attributes.each_with_object({}) { |(k, v), h|
+ if (!self.class.attribute_map.key?(k.to_sym))
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Meli::Variations`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
+ end
+ h[k.to_sym] = v
+ }
+
+ if attributes.key?(:'price')
+ self.price = attributes[:'price']
+ end
+
+ if attributes.key?(:'attribute_combinations')
+ if (value = attributes[:'attribute_combinations']).is_a?(Array)
+ self.attribute_combinations = value
+ end
+ end
+
+ if attributes.key?(:'available_quantity')
+ self.available_quantity = attributes[:'available_quantity']
+ end
+
+ if attributes.key?(:'sold_quantity')
+ self.sold_quantity = attributes[:'sold_quantity']
+ end
+
+ if attributes.key?(:'picture_ids')
+ if (value = attributes[:'picture_ids']).is_a?(Array)
+ self.picture_ids = value
+ end
+ end
+ end
+
+ # Show invalid properties with the reasons. Usually used together with valid?
+ # @return Array for valid properties with the reasons
+ def list_invalid_properties
+ invalid_properties = Array.new
+ invalid_properties
+ end
+
+ # Check to see if the all the properties in the model are valid
+ # @return true if the model is valid
+ def valid?
+ true
+ end
+
+ # Checks equality by comparing each attribute.
+ # @param [Object] Object to be compared
+ def ==(o)
+ return true if self.equal?(o)
+ self.class == o.class &&
+ price == o.price &&
+ attribute_combinations == o.attribute_combinations &&
+ available_quantity == o.available_quantity &&
+ sold_quantity == o.sold_quantity &&
+ picture_ids == o.picture_ids
+ end
+
+ # @see the `==` method
+ # @param [Object] Object to be compared
+ def eql?(o)
+ self == o
+ end
+
+ # Calculates hash code according to all attributes.
+ # @return [Integer] Hash code
+ def hash
+ [price, attribute_combinations, available_quantity, sold_quantity, picture_ids].hash
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def self.build_from_hash(attributes)
+ new.build_from_hash(attributes)
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def build_from_hash(attributes)
+ return nil unless attributes.is_a?(Hash)
+ self.class.openapi_types.each_pair do |key, type|
+ if type =~ /\AArray<(.*)>/i
+ # check to ensure the input is an array given that the attribute
+ # is documented as an array but the input is not
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
+ end
+ elsif !attributes[self.class.attribute_map[key]].nil?
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
+ end
+
+ self
+ end
+
+ # Deserializes the data based on type
+ # @param string type Data type
+ # @param string value Value to be deserialized
+ # @return [Object] Deserialized data
+ def _deserialize(type, value)
+ case type.to_sym
+ when :DateTime
+ DateTime.parse(value)
+ when :Date
+ Date.parse(value)
+ when :String
+ value.to_s
+ when :Integer
+ value.to_i
+ when :Float
+ value.to_f
+ when :Boolean
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+ true
+ else
+ false
+ end
+ when :Object
+ # generic object (usually a Hash), return directly
+ value
+ when /\AArray<(?.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?.+?), (?.+)>\z/
+ k_type = Regexp.last_match[:k_type]
+ v_type = Regexp.last_match[:v_type]
+ {}.tap do |hash|
+ value.each do |k, v|
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+ end
+ end
+ else # model
+ Meli.const_get(type).build_from_hash(value)
+ end
+ end
+
+ # Returns the string representation of the object
+ # @return [String] String presentation of the object
+ def to_s
+ to_hash.to_s
+ end
+
+ # to_body is an alias to to_hash (backward compatibility)
+ # @return [Hash] Returns the object in the form of hash
+ def to_body
+ to_hash
+ end
+
+ # Returns the object in the form of hash
+ # @return [Hash] Returns the object in the form of hash
+ def to_hash
+ hash = {}
+ self.class.attribute_map.each_pair do |attr, param|
+ value = self.send(attr)
+ if value.nil?
+ is_nullable = self.class.openapi_nullable.include?(attr)
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
+ end
+
+ hash[param] = _to_hash(value)
+ end
+ hash
+ end
+
+ # Outputs non-array value in the form of hash
+ # For object, use to_hash. Otherwise, just return the value
+ # @param [Object] value Any valid value
+ # @return [Hash] Returns the value in the form of hash
+ def _to_hash(value)
+ if value.is_a?(Array)
+ value.compact.map { |v| _to_hash(v) }
+ elsif value.is_a?(Hash)
+ {}.tap do |hash|
+ value.each { |k, v| hash[k] = _to_hash(v) }
+ end
+ elsif value.respond_to? :to_hash
+ value.to_hash
+ else
+ value
+ end
+ end
+ end
+end
diff --git a/lib/meli/models/variations_attribute_combinations.rb b/lib/meli/models/variations_attribute_combinations.rb
new file mode 100644
index 0000000..1801c89
--- /dev/null
+++ b/lib/meli/models/variations_attribute_combinations.rb
@@ -0,0 +1,224 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'date'
+
+module Meli
+ class VariationsAttributeCombinations
+ attr_accessor :name
+
+ attr_accessor :value_id
+
+ attr_accessor :value_name
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :'name' => :'name',
+ :'value_id' => :'value_id',
+ :'value_name' => :'value_name'
+ }
+ end
+
+ # Attribute type mapping.
+ def self.openapi_types
+ {
+ :'name' => :'String',
+ :'value_id' => :'String',
+ :'value_name' => :'String'
+ }
+ end
+
+ # List of attributes with nullable: true
+ def self.openapi_nullable
+ Set.new([
+ ])
+ end
+
+ # Initializes the object
+ # @param [Hash] attributes Model attributes in the form of hash
+ def initialize(attributes = {})
+ if (!attributes.is_a?(Hash))
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Meli::VariationsAttributeCombinations` initialize method"
+ end
+
+ # check to see if the attribute exists and convert string to symbol for hash key
+ attributes = attributes.each_with_object({}) { |(k, v), h|
+ if (!self.class.attribute_map.key?(k.to_sym))
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Meli::VariationsAttributeCombinations`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
+ end
+ h[k.to_sym] = v
+ }
+
+ if attributes.key?(:'name')
+ self.name = attributes[:'name']
+ end
+
+ if attributes.key?(:'value_id')
+ self.value_id = attributes[:'value_id']
+ end
+
+ if attributes.key?(:'value_name')
+ self.value_name = attributes[:'value_name']
+ end
+ end
+
+ # Show invalid properties with the reasons. Usually used together with valid?
+ # @return Array for valid properties with the reasons
+ def list_invalid_properties
+ invalid_properties = Array.new
+ invalid_properties
+ end
+
+ # Check to see if the all the properties in the model are valid
+ # @return true if the model is valid
+ def valid?
+ true
+ end
+
+ # Checks equality by comparing each attribute.
+ # @param [Object] Object to be compared
+ def ==(o)
+ return true if self.equal?(o)
+ self.class == o.class &&
+ name == o.name &&
+ value_id == o.value_id &&
+ value_name == o.value_name
+ end
+
+ # @see the `==` method
+ # @param [Object] Object to be compared
+ def eql?(o)
+ self == o
+ end
+
+ # Calculates hash code according to all attributes.
+ # @return [Integer] Hash code
+ def hash
+ [name, value_id, value_name].hash
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def self.build_from_hash(attributes)
+ new.build_from_hash(attributes)
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def build_from_hash(attributes)
+ return nil unless attributes.is_a?(Hash)
+ self.class.openapi_types.each_pair do |key, type|
+ if type =~ /\AArray<(.*)>/i
+ # check to ensure the input is an array given that the attribute
+ # is documented as an array but the input is not
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
+ end
+ elsif !attributes[self.class.attribute_map[key]].nil?
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
+ end
+
+ self
+ end
+
+ # Deserializes the data based on type
+ # @param string type Data type
+ # @param string value Value to be deserialized
+ # @return [Object] Deserialized data
+ def _deserialize(type, value)
+ case type.to_sym
+ when :DateTime
+ DateTime.parse(value)
+ when :Date
+ Date.parse(value)
+ when :String
+ value.to_s
+ when :Integer
+ value.to_i
+ when :Float
+ value.to_f
+ when :Boolean
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+ true
+ else
+ false
+ end
+ when :Object
+ # generic object (usually a Hash), return directly
+ value
+ when /\AArray<(?.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?.+?), (?.+)>\z/
+ k_type = Regexp.last_match[:k_type]
+ v_type = Regexp.last_match[:v_type]
+ {}.tap do |hash|
+ value.each do |k, v|
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+ end
+ end
+ else # model
+ Meli.const_get(type).build_from_hash(value)
+ end
+ end
+
+ # Returns the string representation of the object
+ # @return [String] String presentation of the object
+ def to_s
+ to_hash.to_s
+ end
+
+ # to_body is an alias to to_hash (backward compatibility)
+ # @return [Hash] Returns the object in the form of hash
+ def to_body
+ to_hash
+ end
+
+ # Returns the object in the form of hash
+ # @return [Hash] Returns the object in the form of hash
+ def to_hash
+ hash = {}
+ self.class.attribute_map.each_pair do |attr, param|
+ value = self.send(attr)
+ if value.nil?
+ is_nullable = self.class.openapi_nullable.include?(attr)
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
+ end
+
+ hash[param] = _to_hash(value)
+ end
+ hash
+ end
+
+ # Outputs non-array value in the form of hash
+ # For object, use to_hash. Otherwise, just return the value
+ # @param [Object] value Any valid value
+ # @return [Hash] Returns the value in the form of hash
+ def _to_hash(value)
+ if value.is_a?(Array)
+ value.compact.map { |v| _to_hash(v) }
+ elsif value.is_a?(Hash)
+ {}.tap do |hash|
+ value.each { |k, v| hash[k] = _to_hash(v) }
+ end
+ elsif value.respond_to? :to_hash
+ value.to_hash
+ else
+ value
+ end
+ end
+ end
+end
diff --git a/lib/meli/version.rb b/lib/meli/version.rb
index 80b3d76..b4d9714 100644
--- a/lib/meli/version.rb
+++ b/lib/meli/version.rb
@@ -1,3 +1,15 @@
-require 'meli'
+=begin
+#MELI Markeplace SDK
-Meli::VERSION = "0.0.1"
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+module Meli
+ VERSION = '3.0.0'
+end
diff --git a/meli.gemspec b/meli.gemspec
index 591550a..17d1efb 100644
--- a/meli.gemspec
+++ b/meli.gemspec
@@ -1,29 +1,33 @@
+# -*- encoding: utf-8 -*-
-# coding: utf-8
-lib = File.expand_path('../lib', __FILE__)
-$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
-require 'meli/version'
+=begin
+#MELI Markeplace SDK
-Gem::Specification.new do |spec|
- spec.name = "meli"
- spec.version = Meli::VERSION
- spec.authors = [""]
- spec.email = [""]
+#This is the official Ruby SDK for the MercadoLibre Marketplace platform.
+=end
- if spec.respond_to?(:metadata)
- spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
- end
+$:.push File.expand_path("../lib", __FILE__)
+require "Meli/version"
- spec.summary = %q{MercadoLibre's Ruby SDK}
- spec.description = %q{MercadoLibre's Ruby SDK}
- spec.homepage = "http://developers.mercadolibre.com"
- spec.license = "MIT"
+Gem::Specification.new do |s|
+ s.name = "Meli"
+ s.version = Meli::VERSION
+ s.platform = Gem::Platform::RUBY
+ s.authors = ["MELI"]
+ s.email = [""]
+ s.homepage = "https://github.com/mercadolibre/ruby-sdk"
+ s.summary = "MELI Markeplace SDK Ruby Gem"
+ s.description = "This is the official Ruby SDK for the MercadoLibre Marketplace platform."
+ s.license = "Unlicense"
+ s.required_ruby_version = ">= 1.9"
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
- spec.bindir = "exe"
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
- spec.require_paths = ["lib"]
+ s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
+ s.add_runtime_dependency 'json', '~> 2.3', '>= 2.3.0'
- spec.add_development_dependency "bundler", "~> 1.8"
- spec.add_development_dependency "rake", "~> 10.0"
+ s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
+
+ s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
+ s.test_files = `find spec/*`.split("\n")
+ s.executables = []
+ s.require_paths = ["lib"]
end
diff --git a/spec/api/categories_api_spec.rb b/spec/api/categories_api_spec.rb
new file mode 100644
index 0000000..a2dcc45
--- /dev/null
+++ b/spec/api/categories_api_spec.rb
@@ -0,0 +1,70 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'spec_helper'
+require 'json'
+
+# Unit tests for Meli::CategoriesApi
+# Automatically generated by openapi-generator (https://openapi-generator.tech)
+# Please update as you see appropriate
+describe 'CategoriesApi' do
+ before do
+ # run before each test
+ @api_instance = Meli::CategoriesApi.new
+ end
+
+ after do
+ # run after each test
+ end
+
+ describe 'test an instance of CategoriesApi' do
+ it 'should create an instance of CategoriesApi' do
+ expect(@api_instance).to be_instance_of(Meli::CategoriesApi)
+ end
+ end
+
+ # unit tests for categories_category_id_get
+ # Return by category.
+ # @param category_id
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ describe 'categories_category_id_get test' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ # unit tests for sites_site_id_categories_get
+ # Return a categories by site.
+ # @param site_id
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ describe 'sites_site_id_categories_get test' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ # unit tests for sites_site_id_domain_discovery_search_get
+ # Predictor
+ # @param site_id
+ # @param q
+ # @param limit
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ describe 'sites_site_id_domain_discovery_search_get test' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+end
diff --git a/spec/api/items_api_spec.rb b/spec/api/items_api_spec.rb
new file mode 100644
index 0000000..6552fbf
--- /dev/null
+++ b/spec/api/items_api_spec.rb
@@ -0,0 +1,71 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'spec_helper'
+require 'json'
+
+# Unit tests for Meli::ItemsApi
+# Automatically generated by openapi-generator (https://openapi-generator.tech)
+# Please update as you see appropriate
+describe 'ItemsApi' do
+ before do
+ # run before each test
+ @api_instance = Meli::ItemsApi.new
+ end
+
+ after do
+ # run after each test
+ end
+
+ describe 'test an instance of ItemsApi' do
+ it 'should create an instance of ItemsApi' do
+ expect(@api_instance).to be_instance_of(Meli::ItemsApi)
+ end
+ end
+
+ # unit tests for items_id_get
+ # Return a Item.
+ # @param id
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ describe 'items_id_get test' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ # unit tests for items_id_put
+ # Update a Item.
+ # @param id
+ # @param access_token
+ # @param item
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ describe 'items_id_put test' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ # unit tests for items_post
+ # Create a Item.
+ # @param access_token
+ # @param item
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ describe 'items_post test' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+end
diff --git a/spec/api/items_health_api_spec.rb b/spec/api/items_health_api_spec.rb
new file mode 100644
index 0000000..2544314
--- /dev/null
+++ b/spec/api/items_health_api_spec.rb
@@ -0,0 +1,70 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'spec_helper'
+require 'json'
+
+# Unit tests for Meli::ItemsHealthApi
+# Automatically generated by openapi-generator (https://openapi-generator.tech)
+# Please update as you see appropriate
+describe 'ItemsHealthApi' do
+ before do
+ # run before each test
+ @api_instance = Meli::ItemsHealthApi.new
+ end
+
+ after do
+ # run after each test
+ end
+
+ describe 'test an instance of ItemsHealthApi' do
+ it 'should create an instance of ItemsHealthApi' do
+ expect(@api_instance).to be_instance_of(Meli::ItemsHealthApi)
+ end
+ end
+
+ # unit tests for items_id_health_actions_get
+ # Return item health actions by id.
+ # @param id
+ # @param access_token
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ describe 'items_id_health_actions_get test' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ # unit tests for items_id_health_get
+ # Return health by id.
+ # @param id
+ # @param access_token
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ describe 'items_id_health_get test' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ # unit tests for sites_site_id_health_levels_get
+ # Return health levels.
+ # @param site_id
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ describe 'sites_site_id_health_levels_get test' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+end
diff --git a/spec/api/o_auth20_api_spec.rb b/spec/api/o_auth20_api_spec.rb
new file mode 100644
index 0000000..a430d4e
--- /dev/null
+++ b/spec/api/o_auth20_api_spec.rb
@@ -0,0 +1,65 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'spec_helper'
+require 'json'
+
+# Unit tests for Meli::OAuth20Api
+# Automatically generated by openapi-generator (https://openapi-generator.tech)
+# Please update as you see appropriate
+describe 'OAuth20Api' do
+ before do
+ # run before each test
+ @api_instance = Meli::OAuth20Api.new
+ end
+
+ after do
+ # run after each test
+ end
+
+ describe 'test an instance of OAuth20Api' do
+ it 'should create an instance of OAuth20Api' do
+ expect(@api_instance).to be_instance_of(Meli::OAuth20Api)
+ end
+ end
+
+ # unit tests for auth
+ # Authentication Endpoint
+ # @param response_type
+ # @param client_id
+ # @param redirect_uri
+ # @param [Hash] opts the optional parameters
+ # @return [nil]
+ describe 'auth test' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ # unit tests for get_token
+ # Request Access Token
+ # Partner makes a request to the token endpoint by adding the following parameters described below
+ # @param [Hash] opts the optional parameters
+ # @option opts [String] :grant_type
+ # @option opts [String] :client_id
+ # @option opts [String] :client_secret
+ # @option opts [String] :redirect_uri
+ # @option opts [String] :code
+ # @option opts [String] :refresh_token
+ # @return [Object]
+ describe 'get_token test' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+end
diff --git a/spec/api/rest_client_api_spec.rb b/spec/api/rest_client_api_spec.rb
new file mode 100644
index 0000000..45b6693
--- /dev/null
+++ b/spec/api/rest_client_api_spec.rb
@@ -0,0 +1,85 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'spec_helper'
+require 'json'
+
+# Unit tests for Meli::RestClientApi
+# Automatically generated by openapi-generator (https://openapi-generator.tech)
+# Please update as you see appropriate
+describe 'RestClientApi' do
+ before do
+ # run before each test
+ @api_instance = Meli::RestClientApi.new
+ end
+
+ after do
+ # run after each test
+ end
+
+ describe 'test an instance of RestClientApi' do
+ it 'should create an instance of RestClientApi' do
+ expect(@api_instance).to be_instance_of(Meli::RestClientApi)
+ end
+ end
+
+ # unit tests for resource_delete
+ # Resource path DELETE
+ # @param resource
+ # @param access_token
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ describe 'resource_delete test' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ # unit tests for resource_get
+ # Resource path GET
+ # @param resource
+ # @param access_token
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ describe 'resource_get test' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ # unit tests for resource_post
+ # Resourse path POST
+ # @param resource
+ # @param access_token
+ # @param body
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ describe 'resource_post test' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ # unit tests for resource_put
+ # Resourse path PUT
+ # @param resource
+ # @param access_token
+ # @param body
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ describe 'resource_put test' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+end
diff --git a/spec/api_client_spec.rb b/spec/api_client_spec.rb
new file mode 100644
index 0000000..678af16
--- /dev/null
+++ b/spec/api_client_spec.rb
@@ -0,0 +1,226 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'spec_helper'
+
+describe Meli::ApiClient do
+ context 'initialization' do
+ context 'URL stuff' do
+ context 'host' do
+ it 'removes http from host' do
+ Meli.configure { |c| c.host = 'http://example.com' }
+ expect(Meli::Configuration.default.host).to eq('example.com')
+ end
+
+ it 'removes https from host' do
+ Meli.configure { |c| c.host = 'https://wookiee.com' }
+ expect(Meli::ApiClient.default.config.host).to eq('wookiee.com')
+ end
+
+ it 'removes trailing path from host' do
+ Meli.configure { |c| c.host = 'hobo.com/v4' }
+ expect(Meli::Configuration.default.host).to eq('hobo.com')
+ end
+ end
+
+ context 'base_path' do
+ it "prepends a slash to base_path" do
+ Meli.configure { |c| c.base_path = 'v4/dog' }
+ expect(Meli::Configuration.default.base_path).to eq('/v4/dog')
+ end
+
+ it "doesn't prepend a slash if one is already there" do
+ Meli.configure { |c| c.base_path = '/v4/dog' }
+ expect(Meli::Configuration.default.base_path).to eq('/v4/dog')
+ end
+
+ it "ends up as a blank string if nil" do
+ Meli.configure { |c| c.base_path = nil }
+ expect(Meli::Configuration.default.base_path).to eq('')
+ end
+ end
+ end
+ end
+
+ describe 'params_encoding in #build_request' do
+ let(:config) { Meli::Configuration.new }
+ let(:api_client) { Meli::ApiClient.new(config) }
+
+ it 'defaults to nil' do
+ expect(Meli::Configuration.default.params_encoding).to eq(nil)
+ expect(config.params_encoding).to eq(nil)
+
+ request = api_client.build_request(:get, '/test')
+ expect(request.options[:params_encoding]).to eq(nil)
+ end
+
+ it 'can be customized' do
+ config.params_encoding = :multi
+ request = api_client.build_request(:get, '/test')
+ expect(request.options[:params_encoding]).to eq(:multi)
+ end
+ end
+
+ describe 'timeout in #build_request' do
+ let(:config) { Meli::Configuration.new }
+ let(:api_client) { Meli::ApiClient.new(config) }
+
+ it 'defaults to 0' do
+ expect(Meli::Configuration.default.timeout).to eq(0)
+ expect(config.timeout).to eq(0)
+
+ request = api_client.build_request(:get, '/test')
+ expect(request.options[:timeout]).to eq(0)
+ end
+
+ it 'can be customized' do
+ config.timeout = 100
+ request = api_client.build_request(:get, '/test')
+ expect(request.options[:timeout]).to eq(100)
+ end
+ end
+
+ describe '#deserialize' do
+ it "handles Array" do
+ api_client = Meli::ApiClient.new
+ headers = { 'Content-Type' => 'application/json' }
+ response = double('response', headers: headers, body: '[12, 34]')
+ data = api_client.deserialize(response, 'Array')
+ expect(data).to be_instance_of(Array)
+ expect(data).to eq([12, 34])
+ end
+
+ it 'handles Array>' do
+ api_client = Meli::ApiClient.new
+ headers = { 'Content-Type' => 'application/json' }
+ response = double('response', headers: headers, body: '[[12, 34], [56]]')
+ data = api_client.deserialize(response, 'Array>')
+ expect(data).to be_instance_of(Array)
+ expect(data).to eq([[12, 34], [56]])
+ end
+
+ it 'handles Hash' do
+ api_client = Meli::ApiClient.new
+ headers = { 'Content-Type' => 'application/json' }
+ response = double('response', headers: headers, body: '{"message": "Hello"}')
+ data = api_client.deserialize(response, 'Hash')
+ expect(data).to be_instance_of(Hash)
+ expect(data).to eq(:message => 'Hello')
+ end
+ end
+
+ describe "#object_to_hash" do
+ it 'ignores nils and includes empty arrays' do
+ # uncomment below to test object_to_hash for model
+ # api_client = Meli::ApiClient.new
+ # _model = Meli::ModelName.new
+ # update the model attribute below
+ # _model.id = 1
+ # update the expected value (hash) below
+ # expected = {id: 1, name: '', tags: []}
+ # expect(api_client.object_to_hash(_model)).to eq(expected)
+ end
+ end
+
+ describe '#build_collection_param' do
+ let(:param) { ['aa', 'bb', 'cc'] }
+ let(:api_client) { Meli::ApiClient.new }
+
+ it 'works for csv' do
+ expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
+ end
+
+ it 'works for ssv' do
+ expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
+ end
+
+ it 'works for tsv' do
+ expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
+ end
+
+ it 'works for pipes' do
+ expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
+ end
+
+ it 'works for multi' do
+ expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
+ end
+
+ it 'fails for invalid collection format' do
+ expect { api_client.build_collection_param(param, :INVALID) }.to raise_error(RuntimeError, 'unknown collection format: :INVALID')
+ end
+ end
+
+ describe '#json_mime?' do
+ let(:api_client) { Meli::ApiClient.new }
+
+ it 'works' do
+ expect(api_client.json_mime?(nil)).to eq false
+ expect(api_client.json_mime?('')).to eq false
+
+ expect(api_client.json_mime?('application/json')).to eq true
+ expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
+ expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
+
+ expect(api_client.json_mime?('application/xml')).to eq false
+ expect(api_client.json_mime?('text/plain')).to eq false
+ expect(api_client.json_mime?('application/jsonp')).to eq false
+ end
+ end
+
+ describe '#select_header_accept' do
+ let(:api_client) { Meli::ApiClient.new }
+
+ it 'works' do
+ expect(api_client.select_header_accept(nil)).to be_nil
+ expect(api_client.select_header_accept([])).to be_nil
+
+ expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
+ expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
+ expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
+
+ expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
+ expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
+ end
+ end
+
+ describe '#select_header_content_type' do
+ let(:api_client) { Meli::ApiClient.new }
+
+ it 'works' do
+ expect(api_client.select_header_content_type(nil)).to eq('application/json')
+ expect(api_client.select_header_content_type([])).to eq('application/json')
+
+ expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
+ expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
+ expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
+ expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
+ expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
+ end
+ end
+
+ describe '#sanitize_filename' do
+ let(:api_client) { Meli::ApiClient.new }
+
+ it 'works' do
+ expect(api_client.sanitize_filename('sun')).to eq('sun')
+ expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
+ expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
+ expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
+ expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
+ expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
+ expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
+ expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
+ expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
+ end
+ end
+end
diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb
new file mode 100644
index 0000000..8c4eead
--- /dev/null
+++ b/spec/configuration_spec.rb
@@ -0,0 +1,42 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'spec_helper'
+
+describe Meli::Configuration do
+ let(:config) { Meli::Configuration.default }
+
+ before(:each) do
+ # uncomment below to setup host and base_path
+ # require 'URI'
+ # uri = URI.parse("https://api.mercadolibre.com")
+ # Meli.configure do |c|
+ # c.host = uri.host
+ # c.base_path = uri.path
+ # end
+ end
+
+ describe '#base_url' do
+ it 'should have the default value' do
+ # uncomment below to test default value of the base path
+ # expect(config.base_url).to eq("https://api.mercadolibre.com")
+ end
+
+ it 'should remove trailing slashes' do
+ [nil, '', '/', '//'].each do |base_path|
+ config.base_path = base_path
+ # uncomment below to test trailing slashes
+ # expect(config.base_url).to eq("https://api.mercadolibre.com")
+ end
+ end
+ end
+end
diff --git a/spec/models/attributes_spec.rb b/spec/models/attributes_spec.rb
new file mode 100644
index 0000000..fd959e4
--- /dev/null
+++ b/spec/models/attributes_spec.rb
@@ -0,0 +1,83 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'spec_helper'
+require 'json'
+require 'date'
+
+# Unit tests for Meli::Attributes
+# Automatically generated by openapi-generator (https://openapi-generator.tech)
+# Please update as you see appropriate
+describe 'Attributes' do
+ before do
+ # run before each test
+ @instance = Meli::Attributes.new
+ end
+
+ after do
+ # run after each test
+ end
+
+ describe 'test an instance of Attributes' do
+ it 'should create an instance of Attributes' do
+ expect(@instance).to be_instance_of(Meli::Attributes)
+ end
+ end
+ describe 'test attribute "id"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "name"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "value_id"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "value_name"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "value_struct"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "values"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "attribute_group_id"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "attribute_group_name"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+end
diff --git a/spec/models/attributes_value_struct_spec.rb b/spec/models/attributes_value_struct_spec.rb
new file mode 100644
index 0000000..ab04a86
--- /dev/null
+++ b/spec/models/attributes_value_struct_spec.rb
@@ -0,0 +1,47 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'spec_helper'
+require 'json'
+require 'date'
+
+# Unit tests for Meli::AttributesValueStruct
+# Automatically generated by openapi-generator (https://openapi-generator.tech)
+# Please update as you see appropriate
+describe 'AttributesValueStruct' do
+ before do
+ # run before each test
+ @instance = Meli::AttributesValueStruct.new
+ end
+
+ after do
+ # run after each test
+ end
+
+ describe 'test an instance of AttributesValueStruct' do
+ it 'should create an instance of AttributesValueStruct' do
+ expect(@instance).to be_instance_of(Meli::AttributesValueStruct)
+ end
+ end
+ describe 'test attribute "number"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "unit"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+end
diff --git a/spec/models/attributes_values_spec.rb b/spec/models/attributes_values_spec.rb
new file mode 100644
index 0000000..a9fddee
--- /dev/null
+++ b/spec/models/attributes_values_spec.rb
@@ -0,0 +1,53 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'spec_helper'
+require 'json'
+require 'date'
+
+# Unit tests for Meli::AttributesValues
+# Automatically generated by openapi-generator (https://openapi-generator.tech)
+# Please update as you see appropriate
+describe 'AttributesValues' do
+ before do
+ # run before each test
+ @instance = Meli::AttributesValues.new
+ end
+
+ after do
+ # run after each test
+ end
+
+ describe 'test an instance of AttributesValues' do
+ it 'should create an instance of AttributesValues' do
+ expect(@instance).to be_instance_of(Meli::AttributesValues)
+ end
+ end
+ describe 'test attribute "id"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "name"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "struct"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+end
diff --git a/spec/models/inline_object_spec.rb b/spec/models/inline_object_spec.rb
new file mode 100644
index 0000000..b1deb66
--- /dev/null
+++ b/spec/models/inline_object_spec.rb
@@ -0,0 +1,71 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'spec_helper'
+require 'json'
+require 'date'
+
+# Unit tests for Meli::InlineObject
+# Automatically generated by openapi-generator (https://openapi-generator.tech)
+# Please update as you see appropriate
+describe 'InlineObject' do
+ before do
+ # run before each test
+ @instance = Meli::InlineObject.new
+ end
+
+ after do
+ # run after each test
+ end
+
+ describe 'test an instance of InlineObject' do
+ it 'should create an instance of InlineObject' do
+ expect(@instance).to be_instance_of(Meli::InlineObject)
+ end
+ end
+ describe 'test attribute "grant_type"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "client_id"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "client_secret"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "redirect_uri"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "code"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "refresh_token"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+end
diff --git a/spec/models/item_pictures_spec.rb b/spec/models/item_pictures_spec.rb
new file mode 100644
index 0000000..4dbe871
--- /dev/null
+++ b/spec/models/item_pictures_spec.rb
@@ -0,0 +1,41 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'spec_helper'
+require 'json'
+require 'date'
+
+# Unit tests for Meli::ItemPictures
+# Automatically generated by openapi-generator (https://openapi-generator.tech)
+# Please update as you see appropriate
+describe 'ItemPictures' do
+ before do
+ # run before each test
+ @instance = Meli::ItemPictures.new
+ end
+
+ after do
+ # run after each test
+ end
+
+ describe 'test an instance of ItemPictures' do
+ it 'should create an instance of ItemPictures' do
+ expect(@instance).to be_instance_of(Meli::ItemPictures)
+ end
+ end
+ describe 'test attribute "source"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+end
diff --git a/spec/models/item_spec.rb b/spec/models/item_spec.rb
new file mode 100644
index 0000000..a1726b8
--- /dev/null
+++ b/spec/models/item_spec.rb
@@ -0,0 +1,113 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'spec_helper'
+require 'json'
+require 'date'
+
+# Unit tests for Meli::Item
+# Automatically generated by openapi-generator (https://openapi-generator.tech)
+# Please update as you see appropriate
+describe 'Item' do
+ before do
+ # run before each test
+ @instance = Meli::Item.new
+ end
+
+ after do
+ # run after each test
+ end
+
+ describe 'test an instance of Item' do
+ it 'should create an instance of Item' do
+ expect(@instance).to be_instance_of(Meli::Item)
+ end
+ end
+ describe 'test attribute "title"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "category_id"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "price"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "currency_id"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "available_quantity"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "buying_mode"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "listing_type_id"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "condition"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "description"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "video_id"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "pictures"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "attributes"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "variations"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+end
diff --git a/spec/models/variations_attribute_combinations_spec.rb b/spec/models/variations_attribute_combinations_spec.rb
new file mode 100644
index 0000000..4342ebc
--- /dev/null
+++ b/spec/models/variations_attribute_combinations_spec.rb
@@ -0,0 +1,53 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'spec_helper'
+require 'json'
+require 'date'
+
+# Unit tests for Meli::VariationsAttributeCombinations
+# Automatically generated by openapi-generator (https://openapi-generator.tech)
+# Please update as you see appropriate
+describe 'VariationsAttributeCombinations' do
+ before do
+ # run before each test
+ @instance = Meli::VariationsAttributeCombinations.new
+ end
+
+ after do
+ # run after each test
+ end
+
+ describe 'test an instance of VariationsAttributeCombinations' do
+ it 'should create an instance of VariationsAttributeCombinations' do
+ expect(@instance).to be_instance_of(Meli::VariationsAttributeCombinations)
+ end
+ end
+ describe 'test attribute "name"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "value_id"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "value_name"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+end
diff --git a/spec/models/variations_spec.rb b/spec/models/variations_spec.rb
new file mode 100644
index 0000000..c4b8290
--- /dev/null
+++ b/spec/models/variations_spec.rb
@@ -0,0 +1,65 @@
+=begin
+#MELI Markeplace SDK
+
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+require 'spec_helper'
+require 'json'
+require 'date'
+
+# Unit tests for Meli::Variations
+# Automatically generated by openapi-generator (https://openapi-generator.tech)
+# Please update as you see appropriate
+describe 'Variations' do
+ before do
+ # run before each test
+ @instance = Meli::Variations.new
+ end
+
+ after do
+ # run after each test
+ end
+
+ describe 'test an instance of Variations' do
+ it 'should create an instance of Variations' do
+ expect(@instance).to be_instance_of(Meli::Variations)
+ end
+ end
+ describe 'test attribute "price"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "attribute_combinations"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "available_quantity"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "sold_quantity"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+ describe 'test attribute "picture_ids"' do
+ it 'should work' do
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+ end
+ end
+
+end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 65049f0..8873f12 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,3 +1,111 @@
-require File.expand_path(File.dirname(__FILE__) + '/../lib/meli')
+=begin
+#MELI Markeplace SDK
-require 'yaml'
+#This is a the codebase to generate a SDK for Open Platform Marketplace
+
+The version of the OpenAPI document: 3.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 4.3.1
+
+=end
+
+# load the gem
+require 'Meli'
+
+# The following was generated by the `rspec --init` command. Conventionally, all
+# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
+# The generated `.rspec` file contains `--require spec_helper` which will cause
+# this file to always be loaded, without a need to explicitly require it in any
+# files.
+#
+# Given that it is always loaded, you are encouraged to keep this file as
+# light-weight as possible. Requiring heavyweight dependencies from this file
+# will add to the boot time of your test suite on EVERY test run, even for an
+# individual file that may not need all of that loaded. Instead, consider making
+# a separate helper file that requires the additional dependencies and performs
+# the additional setup, and require it from the spec files that actually need
+# it.
+#
+# The `.rspec` file also contains a few flags that are not defaults but that
+# users commonly want.
+#
+# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
+RSpec.configure do |config|
+ # rspec-expectations config goes here. You can use an alternate
+ # assertion/expectation library such as wrong or the stdlib/minitest
+ # assertions if you prefer.
+ config.expect_with :rspec do |expectations|
+ # This option will default to `true` in RSpec 4. It makes the `description`
+ # and `failure_message` of custom matchers include text for helper methods
+ # defined using `chain`, e.g.:
+ # be_bigger_than(2).and_smaller_than(4).description
+ # # => "be bigger than 2 and smaller than 4"
+ # ...rather than:
+ # # => "be bigger than 2"
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
+ end
+
+ # rspec-mocks config goes here. You can use an alternate test double
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
+ config.mock_with :rspec do |mocks|
+ # Prevents you from mocking or stubbing a method that does not exist on
+ # a real object. This is generally recommended, and will default to
+ # `true` in RSpec 4.
+ mocks.verify_partial_doubles = true
+ end
+
+# The settings below are suggested to provide a good initial experience
+# with RSpec, but feel free to customize to your heart's content.
+=begin
+ # These two settings work together to allow you to limit a spec run
+ # to individual examples or groups you care about by tagging them with
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
+ # get run.
+ config.filter_run :focus
+ config.run_all_when_everything_filtered = true
+
+ # Allows RSpec to persist some state between runs in order to support
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
+ # you configure your source control system to ignore this file.
+ config.example_status_persistence_file_path = "spec/examples.txt"
+
+ # Limits the available syntax to the non-monkey patched syntax that is
+ # recommended. For more details, see:
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
+ config.disable_monkey_patching!
+
+ # This setting enables warnings. It's recommended, but in some cases may
+ # be too noisy due to issues in dependencies.
+ config.warnings = true
+
+ # Many RSpec users commonly either run the entire suite or an individual
+ # file, and it's useful to allow more verbose output when running an
+ # individual spec file.
+ if config.files_to_run.one?
+ # Use the documentation formatter for detailed output,
+ # unless a formatter has already been configured
+ # (e.g. via a command-line flag).
+ config.default_formatter = 'doc'
+ end
+
+ # Print the 10 slowest examples and example groups at the
+ # end of the spec run, to help surface which specs are running
+ # particularly slow.
+ config.profile_examples = 10
+
+ # Run specs in random order to surface order dependencies. If you find an
+ # order dependency and want to debug it, you can fix the order by providing
+ # the seed, which is printed after each run.
+ # --seed 1234
+ config.order = :random
+
+ # Seed global randomization in this process using the `--seed` CLI option.
+ # Setting this allows you to use `--seed` to deterministically reproduce
+ # test failures related to randomization by passing the same `--seed` value
+ # as the one that triggered the failure.
+ Kernel.srand config.seed
+=end
+end