Git Product home page Git Product logo

p6-webservice-food2fork's Introduction

WebService Food2Fork

Food2Fork is a collection of recipes from difference sources. This is a Perl 6 wrapper around their API

Installation

panda install git://github.com/kmwallio/p6-WebService-Food2Fork.git

Usage

Creating a link

use WebService::Food2Fork;

my $yum = Food2Fork.new(:key<API Key>);

Searching

my $food = $yum.search('bbq chicken');

$food looks something like:

{
  count   => 30.Int,
  recipes => [
    {
      f2f_url       => "http://food2fork.com/view/41470".Str,
      image_url     => "http://static.food2fork.com/BBQChickenPizzawithCauliflowerCrust5004699695624ce.jpg".Str,
      publisher     => "Closet Cooking".Str,
      publisher_url => "http://closetcooking.com".Str,
      recipe_id     => "41470".Str,
      social_rank   => 99.9999999999994.Rat,
      source_url    => "http://www.closetcooking.com/2013/02/cauliflower-pizza-crust-with-bbq.html".Str,
      title         => "Cauliflower Pizza Crust (with BBQ Chicken Pizza)".Str,
    },
    ...
  ]
}

Caching Results

Using the free tier? You can use a cache with expiration. Use :memory: as the database to have a temporary database.

By default, searches are cached for 15 minutes. Recipes are cached for 24 hours. You can change this. There currently isn't an option not to cache.

use WebService::Food2Fork;

my $yum = Food2Fork.new(
              :key<API Key>,      # Required
              :cache<:memory:>,   # Optional
              :cache_search<15>,  # 15 minutes
              :cache_recipe<1440> # 1 day
              );

We'll attempt to use tables f2f_search and f2f_recipe or we'll die trying...

Acknowledgements

p6-webservice-food2fork's People

Contributors

kmwallio avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.