Creizer-Meli 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +137 -0
- data/Rakefile +10 -0
- data/creizer-meli.gemspec +33 -0
- data/docs/Attributes.md +31 -0
- data/docs/AttributesValueStruct.md +19 -0
- data/docs/AttributesValues.md +21 -0
- data/docs/CategoriesApi.md +150 -0
- data/docs/InlineObject.md +27 -0
- data/docs/Item.md +41 -0
- data/docs/ItemPictures.md +17 -0
- data/docs/ItemsApi.md +152 -0
- data/docs/ItemsHealthApi.md +150 -0
- data/docs/OAuth20Api.md +117 -0
- data/docs/RestClientApi.md +204 -0
- data/docs/Variations.md +25 -0
- data/docs/VariationsAttributeCombinations.md +21 -0
- data/examples/get_token.rb +21 -0
- data/examples/restclient_post.rb +73 -0
- data/lib/meli.rb +52 -0
- data/lib/meli/api/categories_api.rb +216 -0
- data/lib/meli/api/items_api.rb +226 -0
- data/lib/meli/api/items_health_api.rb +216 -0
- data/lib/meli/api/o_auth20_api.rb +178 -0
- data/lib/meli/api/rest_client_api.rb +306 -0
- data/lib/meli/api_client.rb +387 -0
- data/lib/meli/api_error.rb +57 -0
- data/lib/meli/configuration.rb +297 -0
- data/lib/meli/models/attributes.rb +273 -0
- data/lib/meli/models/attributes_value_struct.rb +215 -0
- data/lib/meli/models/attributes_values.rb +226 -0
- data/lib/meli/models/inline_object.rb +251 -0
- data/lib/meli/models/item.rb +375 -0
- data/lib/meli/models/item_pictures.rb +206 -0
- data/lib/meli/models/variations.rb +246 -0
- data/lib/meli/models/variations_attribute_combinations.rb +224 -0
- data/lib/meli/version.rb +15 -0
- data/spec/api/categories_api_spec.rb +70 -0
- data/spec/api/items_api_spec.rb +71 -0
- data/spec/api/items_health_api_spec.rb +70 -0
- data/spec/api/o_auth20_api_spec.rb +65 -0
- data/spec/api/rest_client_api_spec.rb +85 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/attributes_spec.rb +83 -0
- data/spec/models/attributes_value_struct_spec.rb +47 -0
- data/spec/models/attributes_values_spec.rb +53 -0
- data/spec/models/inline_object_spec.rb +71 -0
- data/spec/models/item_pictures_spec.rb +41 -0
- data/spec/models/item_spec.rb +113 -0
- data/spec/models/variations_attribute_combinations_spec.rb +53 -0
- data/spec/models/variations_spec.rb +65 -0
- data/spec/spec_helper.rb +111 -0
- metadata +173 -0
@@ -0,0 +1,226 @@
|
|
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 ItemsApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Return a Item.
|
23
|
+
# @param id [String]
|
24
|
+
# @param [Hash] opts the optional parameters
|
25
|
+
# @return [Object]
|
26
|
+
def items_id_get(id, opts = {})
|
27
|
+
data, _status_code, _headers = items_id_get_with_http_info(id, opts)
|
28
|
+
data
|
29
|
+
end
|
30
|
+
|
31
|
+
# Return a Item.
|
32
|
+
# @param 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 items_id_get_with_http_info(id, opts = {})
|
36
|
+
if @api_client.config.debugging
|
37
|
+
@api_client.config.logger.debug 'Calling API: ItemsApi.items_id_get ...'
|
38
|
+
end
|
39
|
+
# verify the required parameter 'id' is set
|
40
|
+
if @api_client.config.client_side_validation && id.nil?
|
41
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ItemsApi.items_id_get"
|
42
|
+
end
|
43
|
+
# resource path
|
44
|
+
local_var_path = '/items/{id}'.sub('{' + 'id' + '}', CGI.escape(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: ItemsApi#items_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
78
|
+
end
|
79
|
+
return data, status_code, headers
|
80
|
+
end
|
81
|
+
|
82
|
+
# Update a Item.
|
83
|
+
# @param id [String]
|
84
|
+
# @param access_token [String]
|
85
|
+
# @param item [Item]
|
86
|
+
# @param [Hash] opts the optional parameters
|
87
|
+
# @return [Object]
|
88
|
+
def items_id_put(id, access_token, item, opts = {})
|
89
|
+
data, _status_code, _headers = items_id_put_with_http_info(id, access_token, item, opts)
|
90
|
+
data
|
91
|
+
end
|
92
|
+
|
93
|
+
# Update a Item.
|
94
|
+
# @param id [String]
|
95
|
+
# @param access_token [String]
|
96
|
+
# @param item [Item]
|
97
|
+
# @param [Hash] opts the optional parameters
|
98
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
99
|
+
def items_id_put_with_http_info(id, access_token, item, opts = {})
|
100
|
+
if @api_client.config.debugging
|
101
|
+
@api_client.config.logger.debug 'Calling API: ItemsApi.items_id_put ...'
|
102
|
+
end
|
103
|
+
# verify the required parameter 'id' is set
|
104
|
+
if @api_client.config.client_side_validation && id.nil?
|
105
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ItemsApi.items_id_put"
|
106
|
+
end
|
107
|
+
# verify the required parameter 'access_token' is set
|
108
|
+
if @api_client.config.client_side_validation && access_token.nil?
|
109
|
+
fail ArgumentError, "Missing the required parameter 'access_token' when calling ItemsApi.items_id_put"
|
110
|
+
end
|
111
|
+
# verify the required parameter 'item' is set
|
112
|
+
if @api_client.config.client_side_validation && item.nil?
|
113
|
+
fail ArgumentError, "Missing the required parameter 'item' when calling ItemsApi.items_id_put"
|
114
|
+
end
|
115
|
+
# resource path
|
116
|
+
local_var_path = '/items/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
117
|
+
|
118
|
+
# query parameters
|
119
|
+
query_params = opts[:query_params] || {}
|
120
|
+
query_params[:'access_token'] = access_token
|
121
|
+
|
122
|
+
# header parameters
|
123
|
+
header_params = opts[:header_params] || {}
|
124
|
+
# HTTP header 'Accept' (if needed)
|
125
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
126
|
+
# HTTP header 'Content-Type'
|
127
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
128
|
+
|
129
|
+
# form parameters
|
130
|
+
form_params = opts[:form_params] || {}
|
131
|
+
|
132
|
+
# http body (model)
|
133
|
+
post_body = opts[:body] || @api_client.object_to_http_body(item)
|
134
|
+
|
135
|
+
# return_type
|
136
|
+
return_type = opts[:return_type] || 'Object'
|
137
|
+
|
138
|
+
# auth_names
|
139
|
+
auth_names = opts[:auth_names] || []
|
140
|
+
|
141
|
+
new_options = opts.merge(
|
142
|
+
:header_params => header_params,
|
143
|
+
:query_params => query_params,
|
144
|
+
:form_params => form_params,
|
145
|
+
:body => post_body,
|
146
|
+
:auth_names => auth_names,
|
147
|
+
:return_type => return_type
|
148
|
+
)
|
149
|
+
|
150
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
|
151
|
+
if @api_client.config.debugging
|
152
|
+
@api_client.config.logger.debug "API called: ItemsApi#items_id_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
153
|
+
end
|
154
|
+
return data, status_code, headers
|
155
|
+
end
|
156
|
+
|
157
|
+
# Create a Item.
|
158
|
+
# @param access_token [String]
|
159
|
+
# @param item [Item]
|
160
|
+
# @param [Hash] opts the optional parameters
|
161
|
+
# @return [Object]
|
162
|
+
def items_post(access_token, item, opts = {})
|
163
|
+
data, _status_code, _headers = items_post_with_http_info(access_token, item, opts)
|
164
|
+
data
|
165
|
+
end
|
166
|
+
|
167
|
+
# Create a Item.
|
168
|
+
# @param access_token [String]
|
169
|
+
# @param item [Item]
|
170
|
+
# @param [Hash] opts the optional parameters
|
171
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
172
|
+
def items_post_with_http_info(access_token, item, opts = {})
|
173
|
+
if @api_client.config.debugging
|
174
|
+
@api_client.config.logger.debug 'Calling API: ItemsApi.items_post ...'
|
175
|
+
end
|
176
|
+
# verify the required parameter 'access_token' is set
|
177
|
+
if @api_client.config.client_side_validation && access_token.nil?
|
178
|
+
fail ArgumentError, "Missing the required parameter 'access_token' when calling ItemsApi.items_post"
|
179
|
+
end
|
180
|
+
# verify the required parameter 'item' is set
|
181
|
+
if @api_client.config.client_side_validation && item.nil?
|
182
|
+
fail ArgumentError, "Missing the required parameter 'item' when calling ItemsApi.items_post"
|
183
|
+
end
|
184
|
+
# resource path
|
185
|
+
local_var_path = '/items'
|
186
|
+
|
187
|
+
# query parameters
|
188
|
+
query_params = opts[:query_params] || {}
|
189
|
+
query_params[:'access_token'] = access_token
|
190
|
+
|
191
|
+
# header parameters
|
192
|
+
header_params = opts[:header_params] || {}
|
193
|
+
# HTTP header 'Accept' (if needed)
|
194
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
195
|
+
# HTTP header 'Content-Type'
|
196
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
197
|
+
|
198
|
+
# form parameters
|
199
|
+
form_params = opts[:form_params] || {}
|
200
|
+
|
201
|
+
# http body (model)
|
202
|
+
post_body = opts[:body] || @api_client.object_to_http_body(item)
|
203
|
+
|
204
|
+
# return_type
|
205
|
+
return_type = opts[:return_type] || 'Object'
|
206
|
+
|
207
|
+
# auth_names
|
208
|
+
auth_names = opts[:auth_names] || []
|
209
|
+
|
210
|
+
new_options = opts.merge(
|
211
|
+
:header_params => header_params,
|
212
|
+
:query_params => query_params,
|
213
|
+
:form_params => form_params,
|
214
|
+
:body => post_body,
|
215
|
+
:auth_names => auth_names,
|
216
|
+
:return_type => return_type
|
217
|
+
)
|
218
|
+
|
219
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
220
|
+
if @api_client.config.debugging
|
221
|
+
@api_client.config.logger.debug "API called: ItemsApi#items_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
222
|
+
end
|
223
|
+
return data, status_code, headers
|
224
|
+
end
|
225
|
+
end
|
226
|
+
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 ItemsHealthApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Return item health actions by id.
|
23
|
+
# @param id [String]
|
24
|
+
# @param access_token [String]
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @return [Object]
|
27
|
+
def items_id_health_actions_get(id, access_token, opts = {})
|
28
|
+
data, _status_code, _headers = items_id_health_actions_get_with_http_info(id, access_token, opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Return item health actions by id.
|
33
|
+
# @param id [String]
|
34
|
+
# @param access_token [String]
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
37
|
+
def items_id_health_actions_get_with_http_info(id, access_token, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: ItemsHealthApi.items_id_health_actions_get ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'id' is set
|
42
|
+
if @api_client.config.client_side_validation && id.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ItemsHealthApi.items_id_health_actions_get"
|
44
|
+
end
|
45
|
+
# verify the required parameter 'access_token' is set
|
46
|
+
if @api_client.config.client_side_validation && access_token.nil?
|
47
|
+
fail ArgumentError, "Missing the required parameter 'access_token' when calling ItemsHealthApi.items_id_health_actions_get"
|
48
|
+
end
|
49
|
+
# resource path
|
50
|
+
local_var_path = '/items/{id}/health/actions'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
51
|
+
|
52
|
+
# query parameters
|
53
|
+
query_params = opts[:query_params] || {}
|
54
|
+
query_params[:'access_token'] = access_token
|
55
|
+
|
56
|
+
# header parameters
|
57
|
+
header_params = opts[:header_params] || {}
|
58
|
+
# HTTP header 'Accept' (if needed)
|
59
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
60
|
+
|
61
|
+
# form parameters
|
62
|
+
form_params = opts[:form_params] || {}
|
63
|
+
|
64
|
+
# http body (model)
|
65
|
+
post_body = opts[:body]
|
66
|
+
|
67
|
+
# return_type
|
68
|
+
return_type = opts[:return_type] || 'Object'
|
69
|
+
|
70
|
+
# auth_names
|
71
|
+
auth_names = opts[:auth_names] || []
|
72
|
+
|
73
|
+
new_options = opts.merge(
|
74
|
+
:header_params => header_params,
|
75
|
+
:query_params => query_params,
|
76
|
+
:form_params => form_params,
|
77
|
+
:body => post_body,
|
78
|
+
:auth_names => auth_names,
|
79
|
+
:return_type => return_type
|
80
|
+
)
|
81
|
+
|
82
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
83
|
+
if @api_client.config.debugging
|
84
|
+
@api_client.config.logger.debug "API called: ItemsHealthApi#items_id_health_actions_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
85
|
+
end
|
86
|
+
return data, status_code, headers
|
87
|
+
end
|
88
|
+
|
89
|
+
# Return health by id.
|
90
|
+
# @param id [String]
|
91
|
+
# @param access_token [String]
|
92
|
+
# @param [Hash] opts the optional parameters
|
93
|
+
# @return [Object]
|
94
|
+
def items_id_health_get(id, access_token, opts = {})
|
95
|
+
data, _status_code, _headers = items_id_health_get_with_http_info(id, access_token, opts)
|
96
|
+
data
|
97
|
+
end
|
98
|
+
|
99
|
+
# Return health by id.
|
100
|
+
# @param id [String]
|
101
|
+
# @param access_token [String]
|
102
|
+
# @param [Hash] opts the optional parameters
|
103
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
104
|
+
def items_id_health_get_with_http_info(id, access_token, opts = {})
|
105
|
+
if @api_client.config.debugging
|
106
|
+
@api_client.config.logger.debug 'Calling API: ItemsHealthApi.items_id_health_get ...'
|
107
|
+
end
|
108
|
+
# verify the required parameter 'id' is set
|
109
|
+
if @api_client.config.client_side_validation && id.nil?
|
110
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ItemsHealthApi.items_id_health_get"
|
111
|
+
end
|
112
|
+
# verify the required parameter 'access_token' is set
|
113
|
+
if @api_client.config.client_side_validation && access_token.nil?
|
114
|
+
fail ArgumentError, "Missing the required parameter 'access_token' when calling ItemsHealthApi.items_id_health_get"
|
115
|
+
end
|
116
|
+
# resource path
|
117
|
+
local_var_path = '/items/{id}/health'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
118
|
+
|
119
|
+
# query parameters
|
120
|
+
query_params = opts[:query_params] || {}
|
121
|
+
query_params[:'access_token'] = access_token
|
122
|
+
|
123
|
+
# header parameters
|
124
|
+
header_params = opts[:header_params] || {}
|
125
|
+
# HTTP header 'Accept' (if needed)
|
126
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
127
|
+
|
128
|
+
# form parameters
|
129
|
+
form_params = opts[:form_params] || {}
|
130
|
+
|
131
|
+
# http body (model)
|
132
|
+
post_body = opts[:body]
|
133
|
+
|
134
|
+
# return_type
|
135
|
+
return_type = opts[:return_type] || 'Object'
|
136
|
+
|
137
|
+
# auth_names
|
138
|
+
auth_names = opts[:auth_names] || []
|
139
|
+
|
140
|
+
new_options = opts.merge(
|
141
|
+
:header_params => header_params,
|
142
|
+
:query_params => query_params,
|
143
|
+
:form_params => form_params,
|
144
|
+
:body => post_body,
|
145
|
+
:auth_names => auth_names,
|
146
|
+
:return_type => return_type
|
147
|
+
)
|
148
|
+
|
149
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
150
|
+
if @api_client.config.debugging
|
151
|
+
@api_client.config.logger.debug "API called: ItemsHealthApi#items_id_health_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
152
|
+
end
|
153
|
+
return data, status_code, headers
|
154
|
+
end
|
155
|
+
|
156
|
+
# Return health levels.
|
157
|
+
# @param site_id [String]
|
158
|
+
# @param [Hash] opts the optional parameters
|
159
|
+
# @return [Object]
|
160
|
+
def sites_site_id_health_levels_get(site_id, opts = {})
|
161
|
+
data, _status_code, _headers = sites_site_id_health_levels_get_with_http_info(site_id, opts)
|
162
|
+
data
|
163
|
+
end
|
164
|
+
|
165
|
+
# Return health levels.
|
166
|
+
# @param site_id [String]
|
167
|
+
# @param [Hash] opts the optional parameters
|
168
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
169
|
+
def sites_site_id_health_levels_get_with_http_info(site_id, opts = {})
|
170
|
+
if @api_client.config.debugging
|
171
|
+
@api_client.config.logger.debug 'Calling API: ItemsHealthApi.sites_site_id_health_levels_get ...'
|
172
|
+
end
|
173
|
+
# verify the required parameter 'site_id' is set
|
174
|
+
if @api_client.config.client_side_validation && site_id.nil?
|
175
|
+
fail ArgumentError, "Missing the required parameter 'site_id' when calling ItemsHealthApi.sites_site_id_health_levels_get"
|
176
|
+
end
|
177
|
+
# resource path
|
178
|
+
local_var_path = '/sites/{site_id}/health_levels'.sub('{' + 'site_id' + '}', CGI.escape(site_id.to_s))
|
179
|
+
|
180
|
+
# query parameters
|
181
|
+
query_params = opts[:query_params] || {}
|
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: ItemsHealthApi#sites_site_id_health_levels_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
212
|
+
end
|
213
|
+
return data, status_code, headers
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
@@ -0,0 +1,178 @@
|
|
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 OAuth20Api
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Authentication Endpoint
|
23
|
+
# @param response_type [String]
|
24
|
+
# @param client_id [String]
|
25
|
+
# @param redirect_uri [String]
|
26
|
+
# @param [Hash] opts the optional parameters
|
27
|
+
# @return [nil]
|
28
|
+
def auth(response_type, client_id, redirect_uri, opts = {})
|
29
|
+
auth_with_http_info(response_type, client_id, redirect_uri, opts)
|
30
|
+
nil
|
31
|
+
end
|
32
|
+
|
33
|
+
# Authentication Endpoint
|
34
|
+
# @param response_type [String]
|
35
|
+
# @param client_id [String]
|
36
|
+
# @param redirect_uri [String]
|
37
|
+
# @param [Hash] opts the optional parameters
|
38
|
+
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
39
|
+
def auth_with_http_info(response_type, client_id, redirect_uri, opts = {})
|
40
|
+
if @api_client.config.debugging
|
41
|
+
@api_client.config.logger.debug 'Calling API: OAuth20Api.auth ...'
|
42
|
+
end
|
43
|
+
# verify the required parameter 'response_type' is set
|
44
|
+
if @api_client.config.client_side_validation && response_type.nil?
|
45
|
+
fail ArgumentError, "Missing the required parameter 'response_type' when calling OAuth20Api.auth"
|
46
|
+
end
|
47
|
+
# verify enum value
|
48
|
+
allowable_values = ["code"]
|
49
|
+
if @api_client.config.client_side_validation && !allowable_values.include?(response_type)
|
50
|
+
fail ArgumentError, "invalid value for \"response_type\", must be one of #{allowable_values}"
|
51
|
+
end
|
52
|
+
# verify the required parameter 'client_id' is set
|
53
|
+
if @api_client.config.client_side_validation && client_id.nil?
|
54
|
+
fail ArgumentError, "Missing the required parameter 'client_id' when calling OAuth20Api.auth"
|
55
|
+
end
|
56
|
+
# verify the required parameter 'redirect_uri' is set
|
57
|
+
if @api_client.config.client_side_validation && redirect_uri.nil?
|
58
|
+
fail ArgumentError, "Missing the required parameter 'redirect_uri' when calling OAuth20Api.auth"
|
59
|
+
end
|
60
|
+
# resource path
|
61
|
+
local_var_path = '/authorization'
|
62
|
+
|
63
|
+
# query parameters
|
64
|
+
query_params = opts[:query_params] || {}
|
65
|
+
query_params[:'response_type'] = response_type
|
66
|
+
query_params[:'client_id'] = client_id
|
67
|
+
query_params[:'redirect_uri'] = redirect_uri
|
68
|
+
|
69
|
+
# header parameters
|
70
|
+
header_params = opts[:header_params] || {}
|
71
|
+
# HTTP header 'Accept' (if needed)
|
72
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
73
|
+
|
74
|
+
# form parameters
|
75
|
+
form_params = opts[:form_params] || {}
|
76
|
+
|
77
|
+
# http body (model)
|
78
|
+
post_body = opts[:body]
|
79
|
+
|
80
|
+
# return_type
|
81
|
+
return_type = opts[:return_type]
|
82
|
+
|
83
|
+
# auth_names
|
84
|
+
auth_names = opts[:auth_names] || []
|
85
|
+
|
86
|
+
new_options = opts.merge(
|
87
|
+
:header_params => header_params,
|
88
|
+
:query_params => query_params,
|
89
|
+
:form_params => form_params,
|
90
|
+
:body => post_body,
|
91
|
+
:auth_names => auth_names,
|
92
|
+
:return_type => return_type
|
93
|
+
)
|
94
|
+
|
95
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
96
|
+
if @api_client.config.debugging
|
97
|
+
@api_client.config.logger.debug "API called: OAuth20Api#auth\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
98
|
+
end
|
99
|
+
return data, status_code, headers
|
100
|
+
end
|
101
|
+
|
102
|
+
# Request Access Token
|
103
|
+
# Partner makes a request to the token endpoint by adding the following parameters described below
|
104
|
+
# @param [Hash] opts the optional parameters
|
105
|
+
# @option opts [String] :grant_type
|
106
|
+
# @option opts [String] :client_id
|
107
|
+
# @option opts [String] :client_secret
|
108
|
+
# @option opts [String] :redirect_uri
|
109
|
+
# @option opts [String] :code
|
110
|
+
# @option opts [String] :refresh_token
|
111
|
+
# @return [Object]
|
112
|
+
def get_token(opts = {})
|
113
|
+
data, _status_code, _headers = get_token_with_http_info(opts)
|
114
|
+
data
|
115
|
+
end
|
116
|
+
|
117
|
+
# Request Access Token
|
118
|
+
# Partner makes a request to the token endpoint by adding the following parameters described below
|
119
|
+
# @param [Hash] opts the optional parameters
|
120
|
+
# @option opts [String] :grant_type
|
121
|
+
# @option opts [String] :client_id
|
122
|
+
# @option opts [String] :client_secret
|
123
|
+
# @option opts [String] :redirect_uri
|
124
|
+
# @option opts [String] :code
|
125
|
+
# @option opts [String] :refresh_token
|
126
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
127
|
+
def get_token_with_http_info(opts = {})
|
128
|
+
if @api_client.config.debugging
|
129
|
+
@api_client.config.logger.debug 'Calling API: OAuth20Api.get_token ...'
|
130
|
+
end
|
131
|
+
# resource path
|
132
|
+
local_var_path = '/oauth/token'
|
133
|
+
|
134
|
+
# query parameters
|
135
|
+
query_params = opts[:query_params] || {}
|
136
|
+
|
137
|
+
# header parameters
|
138
|
+
header_params = opts[:header_params] || {}
|
139
|
+
# HTTP header 'Accept' (if needed)
|
140
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
141
|
+
# HTTP header 'Content-Type'
|
142
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
|
143
|
+
|
144
|
+
# form parameters
|
145
|
+
form_params = opts[:form_params] || {}
|
146
|
+
form_params['grant_type'] = opts[:'grant_type'] if !opts[:'grant_type'].nil?
|
147
|
+
form_params['client_id'] = opts[:'client_id'] if !opts[:'client_id'].nil?
|
148
|
+
form_params['client_secret'] = opts[:'client_secret'] if !opts[:'client_secret'].nil?
|
149
|
+
form_params['redirect_uri'] = opts[:'redirect_uri'] if !opts[:'redirect_uri'].nil?
|
150
|
+
form_params['code'] = opts[:'code'] if !opts[:'code'].nil?
|
151
|
+
form_params['refresh_token'] = opts[:'refresh_token'] if !opts[:'refresh_token'].nil?
|
152
|
+
|
153
|
+
# http body (model)
|
154
|
+
post_body = opts[:body]
|
155
|
+
|
156
|
+
# return_type
|
157
|
+
return_type = opts[:return_type] || 'Object'
|
158
|
+
|
159
|
+
# auth_names
|
160
|
+
auth_names = opts[:auth_names] || []
|
161
|
+
|
162
|
+
new_options = opts.merge(
|
163
|
+
:header_params => header_params,
|
164
|
+
:query_params => query_params,
|
165
|
+
:form_params => form_params,
|
166
|
+
:body => post_body,
|
167
|
+
:auth_names => auth_names,
|
168
|
+
:return_type => return_type
|
169
|
+
)
|
170
|
+
|
171
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
172
|
+
if @api_client.config.debugging
|
173
|
+
@api_client.config.logger.debug "API called: OAuth20Api#get_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
174
|
+
end
|
175
|
+
return data, status_code, headers
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|