Class: Openbeautyfacts::ManufacturingPlace

Inherits:
Hashie::Mash
  • Object
show all
Defined in:
lib/openbeautyfacts/manufacturing_place.rb

Constant Summary collapse

LOCALE_PATHS =

TODO: Add more locales

{
  'fr' => 'lieux-de-fabrication',
  'uk' => 'manufacturing-places',
  'us' => 'manufacturing-places',
  'world' => 'manufacturing-places'
}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all(locale: DEFAULT_LOCALE, domain: DEFAULT_DOMAIN) ⇒ Object

Get manufacturing places



18
19
20
21
22
# File 'lib/openbeautyfacts/manufacturing_place.rb', line 18

def all(locale: DEFAULT_LOCALE, domain: DEFAULT_DOMAIN)
  if path = LOCALE_PATHS[locale]
    Product.tags_from_page(self, "https://#{locale}.#{domain}/#{path}")
  end
end

Instance Method Details

#products(page: -1)) ⇒ Object

Get products from manufacturing place



28
29
30
# File 'lib/openbeautyfacts/manufacturing_place.rb', line 28

def products(page: -1)
  Product.from_website_page(url, page: page, products_count: products_count) if url
end