NAME
WebService::Toggl::Report::Weekly - Toggl weekly aggregated report object
SYNOPSIS
use WebService::Toggl;
my $toggl = WebService::Toggl->new({api_key => 'foo'});
my $report = $toggl->weekly({
workspace_id => 1234,
grouping => 'projects', calculate => 'earnings',
});
say $report->total_billable; # billable milliseconds
say $report->week_totals; # array of totals per day
for $project (@{ $report->data }) {
say "Project $project->{title}{project} earned "
. "$project->{amount}[7] $project->{currency} this week.";
for my $user ($projects->{details}) {
say " User $user->{title}{user} contributed "
. "$user->{amount}[7] $user->{currency} to that total";
}
}
DESCRIPTION
This module is a wrapper object around the Toggl weekly report described here. It returns a report of either time spent or earnings grouped by either project or user.
REQUEST ATTRIBUTES
Request attributes common to all reports are detailed in the ::Role::Request pod.
The until
attribute is ignored for the weekly report. It is always assumed to be since
plus six days (for a total of seven).
grouping
Which metric to group reports by. Must be either projects
or users
. Whichever is not selected is used as the subgrouping parameter.
calculate
The property to aggregate. Must be one of time
or earnings
.
RESPONSE ATTRIBUTES
Response attributes common to all reports are detailed in the ::Role::Request pod.
weekly_totals
Eight-element array ref showing aggregated totals of the "calculate" property for each day, with a sum total as the last element.
REPORT DATA
The data
attribute of a ::Report::Weekly
object is an arrayref of hashrefs representing the "grouping" property. It contains a details
key with an array of hashrefs representing the subgrouping parameter. If the "calculate" property is time
, the data
attribute will contain a totals
key with the daily time aggregates. If "calculate" is earnings
, it will contain a currency
key and an amounts
key with the daily aggregated earnings. For more details, see the Toggl API docs.
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>