Module: Openfoodfacts

Defined in:
lib/openfoodfacts.rb,
lib/openfoodfacts/faq.rb,
lib/openfoodfacts/user.rb,
lib/openfoodfacts/city.rb,
lib/openfoodfacts/brand.rb,
lib/openfoodfacts/store.rb,
lib/openfoodfacts/press.rb,
lib/openfoodfacts/trace.rb,
lib/openfoodfacts/label.rb,
lib/openfoodfacts/locale.rb,
lib/openfoodfacts/origin.rb,
lib/openfoodfacts/country.rb,
lib/openfoodfacts/product.rb,
lib/openfoodfacts/version.rb,
lib/openfoodfacts/additive.rb,
lib/openfoodfacts/allergen.rb,
lib/openfoodfacts/category.rb,
lib/openfoodfacts/packaging.rb,
lib/openfoodfacts/contributor.rb,
lib/openfoodfacts/packager_code.rb,
lib/openfoodfacts/product_state.rb,
lib/openfoodfacts/purchase_place.rb,
lib/openfoodfacts/manufacturing_place.rb,
lib/openfoodfacts/ingredient_that_may_be_from_palm_oil.rb

Defined Under Namespace

Classes: Additive, Allergen, Brand, Category, City, Contributor, Country, Faq, IngredientThatMayBeFromPalmOil, Label, Locale, ManufacturingPlace, Origin, PackagerCode, Packaging, Press, Product, ProductState, PurchasePlace, Store, Trace, User

Constant Summary collapse

DEFAULT_LOCALE =
Locale::GLOBAL
DEFAULT_DOMAIN =
'openfoodfacts.org'
VERSION =
"0.3.2"

Class Method Summary collapse

Class Method Details

Return locale from link


37
38
39
# File 'lib/openfoodfacts.rb', line 37

def locale_from_link(link)
  Locale.locale_from_link(link)
end

.localesObject

Get locales


43
44
45
# File 'lib/openfoodfacts.rb', line 43

def locales
  Locale.all
end

.product(barcode, locale: DEFAULT_LOCALE) ⇒ Object

Get product


49
50
51
# File 'lib/openfoodfacts.rb', line 49

def product(barcode, locale: DEFAULT_LOCALE)
  Product.get(barcode, locale: locale)
end

.product_url(barcode, locale: DEFAULT_LOCALE) ⇒ Object

Return product API URL


55
56
57
# File 'lib/openfoodfacts.rb', line 55

def product_url(barcode, locale: DEFAULT_LOCALE)
  Product.url(barcode, locale: locale)
end