Module: Openbeautyfacts

Defined in:
lib/openbeautyfacts.rb,
lib/openbeautyfacts/faq.rb,
lib/openbeautyfacts/city.rb,
lib/openbeautyfacts/user.rb,
lib/openbeautyfacts/brand.rb,
lib/openbeautyfacts/label.rb,
lib/openbeautyfacts/press.rb,
lib/openbeautyfacts/store.rb,
lib/openbeautyfacts/trace.rb,
lib/openbeautyfacts/locale.rb,
lib/openbeautyfacts/origin.rb,
lib/openbeautyfacts/country.rb,
lib/openbeautyfacts/mission.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/entry_date.rb,
lib/openbeautyfacts/ingredient.rb,
lib/openbeautyfacts/contributor.rb,
lib/openbeautyfacts/packager_code.rb,
lib/openbeautyfacts/product_state.rb,
lib/openbeautyfacts/last_edit_date.rb,
lib/openbeautyfacts/purchase_place.rb,
lib/openbeautyfacts/manufacturing_place.rb,
lib/openbeautyfacts/period_after_opening.rb,
lib/openbeautyfacts/number_of_ingredients.rb,
lib/openbeautyfacts/ingredient_that_may_be_from_palm_oil.rb

Defined Under Namespace

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

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

Return locale from link



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

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

.localesObject

Get locales



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

def locales
  Locale.all
end

.product(barcode, locale: DEFAULT_LOCALE) ⇒ Object

Get product



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

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

.product_url(barcode, locale: DEFAULT_LOCALE) ⇒ Object

Return product API URL



61
62
63
# File 'lib/openbeautyfacts.rb', line 61

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