Skip to content

Commit 4308d6b

Browse files
committed
Release 31.0.0.
1 parent 75c3ebf commit 4308d6b

File tree

1,150 files changed

+84107
-350
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,150 files changed

+84107
-350
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/.gitattributes export-ignore
2+
/.travis.yml export-ignore
23
/UPGRADING.md export-ignore
34
/examples export-ignore
45
/tests export-ignore

.travis.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
language: php
2+
3+
php:
4+
- 5.5
5+
- 5.6
6+
- 7.0
7+
- 7.1
8+
9+
branches:
10+
only:
11+
- master
12+
13+
before_script:
14+
- composer install
15+
16+
script:
17+
- vendor/phpunit/phpunit/phpunit --configuration phpunit.xml.dist --coverage-text

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
### 31.0.0
2+
3+
##### AdWords
4+
5+
* Added support and examples for v201710.
6+
* Added an option for setting transparent HTTP gzip compression for reporting
7+
in `adsapi_php.ini`.
8+
9+
##### DFP
10+
11+
* Added UpdateLineItems and UpdateOrders examples.
12+
13+
##### Common
14+
15+
* Removed the PROXY section in `adsapi_php.ini`. Use "proxy" under CONNECTION
16+
instead.
17+
* Added proxy support for non-SOAP utilities and OAuth authentication. See
18+
the CONNECTION section in `adsapi_php.ini` for details.
19+
120
### 30.0.0
221

322
##### AdWords

examples/AdWords/adsapi_php.ini

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ clientCustomerId = "INSERT_CLIENT_CUSTOMER_ID_HERE"
4242
; compressionLevel = <COMPRESSION_LEVEL>
4343
; wsdlCache = <WSDL_CACHE>
4444

45-
[PROXY]
46-
; Optional proxy settings to be used by SOAP requests.
47-
; host = "<HOST>"
48-
; port = <PORT>
49-
; user = "<USER>"
50-
; password = "<PASSWORD>"
45+
[CONNECTION]
46+
; Optional proxy settings to be used by requests.
47+
; If you don't have username and password, just specify host and port.
48+
; proxy = "protocol://user:pass@host:port"
49+
; Enable transparent HTTP gzip compression for all reporting requests.
50+
; enableReportingGzip = false
5151

5252
[LOGGING]
5353
; Optional logging settings.

examples/AdWords/v201702/Optimization/EstimateKeywordTraffic.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ public static function runExample(AdWordsServices $adWordsServices,
106106
// Set targeting criteria. Only locations and languages are supported.
107107
$unitedStates = new Location();
108108
$unitedStates->setId(2840);
109-
$campaignEstimateRequest->setCriteria([$unitedStates]);
110109

111110
// See http://code.google.com/apis/adwords/docs/appendix/languagecodes.html
112111
// for a detailed list of language codes.
113112
$english = new Language();
114113
$english->setId(1000);
115-
$campaignEstimateRequest->setCriteria([$english]);
114+
115+
$campaignEstimateRequest->setCriteria([$unitedStates, $english]);
116116

117117
// Create selector.
118118
$selector = new TrafficEstimatorSelector();

examples/AdWords/v201705/Optimization/EstimateKeywordTraffic.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ public static function runExample(AdWordsServices $adWordsServices,
106106
// Set targeting criteria. Only locations and languages are supported.
107107
$unitedStates = new Location();
108108
$unitedStates->setId(2840);
109-
$campaignEstimateRequest->setCriteria([$unitedStates]);
110109

111110
// See http://code.google.com/apis/adwords/docs/appendix/languagecodes.html
112111
// for a detailed list of language codes.
113112
$english = new Language();
114113
$english->setId(1000);
115-
$campaignEstimateRequest->setCriteria([$english]);
114+
115+
$campaignEstimateRequest->setCriteria([$unitedStates, $english]);
116116

117117
// Create selector.
118118
$selector = new TrafficEstimatorSelector();

examples/AdWords/v201708/Optimization/EstimateKeywordTraffic.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ public static function runExample(AdWordsServices $adWordsServices,
106106
// Set targeting criteria. Only locations and languages are supported.
107107
$unitedStates = new Location();
108108
$unitedStates->setId(2840);
109-
$campaignEstimateRequest->setCriteria([$unitedStates]);
110109

111110
// See http://code.google.com/apis/adwords/docs/appendix/languagecodes.html
112111
// for a detailed list of language codes.
113112
$english = new Language();
114113
$english->setId(1000);
115-
$campaignEstimateRequest->setCriteria([$english]);
114+
115+
$campaignEstimateRequest->setCriteria([$unitedStates, $english]);
116116

117117
// Create selector.
118118
$selector = new TrafficEstimatorSelector();
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?php
2+
/**
3+
* Copyright 2017 Google Inc. All Rights Reserved.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
namespace Google\AdsApi\Examples\AdWords\v201710\AccountManagement;
18+
19+
require __DIR__ . '/../../../../vendor/autoload.php';
20+
21+
use Google\AdsApi\AdWords\AdWordsServices;
22+
use Google\AdsApi\AdWords\AdWordsSession;
23+
use Google\AdsApi\AdWords\AdWordsSessionBuilder;
24+
use Google\AdsApi\AdWords\v201710\cm\Operator;
25+
use Google\AdsApi\AdWords\v201710\mcm\CustomerService;
26+
use Google\AdsApi\AdWords\v201710\mcm\ServiceLink;
27+
use Google\AdsApi\AdWords\v201710\mcm\ServiceLinkLinkStatus;
28+
use Google\AdsApi\AdWords\v201710\mcm\ServiceLinkOperation;
29+
use Google\AdsApi\AdWords\v201710\mcm\ServiceType;
30+
use Google\AdsApi\Common\OAuth2TokenBuilder;
31+
32+
/**
33+
* This example accepts a pending invitation to link your AdWords account to a
34+
* Google Merchant Center account.
35+
*/
36+
class AcceptServiceLink {
37+
38+
const SERVICE_LINK_ID = 'INSERT_SERVICE_LINK_ID_HERE';
39+
40+
public static function runExample(AdWordsServices $adWordsServices,
41+
AdWordsSession $session, $serviceLinkId) {
42+
$customerService = $adWordsServices->get($session, CustomerService::class);
43+
44+
// Create service link.
45+
$serviceLink = new ServiceLink();
46+
$serviceLink->setServiceLinkId($serviceLinkId);
47+
$serviceLink->setServiceType(ServiceType::MERCHANT_CENTER);
48+
$serviceLink->setLinkStatus(ServiceLinkLinkStatus::ACTIVE);
49+
50+
// Create a service link operation and add it to the list.
51+
$operations = [];
52+
$operation = new ServiceLinkOperation();
53+
$operation->setOperator(Operator::SET);
54+
$operation->setOperand($serviceLink);
55+
$operations[] = $operation;
56+
57+
// Accept service links on the server and print out some information about
58+
// accepted service links.
59+
$serviceLinks = $customerService->mutateServiceLinks($operations);
60+
foreach ($serviceLinks as $serviceLink) {
61+
printf(
62+
"Service link with service link ID %d and type '%s' updated to status"
63+
. ": %s.\n",
64+
$serviceLink->getServiceLinkId(),
65+
$serviceLink->getServiceType(),
66+
$serviceLink->getLinkStatus()
67+
);
68+
}
69+
}
70+
71+
public static function main() {
72+
// Generate a refreshable OAuth2 credential for authentication.
73+
$oAuth2Credential = (new OAuth2TokenBuilder())
74+
->fromFile()
75+
->build();
76+
77+
// Construct an API session configured from a properties file and the OAuth2
78+
// credentials above.
79+
$session = (new AdWordsSessionBuilder())
80+
->fromFile()
81+
->withOAuth2Credential($oAuth2Credential)
82+
->build();
83+
self::runExample(
84+
new AdWordsServices(), $session, intval(self::SERVICE_LINK_ID));
85+
}
86+
}
87+
88+
AcceptServiceLink::main();
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?php
2+
/**
3+
* Copyright 2017 Google Inc. All Rights Reserved.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
namespace Google\AdsApi\Examples\AdWords\v201710\AccountManagement;
18+
19+
require __DIR__ . '/../../../../vendor/autoload.php';
20+
21+
use Google\AdsApi\AdWords\AdWordsServices;
22+
use Google\AdsApi\AdWords\AdWordsSession;
23+
use Google\AdsApi\AdWords\AdWordsSessionBuilder;
24+
use Google\AdsApi\AdWords\v201710\cm\Operator;
25+
use Google\AdsApi\AdWords\v201710\mcm\ManagedCustomerService;
26+
use Google\AdsApi\AdWords\v201710\mcm\ManagedCustomer;
27+
use Google\AdsApi\AdWords\v201710\mcm\ManagedCustomerOperation;
28+
use Google\AdsApi\Common\OAuth2TokenBuilder;
29+
30+
/**
31+
* This example creates a new account under an AdWords manager account. Note:
32+
* this example must be run using the credentials of an AdWords manager account,
33+
* and by default the new account will only be accessible via the parent AdWords
34+
* manager account.
35+
*/
36+
class CreateAccount {
37+
38+
public static function runExample(AdWordsServices $adWordsServices,
39+
AdWordsSession $session) {
40+
$managedCustomerService =
41+
$adWordsServices->get($session, ManagedCustomerService::class);
42+
43+
// Create a managed customer.
44+
$customer = new ManagedCustomer();
45+
$customer->setName('Account #' . uniqid());
46+
$customer->setCurrencyCode('EUR');
47+
$customer->setDateTimeZone('Europe/London');
48+
49+
// Create a managed customer operation and add it to the list.
50+
$operations = [];
51+
$operation = new ManagedCustomerOperation();
52+
$operation->setOperator(Operator::ADD);
53+
$operation->setOperand($customer);
54+
$operations[] = $operation;
55+
56+
// Create a managed customer on the server and print out some information
57+
// about it.
58+
$customer = $managedCustomerService->mutate($operations)->getValue()[0];
59+
printf("Account with customer ID %d was created.\n",
60+
$customer->getCustomerId());
61+
}
62+
63+
public static function main() {
64+
// Generate a refreshable OAuth2 credential for authentication.
65+
$oAuth2Credential = (new OAuth2TokenBuilder())
66+
->fromFile()
67+
->build();
68+
69+
// Construct an API session configured from a properties file and the OAuth2
70+
// credentials above.
71+
// You can use withClientCustomerId() of AdWordsSessionBuilder to specify
72+
// your manager account ID under which you want to create an account.
73+
$session = (new AdWordsSessionBuilder())
74+
->fromFile()
75+
->withOAuth2Credential($oAuth2Credential)
76+
->build();
77+
self::runExample(new AdWordsServices(), $session);
78+
}
79+
}
80+
81+
CreateAccount::main();

0 commit comments

Comments
 (0)