Creizer-Meli 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +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
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 872ea3fc54681abb85d61906c2bd003abae15793
|
4
|
+
data.tar.gz: 5513d1c5ab1239a2f3b826e8f23d08692c546e49
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b5fb3cb9d98ae965091e715fac6a5815e67076924ca8617d9f730926e0b088cab39e0c533a52024d58c44d0f6f590166e90b4724a4596bee83e5920e40e945fe
|
7
|
+
data.tar.gz: 98a0e5f88adfd3e31a095156a9e7c6379013b995e65a62788f173ba44401764bacce616e840245a8d187aa877ef2eef0997767755ba8b74b02a6058494f7db2d
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
|
2
|
+
<h1 align="center">
|
3
|
+
<a href="https://developers.mercadolibre.com">
|
4
|
+
<img src="https://user-images.githubusercontent.com/1153516/29861072-689ec57e-8d3e-11e7-8368-dd923543258f.jpg" alt="Mercado Libre Developers" width="230"></a>
|
5
|
+
</a>
|
6
|
+
<br><br>
|
7
|
+
MercadoLibre's Ruby SDK
|
8
|
+
<br>
|
9
|
+
</h1>
|
10
|
+
|
11
|
+
<h4 align="center">This is the official Ruby SDK for MercadoLibre's Platform.</h4>
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
### Build a gem
|
16
|
+
|
17
|
+
To build the Ruby code into a gem:
|
18
|
+
|
19
|
+
```shell
|
20
|
+
gem build meli.gemspec
|
21
|
+
```
|
22
|
+
|
23
|
+
Then either install the gem locally:
|
24
|
+
|
25
|
+
```shell
|
26
|
+
gem install ./meli-3.0.0.gem
|
27
|
+
```
|
28
|
+
|
29
|
+
(for development, run `gem install --dev ./meli-3.0.0.gem` to install the development dependencies)
|
30
|
+
|
31
|
+
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
32
|
+
|
33
|
+
Finally add this to the Gemfile:
|
34
|
+
|
35
|
+
gem 'meli', '~> 3.0.0'
|
36
|
+
|
37
|
+
### Install from Git
|
38
|
+
|
39
|
+
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:
|
40
|
+
|
41
|
+
gem 'meli', :git => 'https://github.com/mercadolibre/ruby-sdk.git'
|
42
|
+
|
43
|
+
### Include the Ruby code directly
|
44
|
+
|
45
|
+
Include the Ruby code directly using `-I` as follows:
|
46
|
+
|
47
|
+
```shell
|
48
|
+
ruby -Ilib script.rb
|
49
|
+
```
|
50
|
+
|
51
|
+
## Usage
|
52
|
+
```ruby
|
53
|
+
# Auth URLs Options by country
|
54
|
+
|
55
|
+
# 1: "https://auth.mercadolibre.com.ar"
|
56
|
+
# 2: "https://auth.mercadolivre.com.br"
|
57
|
+
# 3: "https://auth.mercadolibre.com.co"
|
58
|
+
# 4: "https://auth.mercadolibre.com.mx"
|
59
|
+
# 5: "https://auth.mercadolibre.com.uy"
|
60
|
+
# 6: "https://auth.mercadolibre.cl"
|
61
|
+
# 7: "https://auth.mercadolibre.com.cr"
|
62
|
+
# 8: "https://auth.mercadolibre.com.ec"
|
63
|
+
# 9: "https://auth.mercadolibre.com.ve"
|
64
|
+
# 10: "https://auth.mercadolibre.com.pa"
|
65
|
+
# 11: "https://auth.mercadolibre.com.pe"
|
66
|
+
# 12: "https://auth.mercadolibre.com.do"
|
67
|
+
# 13: "https://auth.mercadolibre.com.bo"
|
68
|
+
# 14: "https://auth.mercadolibre.com.py"
|
69
|
+
|
70
|
+
# For example in your app
|
71
|
+
client_id = "Your client_id"
|
72
|
+
redirect_uri = "Your redirect uri"
|
73
|
+
puts '<a href= "https://auth.mercadolibre.com.ar/authorization?response_type=code&client_id=' + client_id + '&redirect_uri=' + redirect_uri +'">'+ Authenticate + '</a>'
|
74
|
+
```
|
75
|
+
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.
|
76
|
+
|
77
|
+
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
|
78
|
+
|
79
|
+
|
80
|
+
## Examples for OAuth - get token
|
81
|
+
```ruby
|
82
|
+
# load the gem
|
83
|
+
require 'Meli'
|
84
|
+
|
85
|
+
api_instance = Meli::OAuth20Api.new
|
86
|
+
opts = {
|
87
|
+
grant_type: 'authorization_code', # String |
|
88
|
+
client_id: 'client_id_example', # String |
|
89
|
+
client_secret: 'client_secret_example', # String |
|
90
|
+
redirect_uri: 'redirect_uri_example', # String |
|
91
|
+
code: 'code_example', # String |
|
92
|
+
refresh_token: 'refresh_token_example' # String |
|
93
|
+
}
|
94
|
+
|
95
|
+
begin
|
96
|
+
#Request Access Token
|
97
|
+
result = api_instance.get_token(opts)
|
98
|
+
p result
|
99
|
+
rescue Meli::ApiError => e
|
100
|
+
puts "Exception when calling OAuth20Api->get_token: #{e}"
|
101
|
+
end
|
102
|
+
```
|
103
|
+
|
104
|
+
|
105
|
+
## Example using the RestClient with a POST Item
|
106
|
+
```ruby
|
107
|
+
# load the gem
|
108
|
+
require 'Meli'
|
109
|
+
|
110
|
+
api_instance = Meli::RestClientApi.new
|
111
|
+
resource = 'resource_example' # String |
|
112
|
+
access_token = 'access_token_example' # String |
|
113
|
+
body = nil # Object |
|
114
|
+
|
115
|
+
begin
|
116
|
+
#Resourse path POST
|
117
|
+
result = api_instance.resource_post(resource, access_token, body)
|
118
|
+
p result
|
119
|
+
rescue Meli::ApiError => e
|
120
|
+
puts "Exception when calling RestClientApi->resource_post: #{e}"
|
121
|
+
end
|
122
|
+
```
|
123
|
+
|
124
|
+
|
125
|
+
## Documentation & Important notes
|
126
|
+
|
127
|
+
##### The URIs are relative to https://api.mercadolibre.com
|
128
|
+
|
129
|
+
##### The Authorization URLs:
|
130
|
+
###### Remember set your correct country ID
|
131
|
+
###### https://auth.mercadolibre.{country_domain}
|
132
|
+
|
133
|
+
##### All docs for the library are located [here](https://github.com/mercadolibre/ruby-sdk/tree/master/docs)
|
134
|
+
|
135
|
+
##### Check out our examples codes in the folder [examples](https://github.com/mercadolibre/ruby-sdk/tree/master/examples)
|
136
|
+
|
137
|
+
##### Don’t forget to check out our [developer site](https://developers.mercadolibre.com/)
|
data/Rakefile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
=begin
|
4
|
+
#MELI Markeplace SDK
|
5
|
+
|
6
|
+
#This is the official Ruby SDK for the MercadoLibre Marketplace platform.
|
7
|
+
=end
|
8
|
+
|
9
|
+
$:.push File.expand_path("../lib", __FILE__)
|
10
|
+
require "Meli/version"
|
11
|
+
|
12
|
+
Gem::Specification.new do |s|
|
13
|
+
s.name = "Creizer-Meli"
|
14
|
+
s.version = Meli::VERSION
|
15
|
+
s.platform = Gem::Platform::RUBY
|
16
|
+
s.authors = ["MELI"]
|
17
|
+
s.email = [""]
|
18
|
+
s.homepage = "https://github.com/mercadolibre/ruby-sdk"
|
19
|
+
s.summary = "MELI Markeplace SDK Ruby Gem"
|
20
|
+
s.description = "This is the official Ruby SDK for the MercadoLibre Marketplace platform."
|
21
|
+
s.license = "Unlicense"
|
22
|
+
s.required_ruby_version = ">= 1.9"
|
23
|
+
|
24
|
+
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
25
|
+
s.add_runtime_dependency 'json', '~> 2.3', '>= 2.3.0'
|
26
|
+
|
27
|
+
s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
|
28
|
+
|
29
|
+
s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
|
30
|
+
s.test_files = `find spec/*`.split("\n")
|
31
|
+
s.executables = []
|
32
|
+
s.require_paths = ["lib"]
|
33
|
+
end
|
data/docs/Attributes.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Meli::Attributes
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**id** | **String** | | [optional]
|
8
|
+
**name** | **String** | | [optional]
|
9
|
+
**value_id** | **String** | | [optional]
|
10
|
+
**value_name** | **String** | | [optional]
|
11
|
+
**value_struct** | [**AttributesValueStruct**](AttributesValueStruct.md) | | [optional]
|
12
|
+
**values** | [**Array<AttributesValues>**](AttributesValues.md) | | [optional]
|
13
|
+
**attribute_group_id** | **String** | | [optional]
|
14
|
+
**attribute_group_name** | **String** | | [optional]
|
15
|
+
|
16
|
+
## Code Sample
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
require 'Meli'
|
20
|
+
|
21
|
+
instance = Meli::Attributes.new(id: DATA_STORAGE_CAPACITY,
|
22
|
+
name: Capacidad de almacenamiento de datos,
|
23
|
+
value_id: null,
|
24
|
+
value_name: 8 GB,
|
25
|
+
value_struct: null,
|
26
|
+
values: null,
|
27
|
+
attribute_group_id: OTHERS,
|
28
|
+
attribute_group_name: Otros)
|
29
|
+
```
|
30
|
+
|
31
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Meli::AttributesValueStruct
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**number** | **Float** | | [optional]
|
8
|
+
**unit** | **String** | | [optional]
|
9
|
+
|
10
|
+
## Code Sample
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
require 'Meli'
|
14
|
+
|
15
|
+
instance = Meli::AttributesValueStruct.new(number: 8,
|
16
|
+
unit: GB)
|
17
|
+
```
|
18
|
+
|
19
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Meli::AttributesValues
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**id** | **String** | | [optional]
|
8
|
+
**name** | **String** | | [optional]
|
9
|
+
**struct** | [**AttributesValueStruct**](AttributesValueStruct.md) | | [optional]
|
10
|
+
|
11
|
+
## Code Sample
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'Meli'
|
15
|
+
|
16
|
+
instance = Meli::AttributesValues.new(id: null,
|
17
|
+
name: 8 GB,
|
18
|
+
struct: null)
|
19
|
+
```
|
20
|
+
|
21
|
+
|
@@ -0,0 +1,150 @@
|
|
1
|
+
# Meli::CategoriesApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://api.mercadolibre.com*
|
4
|
+
|
5
|
+
Method | HTTP request | Description
|
6
|
+
------------- | ------------- | -------------
|
7
|
+
[**categories_category_id_get**](CategoriesApi.md#categories_category_id_get) | **GET** /categories/{category_id} | Return by category.
|
8
|
+
[**sites_site_id_categories_get**](CategoriesApi.md#sites_site_id_categories_get) | **GET** /sites/{site_id}/categories | Return a categories by site.
|
9
|
+
[**sites_site_id_domain_discovery_search_get**](CategoriesApi.md#sites_site_id_domain_discovery_search_get) | **GET** /sites/{site_id}/domain_discovery/search | Predictor
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
## categories_category_id_get
|
14
|
+
|
15
|
+
> Object categories_category_id_get(category_id)
|
16
|
+
|
17
|
+
Return by category.
|
18
|
+
|
19
|
+
### Example
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
# load the gem
|
23
|
+
require 'Meli'
|
24
|
+
|
25
|
+
api_instance = Meli::CategoriesApi.new
|
26
|
+
category_id = 'category_id_example' # String |
|
27
|
+
|
28
|
+
begin
|
29
|
+
#Return by category.
|
30
|
+
result = api_instance.categories_category_id_get(category_id)
|
31
|
+
p result
|
32
|
+
rescue Meli::ApiError => e
|
33
|
+
puts "Exception when calling CategoriesApi->categories_category_id_get: #{e}"
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
### Parameters
|
38
|
+
|
39
|
+
|
40
|
+
Name | Type | Description | Notes
|
41
|
+
------------- | ------------- | ------------- | -------------
|
42
|
+
**category_id** | **String**| |
|
43
|
+
|
44
|
+
### Return type
|
45
|
+
|
46
|
+
**Object**
|
47
|
+
|
48
|
+
### Authorization
|
49
|
+
|
50
|
+
No authorization required
|
51
|
+
|
52
|
+
### HTTP request headers
|
53
|
+
|
54
|
+
- **Content-Type**: Not defined
|
55
|
+
- **Accept**: application/json
|
56
|
+
|
57
|
+
|
58
|
+
## sites_site_id_categories_get
|
59
|
+
|
60
|
+
> Object sites_site_id_categories_get(site_id)
|
61
|
+
|
62
|
+
Return a categories by site.
|
63
|
+
|
64
|
+
### Example
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
# load the gem
|
68
|
+
require 'Meli'
|
69
|
+
|
70
|
+
api_instance = Meli::CategoriesApi.new
|
71
|
+
site_id = 'site_id_example' # String |
|
72
|
+
|
73
|
+
begin
|
74
|
+
#Return a categories by site.
|
75
|
+
result = api_instance.sites_site_id_categories_get(site_id)
|
76
|
+
p result
|
77
|
+
rescue Meli::ApiError => e
|
78
|
+
puts "Exception when calling CategoriesApi->sites_site_id_categories_get: #{e}"
|
79
|
+
end
|
80
|
+
```
|
81
|
+
|
82
|
+
### Parameters
|
83
|
+
|
84
|
+
|
85
|
+
Name | Type | Description | Notes
|
86
|
+
------------- | ------------- | ------------- | -------------
|
87
|
+
**site_id** | **String**| |
|
88
|
+
|
89
|
+
### Return type
|
90
|
+
|
91
|
+
**Object**
|
92
|
+
|
93
|
+
### Authorization
|
94
|
+
|
95
|
+
No authorization required
|
96
|
+
|
97
|
+
### HTTP request headers
|
98
|
+
|
99
|
+
- **Content-Type**: Not defined
|
100
|
+
- **Accept**: application/json
|
101
|
+
|
102
|
+
|
103
|
+
## sites_site_id_domain_discovery_search_get
|
104
|
+
|
105
|
+
> Object sites_site_id_domain_discovery_search_get(site_id, q, limit)
|
106
|
+
|
107
|
+
Predictor
|
108
|
+
|
109
|
+
### Example
|
110
|
+
|
111
|
+
```ruby
|
112
|
+
# load the gem
|
113
|
+
require 'Meli'
|
114
|
+
|
115
|
+
api_instance = Meli::CategoriesApi.new
|
116
|
+
site_id = 'site_id_example' # String |
|
117
|
+
q = 'q_example' # String |
|
118
|
+
limit = 'limit_example' # String |
|
119
|
+
|
120
|
+
begin
|
121
|
+
#Predictor
|
122
|
+
result = api_instance.sites_site_id_domain_discovery_search_get(site_id, q, limit)
|
123
|
+
p result
|
124
|
+
rescue Meli::ApiError => e
|
125
|
+
puts "Exception when calling CategoriesApi->sites_site_id_domain_discovery_search_get: #{e}"
|
126
|
+
end
|
127
|
+
```
|
128
|
+
|
129
|
+
### Parameters
|
130
|
+
|
131
|
+
|
132
|
+
Name | Type | Description | Notes
|
133
|
+
------------- | ------------- | ------------- | -------------
|
134
|
+
**site_id** | **String**| |
|
135
|
+
**q** | **String**| |
|
136
|
+
**limit** | **String**| |
|
137
|
+
|
138
|
+
### Return type
|
139
|
+
|
140
|
+
**Object**
|
141
|
+
|
142
|
+
### Authorization
|
143
|
+
|
144
|
+
No authorization required
|
145
|
+
|
146
|
+
### HTTP request headers
|
147
|
+
|
148
|
+
- **Content-Type**: Not defined
|
149
|
+
- **Accept**: application/json
|
150
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Meli::InlineObject
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**grant_type** | **String** | | [optional]
|
8
|
+
**client_id** | **String** | | [optional]
|
9
|
+
**client_secret** | **String** | | [optional]
|
10
|
+
**redirect_uri** | **String** | | [optional]
|
11
|
+
**code** | **String** | | [optional]
|
12
|
+
**refresh_token** | **String** | | [optional]
|
13
|
+
|
14
|
+
## Code Sample
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
require 'Meli'
|
18
|
+
|
19
|
+
instance = Meli::InlineObject.new(grant_type: authorization_code,
|
20
|
+
client_id: null,
|
21
|
+
client_secret: null,
|
22
|
+
redirect_uri: null,
|
23
|
+
code: null,
|
24
|
+
refresh_token: null)
|
25
|
+
```
|
26
|
+
|
27
|
+
|