this must be changed to the latest path = "api/v3/product/#{code}.json" as well as
The parsing logic needs to be updatednew(hash["product"]) if !hash.nil? && hash["status"] == "success"
Steps to reproduce the behavior:
Open up the console and try calling x = Openfoodfacts.product("5449000000439") which returns Nil. Once the changes are made it also lacks error validation on Openfoodfacts.product("3")
What
The API path is outdated
this must be changed to the latest
path = "api/v3/product/#{code}.json"
as well as The parsing logic needs to be updatednew(hash["product"]) if !hash.nil? && hash["status"] == "success"
Steps to reproduce the behavior:
Open up the console and try calling
x = Openfoodfacts.product("5449000000439")
which returns Nil. Once the changes are made it also lacks error validation onOpenfoodfacts.product("3")
Expected behavior
Should return the product and handle errors.
Platform