Skip to content

Instantly share code, notes, and snippets.

@rubinovitz
Created June 27, 2015 21:38
Show Gist options
  • Save rubinovitz/277b3a2d5a20666d9f33 to your computer and use it in GitHub Desktop.
Save rubinovitz/277b3a2d5a20666d9f33 to your computer and use it in GitHub Desktop.
Crunchbase DDG Spice Scaffolding
package DDG::Spice::Crunchbase;
# ABSTRACT: Write an abstract here
# Start at https://duck.co/duckduckhack/spice_overview if you are new
# to instant answer development
use DDG::Spice;
# Caching - https://duck.co/duckduckhack/spice_advanced_backend#caching
spice is_cached => 1;
# Metadata. See https://duck.co/duckduckhack/metadata for help in filling out this section.
name "Crunchbase";
source "";
icon_url "";
description "Succinct explanation of what this instant answer does";
primary_example_queries "first example query", "second example query";
secondary_example_queries "optional -- demonstrate any additional triggers";
# Uncomment and complete: https://duck.co/duckduckhack/metadata#category
# category "";
# Uncomment and complete: https://duck.co/duckduckhack/metadata#topics
# topics "";
code_url "https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/Crunchbase.pm";
attribution github => ["GitHubAccount", "Friendly Name"],
twitter => "twitterhandle";
# API endpoint - https://duck.co/duckduckhack/spice_attributes#spice-codetocode
spice to => 'http://example.com/search/$1';
# Triggers - https://duck.co/duckduckhack/spice_triggers
triggers any => "triggerWord", "trigger phrase";
# Handle statement
handle remainder => sub {
# optional - regex guard
# return unless qr/^\w+/;
return unless $_; # Guard against "no answer"
return $_;
};
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment