Google-Ads-GoogleAds-Client

 view release on metacpan or  search on metacpan

lib/Google/Ads/GoogleAds/BaseService.pm  view on Meta::CPAN

=head1 DESCRIPTION

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

=head1 SYNOPSIS

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

  my $api_client = Google::Ads::GoogleAds::Client->new();

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

=head1 ATTRIBUTES

Each service instance is initialized by L<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<>);

=head2 api_client

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

=head1 METHODS

=head2 call

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

=head3 Parameters

=over

=item *

I<http_method>: The HTTP request method, e.g. GET, POST.

=item *

I<request_path>: The relative request URL which may contain wildcards to expand,
e.g. {+resourceName}, {+customerId}.

=item *

I<request_body>: A Perl object representing the HTTP request payload, which will
be used to expand the {+resourceName} or any other expression in the request path
and encoded into JSON string for a HTTP POST request.

=item *

I<response_type>: The class name of the expected response. An instance of this class
will be returned if the request succeeds.

=item *

I<content_callback>: The optional streaming content callback method.

=back

=head3 Returns

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

=head2 _get_http_headers

Prepare the basic HTTP request headers including Content-Type, user-agent,
developer-token, login-customer-id, linked-customer-id - if needed. The headers
will be consolidated with access token in the method of
L<Google::Ads::GoogleAds::Common::OAuth2BaseHandler/prepare_request>.

=head3 Returns

The basic HTTP headers including Content-Type, user-agent, developer-token,
login-customer-id, linked-customer-id - if needed.

=head1 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.

=head1 REPOSITORY INFORMATION

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

=cut



( run in 0.761 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )