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

NAME

Google::Ads::Common::ReportUtils

SYNOPSIS

 use Google::Ads::Common::ReportUtils;

 Google::Ads::Common::ReportUtils::download_report($report_definition,
                                                   $client, $path);

DESCRIPTION

Google::Ads::Common::ReportUtils a collection of utility methods for working with reports.

SUBROUTINES

download_report

Downloads a new instance of an existing report definition. If the file_path parameter is specified it will be downloaded to the file at that path, otherwise it will be downloaded to memory and be returned as a string.

Parameters

  • The report_definition parameter is either: - the id of a pre-defined report to download - a ReportDefinition object to be defined and download on the fly - a hash with an AWQL query and format. i.e. { query => 'query', format => 'format' }

    In the case of a plain id then the regular download endpoint will be used to download a pre-stored definition, otherwise the versioned download url endpoint (based on the version of the given Client object) will be used.

  • The client parameter is an instance of a valid Google::AdWords::Client.

  • The file_path is an optional parameter that if given the subroutine will write out the report to the given file path.

  • The server is an optional parameter that can be set to alter the URL from where the report will be requested.

  • The return_money_in_micros is an optional parameter that can be set to alter the output of money kind of fields in the report.

  • The timeout is an optional parameter that can be set to alter the default time that the http client waits to get a response from the server. If not set, the default timeout used is Google::Ads::Common::ReportUtils::LWP_DEFAULT_TIMEOUT.

Returns

If a file_path is given, the report gets saved to file and the file size is returned, if not the report data itself is returned.

Exceptions

Starting with v201209 of the API a Google::Ads::Common::ReportDownloadError object will be returned in case of a download error. If not passing a file_path to dump the report then you must check if the return isa("Google::Ads::Common::ReportDownloadError").

Prior to v201209 a warn() will be issued if a report download error occurs.

LICENSE AND COPYRIGHT

Copyright 2011 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

AUTHOR

David Torres <api.davidtorres at gmail.com>

REPOSITORY INFORMATION

 $Rev: $
 $LastChangedBy: $
 $Id: $