NAME

Google::Ads::GoogleAds::BaseService

DESCRIPTION

The abstract base class for all Google Ads API services, e.g. CampaignService, AdGroupService, etc.

SYNOPSIS

  use Google::Ads::GoogleAds::Client;

  my $api_client = Google::Ads::GoogleAds::Client->new({version => "V2"});

  my $campaign_service = $api_client->CampaignService();

ATTRIBUTES

Each service instance is initialized by Google::Ads::GoogleAds::Client,and these attributes are set automatically.

Alternatively, there is a get_ and set_ method associated with each attribute for retrieving or setting them dynamically.

  my %api_client_of : ATTR(:name<api_client> :default<>);

api_client

A reference to the Google::Ads::GoogleAds::Client, holding the API credentials and configurations.

METHODS

call

Sends REST HTTP requests to Google Ads API server and handles the responses.

Parameters

  • http_method: The HTTP request method, e.g. GET, POST.

  • request_path: The relative request URL which may contains wildcard to expand, e.g. {+resourceName}, {+customerId}.

  • path_params: The parameter(s) to expand the {+resourceName} or any other expression in the request path, which might be a scalar or a hash reference.

  • request_body: A Perl object representing the HTTP request payload, which will be encoded into JSON string for a HTTP POST request. Should be undef for GET request.

  • response_type: The class name of the expected response. A instance of this class will be returned if the request succeeds.

    content_callback: The optional streaming content callback method.

Returns

A instance of the class defined by the response_type argument, or a Google::Ads::GoogleAds::GoogleAdsException object if an error has occurred at the server side by default. However if the die_on_faults flag is set to true in Google::Ads::GoogleAds::Client, the service will issue a die() with error message on API errors.

_get_http_headers

Prepare the basic HTTP request headers including Content-Type, developer-token and login_customer_id - if needed. The headers will be consolidated with access token in the method of "prepare_request" in Google::Ads::GoogleAds::Common::OAuth2BaseHandler.

Returns

The basic HTTP headers including Content-Type, developer-token and login_customer_id - if needed.

LICENSE AND COPYRIGHT

Copyright 2019 Google LLC

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.

REPOSITORY INFORMATION

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