NAME

WWW::Asana - Client Class for accessing Asana API

VERSION

version 0.003

SYNOPSIS

  my $asana = WWW::Asana->new(
    api_key => $asana_api_key,
  );

  my $me = $asana->me;

  print $me->email;

  for (@{$asana->users}) {
    print $_->name;
  }

  my $current_me = $me->reload;

  my @workspaces = @{$me->workspaces};

  my @tasks = @{$some_workspace->tasks($me)};
  my @projects = @{$some_workspace->projects};
  my @tags = @{$some_workspace->tags};

  my $new_task = $some_workspace->create_task({
    name => 'Test out WWW::Asana',
    notes => 'really cool library, should test it out',
    assignee => $me,
  });

  $new_task->completed(1);
  $new_task->due_on($new_task->created_at + DateTime::Duration->new( days => 1 ));
  my $new_version_of_task = $new_task->update;

  $new_task->add_project($some_project);

  $new_task->add_tag($some_tag);

  my $story = $new_task->comment('I still didnt made it, DAMN!');

  print $story->created_by->name;

DESCRIPTION

This library gives an abstract to access the API of the Asana issue system.

ATTRIBUTES

api_key

API Key for the account given on the Account Settings of your Asana (see under API)

version

Version of the API in use, so far only 1.0 is supported and this is also the default value here.

base_uri

Base of the URL of the Asana API, the default value here is https://app.asana.com/api.

useragent

LWP::UserAgent object used for the HTTP requests.

useragent_agent

The user agent string used for the "useragent" object.

useragent_timeout

The timeout value in seconds used for the "useragent" object, defaults to default value of LWP::UserAgent.

request_class

Request class used to generate the request. Defaults to WWW::Asana::Request.

response_class

Response class used to handle the response of the request. Defaults to WWW::Asana::Response.

METHODS

request

Takes a WWW::Asana::Request object and gives back a WWW::Asana::Response. If not given a WWW::Asana::Request, then it will pass the arguments to "get_request" to get one.

TODO: Adding an auto-retry option on reaching limits

get_url

Takes "base_uri", "version" and the arguments and joins them together with /.

get_request

Generates a WWW::Asana::Request out of the parameter. The first parameter is target class name given without the WWW::Asana:: namespace. The second parameter is the method to use for the generated request, the other parameters are taken as part of the URL on the Asana API. If additional is given a HashRef at the end of the parameters, then those are used as data for the request.

do

This method is actually executing a request specified by all parameters beside the first one, which are given to "get_request". On this response then is called "to" in WWW::Asana::Response with the first parameter as argument. The result of this is given back, the type then depends on the parameter for the "to" in WWW::Asana::Response function.

me

Makes a request to /users/me and gives back a WWW::Asana::User of yourself.

users

Makes a request to /users and gives back an arrayref of WWW::Asana::User with all the users of the system.

user

Makes a request to /users/ together with the first argument given, which needs to be an Asana user id. It gives back a WWW::Asana::User of the given user.

SUPPORT

IRC

  Join #duckduckgo on irc.freenode.net. Highlight Getty for fast reaction :).

Repository

  http://github.com/Getty/p5-www-asana
  Pull request and additional contributors are welcome

Issue Tracker

  http://github.com/Getty/p5-www-asana/issues

AUTHOR

Torsten Raudssus <torsten@raudss.us>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.