mercadolibre 1.2.0 → 1.3.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/mercadolibre/api.rb +6 -5
- data/lib/mercadolibre/core/categories_and_listings.rb +27 -9
- data/lib/mercadolibre/core/metrics.rb +6 -0
- data/lib/mercadolibre/core/{auth.rb → oauth.rb} +1 -1
- data/lib/mercadolibre/core/{order_management.rb → orders_and_feedback.rb} +1 -1
- data/lib/mercadolibre/core/{questions.rb → questions_and_answers.rb} +1 -1
- data/lib/mercadolibre/core/{shippings.rb → shipping.rb} +1 -1
- data/lib/mercadolibre/core/users_and_apps.rb +81 -0
- data/lib/mercadolibre/version.rb +1 -1
- data/lib/mercadolibre.rb +7 -6
- data/lib/mercadopago/api.rb +1 -1
- data/lib/mercadopago/core/{auth.rb → oauth.rb} +1 -1
- metadata +9 -8
- data/lib/mercadolibre/core/users.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd38a2d993d7500e9d40cb333837105d44870396
|
4
|
+
data.tar.gz: dee970c952e36c30bb4dbb6dedebae38cdddb9e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b949f083835357302cde4c6a59198754e9217bcbe531084f1d88c8ecdfb352ea57f9ee6718067eaea6a7b5043270a973aee98a5c1a39a7fd3deca940e22f58e
|
7
|
+
data.tar.gz: 9be591299723b63acc698b727cfa2cdb4451db8d4fac3515176889038760f202a5dbf1b81c9b8952cb8482003a105045e60ff69dd0a705f0ce1592e692b9897c
|
data/CHANGELOG.md
CHANGED
data/lib/mercadolibre/api.rb
CHANGED
@@ -12,15 +12,16 @@ module Mercadolibre
|
|
12
12
|
@site = args[:site]
|
13
13
|
end
|
14
14
|
|
15
|
-
include Mercadolibre::Core::Auth
|
16
15
|
include Mercadolibre::Core::CategoriesAndListings
|
17
16
|
include Mercadolibre::Core::Collections
|
18
17
|
include Mercadolibre::Core::ItemsAndSearches
|
19
18
|
include Mercadolibre::Core::LocationsAndCurrencies
|
20
|
-
include Mercadolibre::Core::
|
21
|
-
include Mercadolibre::Core::
|
22
|
-
include Mercadolibre::Core::
|
23
|
-
include Mercadolibre::Core::
|
19
|
+
include Mercadolibre::Core::Metrics
|
20
|
+
include Mercadolibre::Core::Oauth
|
21
|
+
include Mercadolibre::Core::OrdersAndFeedbacks
|
22
|
+
include Mercadolibre::Core::QuestionsAndAnswers
|
23
|
+
include Mercadolibre::Core::Shipping
|
24
|
+
include Mercadolibre::Core::UsersAndApps
|
24
25
|
|
25
26
|
def get_last_response
|
26
27
|
@last_response
|
@@ -5,7 +5,7 @@ module Mercadolibre
|
|
5
5
|
get_request('/sites').body
|
6
6
|
end
|
7
7
|
|
8
|
-
def get_site(site_id)
|
8
|
+
def get_site(site_id=nil)
|
9
9
|
get_request("/sites/#{site_id}").body
|
10
10
|
end
|
11
11
|
|
@@ -13,28 +13,46 @@ module Mercadolibre
|
|
13
13
|
get_request("/site_domains/#{domain}").body
|
14
14
|
end
|
15
15
|
|
16
|
-
def get_listing_types(site_id)
|
16
|
+
def get_listing_types(site_id=nil)
|
17
|
+
site_id = @site if site_id.nil?
|
17
18
|
get_request("/sites/#{site_id}/listing_types").body
|
18
19
|
end
|
19
20
|
|
20
|
-
def get_listing_exposures(site_id)
|
21
|
+
def get_listing_exposures(site_id=nil)
|
22
|
+
site_id = @site if site_id.nil?
|
21
23
|
get_request("/sites/#{site_id}/listing_exposures").body
|
22
24
|
end
|
23
25
|
|
24
|
-
def get_listing_prices(filters)
|
25
|
-
valid_filters = ['price', 'listing_type_id', 'quantity', 'category_id', 'currency_id']
|
26
|
-
filters.keep_if { |k,v| valid_filters.include?(k.to_s) }
|
27
|
-
|
26
|
+
def get_listing_prices(filters={})
|
28
27
|
get_request("/sites/#{site_id}/listing_prices", filters).body
|
29
28
|
end
|
30
29
|
|
31
|
-
def get_site_categories(site_id)
|
30
|
+
def get_site_categories(site_id=nil)
|
31
|
+
site_id = @site if site_id.nil?
|
32
32
|
get_request("/sites/#{site_id}/categories").body
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
35
|
+
def get_site_category(category_id)
|
36
36
|
get_request("/categories/#{category_id}").body
|
37
37
|
end
|
38
|
+
|
39
|
+
def get_category_attributes(category_id)
|
40
|
+
get_request("/categories/#{category_id}/attributes").body
|
41
|
+
end
|
42
|
+
|
43
|
+
def get_category_prediction(title, site_id=nil)
|
44
|
+
site_id = @site if site_id.nil?
|
45
|
+
get_request("/sites/#{site_id}/category_predictor/predict", { title: title }).body
|
46
|
+
end
|
47
|
+
|
48
|
+
def get_category_promotion_packs(category_id)
|
49
|
+
get_request("/categories/#{category_id}/classifieds_promotion_packs").body
|
50
|
+
end
|
51
|
+
|
52
|
+
def get_listing_type(listing_type_id, site_id=nil)
|
53
|
+
site_id = @site if site_id.nil?
|
54
|
+
get_request("/sites/#{site_id}/listing_types/#{listing_type_id}", { title: title }).body
|
55
|
+
end
|
38
56
|
end
|
39
57
|
end
|
40
58
|
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
module Mercadolibre
|
2
|
+
module Core
|
3
|
+
module UsersAndApps
|
4
|
+
def get_user(user_id)
|
5
|
+
get_request("/users/#{user_id}", { access_token: @access_token }).body
|
6
|
+
end
|
7
|
+
|
8
|
+
def get_users(user_ids)
|
9
|
+
get_request('/users', { ids: user_ids.join(',') }).body
|
10
|
+
end
|
11
|
+
|
12
|
+
def get_seller(nickname)
|
13
|
+
filters = { nickname: nickname, limit: 0 }
|
14
|
+
response = get_request("/sites/#{@site}/search", filters)[:body]
|
15
|
+
get_user(response.seller.id)
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_my_user
|
19
|
+
get_request('/users/me', { access_token: @access_token }).body
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_user_addresses(user_id)
|
23
|
+
get_request("/users/#{user_id}/addresses", { access_token: @access_token }).body
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_user_payment_methods(user_id)
|
27
|
+
get_request("/users/#{user_id}/payment_methods", { access_token: @access_token }).body
|
28
|
+
end
|
29
|
+
|
30
|
+
def get_user_brands(user_id)
|
31
|
+
get_request("/users/#{user_id}/brands", { access_token: @access_token }).body
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_user_promotion_packs(user_id, listing_type=nil, category_id=nil)
|
35
|
+
filters = { access_token: @access_token }
|
36
|
+
|
37
|
+
if category_id.present?
|
38
|
+
filters[:categoryId] = category_id
|
39
|
+
end
|
40
|
+
|
41
|
+
if listing_type.present?
|
42
|
+
url = "/users/#{user_id}/classifieds_promotion_packs/#{listing_type}"
|
43
|
+
else
|
44
|
+
url = "/users/#{user_id}/classifieds_promotion_packs"
|
45
|
+
end
|
46
|
+
|
47
|
+
get_request(url, filters).body
|
48
|
+
end
|
49
|
+
|
50
|
+
def get_user_available_listing_types(user_id, category_id)
|
51
|
+
filters = {
|
52
|
+
access_token: @access_token,
|
53
|
+
category_id: category_id
|
54
|
+
}
|
55
|
+
|
56
|
+
get_request("/users/#{user_id}/available_listing_types", filters).body
|
57
|
+
end
|
58
|
+
|
59
|
+
def get_user_listing_type_availability(listing_type, category_id)
|
60
|
+
filters = {
|
61
|
+
access_token: @access_token,
|
62
|
+
category_id: category_id
|
63
|
+
}
|
64
|
+
|
65
|
+
get_request("/users/#{user_id}/available_listing_type/#{listing_type}", filters).body
|
66
|
+
end
|
67
|
+
|
68
|
+
def get_application_feeds
|
69
|
+
get_request("/users/#{user_id}/applications/#{@app_key}", { access_token: @access_token }).body
|
70
|
+
end
|
71
|
+
|
72
|
+
def get_application_info
|
73
|
+
get_request("/applications/#{@app_key}", { access_token: @access_token }).body
|
74
|
+
end
|
75
|
+
|
76
|
+
def get_user_accepted_payment_methods(user_id)
|
77
|
+
get_request("/users/#{user_id}/accepted_payment_methods").body
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
data/lib/mercadolibre/version.rb
CHANGED
data/lib/mercadolibre.rb
CHANGED
@@ -1,21 +1,22 @@
|
|
1
1
|
require "mercadolibre/version"
|
2
2
|
|
3
3
|
# mercadolibre -> core
|
4
|
-
require "mercadolibre/core/auth"
|
5
4
|
require "mercadolibre/core/categories_and_listings"
|
6
5
|
require "mercadolibre/core/collections"
|
7
6
|
require "mercadolibre/core/items_and_searches"
|
8
7
|
require "mercadolibre/core/locations_and_currencies"
|
9
|
-
require "mercadolibre/core/
|
10
|
-
require "mercadolibre/core/
|
11
|
-
require "mercadolibre/core/
|
12
|
-
require "mercadolibre/core/
|
8
|
+
require "mercadolibre/core/metrics"
|
9
|
+
require "mercadolibre/core/oauth"
|
10
|
+
require "mercadolibre/core/orders_and_feedback"
|
11
|
+
require "mercadolibre/core/questions_and_answers"
|
12
|
+
require "mercadolibre/core/shipping"
|
13
|
+
require "mercadolibre/core/users_and_apps"
|
13
14
|
|
14
15
|
# mercadolibre -> api
|
15
16
|
require "mercadolibre/api"
|
16
17
|
|
17
18
|
# mercadopago -> core
|
18
|
-
require "mercadopago/core/
|
19
|
+
require "mercadopago/core/oauth"
|
19
20
|
require "mercadopago/core/payments"
|
20
21
|
|
21
22
|
# mercadopago -> api
|
data/lib/mercadopago/api.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mercadolibre
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matias Hick
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -64,18 +64,19 @@ files:
|
|
64
64
|
- README.md
|
65
65
|
- lib/mercadolibre.rb
|
66
66
|
- lib/mercadolibre/api.rb
|
67
|
-
- lib/mercadolibre/core/auth.rb
|
68
67
|
- lib/mercadolibre/core/categories_and_listings.rb
|
69
68
|
- lib/mercadolibre/core/collections.rb
|
70
69
|
- lib/mercadolibre/core/items_and_searches.rb
|
71
70
|
- lib/mercadolibre/core/locations_and_currencies.rb
|
72
|
-
- lib/mercadolibre/core/
|
73
|
-
- lib/mercadolibre/core/
|
74
|
-
- lib/mercadolibre/core/
|
75
|
-
- lib/mercadolibre/core/
|
71
|
+
- lib/mercadolibre/core/metrics.rb
|
72
|
+
- lib/mercadolibre/core/oauth.rb
|
73
|
+
- lib/mercadolibre/core/orders_and_feedback.rb
|
74
|
+
- lib/mercadolibre/core/questions_and_answers.rb
|
75
|
+
- lib/mercadolibre/core/shipping.rb
|
76
|
+
- lib/mercadolibre/core/users_and_apps.rb
|
76
77
|
- lib/mercadolibre/version.rb
|
77
78
|
- lib/mercadopago/api.rb
|
78
|
-
- lib/mercadopago/core/
|
79
|
+
- lib/mercadopago/core/oauth.rb
|
79
80
|
- lib/mercadopago/core/payments.rb
|
80
81
|
homepage: https://github.com/unformattmh/mercadolibre
|
81
82
|
licenses:
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module Mercadolibre
|
2
|
-
module Core
|
3
|
-
module Users
|
4
|
-
def get_my_user
|
5
|
-
get_request('/users/me', { access_token: @access_token }).body
|
6
|
-
end
|
7
|
-
|
8
|
-
def get_user(user_id)
|
9
|
-
get_request("/users/#{user_id}").body
|
10
|
-
end
|
11
|
-
|
12
|
-
def get_users(user_ids)
|
13
|
-
get_request('/users', { ids: user_ids.join(',') }).body
|
14
|
-
end
|
15
|
-
|
16
|
-
def get_seller(nickname)
|
17
|
-
filters = { nickname: nickname, limit: 0 }
|
18
|
-
response = get_request("/sites/#{@site}/search", filters)[:body]
|
19
|
-
get_user(response.seller.id)
|
20
|
-
end
|
21
|
-
|
22
|
-
def get_user_accepted_payment_methods(user_id)
|
23
|
-
get_request("/users/#{user_id}/accepted_payment_methods").body
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|