The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WWW::Kickstarter - Retrieve information from Kickstarter

VERSION

Version 1.4.0

SYNOPSIS

   use WWW::Kickstarter;

   my $email    = '...';  # Your Kickstarter login credentials
   my $password = '...';

   my $ks = WWW::Kickstarter->new();
   my $myself = $ks->login($email, $password);

   my $iter = $ks->projects_ending_soon();
   while (my ($project) = $iter->()) {
      print($project->name, "\n");
   }

DESCRIPTION

This distribution provides access to Kickstarter's private API to obtain information about your account, other users and and projects.

CONSTRUCTOR

new

   my $ks = WWW::Kickstarter->new(%opts);

This is the starting point to using the API, after which you much login using the $ks->login method documented immediately below.

Options:

  • agent => "application_name/version "

    The string to pass to Kickstarter in the User-Agent HTTP header. If the string ends with a space, the name and version of this library will be appended, as will the name of version of the underling HTTP client.

  • impolite => 1

    This module throttles the rate at which it sends requests to Kickstarter. It won't place another request until $X seconds has passed since the last request, where $X is the amount of time taken to fulfill the last request, but at most 4 seconds.

    impolite => 1 disables the throttling.

  • http_client_class => $class_name

    The class to use instead of WWW::Kickstarter::HttpClient::Lwp as the HTTP client. For example, this would allow you to easily substitute Net::Curl for LWP::UserAgent. See WWW::Kickstarter::HttpClient for documentation on the interface the replacement class needs to provide.

  • json_parser_class => $class_name

    The class to use instead of WWW::Kickstarter::JsonParser::JsonXs as the JSON parser. For example, this would allow you to easily substitute JSON::PP for JSON::XS. See WWW::Kickstarter::JsonParser for documentation on the interface the replacement class needs to provide.

ACCESSORS

my_id

   my $user_id = $ks->my_id;

Returns the id of the logged-in user.

API CALLS

login

   my $myself = $ks->login($email, $password);

You must login using your standard Kickstarter credentials before you can query the API.

Returns a WWW::Kickstarter::Data::User::Myself object for the user that logged in.

myself

   my $myself = $ks->myself();

Fetches and returns the logged-in user as a WWW::Kickstarter::Data::User::Myself object.

my_notification_prefs

   my @notification_prefs = $ks->my_notification_prefs();

Fetches and returns the the logged-in user's notification preferences of backed projects as WWW::Kickstarter::Data::NotificationPref objects. The notification preferences for the project created last is returned first.

my_projects_created

   my @projects = $ks->my_projects_created();

Fetches and returns the projects created by the logged-in user as WWW::Kickstarter::Data::Project objects. The project created last is returned first.

my_projects_backed

   my $projects_iter = $ks->my_projects_backed(%opts);

Returns an iterator that fetches and returns the projects backed by the logged-in user as WWW::Kickstarter::Data::Project objects. The most recently backed project is returned first.

Note that some projects may be returned twice. This happens when the data being queried changes while the results are being traversed.

Options:

  • page => $page_num

    If provided, the pages of results before the specified page number are skipped.

my_projects_starred

   my $projects_iter = $ks->my_projects_starred(%opts);

Returns an iterator that fetches and returns the projects starred by the logged-in user as WWW::Kickstarter::Data::Project objects. The most recently starred project is returned first.

Note that some projects may be returned twice. This happens when the data being queried changes while the results are being traversed.

Options:

  • page => $page_num

    If provided, the pages of results before the specified page number are skipped.

user

   my $user = $ks->user($user_id);

Fetches and returns the specified user as a WWW::Kickstarter::Data::User object.

Note that the argument must be the user's numerical id (as returned by $user->id).

user_projects_created

   my @projects = $ks->user_projects_created($user_id);

Fetches and returns the projects created by the specified user as WWW::Kickstarter::Data::Project objects. The project created last is returned first.

Note that the argument must be the user's numerical id (as returned by $user->id).

project

   my $project = $ks->project($project_id);
   my $project = $ks->project($project_slug);

Fetches and returns the specified project as a WWW::Kickstarter::Data::Project object.

The argument may be the project's numerical id (as returned by $project->id) or its "slug" (as returned by $project->slug).

projects

   my $projects_iter = $ks->projects(%opts);

Returns an iterator that fetches and returns all Kickstarter projects as WWW::Kickstarter::Data::Project objects.

Note that some projects may be returned twice, and some might be skipped. This happens when the data being queried changes while the results are being traversed.

Options:

  • page => $page_num

    If provided, the pages of results before the specified page number are skipped.

  • category => $category_id

  • category => $category_slug

  • category => $category_name

    Limits the projects returned to those of the specified category (or one of its subcategories).

  • location => $woe_id

    Limits the projects returned to those associated with the specified location.

  • sort => 'magic' (default)

  • sort => 'end_date'

  • sort => 'newest'

  • sort => 'launch_date'

  • sort => 'popularity'

  • sort => 'most_funded'

    Controls the order in which the projects are returned.

  • backed_by_self => 1

    Limits the projects returned to those the logged-in user backed.

  • starred_by_self => 1

    Limits the projects returned to those the logged-in user starred.

  • backed_by_friends => 1

    Limits the projects returned to those friends of the logged-in user backed.

  • picked_by_staff => 1

    Limits the projects returned to those recommended by Kickstarter.

  • state => 'live'

  • state => 'successful'

    Limits the projects returned to those with the specified state.

    The empty string and the string all are accepted as equivalent to not providing the option at all.

  • goal => $goal_range_id

    Limits the projects returned to those which have a goal that falls within the specified range. The ranges are defined as follows:

    • 0: <$10k

    • 1: $10k to $100k

    • 2: $100k to $1M

    • 3: >$1M

    The empty string and the string all are accepted as equivalent to not providing the option at all.

  • pledged => $pledged_range_id

    Limits the projects returned to those to which the amount pledged falls within the specified range. The ranges are defined as follows:

    • 0: <$10k

    • 1: $10k to $100k

    • 2: $100k to $1M

    • 3: >$1M

    The empty string and the string all are accepted as equivalent to not providing the option at all.

  • raised => $raised_range_id

    Limits the projects returned to those to which the amount pledged falls within the specified range. The ranges are defined as follows:

    • 0: <75%

    • 1: 75% to 100%

    • 2: >100%

    The empty string and the string all are accepted as equivalent to not providing the option at all.

  • tag => $tag_id

  • tag => $tag_slug

    Limits the projects returned to those with the specified tag.

    I don't know of an API endpoint that returns a list of available tags. The following are the tags that exist at the time of this writing:

    • Bikes (id: 50, slug: bikes)

    • Burning Man (id: 34, slug: burning-man)

    • Cats (id: 31, slug: cats)

    • Civic (id: 3, slug: civic)

    • Cthulhu (id: 38, slug: cthulhu)

    • Fringe (id: 99, slug: fringe)

    • Library (id: 46, slug: library)

    • LOL (id: 105, slug: lol)

    • Maps (id: 48, slug: maps)

    • Movie Theater (id: 43, slug: movie-theater)

    • Museums (id: 63, slug: museums)

    • Open source (id: 20, slug: open-source)

    • Robots (id: 41, slug: robots)

    • Science (id: 19, slug: science)

    • Space is the Place (id: 107, slug: space-is-the-place)

    • World Maker Faire 2014 (id: 106, slug: world-maker-faire-2014)

    The following are also tags that are known to exist, but these aren't shown on the website. It's possible they aren't actively used anymore.

    • Arctic (id: 39, slug: arctic)

    • Maker Faire (id: 87, slug: maker-faire)

    • RPG (id: 33, slug: rpg)

    • Space (id: 28, slug: space)

    • Sundance (id: 29, slug: sundance)

    • Zombies (id: 30, slug: zombies)

    The first list was obtained from Kickstarter's Advanced Discover page. The second list was obtained through trial and error.

   my $projects_iter = $ks->projects_recommended(%opts);

Returns an iterator that fetches and returns recommended projects as WWW::Kickstarter::Data::Project objects.

It accepts the same options as projects.

projects_ending_soon

   my $projects_iter = $ks->projects_ending_soon(%opts);

Returns an iterator that fetches and returns projects ending soon as WWW::Kickstarter::Data::Project objects. The project closest to its deadline is returned first.

It accepts the same options as projects.

projects_recently_launched

   my $projects_iter = $ks->projects_recently_launched(%opts);

Returns an iterator that fetches and returns recently launched projects as WWW::Kickstarter::Data::Project objects. The most recently launched project is returned first.

It accepts the same options as projects.

   my $projects_iter = $ks->popular_projects(%opts);

Returns an iterator that fetches and returns popular projects as WWW::Kickstarter::Data::Project objects.

It accepts the same options as projects.

category

   my $category = $ks->category($category_id);
   my $category = $ks->category($category_slug);
   my $category = $ks->category($category_name);

Fetches and returns the specified category as a WWW::Kickstarter::Data::Category object.

The argument may be the category's numerical id (as returned by $category->id), its "slug" (as returned by $category->slug) or its name (as returned by $category->name).

categories

    my $categories = $ks->categories();

Fetches and returns all the categories as a WWW::Kickstarter::Data::Categories object.

category_projects

   my $projects_iter = $ks->category_projects($category_id,   %opts);
   my $projects_iter = $ks->category_projects($category_slug, %opts);
   my $projects_iter = $ks->category_projects($category_name, %opts);

Returns an iterator that fetches and returns projects in the specified category as WWW::Kickstarter::Data::Project objects.

The argument may be the category's numerical id (as returned by $category->id), its "slug" (as returned by $category->slug) or its name (as returned by $category->name).

It accepts the same options as projects.

   my $projects_iter = $ks->category_projects_recommended($category_id,   %opts);
   my $projects_iter = $ks->category_projects_recommended($category_slug, %opts);
   my $projects_iter = $ks->category_projects_recommended($category_name, %opts);

Returns an iterator that fetches and returns the recommended projects in the specified category as WWW::Kickstarter::Data::Project objects.

The argument may be the category's numerical id (as returned by $category->id), its "slug" (as returned by $category->slug) or its name (as returned by $category->name).

It accepts the same options as projects.

ERROR REPORTING

When an API call encounters an error, it throws a WWW::Kickstarter::Error object as an exception.

GARANTEE

Kickstarter has not provided a public API. As such, this distribution uses a private API to obtain information. The API is subject to incompatible change without notice. This has already happened, and may happen again. I cannot guarantee the continuing operation of this distribution.

BUGS AND KNOWN ISSUES

Please report any bugs or feature requests to bug-WWW-Kickstarter at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Kickstarter. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

The following issues are known:

  • A lot of the data returned by the API has not been made available through accessors.

  • Some of the data that has not been available through accessors should be converted to objects (e.g. locations).

  • Some API calls may not have been made available.

  • Non-existent test suite.

Feel free to bug me (<ikegami@adaelis.com>) to work on these, or to submit a patch to the bug tracker.

SUPPORT

You can find documentation for this module with the perldoc command.

   perldoc WWW::Kickstarter

You can also look for information at:

AUTHORS

Eric Brine, <ikegami@adaelis.com>

Initial release assisted by Mark Olson's "Kickscraper" project for Ruby.

COPYRIGHT & LICENSE

No rights reserved.

The author has dedicated the work to the Commons by waiving all of his or her rights to the work worldwide under copyright law and all related or neighboring legal rights he or she had in the work, to the extent allowable by law.

Works under CC0 do not require attribution. When citing the work, you should not imply endorsement by the author.