openfoodfacts 0.6.2 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5bba81d2fa5eba4c502cdd6b59ddee3b504addc298f0a0ebaf254b0c2885641
4
- data.tar.gz: c9bb2c4266aaeac2c606e741f44a4d60d81d919be29f587a6abc15ef15c74fcf
3
+ metadata.gz: 66959a945067cf3bd664337b6effab5aaefad026516fa44971ac88da8ba06e34
4
+ data.tar.gz: f311a6138bb21af333fa4e46d4fc2e5a531305b1bcc52c6d0d854bb9f9ebc81e
5
5
  SHA512:
6
- metadata.gz: 7201788f4331aacbe1406f67a91432ce0b1493ce635f5359781a0bd9d2645a3740499c2a263e60f7ecd94ceb1e81df0e54d306c92cbfd2b14010c69c9ffab83b
7
- data.tar.gz: 25d08f6c5a61a7db159c7c36efbfcd31363bf7b97ca77cc910ff1f45795bc091aa3e106354fe8f9e7585f6ef05e63b825ca1f1c651a6f987aa16ea1063a36e3b
6
+ metadata.gz: 0c0e9a7d22e07aff54f2e3e4f640a99eb60abc1e9fc37009889eac3caa845925a44a50e820a768d998a2b20d5ab011d6d46ee358933a062b6bd2e7cced912fd3
7
+ data.tar.gz: 9a5a7fa4b8ba2ab280a72b1915232d377b2526e735801904c0ced26ebbfc2a29acd78e513c9af1f06025f5895adc13296cba7890a54c77379b342c63e21228c9
data/README.md CHANGED
@@ -1,11 +1,20 @@
1
- # Open Food Facts
1
+ # Open Food Facts Ruby SDK
2
+
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://static.openfoodfacts.org/images/logos/off-logo-horizontal-dark.png?refresh_github_cache=1">
5
+ <source media="(prefers-color-scheme: light)" srcset="https://static.openfoodfacts.org/images/logos/off-logo-horizontal-light.png?refresh_github_cache=1">
6
+ <img height="48" src="https://static.openfoodfacts.org/images/logos/off-logo-horizontal-light.svg"/>
7
+ </picture>
2
8
 
3
9
  [![Gem Version](https://badge.fury.io/rb/openfoodfacts.svg)](https://badge.fury.io/rb/openfoodfacts)
4
10
  [![Build Status](https://github.com/openfoodfacts/openfoodfacts-ruby/actions/workflows/ruby.yml/badge.svg)](https://github.com/openfoodfacts/openfoodfacts-ruby/actions/workflows/ruby.yml)
5
11
  [![RuboCop](https://github.com/openfoodfacts/openfoodfacts-ruby/actions/workflows/rubocop-analysis.yml/badge.svg)](https://github.com/openfoodfacts/openfoodfacts-ruby/actions/workflows/rubocop-analysis.yml)
6
12
  [![Documentation](https://inch-ci.org/github/openfoodfacts/openfoodfacts-ruby.svg?branch=master)](https://inch-ci.org/github/openfoodfacts/openfoodfacts-ruby)
7
13
 
8
- API Wrapper for [Open Food Facts](https://openfoodfacts.org/), the open database about food.
14
+ - API Wrapper for [Open Food Facts](https://openfoodfacts.org/), the open database about food.
15
+ - We [have a similar package for cosmetics](https://github.com/openfoodfacts/openbeautyfacts-ruby).
16
+ - Note: This package needs updates for the newest APIs.
17
+ - Please see on the wiki [how to join the community to help with the Ruby package](https://wiki.openfoodfacts.org/API/Ruby)
9
18
 
10
19
  ## Installation
11
20
 
@@ -104,7 +113,7 @@ Openfoodfacts::Locale.all
104
113
 
105
114
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
106
115
 
107
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
116
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `lib/openfoodfacts/version.rb`, and push to the main branch. Releases are automated via GitHub Actions using Trusted Publishers for secure publishing to [rubygems.org](https://rubygems.org).
108
117
 
109
118
  ## Contributing
110
119
 
@@ -113,3 +122,15 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
113
122
  3. Commit your changes (`git commit -am 'Add some feature'`)
114
123
  4. Push to the branch (`git push origin my-new-feature`)
115
124
  5. Create a new Pull Request
125
+
126
+
127
+
128
+ ### Third party applications
129
+
130
+ * Feel [free to open a PR to add your application in this list](https://github.com/openfoodfacts/openfoodfacts-ruby/edit/main/REUSERS.md).
131
+ * Please get in touch at reuse@openfoodfacts.org
132
+ * We are very interested in learning what the Open Food Facts data is used for. It is not mandatory, but we would very much appreciate it if you tell us about your re-uses (https://forms.gle/hwaeqBfs8ywwhbTg8) so that we can share them with the Open Food Facts community. You can also fill this form to get a chance to get your app featured: https://forms.gle/hwaeqBfs8ywwhbTg8
133
+ * Make sure you comply with the OdBL licence, mentioning the Source of your data, and ensuring to avoid combining non free data you can't release legally as open data. Another requirement is contributing back any product you add using this SDK.
134
+
135
+ ## Authors
136
+
data/Rakefile CHANGED
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rake/testtask'
3
-
5
+
4
6
  Rake::TestTask.new do |task|
5
- task.libs << "lib"
6
- task.libs << "test"
7
- task.pattern = "test/test_*.rb"
7
+ task.libs << 'lib'
8
+ task.libs << 'test'
9
+ task.pattern = 'test/test_*.rb'
8
10
  end
9
11
 
10
12
  task default: :test
@@ -16,4 +18,4 @@ task :console do
16
18
  require File.join(__FILE__, '../lib/openfoodfacts')
17
19
  ARGV.clear
18
20
  IRB.start
19
- end
21
+ end
@@ -1,44 +1,41 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'hashie'
2
4
 
3
5
  module Openfoodfacts
4
6
  class Additive < Hashie::Mash
5
-
6
7
  # TODO: Add more locales
7
8
  LOCALE_PATHS = {
8
9
  'fr' => 'additifs',
9
10
  'uk' => 'additives',
10
11
  'us' => 'additives',
11
12
  'world' => 'additives'
12
- }
13
+ }.freeze
13
14
 
14
15
  class << self
15
-
16
16
  # Get additives
17
17
  #
18
18
  def all(locale: DEFAULT_LOCALE, domain: DEFAULT_DOMAIN)
19
- if path = LOCALE_PATHS[locale]
20
- page_url = "https://#{locale}.#{domain}/#{path}"
19
+ if (path = LOCALE_PATHS[locale])
20
+ page_url = "https://#{locale}.#{domain}/facets/#{path}"
21
21
 
22
22
  Product.tags_from_page(self, page_url) do |tag|
23
23
  columns = tag.css('td')
24
24
 
25
25
  link = tag.css('a').first
26
26
  attributes = {
27
- "name" => link.text.strip,
28
- "url" => URI.join(page_url, link.attr('href')).to_s,
29
- "products_count" => columns[1].text.to_i
27
+ 'name' => link.text.strip,
28
+ 'url' => URI.join(page_url, link.attr('href')).to_s,
29
+ 'products_count' => columns[1].text.to_i
30
30
  }
31
31
 
32
32
  riskiness = columns.last.attr('class')
33
- if riskiness
34
- attributes["riskiness"] = riskiness[/level_(\d+)/, 1].to_i
35
- end
33
+ attributes['riskiness'] = riskiness[/level_(\d+)/, 1].to_i if riskiness
36
34
 
37
35
  new(attributes)
38
36
  end
39
37
  end
40
38
  end
41
-
42
39
  end
43
40
 
44
41
  # Get products with additive
@@ -46,6 +43,5 @@ module Openfoodfacts
46
43
  def products(page: -1)
47
44
  Product.from_website_page(url, page: page, products_count: products_count) if url
48
45
  end
49
-
50
46
  end
51
47
  end
@@ -1,26 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'hashie'
2
4
 
3
5
  module Openfoodfacts
4
6
  class Allergen < Hashie::Mash
5
-
6
7
  # TODO: Add more locales
7
8
  LOCALE_PATHS = {
8
9
  'fr' => 'allergenes',
9
10
  'uk' => 'allergens',
10
11
  'us' => 'allergens',
11
12
  'world' => 'allergens'
12
- }
13
+ }.freeze
13
14
 
14
15
  class << self
15
-
16
16
  # Get allergens
17
17
  #
18
18
  def all(locale: DEFAULT_LOCALE, domain: DEFAULT_DOMAIN)
19
- if path = LOCALE_PATHS[locale]
19
+ if (path = LOCALE_PATHS[locale])
20
20
  Product.tags_from_page(self, "https://#{locale}.#{domain}/#{path}")
21
21
  end
22
22
  end
23
-
24
23
  end
25
24
 
26
25
  # Get products with allergen
@@ -28,6 +27,5 @@ module Openfoodfacts
28
27
  def products(page: -1)
29
28
  Product.from_website_page(url, page: page, products_count: products_count) if url
30
29
  end
31
-
32
30
  end
33
31
  end
@@ -1,26 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'hashie'
2
4
 
3
5
  module Openfoodfacts
4
6
  class Brand < Hashie::Mash
5
-
6
7
  # TODO: Add more locales
7
8
  LOCALE_PATHS = {
8
9
  'fr' => 'marques',
9
10
  'uk' => 'brands',
10
11
  'us' => 'brands',
11
12
  'world' => 'brands'
12
- }
13
+ }.freeze
13
14
 
14
15
  class << self
15
-
16
16
  # Get product brands
17
17
  #
18
18
  def all(locale: DEFAULT_LOCALE, domain: DEFAULT_DOMAIN)
19
- if path = LOCALE_PATHS[locale]
20
- Product.tags_from_page(self, "https://#{locale}.#{domain}/#{path}")
19
+ if (path = LOCALE_PATHS[locale])
20
+ Product.tags_from_page(self, "https://#{locale}.#{domain}/facets/#{path}")
21
21
  end
22
22
  end
23
-
24
23
  end
25
24
 
26
25
  # Get products with brand
@@ -28,6 +27,5 @@ module Openfoodfacts
28
27
  def products(page: -1)
29
28
  Product.from_website_page(url, page: page, products_count: products_count) if url
30
29
  end
31
-
32
30
  end
33
31
  end
@@ -1,26 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'hashie'
2
4
 
3
5
  module Openfoodfacts
4
6
  class Category < Hashie::Mash
5
-
6
7
  # TODO: Add more locales
7
8
  LOCALE_PATHS = {
8
9
  'fr' => 'categories',
9
10
  'uk' => 'categories',
10
11
  'us' => 'categories',
11
12
  'world' => 'categories'
12
- }
13
+ }.freeze
13
14
 
14
15
  class << self
15
-
16
16
  # Get categories
17
17
  #
18
18
  def all(locale: DEFAULT_LOCALE, domain: DEFAULT_DOMAIN)
19
- if path = LOCALE_PATHS[locale]
19
+ if (path = LOCALE_PATHS[locale])
20
20
  Product.tags_from_page(self, "https://#{locale}.#{domain}/#{path}")
21
21
  end
22
22
  end
23
-
24
23
  end
25
24
 
26
25
  # Get products with category
@@ -28,6 +27,5 @@ module Openfoodfacts
28
27
  def products(page: -1)
29
28
  Product.from_website_page(url, page: page, products_count: products_count) if url
30
29
  end
31
-
32
30
  end
33
31
  end
@@ -1,26 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'hashie'
2
4
 
3
5
  module Openfoodfacts
4
6
  class City < Hashie::Mash
5
-
6
7
  # TODO: Add more locales
7
8
  LOCALE_PATHS = {
8
9
  'fr' => 'communes',
9
10
  'uk' => 'cities',
10
11
  'us' => 'cities',
11
12
  'world' => 'cities'
12
- }
13
+ }.freeze
13
14
 
14
15
  class << self
15
-
16
16
  # Get cities
17
17
  #
18
18
  def all(locale: DEFAULT_LOCALE, domain: DEFAULT_DOMAIN)
19
- if path = LOCALE_PATHS[locale]
19
+ if (path = LOCALE_PATHS[locale])
20
20
  Product.tags_from_page(self, "https://#{locale}.#{domain}/#{path}")
21
21
  end
22
22
  end
23
-
24
23
  end
25
24
 
26
25
  # Get products with city
@@ -28,6 +27,5 @@ module Openfoodfacts
28
27
  def products(page: -1)
29
28
  Product.from_website_page(url, page: page, products_count: products_count) if url
30
29
  end
31
-
32
30
  end
33
31
  end
@@ -1,26 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'hashie'
2
4
 
3
5
  module Openfoodfacts
4
6
  class Contributor < Hashie::Mash
5
-
6
7
  # TODO: Add more locales
7
8
  LOCALE_PATHS = {
8
9
  'fr' => 'contributeurs',
9
10
  'uk' => 'contributors',
10
11
  'us' => 'contributors',
11
12
  'world' => 'contributors'
12
- }
13
+ }.freeze
13
14
 
14
15
  class << self
15
-
16
16
  # Get contributors
17
17
  #
18
18
  def all(locale: DEFAULT_LOCALE, domain: DEFAULT_DOMAIN)
19
- if path = LOCALE_PATHS[locale]
19
+ if (path = LOCALE_PATHS[locale])
20
20
  Product.tags_from_page(self, "https://#{locale}.#{domain}/#{path}")
21
21
  end
22
22
  end
23
-
24
23
  end
25
24
 
26
25
  # Get products for contributor
@@ -28,6 +27,5 @@ module Openfoodfacts
28
27
  def products(page: -1)
29
28
  Product.from_website_page(url, page: page, products_count: products_count) if url
30
29
  end
31
-
32
30
  end
33
31
  end
@@ -1,26 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'hashie'
2
4
 
3
5
  module Openfoodfacts
4
6
  class Country < Hashie::Mash
5
-
6
7
  # TODO: Add more locales
7
8
  LOCALE_PATHS = {
8
9
  'fr' => 'pays',
9
10
  'uk' => 'countries',
10
11
  'us' => 'countries',
11
12
  'world' => 'countries'
12
- }
13
+ }.freeze
13
14
 
14
15
  class << self
15
-
16
16
  # Get countries
17
17
  #
18
18
  def all(locale: DEFAULT_LOCALE, domain: DEFAULT_DOMAIN)
19
- if path = LOCALE_PATHS[locale]
19
+ if (path = LOCALE_PATHS[locale])
20
20
  Product.tags_from_page(self, "https://#{locale}.#{domain}/#{path}")
21
21
  end
22
22
  end
23
-
24
23
  end
25
24
 
26
25
  # Get products with country
@@ -28,6 +27,5 @@ module Openfoodfacts
28
27
  def products(page: -1)
29
28
  Product.from_website_page(url, page: page, products_count: products_count) if url
30
29
  end
31
-
32
30
  end
33
31
  end
@@ -1,26 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'hashie'
2
4
 
3
5
  module Openfoodfacts
4
6
  class EntryDate < Hashie::Mash
5
-
6
7
  # TODO: Add more locales
7
8
  LOCALE_PATHS = {
8
9
  'fr' => 'dates-d-ajout',
9
10
  'uk' => 'entry-dates',
10
11
  'us' => 'entry-dates',
11
12
  'world' => 'entry-dates'
12
- }
13
+ }.freeze
13
14
 
14
15
  class << self
15
-
16
16
  # Get entry dates
17
17
  #
18
18
  def all(locale: DEFAULT_LOCALE, domain: DEFAULT_DOMAIN)
19
- if path = LOCALE_PATHS[locale]
20
- Product.tags_from_page(self, "https://#{locale}.#{domain}/#{path}")
19
+ if (path = LOCALE_PATHS[locale])
20
+ Product.tags_from_page(self, "https://#{locale}.#{domain}/facets/#{path}")
21
21
  end
22
22
  end
23
-
24
23
  end
25
24
 
26
25
  # Get products with entry date
@@ -28,6 +27,5 @@ module Openfoodfacts
28
27
  def products(page: -1)
29
28
  Product.from_website_page(url, page: page, products_count: products_count) if url
30
29
  end
31
-
32
30
  end
33
31
  end
@@ -1,22 +1,22 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'hashie'
2
4
  require 'nokogiri'
3
- require 'open-uri'
4
5
 
5
6
  module Openfoodfacts
6
7
  class Faq < Hashie::Mash
7
-
8
8
  # TODO: Add more locales
9
9
  LOCALE_PATHS = {
10
10
  'fr' => 'questions-frequentes',
11
11
  'uk' => 'faq',
12
12
  'us' => 'faq',
13
13
  'world' => 'faq'
14
- }
14
+ }.freeze
15
15
 
16
16
  class << self
17
17
  def items(locale: DEFAULT_LOCALE, domain: DEFAULT_DOMAIN)
18
- if path = LOCALE_PATHS[locale]
19
- html = URI.open("https://#{locale}.#{domain}/#{path}").read
18
+ if (path = LOCALE_PATHS[locale])
19
+ html = Openfoodfacts.http_get("https://#{locale}.#{domain}/#{path}").read
20
20
  dom = Nokogiri::HTML.fragment(html)
21
21
 
22
22
  titles = dom.css('#main_column h2')
@@ -25,26 +25,21 @@ module Openfoodfacts
25
25
 
26
26
  element = item.next_sibling
27
27
  while !element.nil? && element.node_name != 'h2'
28
- if element.node_name == 'p'
29
- paragraphs.push(element)
30
- end
28
+ paragraphs.push(element) if element.node_name == 'p'
31
29
 
32
30
  element = element.next_sibling
33
31
  end
34
32
 
35
- if index == titles.length - 1
36
- paragraphs = paragraphs[0..-3]
37
- end
33
+ paragraphs = paragraphs[0..-3] if index == titles.length - 1
38
34
 
39
35
  new({
40
- "question" => item.text.strip,
41
- "answer" => paragraphs.map { |paragraph| paragraph.text.strip.gsub(/\r?\n/, ' ') }.join("\n\n"),
42
- "answer_html" => paragraphs.map(&:to_html).join
43
- })
36
+ 'question' => item.text.strip,
37
+ 'answer' => paragraphs.map { |paragraph| paragraph.text.strip.gsub(/\r?\n/, ' ') }.join("\n\n"),
38
+ 'answer_html' => paragraphs.map(&:to_html).join
39
+ })
44
40
  end
45
41
  end
46
42
  end
47
43
  end
48
-
49
44
  end
50
45
  end
@@ -1,26 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'hashie'
2
4
 
3
5
  module Openfoodfacts
4
6
  class IngredientThatMayBeFromPalmOil < Hashie::Mash
5
-
6
7
  # TODO: Add more locales
7
8
  LOCALE_PATHS = {
8
9
  'fr' => 'ingredients-pouvant-etre-issus-de-l-huile-de-palme',
9
10
  'uk' => 'ingredients-that-may-be-from-palm-oil',
10
11
  'us' => 'ingredients-that-may-be-from-palm-oil',
11
12
  'world' => 'ingredients-that-may-be-from-palm-oil'
12
- }
13
+ }.freeze
13
14
 
14
15
  class << self
15
-
16
16
  # Get ingredients that may be from palm oil
17
17
  #
18
18
  def all(locale: DEFAULT_LOCALE, domain: DEFAULT_DOMAIN)
19
- if path = LOCALE_PATHS[locale]
19
+ if (path = LOCALE_PATHS[locale])
20
20
  Product.tags_from_page(self, "https://#{locale}.#{domain}/#{path}")
21
21
  end
22
22
  end
23
-
24
23
  end
25
24
 
26
25
  # Get products with ingredient that may be from palm oil
@@ -28,6 +27,5 @@ module Openfoodfacts
28
27
  def products(page: -1)
29
28
  Product.from_website_page(url, page: page, products_count: products_count) if url
30
29
  end
31
-
32
30
  end
33
31
  end
@@ -1,26 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'hashie'
2
4
 
3
5
  module Openfoodfacts
4
6
  class Label < Hashie::Mash
5
-
6
7
  # TODO: Add more locales
7
8
  LOCALE_PATHS = {
8
9
  'fr' => 'labels',
9
10
  'uk' => 'labels',
10
11
  'us' => 'labels',
11
12
  'world' => 'labels'
12
- }
13
+ }.freeze
13
14
 
14
15
  class << self
15
-
16
16
  # Get labels
17
17
  #
18
18
  def all(locale: DEFAULT_LOCALE, domain: DEFAULT_DOMAIN)
19
- if path = LOCALE_PATHS[locale]
19
+ if (path = LOCALE_PATHS[locale])
20
20
  Product.tags_from_page(self, "https://#{locale}.#{domain}/#{path}")
21
21
  end
22
22
  end
23
-
24
23
  end
25
24
 
26
25
  # Get products with label
@@ -28,6 +27,5 @@ module Openfoodfacts
28
27
  def products(page: -1)
29
28
  Product.from_website_page(url, page: page, products_count: products_count) if url
30
29
  end
31
-
32
30
  end
33
31
  end
@@ -1,26 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'hashie'
2
4
 
3
5
  module Openfoodfacts
4
6
  class Language < Hashie::Mash
5
-
6
7
  # TODO: Add more locales
7
8
  LOCALE_PATHS = {
8
9
  'fr' => 'langues',
9
10
  'uk' => 'languages',
10
11
  'us' => 'languages',
11
12
  'world' => 'languages'
12
- }
13
+ }.freeze
13
14
 
14
15
  class << self
15
-
16
16
  # Get languages
17
17
  #
18
18
  def all(locale: DEFAULT_LOCALE, domain: DEFAULT_DOMAIN)
19
- if path = LOCALE_PATHS[locale]
20
- Product.tags_from_page(self, "https://#{locale}.#{domain}/#{path}")
19
+ if (path = LOCALE_PATHS[locale])
20
+ Product.tags_from_page(self, "https://#{locale}.#{domain}/facets/#{path}")
21
21
  end
22
22
  end
23
-
24
23
  end
25
24
 
26
25
  # Get products with language
@@ -28,6 +27,5 @@ module Openfoodfacts
28
27
  def products(page: -1)
29
28
  Product.from_website_page(url, page: page, products_count: products_count) if url
30
29
  end
31
-
32
30
  end
33
31
  end
@@ -1,26 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'hashie'
2
4
 
3
5
  module Openfoodfacts
4
6
  class LastEditDate < Hashie::Mash
5
-
6
7
  # TODO: Add more locales
7
8
  LOCALE_PATHS = {
8
9
  'fr' => 'dates-de-derniere-modification',
9
10
  'uk' => 'last-edit-dates',
10
11
  'us' => 'last-edit-dates',
11
12
  'world' => 'last-edit-dates'
12
- }
13
+ }.freeze
13
14
 
14
15
  class << self
15
-
16
16
  # Get last edit dates
17
17
  #
18
18
  def all(locale: DEFAULT_LOCALE, domain: DEFAULT_DOMAIN)
19
- if path = LOCALE_PATHS[locale]
20
- Product.tags_from_page(self, "https://#{locale}.#{domain}/#{path}")
19
+ if (path = LOCALE_PATHS[locale])
20
+ Product.tags_from_page(self, "https://#{locale}.#{domain}/facets/#{path}")
21
21
  end
22
22
  end
23
-
24
23
  end
25
24
 
26
25
  # Get products with last edit date
@@ -28,6 +27,5 @@ module Openfoodfacts
28
27
  def products(page: -1)
29
28
  Product.from_website_page(url, page: page, products_count: products_count) if url
30
29
  end
31
-
32
30
  end
33
31
  end