| 1 | # Copyright 2019, Google LLC | ||
| 2 | # | ||
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 4 | # you may not use this file except in compliance with the License. | ||
| 5 | # You may obtain a copy of the License at | ||
| 6 | # | ||
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
| 8 | # | ||
| 9 | # Unless required by applicable law or agreed to in writing, software | ||
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, | ||
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 12 | # See the License for the specific language governing permissions and | ||
| 13 | # limitations under the License. | ||
| 14 | # | ||
| 15 | # The base class for all Google Ads API entities, e.g. common, resource, | ||
| 16 | # request, response, etc. | ||
| 17 | |||
| 18 | package Google::Ads::GoogleAds::BaseEntity; | ||
| 19 | |||
| 20 | 7 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 21 | 7 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 22 | 7 | ▶ | use version; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 23 | |||
| 24 | # The following needs to be on one line because CPAN uses a particularly hacky | ||
| 25 | # eval() to determine module versions. | ||
| 26 | 7 | ▶ | use Google::Ads::GoogleAds::Constants; our $VERSION = ${Google::Ads::GoogleAds::Constants::VERSION}; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 27 | |||
| 28 | # Called by JSON::XS to convert a blessed object to JSON. | ||
| 29 | 1 | ▶ | sub TO_JSON { |
|
Subroutine
TO_JSON: called CC=1 SCAR=0.0
Pod
documented
| |||
| 30 | 1 | return {%{shift()}}; | |
| 31 | } | ||
| 32 | |||
| 33 | 7 | 1; | |
| 34 | |||
| 35 | =pod | ||
| 36 | |||
| 37 | =head1 NAME | ||
| 38 | |||
| 39 | Google::Ads::GoogleAds::BaseEntity | ||
| 40 | |||
| 41 | =head1 DESCRIPTION | ||
| 42 | |||
| 43 | The abstract base class for all Google Ads API entities, e.g. common, resource, | ||
| 44 | request, response, etc. | ||
| 45 | |||
| 46 | =head1 METHODS | ||
| 47 | |||
| 48 | =head2 TO_JSON | ||
| 49 | |||
| 50 | The C<TO_JSON> method is invoked by L<JSON::XS> in scalar context, to convert a | ||
| 51 | blessed object into JSON. As JSON cannot directly represent Perl objects, we have | ||
| 52 | to enable the C<convert_blessed> attribute in L<JSON::XS> and define the C<TO_JSON> | ||
| 53 | method for each entity class to convert. | ||
| 54 | |||
| 55 | =head3 Returns | ||
| 56 | |||
| 57 | A scalar as the reference to the hash to convert based on the current object. | ||
| 58 | |||
| 59 | =head1 LICENSE AND COPYRIGHT | ||
| 60 | |||
| 61 | Copyright 2019 Google LLC | ||
| 62 | |||
| 63 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 64 | you may not use this file except in compliance with the License. | ||
| 65 | You may obtain a copy of the License at | ||
| 66 | |||
| 67 | http://www.apache.org/licenses/LICENSE-2.0 | ||
| 68 | |||
| 69 | Unless required by applicable law or agreed to in writing, software | ||
| 70 | distributed under the License is distributed on an "AS IS" BASIS, | ||
| 71 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 72 | See the License for the specific language governing permissions and | ||
| 73 | limitations under the License. | ||
| 74 | |||
| 75 | =head1 REPOSITORY INFORMATION | ||
| 76 | |||
| 77 | $Rev: $ | ||
| 78 | $LastChangedBy: $ | ||
| 79 | $Id: $ | ||
| 80 | |||
| 81 | =cut | ||