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

NAME

WebService::Toggl::Role::Base - Common behavior for all WebService::Toggl objects

DESCRIPTION

This role provide behavior common to all WebService::Toggl::API:: and WebService::Toggl::Report:: objects.

ATTRIBUTES

api_key

The API token used to identify the authorized user. If you don't provide this, you'll need to supply the _request attribute.

server

The base URL for the Toggl API server. Defaults to 'https://www.toggl.com'.

_request

The object that sets the headers and makes the requests. Defaults to a WebService::Toggl::Request object that uses Role::REST::Client.

METHODS

api_get($url, $data, $args)

api_post($url, $data, $args)

api_put($url, $data, $args)

api_delete($url, $data, $args)

These are proxy methods to the get, post, put, and delete methods available on the _request object via Role::REST::Client.

new_item($class, \%args)

Creates a new object of type WebService::Toggl::API::$class. The new object receives the _request attribute of the calling object, and so does not need the api_key attribute to be set. \%args will be passed through to the constructor of the new object.

new_item_from_raw($class, \%raw)

Similar to new_item() but sets the new object's raw attribute to the \%raw argument. This obviates the need for querying the API to get the object.

new_report($class, $args)

Same as new_item(), but creates an object of type WebService::Toggl::Report::$class.

new_set($class, $args)

Proxies to new_item(). If API Items and Sets are split into different classes, this may change.

new_set_from_raw($class, $raw)

Proxies to new_item_from_raw(). If API Items and Sets are split into different classes, this may change.

LICENSE

Copyright (C) Fitz Elliott.

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

AUTHOR

Fitz Elliott <felliott@fiskur.org>