Crystal module for openfood.ch
OpenFood is an independent and open database of barcoded edible products sold in Switzerland. It is maintained by the Digital Epidemiology Laboratory of EPFL and gratefully acknowledges access to the shops of Coop and Migros (Switzerland).
This module is still in development, contribute if you can 👍
Add this to your application's shard.yml
:
dependencies:
openfood:
github: denysvitali/openfood
require "openfood"
result = OpenFood.getProducts(50) #Gets 50 products
# result is of type OpenFood::Pagination
result.data.each do |el|
# el is of type OpenFood::Product (see src/openfood/responses/Product.cr)
if el.attributes.name != nil
puts el.attributes.name
end
end
- Fork it ( https://github.com/denysvitali/openfood/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
- denysvitali Denys Vitali - creator, maintainer