mercadolibre 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f8c16d0c18a6d1d9aea7b92e6ab7fe0ed0876388
4
- data.tar.gz: 457995eab154f1cb315e42128e60e80c667dc1bf
3
+ metadata.gz: 19c27d08b54ebb86fc18958f21cb75149c99dbc7
4
+ data.tar.gz: 75c1ee72e514f505dd2890165424df01ba3fff03
5
5
  SHA512:
6
- metadata.gz: db44a5bf89a710404d3efc7fc6ace79c194fc83294cfbf9d31f9dc9610e166307e27ea9ce939a4abeb3e31ca01fd579b1256318fbfe40960f7ec39bc4d0a5c01
7
- data.tar.gz: 825f47d7da50a74313e3d319a0d3ed6db232b7a5a6c7893c03a32cc22004ea20836aa607c615b1464c4b10b0361d456b204212a668516bf5a08c34cb70701dc9
6
+ metadata.gz: 9600dc5c39d2fee08de877ab0ac8c7848352be0f171a1c47e5501d668464796af16ab01b80fc0f1431aa7a3c4f94d7038892f4b59d99adc6f9ee64508f11c411
7
+ data.tar.gz: 7c1c162e7b0889b5e219413dfa93ee3e1169d544ff6f34be55c8fd5284f2cd26d1e218f6dc6b95599680a966369c0b2d04c00dda2d6ce049a281d88071ae7f93
data/CHANGELOG.md CHANGED
@@ -33,3 +33,7 @@
33
33
  ## v0.0.9
34
34
 
35
35
  * Implemented more methods from the API
36
+
37
+ ## v0.1.0
38
+
39
+ * Improved documentation and little refactor
data/README.md CHANGED
@@ -1,21 +1,273 @@
1
- # Mercadolibre
1
+ Mercadolibre
2
+ ==============
2
3
 
3
- Implementation of meli API to access MercadoLibre
4
+ Mercadolibre gem implements MELI API (Official API available to interact with Mercadolibre).
4
5
 
5
- ## Installation
6
+ It implements most of the methods of the official API and it makes it very easy to interact with.
6
7
 
7
- Add this line to your application's Gemfile:
8
+ Requirements
9
+ -----------------
8
10
 
9
- gem 'mercadolibre'
11
+ You need to create an application in http://applications.mercadolibre.com in order to get app key and app secret.
10
12
 
11
- And then execute:
13
+ Rest Client is used to perform all API calls.
12
14
 
13
- $ bundle
14
15
 
15
- Or install it yourself as:
16
+ Installation
17
+ -----------------
16
18
 
17
- $ gem install mercadolibre
19
+ gem install mercadolibre
18
20
 
19
- ## Usage
20
21
 
21
- TODO: Write usage instructions here
22
+ Getting started
23
+ -----------------
24
+
25
+ MELI uses OAuth protocol for authentication, so you first need to get an access token.
26
+
27
+ In order to do that you first need to instance the API:
28
+
29
+ api = Mercadolibre::Api.new({
30
+ app_key: 'YOUR_APP_KEY',
31
+ app_secret: 'YOUR_APP_SECRET',
32
+ callback_url: 'YOUR_CALLBACK_URL',
33
+ site: 'YOUR_SITE_COUNTRY'
34
+ })
35
+
36
+ Site country is the site id for the country you are using (eg. Argentina's site id is MLA).
37
+
38
+ In case you already have an access token, it could be passed directly in the constructor hash or it can be assigned through property 'access_token'.
39
+
40
+ To get a url of mercadolibre authentication page you can call authenticate_url method:
41
+
42
+ # it returns the authentication page you should send user to
43
+ api.authenticate_url
44
+
45
+ After authentication, you'll be redirected to callback url with an auth code (code variable from return url). With this code, you'll get access token (also refresh token in case you need it).
46
+
47
+ # auth_data (access_token, refresh_token, expired_at)
48
+ auth_data = api.authenticate(your_auth_code)
49
+
50
+ As soon as you are authenticated and you have a valid access token, you are all set for using the API.
51
+
52
+
53
+ API Methods
54
+ -----------------
55
+
56
+ ##### Auth
57
+
58
+ * api.authenticate_url
59
+ -> Returns mercadolibre authentication url.
60
+
61
+ * api.authenticate(auth_code)
62
+ -> Returns authentication tokens with auth code provided in callback url.
63
+
64
+ * api.update_token(refresh_token)
65
+ -> Extends token expiration (useful to keep alive a token).
66
+
67
+ ##### Categories and listings
68
+
69
+ * api.get_sites
70
+ -> Returns all available sites.
71
+
72
+ * api.get_site(site_id)
73
+ -> Returns data of specific site.
74
+
75
+ * api.get_site_domain_info(domain)
76
+ -> Returns data of specific site domain (eg. mercadolibre.com.ar).
77
+
78
+ * api.get_listing_types(site_id)
79
+ -> Return all listing types available for the site.
80
+
81
+ * api.get_listing_exposures(site_id)
82
+ -> Return all listing exposures available for the site.
83
+
84
+ * api.get_listing_prices(filters)
85
+ -> Return all listing prices that matches with the given filters.
86
+ Possible filters are:
87
+ - price
88
+ - listing_type_id
89
+ - quantity
90
+ - category_id
91
+ - currency_id
92
+
93
+ * api.get_site_categories(site_id)
94
+ -> Returns main site categories.
95
+
96
+ ##### Items and searches
97
+
98
+ * api.get_all_my_item_ids(filters={})
99
+ -> Search all your item ids with filters (without pagination).
100
+
101
+ * api.get_my_item_ids(filters={})
102
+ -> Search all your item ids with filters (with pagination).
103
+
104
+ * api.get_all_item_ids(filters={})
105
+ -> Search all item ids with filters (without pagination).
106
+
107
+ * api.get_item_ids(filters={})
108
+ -> Search all item ids with filters (with pagination).
109
+
110
+ * api.get_item(item_id)
111
+ -> Gets item detail.
112
+
113
+ * api.get_item_visits(item_ids)
114
+ -> Gets items visits. If you provide an item id as a string you'll get an integer.
115
+ If you pass an array of item ids, you'll get a hash with the items visits for each.
116
+
117
+ * api.get_item_descriptions(item_id)
118
+ -> Gets all item descriptions from an item.
119
+
120
+ * api.get_item_available_upgrades(item_id)
121
+ -> Gets all available listing types for upgrade for the item.
122
+
123
+ * api.get_search_url(site_id, q)
124
+ -> Gets search url for the site and query.
125
+
126
+ * api.get_hot_items(site_id, category_id, limit=15)
127
+ -> Gets category hot items.
128
+
129
+ * api.get_featured_items(site_id, pool_id)
130
+ -> Gets featured items.
131
+
132
+ * api.get_site_trends(site_id, category_id)
133
+ -> Gets site trends for category.
134
+
135
+ * api.item_valid?(attribs)
136
+ -> Checks if attributes are valid for creating an item.
137
+
138
+ * api.create_item(attribs)
139
+ -> Creates an item.
140
+
141
+ * api.relist_item(item_id, price, quantity, listing_type_id)
142
+ -> Relists an item.
143
+
144
+ * api.update_item_fields(item_id, attribs)
145
+ -> Updates item fields (price, stock, etc).
146
+
147
+ * api.update_item_listing_type(item_id, listing_type_id)
148
+ -> Updates item listing type.
149
+
150
+ * api.add_item_description(item_id, text)
151
+ -> Adds description to item.
152
+
153
+ ##### Locations and currencies
154
+
155
+ * api.get_countries
156
+ -> Gets countries.
157
+
158
+ * api.get_country(country_id)
159
+ -> Gets country.
160
+
161
+ * api.get_state(state_id)
162
+ -> Gets state.
163
+
164
+ * api.get_city(city_id)
165
+ -> Gets city.
166
+
167
+ * api.get_currencies
168
+ -> Gets currencies
169
+
170
+ * api.get_currency(currency_id)
171
+ -> Gets currency info
172
+
173
+ * api.currency_convertion_rate(currency_from, currency_to)
174
+ -> Gets currency conversion rate
175
+
176
+ * api.get_zip_code_info(country_id, zip_code)
177
+ -> Gets zip code info
178
+
179
+ ##### Order management
180
+
181
+ * api.get_all_orders(filters={})
182
+ -> Get all orders with filters (without pagination)
183
+
184
+ * api.get_orders(filters={})
185
+ -> Get all orders with filters (with pagination)
186
+
187
+ * api.get_order(order_id)
188
+ -> Gets order detail
189
+
190
+ * api.get_order_feedbacks(order_id)
191
+ -> Gets both seller and buyer feedbacks
192
+
193
+ * api.get_buyer_feedback(order_id)
194
+ -> Gets buyer feedback
195
+
196
+ * api.get_seller_feedback(order_id)
197
+ -> Gets seller feedback
198
+
199
+ * api.give_feedback_to_order(order_id, feedback_data)
200
+ -> Gives feedback to order
201
+
202
+ * api.change_feedback_from_order(order_id, kind, feedback_data)
203
+ -> Updates feedback from order. Kind is seller or buyer.
204
+
205
+ * api.reply_feedback(order_id, kind, text)
206
+ -> Reply a feedback. Kind is seller or buyer.
207
+
208
+ * api.get_site_payment_methods(site_id)
209
+ -> Get all payment methods from site.
210
+
211
+ * api.get_order_blacklist(user_id)
212
+ -> Get all users restricted to purchase you an item.
213
+
214
+ ##### Questions
215
+
216
+ * api.get_all_questions(filters={})
217
+ -> Get all questions with filters (without pagination)
218
+
219
+ * api.get_questions(filters={})
220
+ -> Get all questions with filters (with pagination)
221
+
222
+ * api.get_question(question_id)
223
+ -> Gets question detail
224
+
225
+ * api.delete_question(question_id)
226
+ -> Deletes question
227
+
228
+ * api.ask_question(item_id, text)
229
+ -> Asks a question
230
+
231
+ * api.answer_question(question_id, text)
232
+ -> Answers a question
233
+
234
+ * api.get_blacklisted_users_ids(seller_id)
235
+ -> Get all blacklisted users
236
+
237
+ * api.add_user_to_blacklist(seller_id, user_id)
238
+ -> Adds user to blacklist
239
+
240
+ * api.remove_user_from_blacklist(seller_id, user_id)
241
+ -> Removes user from blacklist
242
+
243
+ ##### Users
244
+
245
+ * api.get_my_user
246
+ -> Gets current user
247
+
248
+ * api.get_user(user_id)
249
+ -> Gets user detail
250
+
251
+ * api.get_users(user_ids)
252
+ -> Get all users with user_id from array
253
+
254
+ * api.get_user_accepted_payment_methods(user_id)
255
+ -> Get all accepted payment methods for the user.
256
+
257
+ **Note:** For further details about the methods, params and possible errors please check https://api.mercadolibre.com.
258
+
259
+ Problems?
260
+ -----------------
261
+
262
+ If you are encountering what you think is a bug, please open an issue.
263
+
264
+ Todo
265
+ -----------------
266
+
267
+ Error handling should be improved to capture errors for common errors, already quoted on meli API.
268
+
269
+
270
+ Author
271
+ -----------------
272
+
273
+ Matias Hick (me@unformatt.com.ar)
data/lib/mercadolibre.rb CHANGED
@@ -37,7 +37,7 @@ require "mercadolibre/core/items_and_searches"
37
37
  require "mercadolibre/core/locations_and_currencies"
38
38
  require "mercadolibre/core/order_management"
39
39
  require "mercadolibre/core/questions"
40
- require "mercadolibre/core/users_and_apps"
40
+ require "mercadolibre/core/users"
41
41
  require "mercadolibre/api"
42
42
 
43
43
  # dependencies
@@ -18,7 +18,7 @@ module Mercadolibre
18
18
  include Mercadolibre::Core::LocationsAndCurrencies
19
19
  include Mercadolibre::Core::OrderManagement
20
20
  include Mercadolibre::Core::Questions
21
- include Mercadolibre::Core::UsersAndApps
21
+ include Mercadolibre::Core::Users
22
22
 
23
23
  private
24
24
 
@@ -152,8 +152,8 @@ module Mercadolibre
152
152
  put_request("/items/#{item_id}?access_token=#{@access_token}", payload, headers)[:body]
153
153
  end
154
154
 
155
- def update_item_listing_type(item_id, new_listing_kind)
156
- payload = { id: new_listing_kind }.to_json
155
+ def update_item_listing_type(item_id, listing_type_id)
156
+ payload = { id: listing_type_id }.to_json
157
157
 
158
158
  headers = { content_type: :json, accept: :json }
159
159
 
@@ -1,6 +1,6 @@
1
1
  module Mercadolibre
2
2
  module Core
3
- module UsersAndApps
3
+ module Users
4
4
  def get_my_user
5
5
  result = get_request('/users/me', { access_token: @access_token })
6
6
 
@@ -1,3 +1,3 @@
1
1
  module Mercadolibre
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mercadolibre
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias Hick
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.6.7
55
- description: Connect to meli api
55
+ description: Connect to Mercadolibre through Meli API
56
56
  email:
57
57
  - unformatt@gmail.com
58
58
  executables: []
@@ -70,7 +70,7 @@ files:
70
70
  - lib/mercadolibre/core/locations_and_currencies.rb
71
71
  - lib/mercadolibre/core/order_management.rb
72
72
  - lib/mercadolibre/core/questions.rb
73
- - lib/mercadolibre/core/users_and_apps.rb
73
+ - lib/mercadolibre/core/users.rb
74
74
  - lib/mercadolibre/entity/answer.rb
75
75
  - lib/mercadolibre/entity/auth.rb
76
76
  - lib/mercadolibre/entity/category.rb
@@ -123,5 +123,5 @@ rubyforge_project:
123
123
  rubygems_version: 2.2.2
124
124
  signing_key:
125
125
  specification_version: 4
126
- summary: Connect to meli api
126
+ summary: Connect to Mercadolibre through Meli API
127
127
  test_files: []