Module: Openbeautyfacts

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

Defined Under Namespace

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

Constant Summary collapse

DEFAULT_LOCALE =
Locale::GLOBAL
DEFAULT_DOMAIN =
'openbeautyfacts.org'
VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

Return locale from link


39
40
41
# File 'lib/openbeautyfacts.rb', line 39

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

.localesObject

Get locales


45
46
47
# File 'lib/openbeautyfacts.rb', line 45

def locales
  Locale.all
end

.product(barcode, locale: DEFAULT_LOCALE) ⇒ Object

Get product


51
52
53
# File 'lib/openbeautyfacts.rb', line 51

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

.product_url(barcode, locale: DEFAULT_LOCALE) ⇒ Object

Return product API URL


57
58
59
# File 'lib/openbeautyfacts.rb', line 57

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