openfoodfacts / openfoodfacts-ruby

Open Food Facts API Wrapper
MIT License
34 stars 11 forks source link

Gem no longer works #95

Open shivneelmistry opened 1 month ago

shivneelmistry commented 1 month ago

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 updated new(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")

Expected behavior

Should return the product and handle errors.

Platform

teolemon commented 1 month ago

@shivneelmistry 👍 would you be able to open a PR to fix this ?

shivneelmistry commented 1 month ago

I have made some changes here, fix: Update API paths #96