Creizer-Meli 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +137 -0
  4. data/Rakefile +10 -0
  5. data/creizer-meli.gemspec +33 -0
  6. data/docs/Attributes.md +31 -0
  7. data/docs/AttributesValueStruct.md +19 -0
  8. data/docs/AttributesValues.md +21 -0
  9. data/docs/CategoriesApi.md +150 -0
  10. data/docs/InlineObject.md +27 -0
  11. data/docs/Item.md +41 -0
  12. data/docs/ItemPictures.md +17 -0
  13. data/docs/ItemsApi.md +152 -0
  14. data/docs/ItemsHealthApi.md +150 -0
  15. data/docs/OAuth20Api.md +117 -0
  16. data/docs/RestClientApi.md +204 -0
  17. data/docs/Variations.md +25 -0
  18. data/docs/VariationsAttributeCombinations.md +21 -0
  19. data/examples/get_token.rb +21 -0
  20. data/examples/restclient_post.rb +73 -0
  21. data/lib/meli.rb +52 -0
  22. data/lib/meli/api/categories_api.rb +216 -0
  23. data/lib/meli/api/items_api.rb +226 -0
  24. data/lib/meli/api/items_health_api.rb +216 -0
  25. data/lib/meli/api/o_auth20_api.rb +178 -0
  26. data/lib/meli/api/rest_client_api.rb +306 -0
  27. data/lib/meli/api_client.rb +387 -0
  28. data/lib/meli/api_error.rb +57 -0
  29. data/lib/meli/configuration.rb +297 -0
  30. data/lib/meli/models/attributes.rb +273 -0
  31. data/lib/meli/models/attributes_value_struct.rb +215 -0
  32. data/lib/meli/models/attributes_values.rb +226 -0
  33. data/lib/meli/models/inline_object.rb +251 -0
  34. data/lib/meli/models/item.rb +375 -0
  35. data/lib/meli/models/item_pictures.rb +206 -0
  36. data/lib/meli/models/variations.rb +246 -0
  37. data/lib/meli/models/variations_attribute_combinations.rb +224 -0
  38. data/lib/meli/version.rb +15 -0
  39. data/spec/api/categories_api_spec.rb +70 -0
  40. data/spec/api/items_api_spec.rb +71 -0
  41. data/spec/api/items_health_api_spec.rb +70 -0
  42. data/spec/api/o_auth20_api_spec.rb +65 -0
  43. data/spec/api/rest_client_api_spec.rb +85 -0
  44. data/spec/api_client_spec.rb +226 -0
  45. data/spec/configuration_spec.rb +42 -0
  46. data/spec/models/attributes_spec.rb +83 -0
  47. data/spec/models/attributes_value_struct_spec.rb +47 -0
  48. data/spec/models/attributes_values_spec.rb +53 -0
  49. data/spec/models/inline_object_spec.rb +71 -0
  50. data/spec/models/item_pictures_spec.rb +41 -0
  51. data/spec/models/item_spec.rb +113 -0
  52. data/spec/models/variations_attribute_combinations_spec.rb +53 -0
  53. data/spec/models/variations_spec.rb +65 -0
  54. data/spec/spec_helper.rb +111 -0
  55. metadata +173 -0
@@ -0,0 +1,204 @@
1
+ # Meli::RestClientApi
2
+
3
+ All URIs are relative to *https://api.mercadolibre.com*
4
+
5
+ Method | HTTP request | Description
6
+ ------------- | ------------- | -------------
7
+ [**resource_delete**](RestClientApi.md#resource_delete) | **DELETE** /{resource} | Resource path DELETE
8
+ [**resource_get**](RestClientApi.md#resource_get) | **GET** /{resource} | Resource path GET
9
+ [**resource_post**](RestClientApi.md#resource_post) | **POST** /{resource} | Resourse path POST
10
+ [**resource_put**](RestClientApi.md#resource_put) | **PUT** /{resource} | Resourse path PUT
11
+
12
+
13
+
14
+ ## resource_delete
15
+
16
+ > Object resource_delete(resource, access_token)
17
+
18
+ Resource path DELETE
19
+
20
+ ### Example
21
+
22
+ ```ruby
23
+ # load the gem
24
+ require 'Meli'
25
+
26
+ api_instance = Meli::RestClientApi.new
27
+ resource = 'resource_example' # String |
28
+ access_token = 'access_token_example' # String |
29
+
30
+ begin
31
+ #Resource path DELETE
32
+ result = api_instance.resource_delete(resource, access_token)
33
+ p result
34
+ rescue Meli::ApiError => e
35
+ puts "Exception when calling RestClientApi->resource_delete: #{e}"
36
+ end
37
+ ```
38
+
39
+ ### Parameters
40
+
41
+
42
+ Name | Type | Description | Notes
43
+ ------------- | ------------- | ------------- | -------------
44
+ **resource** | **String**| |
45
+ **access_token** | **String**| |
46
+
47
+ ### Return type
48
+
49
+ **Object**
50
+
51
+ ### Authorization
52
+
53
+ No authorization required
54
+
55
+ ### HTTP request headers
56
+
57
+ - **Content-Type**: Not defined
58
+ - **Accept**: application/json
59
+
60
+
61
+ ## resource_get
62
+
63
+ > Object resource_get(resource, access_token)
64
+
65
+ Resource path GET
66
+
67
+ ### Example
68
+
69
+ ```ruby
70
+ # load the gem
71
+ require 'Meli'
72
+
73
+ api_instance = Meli::RestClientApi.new
74
+ resource = 'resource_example' # String |
75
+ access_token = 'access_token_example' # String |
76
+
77
+ begin
78
+ #Resource path GET
79
+ result = api_instance.resource_get(resource, access_token)
80
+ p result
81
+ rescue Meli::ApiError => e
82
+ puts "Exception when calling RestClientApi->resource_get: #{e}"
83
+ end
84
+ ```
85
+
86
+ ### Parameters
87
+
88
+
89
+ Name | Type | Description | Notes
90
+ ------------- | ------------- | ------------- | -------------
91
+ **resource** | **String**| |
92
+ **access_token** | **String**| |
93
+
94
+ ### Return type
95
+
96
+ **Object**
97
+
98
+ ### Authorization
99
+
100
+ No authorization required
101
+
102
+ ### HTTP request headers
103
+
104
+ - **Content-Type**: Not defined
105
+ - **Accept**: application/json
106
+
107
+
108
+ ## resource_post
109
+
110
+ > Object resource_post(resource, access_token, body)
111
+
112
+ Resourse path POST
113
+
114
+ ### Example
115
+
116
+ ```ruby
117
+ # load the gem
118
+ require 'Meli'
119
+
120
+ api_instance = Meli::RestClientApi.new
121
+ resource = 'resource_example' # String |
122
+ access_token = 'access_token_example' # String |
123
+ body = nil # Object |
124
+
125
+ begin
126
+ #Resourse path POST
127
+ result = api_instance.resource_post(resource, access_token, body)
128
+ p result
129
+ rescue Meli::ApiError => e
130
+ puts "Exception when calling RestClientApi->resource_post: #{e}"
131
+ end
132
+ ```
133
+
134
+ ### Parameters
135
+
136
+
137
+ Name | Type | Description | Notes
138
+ ------------- | ------------- | ------------- | -------------
139
+ **resource** | **String**| |
140
+ **access_token** | **String**| |
141
+ **body** | **Object**| |
142
+
143
+ ### Return type
144
+
145
+ **Object**
146
+
147
+ ### Authorization
148
+
149
+ No authorization required
150
+
151
+ ### HTTP request headers
152
+
153
+ - **Content-Type**: application/json
154
+ - **Accept**: application/json
155
+
156
+
157
+ ## resource_put
158
+
159
+ > Object resource_put(resource, access_token, body)
160
+
161
+ Resourse path PUT
162
+
163
+ ### Example
164
+
165
+ ```ruby
166
+ # load the gem
167
+ require 'Meli'
168
+
169
+ api_instance = Meli::RestClientApi.new
170
+ resource = 'resource_example' # String |
171
+ access_token = 'access_token_example' # String |
172
+ body = nil # Object |
173
+
174
+ begin
175
+ #Resourse path PUT
176
+ result = api_instance.resource_put(resource, access_token, body)
177
+ p result
178
+ rescue Meli::ApiError => e
179
+ puts "Exception when calling RestClientApi->resource_put: #{e}"
180
+ end
181
+ ```
182
+
183
+ ### Parameters
184
+
185
+
186
+ Name | Type | Description | Notes
187
+ ------------- | ------------- | ------------- | -------------
188
+ **resource** | **String**| |
189
+ **access_token** | **String**| |
190
+ **body** | **Object**| |
191
+
192
+ ### Return type
193
+
194
+ **Object**
195
+
196
+ ### Authorization
197
+
198
+ No authorization required
199
+
200
+ ### HTTP request headers
201
+
202
+ - **Content-Type**: application/json
203
+ - **Accept**: application/json
204
+
@@ -0,0 +1,25 @@
1
+ # Meli::Variations
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **price** | **Integer** | | [optional]
8
+ **attribute_combinations** | [**Array<VariationsAttributeCombinations>**](VariationsAttributeCombinations.md) | | [optional]
9
+ **available_quantity** | **Integer** | | [optional]
10
+ **sold_quantity** | **Integer** | | [optional]
11
+ **picture_ids** | **Array<String>** | | [optional]
12
+
13
+ ## Code Sample
14
+
15
+ ```ruby
16
+ require 'Meli'
17
+
18
+ instance = Meli::Variations.new(price: 350,
19
+ attribute_combinations: null,
20
+ available_quantity: 2,
21
+ sold_quantity: 0,
22
+ picture_ids: null)
23
+ ```
24
+
25
+
@@ -0,0 +1,21 @@
1
+ # Meli::VariationsAttributeCombinations
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **name** | **String** | | [optional]
8
+ **value_id** | **String** | | [optional]
9
+ **value_name** | **String** | | [optional]
10
+
11
+ ## Code Sample
12
+
13
+ ```ruby
14
+ require 'Meli'
15
+
16
+ instance = Meli::VariationsAttributeCombinations.new(name: Color,
17
+ value_id: 283165,
18
+ value_name: Gris)
19
+ ```
20
+
21
+
@@ -0,0 +1,21 @@
1
+ # You need use this code in to the main folder
2
+ # Load the gem
3
+ require 'Meli'
4
+
5
+ api_instance = Meli::OAuth20Api.new
6
+ opts = {
7
+ grant_type: 'authorization_code', # Or 'refresh_token' if you need get one new token
8
+ client_id: 'client_id_example', # Your client_id
9
+ client_secret: 'client_secret_example', # Your client_secret
10
+ redirect_uri: 'redirect_uri_example', # Your redirect_uri
11
+ code: 'code_example', # The parameter CODE who was received in the query.
12
+ refresh_token: 'refresh_token_example' # Your refresh_token
13
+ }
14
+
15
+ begin
16
+ #Request Access Token
17
+ result = api_instance.get_token(opts)
18
+ p result
19
+ rescue Meli::ApiError => e
20
+ puts "Exception when calling OAuth20Api->get_token: #{e}"
21
+ end
@@ -0,0 +1,73 @@
1
+ # You need use this code in to the main folder
2
+ # Load the gem
3
+ require 'Meli'
4
+
5
+ api_instance = Meli::RestClientApi.new
6
+ resource = 'items' # A resource example like items, search, category, etc.
7
+ access_token = 'access_token_example' # Your access token.
8
+ body = {
9
+ "title": "Item de test from ruby - No Ofertar",
10
+ "category_id": "MLA5991",
11
+ "price": "350",
12
+ "currency_id": "ARS",
13
+ "available_quantity": "12",
14
+ "buying_mode": "buy_it_now",
15
+ "listing_type_id": "bronze",
16
+ "condition": "new",
17
+ "description": "Item de Teste. Mercado Livre SDK",
18
+ "video_id": "RXWn6kftTHY",
19
+ "pictures": [
20
+ {
21
+ "source": "https://http2.mlstatic.com/storage/developers-site-cms-admin/openapi/319968615067-mp3.jpg"
22
+ }
23
+ ],
24
+ "attributes": [
25
+ {
26
+ "id": "DATA_STORAGE_CAPACITY",
27
+ "name": "Capacidad de almacenamiento de datos",
28
+ "value_id": "null",
29
+ "value_name": "8 GB",
30
+ "value_struct": {
31
+ "number": 8,
32
+ "unit": "GB"
33
+ },
34
+ "values": [
35
+ {
36
+ "id": "null",
37
+ "name": "8 GB",
38
+ "struct": {
39
+ "number": 8,
40
+ "unit": "GB"
41
+ }
42
+ }
43
+ ],
44
+ "attribute_group_id": "OTHERS",
45
+ "attribute_group_name": "Otros"
46
+ }
47
+ ],
48
+ "variations": [
49
+ {
50
+ "price": 350,
51
+ "attribute_combinations": [
52
+ {
53
+ "name": "Color",
54
+ "value_id": "283165",
55
+ "value_name": "Gris"
56
+ }
57
+ ],
58
+ "available_quantity": 2,
59
+ "sold_quantity": 0,
60
+ "picture_ids": [
61
+ "882629-MLA40983876214_032020"
62
+ ]
63
+ }
64
+ ]
65
+ }
66
+
67
+ begin
68
+ #Resourse path POST
69
+ result = api_instance.resource_post(resource, access_token, body)
70
+ p result
71
+ rescue Meli::ApiError => e
72
+ puts "Exception when calling RestClientApi->resource_post: #{e}"
73
+ end
@@ -0,0 +1,52 @@
1
+ =begin
2
+ #MELI Markeplace SDK
3
+
4
+ #This is a the codebase to generate a SDK for Open Platform Marketplace
5
+
6
+ The version of the OpenAPI document: 3.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ # Common files
14
+ require 'Meli/api_client'
15
+ require 'Meli/api_error'
16
+ require 'Meli/version'
17
+ require 'Meli/configuration'
18
+
19
+ # Models
20
+ require 'Meli/models/attributes'
21
+ require 'Meli/models/attributes_value_struct'
22
+ require 'Meli/models/attributes_values'
23
+ require 'Meli/models/inline_object'
24
+ require 'Meli/models/item'
25
+ require 'Meli/models/item_pictures'
26
+ require 'Meli/models/variations'
27
+ require 'Meli/models/variations_attribute_combinations'
28
+
29
+ # APIs
30
+ require 'Meli/api/categories_api'
31
+ require 'Meli/api/items_api'
32
+ require 'Meli/api/items_health_api'
33
+ require 'Meli/api/o_auth20_api'
34
+ require 'Meli/api/rest_client_api'
35
+
36
+ module Meli
37
+ class << self
38
+ # Customize default settings for the SDK using block.
39
+ # Meli.configure do |config|
40
+ # config.username = "xxx"
41
+ # config.password = "xxx"
42
+ # end
43
+ # If no block given, return the default Configuration object.
44
+ def configure
45
+ if block_given?
46
+ yield(Configuration.default)
47
+ else
48
+ Configuration.default
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,216 @@
1
+ =begin
2
+ #MELI Markeplace SDK
3
+
4
+ #This is a the codebase to generate a SDK for Open Platform Marketplace
5
+
6
+ The version of the OpenAPI document: 3.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Meli
16
+ class CategoriesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Return by category.
23
+ # @param category_id [String]
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [Object]
26
+ def categories_category_id_get(category_id, opts = {})
27
+ data, _status_code, _headers = categories_category_id_get_with_http_info(category_id, opts)
28
+ data
29
+ end
30
+
31
+ # Return by category.
32
+ # @param category_id [String]
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
35
+ def categories_category_id_get_with_http_info(category_id, opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: CategoriesApi.categories_category_id_get ...'
38
+ end
39
+ # verify the required parameter 'category_id' is set
40
+ if @api_client.config.client_side_validation && category_id.nil?
41
+ fail ArgumentError, "Missing the required parameter 'category_id' when calling CategoriesApi.categories_category_id_get"
42
+ end
43
+ # resource path
44
+ local_var_path = '/categories/{category_id}'.sub('{' + 'category_id' + '}', CGI.escape(category_id.to_s))
45
+
46
+ # query parameters
47
+ query_params = opts[:query_params] || {}
48
+
49
+ # header parameters
50
+ header_params = opts[:header_params] || {}
51
+ # HTTP header 'Accept' (if needed)
52
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
53
+
54
+ # form parameters
55
+ form_params = opts[:form_params] || {}
56
+
57
+ # http body (model)
58
+ post_body = opts[:body]
59
+
60
+ # return_type
61
+ return_type = opts[:return_type] || 'Object'
62
+
63
+ # auth_names
64
+ auth_names = opts[:auth_names] || []
65
+
66
+ new_options = opts.merge(
67
+ :header_params => header_params,
68
+ :query_params => query_params,
69
+ :form_params => form_params,
70
+ :body => post_body,
71
+ :auth_names => auth_names,
72
+ :return_type => return_type
73
+ )
74
+
75
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
76
+ if @api_client.config.debugging
77
+ @api_client.config.logger.debug "API called: CategoriesApi#categories_category_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
78
+ end
79
+ return data, status_code, headers
80
+ end
81
+
82
+ # Return a categories by site.
83
+ # @param site_id [String]
84
+ # @param [Hash] opts the optional parameters
85
+ # @return [Object]
86
+ def sites_site_id_categories_get(site_id, opts = {})
87
+ data, _status_code, _headers = sites_site_id_categories_get_with_http_info(site_id, opts)
88
+ data
89
+ end
90
+
91
+ # Return a categories by site.
92
+ # @param site_id [String]
93
+ # @param [Hash] opts the optional parameters
94
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
95
+ def sites_site_id_categories_get_with_http_info(site_id, opts = {})
96
+ if @api_client.config.debugging
97
+ @api_client.config.logger.debug 'Calling API: CategoriesApi.sites_site_id_categories_get ...'
98
+ end
99
+ # verify the required parameter 'site_id' is set
100
+ if @api_client.config.client_side_validation && site_id.nil?
101
+ fail ArgumentError, "Missing the required parameter 'site_id' when calling CategoriesApi.sites_site_id_categories_get"
102
+ end
103
+ # resource path
104
+ local_var_path = '/sites/{site_id}/categories'.sub('{' + 'site_id' + '}', CGI.escape(site_id.to_s))
105
+
106
+ # query parameters
107
+ query_params = opts[:query_params] || {}
108
+
109
+ # header parameters
110
+ header_params = opts[:header_params] || {}
111
+ # HTTP header 'Accept' (if needed)
112
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
113
+
114
+ # form parameters
115
+ form_params = opts[:form_params] || {}
116
+
117
+ # http body (model)
118
+ post_body = opts[:body]
119
+
120
+ # return_type
121
+ return_type = opts[:return_type] || 'Object'
122
+
123
+ # auth_names
124
+ auth_names = opts[:auth_names] || []
125
+
126
+ new_options = opts.merge(
127
+ :header_params => header_params,
128
+ :query_params => query_params,
129
+ :form_params => form_params,
130
+ :body => post_body,
131
+ :auth_names => auth_names,
132
+ :return_type => return_type
133
+ )
134
+
135
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
136
+ if @api_client.config.debugging
137
+ @api_client.config.logger.debug "API called: CategoriesApi#sites_site_id_categories_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
138
+ end
139
+ return data, status_code, headers
140
+ end
141
+
142
+ # Predictor
143
+ # @param site_id [String]
144
+ # @param q [String]
145
+ # @param limit [String]
146
+ # @param [Hash] opts the optional parameters
147
+ # @return [Object]
148
+ def sites_site_id_domain_discovery_search_get(site_id, q, limit, opts = {})
149
+ data, _status_code, _headers = sites_site_id_domain_discovery_search_get_with_http_info(site_id, q, limit, opts)
150
+ data
151
+ end
152
+
153
+ # Predictor
154
+ # @param site_id [String]
155
+ # @param q [String]
156
+ # @param limit [String]
157
+ # @param [Hash] opts the optional parameters
158
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
159
+ def sites_site_id_domain_discovery_search_get_with_http_info(site_id, q, limit, opts = {})
160
+ if @api_client.config.debugging
161
+ @api_client.config.logger.debug 'Calling API: CategoriesApi.sites_site_id_domain_discovery_search_get ...'
162
+ end
163
+ # verify the required parameter 'site_id' is set
164
+ if @api_client.config.client_side_validation && site_id.nil?
165
+ fail ArgumentError, "Missing the required parameter 'site_id' when calling CategoriesApi.sites_site_id_domain_discovery_search_get"
166
+ end
167
+ # verify the required parameter 'q' is set
168
+ if @api_client.config.client_side_validation && q.nil?
169
+ fail ArgumentError, "Missing the required parameter 'q' when calling CategoriesApi.sites_site_id_domain_discovery_search_get"
170
+ end
171
+ # verify the required parameter 'limit' is set
172
+ if @api_client.config.client_side_validation && limit.nil?
173
+ fail ArgumentError, "Missing the required parameter 'limit' when calling CategoriesApi.sites_site_id_domain_discovery_search_get"
174
+ end
175
+ # resource path
176
+ local_var_path = '/sites/{site_id}/domain_discovery/search'.sub('{' + 'site_id' + '}', CGI.escape(site_id.to_s))
177
+
178
+ # query parameters
179
+ query_params = opts[:query_params] || {}
180
+ query_params[:'q'] = q
181
+ query_params[:'limit'] = limit
182
+
183
+ # header parameters
184
+ header_params = opts[:header_params] || {}
185
+ # HTTP header 'Accept' (if needed)
186
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
187
+
188
+ # form parameters
189
+ form_params = opts[:form_params] || {}
190
+
191
+ # http body (model)
192
+ post_body = opts[:body]
193
+
194
+ # return_type
195
+ return_type = opts[:return_type] || 'Object'
196
+
197
+ # auth_names
198
+ auth_names = opts[:auth_names] || []
199
+
200
+ new_options = opts.merge(
201
+ :header_params => header_params,
202
+ :query_params => query_params,
203
+ :form_params => form_params,
204
+ :body => post_body,
205
+ :auth_names => auth_names,
206
+ :return_type => return_type
207
+ )
208
+
209
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
210
+ if @api_client.config.debugging
211
+ @api_client.config.logger.debug "API called: CategoriesApi#sites_site_id_domain_discovery_search_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
212
+ end
213
+ return data, status_code, headers
214
+ end
215
+ end
216
+ end