rict;
use warnings;
# ABSTRACT: Simple interface to the Google Analytics Core Reporting API
use JSON;
use LWP::UserAgent;
use Net::Google::Analytics::Request;
use Net::Google::Analytics::Response;
u
http_res->decoded_content);
return $res;
}
my $json = from_json($http_res->decoded_content);
$res->_parse_json($json);
$res->start_index($start_index);
$res->is_success(1
}
sub _parse_json {
my ($self, $json) = @_;
$self->items_per_page($json->{itemsPerPage});
$self->total_results($json->{totalResults});
$self->contains_sampled_data($json->{containsSa
a});
$self->profile_info($json->{profileInfo});
my $json_totals = $json->{totalsForAllResults};
my %totals;
while (my ($json_name, $total) = each(%$json_totals)) {
my $column
al;
}
$self->_totals(\%totals);
my @column_headers;
for my $column_header (@{ $json->{columnHeaders} }) {
push(@column_headers, {
name => _parse_column_na
h2::VERSION = '3.05';
use strict;
use warnings;
# ABSTRACT: OAuth2 for Google Analytics API
use JSON;
use LWP::UserAgent;
use URI;
sub new {
my $class = shift;
my $self = { @_ };
die(
;
die('error getting token: ' . $res->status_line) unless $res->is_success;
return from_json($res->decoded_content);
}
sub refresh_access_token {
my ($self, $refresh_token) = @_;
m
;
die('error getting token: ' . $res->status_line) unless $res->is_success;
return from_json($res->decoded_content);
}
sub interactive {
my $self = shift;
my $url = $self->authoriz