Food2Fork
A gem for accessing the Food2Fork API
Installation
Add this line to your application's Gemfile:
gem 'food2fork'
And then execute:
$ bundle
Or install it yourself as:
$ gem install food2fork
Usage
Examples
authentication
All requests require a valid API key. For a free api key please apply here
# set FOOD2FORK_API_KEY as environment variable
export FOOD2FORK_API_KEY=52e595d8dff202904d....
All parameters can be encoded as either HTTP GET or POST parameters.
Recipes search api
Food2Fork::Recipe.search # => returns list of Recipe array object
Recipe search parameters
- q: (optional) Search Query (Ingredients should be separated by commas). If this is omitted top rated recipes will be returned.
- sort: (optional) How the results should be sorted. See Below for details.
- page: (optional) Used to get additional results
Food2Fork::Recipe.search({q: 'Paneer', sort: 'r', page: 3}) # => returns list of Recipe array object
Get Recipe
- rId: (integer,optional) - Id of desired recipe as returned by Search Query
Food2Fork::Recipe.get({rId: 47024}) # => returns recipe object
Search Sorting
The Food2Fork API offers two kinds of sorting for queries. The first is by rating. This rating is based off of social media scores to determine the best recipes.
sort=r
The second is by trendingness. The most recent recipes from our publishers have a trend score based on how quickly they are gaining popularity.
sort=t
Pages (Search Only)
Any request will return a maximum of 30 results. To get the next set of results send the same request again but with
page = 2
The default if omitted is
page = 1
Contributing
- Fork it
- 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 new Pull Request
Let’s build something great:
We’d love to design & build your next big idea, or lend a hand on an existing project.
Email - [email protected]
Website - http://7precisions.com