}
use strict;
# ABSTRACT: Simple interface to the Google Search Console Core Reporting API
use JSON;
use LWP::UserAgent;
use Net::Google::WebmasterTools::Request;
use Net::Google::WebmasterTools::R
my $json = to_json( \%params );
my $http_req = HTTP::Request->new( 'POST', $uri->as_string );
$http_req->header(@auth_params);
$http_req->header( 'Content-Type' => 'application/json' );
$http_req->content($json);
if ( ( $req->report_name eq 'sitemaps' ) && ( $req->method eq 'list' ) ) {
$http_req = HTTP::Request->new( 'GET', $uri->as_string );
}
elsif ( ( $r
}
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
::OAuth2::VERSION = '0.03';
}
use strict;
# ABSTRACT: OAuth2 for Google Webmaster Tools 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