Module: Mercadolibre::Core::CategoriesAndListings

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

Instance Method Summary collapse

Instance Method Details

#get_category(category_id) ⇒ Object


49
50
51
52
53
# File 'lib/mercadolibre/core/categories_and_listings.rb', line 49

def get_category(category_id)
  result = get_request("/categories/#{category_id}")

  Mercadolibre::Entity::Category.new(result[:body])
end

#get_listing_exposures(site_id) ⇒ Object


28
29
30
31
32
# File 'lib/mercadolibre/core/categories_and_listings.rb', line 28

def get_listing_exposures(site_id)
  results = get_request("/sites/#{site_id}/listing_exposures")

  results[:body].map { |r| Mercadolibre::Entity::ListingExposure.new(r) }
end

#get_listing_prices(filters) ⇒ Object


34
35
36
37
38
39
40
41
# File 'lib/mercadolibre/core/categories_and_listings.rb', line 34

def get_listing_prices(filters)
  valid_filters = ['price', 'listing_type_id', 'quantity', 'category_id', 'currency_id']
  filters.keep_if { |k,v| valid_filters.include?(k.to_s) }

  results = get_request("/sites/#{site_id}/listing_prices", filters)

  results[:body].map { |r| Mercadolibre::Entity::ListingPrice.new(r) }
end

#get_listing_types(site_id) ⇒ Object


22
23
24
25
26
# File 'lib/mercadolibre/core/categories_and_listings.rb', line 22

def get_listing_types(site_id)
  results = get_request("/sites/#{site_id}/listing_types")

  results[:body].map { |r| Mercadolibre::Entity::ListingType.new(r) }
end

#get_site(site_id) ⇒ Object


10
11
12
13
14
# File 'lib/mercadolibre/core/categories_and_listings.rb', line 10

def get_site(site_id)
  result = get_request("/sites/#{site_id}")

  Mercadolibre::Entity::Site.new(result[:body])
end

#get_site_categories(site_id) ⇒ Object


43
44
45
46
47
# File 'lib/mercadolibre/core/categories_and_listings.rb', line 43

def get_site_categories(site_id)
  results = get_request("/sites/#{site_id}/categories")

  results[:body].map { |r| Mercadolibre::Entity::Category.new(r) }
end

#get_site_domain_info(domain) ⇒ Object


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

def get_site_domain_info(domain)
  result = get_request("/site_domains/#{domain}")

  Mercadolibre::Entity::SiteDomain.new(result[:body])
end

#get_sitesObject


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

def get_sites
  results = get_request('/sites')

  results[:body].map { |r| Mercadolibre::Entity::Site.new(r) }
end