Module: Mercadolibre::Core::Searching

Included in:
Api
Defined in:
lib/mercadolibre/core/searching.rb

Instance Method Summary collapse

Instance Method Details



30
31
32
# File 'lib/mercadolibre/core/searching.rb', line 30

def get_featured_items(site_id, pool_id)
  get_request("/sites/#{site_id}/featured_items/#{pool_id}").body
end

#get_hot_items(site_id, category_id, limit = 15) ⇒ Object



26
27
28
# File 'lib/mercadolibre/core/searching.rb', line 26

def get_hot_items(site_id, category_id, limit=15)
  get_request("/sites/#{site_id}/hot_items/search?category=#{category_id}&limit=#{limit}").body
end

#get_search_url(site_id, q) ⇒ Object



22
23
24
# File 'lib/mercadolibre/core/searching.rb', line 22

def get_search_url(site_id, q)
  get_request("/sites/#{site_id}/searchUrl?q=#{q}").body
end

#search_item_ids(filters = {}) ⇒ Object



10
11
12
# File 'lib/mercadolibre/core/searching.rb', line 10

def search_item_ids(filters={})
  search_items(filters).results.map(&:id)
end

#search_items(filters = {}) ⇒ Object



4
5
6
7
8
# File 'lib/mercadolibre/core/searching.rb', line 4

def search_items(filters={})
  filters.merge!({ access_token: @access_token })
  
  get_request("/sites/#{@site}/search", filters).body
end

#search_my_item_ids(filters = {}) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/mercadolibre/core/searching.rb', line 14

def search_my_item_ids(filters={})
  user_id = filters[:user_id] || get_my_user.id

  filters.merge!({ access_token: @access_token, limit: 50, offset: 0 })

  get_request("/users/#{user_id}/items/search", filters).body
end