Module: Mercadolibre::Core::Categories
- Included in:
- Api
- Defined in:
- lib/mercadolibre/core/categories.rb
Instance Method Summary collapse
- #get_all_categories(site_id, args = {}) ⇒ Object
- #get_category(category_id) ⇒ Object
- #get_category_attributes(category_id) ⇒ Object
- #get_category_prediction(site_id, args) ⇒ Object
- #get_category_promotion_packs(category_id) ⇒ Object
- #get_multiple_category_prediction(site_id, categories_data) ⇒ Object
- #get_site_categories(site_id) ⇒ Object
- #get_site_trends(site_id, category_id = nil) ⇒ Object
Instance Method Details
#get_all_categories(site_id, args = {}) ⇒ Object
32 33 34 |
# File 'lib/mercadolibre/core/categories.rb', line 32 def get_all_categories(site_id, args={}) get_request("/sites/#{site_id}/categories/all", args, { api_response_kind: 'raw' }).body end |
#get_category(category_id) ⇒ Object
8 9 10 |
# File 'lib/mercadolibre/core/categories.rb', line 8 def get_category(category_id) get_request("/categories/#{category_id}").body end |
#get_category_attributes(category_id) ⇒ Object
12 13 14 |
# File 'lib/mercadolibre/core/categories.rb', line 12 def get_category_attributes(category_id) get_request("/categories/#{category_id}/attributes").body end |
#get_category_prediction(site_id, args) ⇒ Object
16 17 18 |
# File 'lib/mercadolibre/core/categories.rb', line 16 def get_category_prediction(site_id, args) get_request("/sites/#{site_id}/category_predictor/predict", args).body end |
#get_category_promotion_packs(category_id) ⇒ Object
28 29 30 |
# File 'lib/mercadolibre/core/categories.rb', line 28 def get_category_promotion_packs(category_id) get_request("/categories/#{category_id}/classifieds_promotion_packs").body end |
#get_multiple_category_prediction(site_id, categories_data) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/mercadolibre/core/categories.rb', line 20 def get_multiple_category_prediction(site_id, categories_data) payload = categories_data.to_json headers = { content_type: :json } post_request("/sites/#{site_id}/category_predictor/predict", payload, headers).body end |
#get_site_categories(site_id) ⇒ Object
4 5 6 |
# File 'lib/mercadolibre/core/categories.rb', line 4 def get_site_categories(site_id) get_request("/sites/#{site_id}/categories").body end |
#get_site_trends(site_id, category_id = nil) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/mercadolibre/core/categories.rb', line 36 def get_site_trends(site_id, category_id=nil) if category_id.present? params = { category: category_id } else params = { } end get_request("/sites/#{site_id}/trends/search", params).body end |