NAME

WWW::Trello::Lite - Simple wrapper around the Trello web service.

SYNOPSIS

  # Get the currently open lists from a given board...
  my $trello = WWW::Trello::Lite->new(
      key   => 'invalidkey',
      token => 'invalidtoken'
  );
  my $lists = $trello->get( "boards/$id/lists" )

  # Add a new card...
  $trello->post( "cards", {name => 'New card', idList => $id} );

DESCRIPTION

Trello manages lists of stuff. Trello provides an API for remote control. WWW::Trello::Lite provides Perl scripts easy access to the API. I use it to add cards on my to-do list.

Translating the Trello API documentation into functional calls is straight forward.

  # Trello API documentation says:
  # GET /1/cards/[card_id]
  my $card = $trello->get( "cards/$id" );

The first word (GET, POST, PUT, DELETE) becomes the method call. Ignore the number. That is the Trello API version number. WWW::Trello::Lite handles that for you automatically.

The rest of the API URL slides into the first parameter of the method.

Some API calls, such as this one, also accept Arguments. Pass the arguments as a hash reference in the second parameter. The argument name is a key. And the argument value is the value.

  # Trello API documentation says:
  # GET /1/cards/[card_id]
  my $card = $trello->get( "cards/$id", {attachments => 'true'} );

METHODS & ATTRIBUTES

get / delete / post / put

The method name corresponds with the first word in the Trello API documentation. It tells Trello what you are trying to do. Each method expects two parameters:

1. URL

The URL (minus the server name) for the API call. You can also leave off the version number. Begin with the item such as boards or cards.

2. arguments

An optional hash reference of arguments for the API call. The class automatically adds your development key and token. It is not necessary to include them in the arguments.

See the corresponding method in Role::REST::Client for information about the return value.

key

This attribute accepts your Trello developer key. Trello requires that all users of the API have a unique key. Please refer to the Trello API documentation to obtain a key.

server

This attribute holds the URL to the Trello web server. The class sets this for you. You can read the value from this attribute if your code wants to know the URL for some reason.

token

This attribute holds the Trello authorization token. The authorization token tells Trello that this script can modify your boards and lists.

For example, I use these scripts in cron jobs. So I generate a forever token once, then code it into the script.

version

This attribute tells Trello that we are using version 1 of the API. Trello supports API changes by including the version number in each request. Currently there is only one version. This atribute lets the object handle future versions without any code changes.

You may pass the version to the constructor, if the default value of 1 does not meet your needs.

BUGS/CAVEATS/etc

WWW::Trello::Lite is not associated with Trello or Fog Creek Software in any way.

WWW::Trello::Lite is a very simplistic wrapper around the Trello API. It provides no validity checks and does not create nice objects for each item. You get the raw data as decoded from JSON.

AUTHOR

Robert Wohlfarth <rbwohlfarth@gmail.com>

SEE ALSO

Role::REST::Client, Role::REST::Client::Response

LICENSE

Copyright 2013 Robert Wohlfarth

You can redistribute and/or modify this module under the same terms as Perl itself.