Skip to content

Commit

Permalink
Release 31.0.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiboknacky committed Oct 12, 2017
1 parent 75c3ebf commit 4308d6b
Show file tree
Hide file tree
Showing 1,150 changed files with 84,107 additions and 350 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/.gitattributes export-ignore
/.travis.yml export-ignore
/UPGRADING.md export-ignore
/examples export-ignore
/tests export-ignore
Expand Down
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
language: php

php:
- 5.5
- 5.6
- 7.0
- 7.1

branches:
only:
- master

before_script:
- composer install

script:
- vendor/phpunit/phpunit/phpunit --configuration phpunit.xml.dist --coverage-text
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
### 31.0.0

##### AdWords

* Added support and examples for v201710.
* Added an option for setting transparent HTTP gzip compression for reporting
in `adsapi_php.ini`.

##### DFP

* Added UpdateLineItems and UpdateOrders examples.

##### Common

* Removed the PROXY section in `adsapi_php.ini`. Use "proxy" under CONNECTION
instead.
* Added proxy support for non-SOAP utilities and OAuth authentication. See
the CONNECTION section in `adsapi_php.ini` for details.

### 30.0.0

##### AdWords
Expand Down
12 changes: 6 additions & 6 deletions examples/AdWords/adsapi_php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ clientCustomerId = "INSERT_CLIENT_CUSTOMER_ID_HERE"
; compressionLevel = <COMPRESSION_LEVEL>
; wsdlCache = <WSDL_CACHE>

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

[LOGGING]
; Optional logging settings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ public static function runExample(AdWordsServices $adWordsServices,
// Set targeting criteria. Only locations and languages are supported.
$unitedStates = new Location();
$unitedStates->setId(2840);
$campaignEstimateRequest->setCriteria([$unitedStates]);

// See http://code.google.com/apis/adwords/docs/appendix/languagecodes.html
// for a detailed list of language codes.
$english = new Language();
$english->setId(1000);
$campaignEstimateRequest->setCriteria([$english]);

$campaignEstimateRequest->setCriteria([$unitedStates, $english]);

// Create selector.
$selector = new TrafficEstimatorSelector();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ public static function runExample(AdWordsServices $adWordsServices,
// Set targeting criteria. Only locations and languages are supported.
$unitedStates = new Location();
$unitedStates->setId(2840);
$campaignEstimateRequest->setCriteria([$unitedStates]);

// See http://code.google.com/apis/adwords/docs/appendix/languagecodes.html
// for a detailed list of language codes.
$english = new Language();
$english->setId(1000);
$campaignEstimateRequest->setCriteria([$english]);

$campaignEstimateRequest->setCriteria([$unitedStates, $english]);

// Create selector.
$selector = new TrafficEstimatorSelector();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ public static function runExample(AdWordsServices $adWordsServices,
// Set targeting criteria. Only locations and languages are supported.
$unitedStates = new Location();
$unitedStates->setId(2840);
$campaignEstimateRequest->setCriteria([$unitedStates]);

// See http://code.google.com/apis/adwords/docs/appendix/languagecodes.html
// for a detailed list of language codes.
$english = new Language();
$english->setId(1000);
$campaignEstimateRequest->setCriteria([$english]);

$campaignEstimateRequest->setCriteria([$unitedStates, $english]);

// Create selector.
$selector = new TrafficEstimatorSelector();
Expand Down
88 changes: 88 additions & 0 deletions examples/AdWords/v201710/AccountManagement/AcceptServiceLink.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php
/**
* Copyright 2017 Google Inc. All Rights Reserved.
*
* 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.
*/
namespace Google\AdsApi\Examples\AdWords\v201710\AccountManagement;

require __DIR__ . '/../../../../vendor/autoload.php';

use Google\AdsApi\AdWords\AdWordsServices;
use Google\AdsApi\AdWords\AdWordsSession;
use Google\AdsApi\AdWords\AdWordsSessionBuilder;
use Google\AdsApi\AdWords\v201710\cm\Operator;
use Google\AdsApi\AdWords\v201710\mcm\CustomerService;
use Google\AdsApi\AdWords\v201710\mcm\ServiceLink;
use Google\AdsApi\AdWords\v201710\mcm\ServiceLinkLinkStatus;
use Google\AdsApi\AdWords\v201710\mcm\ServiceLinkOperation;
use Google\AdsApi\AdWords\v201710\mcm\ServiceType;
use Google\AdsApi\Common\OAuth2TokenBuilder;

/**
* This example accepts a pending invitation to link your AdWords account to a
* Google Merchant Center account.
*/
class AcceptServiceLink {

const SERVICE_LINK_ID = 'INSERT_SERVICE_LINK_ID_HERE';

public static function runExample(AdWordsServices $adWordsServices,
AdWordsSession $session, $serviceLinkId) {
$customerService = $adWordsServices->get($session, CustomerService::class);

// Create service link.
$serviceLink = new ServiceLink();
$serviceLink->setServiceLinkId($serviceLinkId);
$serviceLink->setServiceType(ServiceType::MERCHANT_CENTER);
$serviceLink->setLinkStatus(ServiceLinkLinkStatus::ACTIVE);

// Create a service link operation and add it to the list.
$operations = [];
$operation = new ServiceLinkOperation();
$operation->setOperator(Operator::SET);
$operation->setOperand($serviceLink);
$operations[] = $operation;

// Accept service links on the server and print out some information about
// accepted service links.
$serviceLinks = $customerService->mutateServiceLinks($operations);
foreach ($serviceLinks as $serviceLink) {
printf(
"Service link with service link ID %d and type '%s' updated to status"
. ": %s.\n",
$serviceLink->getServiceLinkId(),
$serviceLink->getServiceType(),
$serviceLink->getLinkStatus()
);
}
}

public static function main() {
// Generate a refreshable OAuth2 credential for authentication.
$oAuth2Credential = (new OAuth2TokenBuilder())
->fromFile()
->build();

// Construct an API session configured from a properties file and the OAuth2
// credentials above.
$session = (new AdWordsSessionBuilder())
->fromFile()
->withOAuth2Credential($oAuth2Credential)
->build();
self::runExample(
new AdWordsServices(), $session, intval(self::SERVICE_LINK_ID));
}
}

AcceptServiceLink::main();
81 changes: 81 additions & 0 deletions examples/AdWords/v201710/AccountManagement/CreateAccount.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php
/**
* Copyright 2017 Google Inc. All Rights Reserved.
*
* 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.
*/
namespace Google\AdsApi\Examples\AdWords\v201710\AccountManagement;

require __DIR__ . '/../../../../vendor/autoload.php';

use Google\AdsApi\AdWords\AdWordsServices;
use Google\AdsApi\AdWords\AdWordsSession;
use Google\AdsApi\AdWords\AdWordsSessionBuilder;
use Google\AdsApi\AdWords\v201710\cm\Operator;
use Google\AdsApi\AdWords\v201710\mcm\ManagedCustomerService;
use Google\AdsApi\AdWords\v201710\mcm\ManagedCustomer;
use Google\AdsApi\AdWords\v201710\mcm\ManagedCustomerOperation;
use Google\AdsApi\Common\OAuth2TokenBuilder;

/**
* This example creates a new account under an AdWords manager account. Note:
* this example must be run using the credentials of an AdWords manager account,
* and by default the new account will only be accessible via the parent AdWords
* manager account.
*/
class CreateAccount {

public static function runExample(AdWordsServices $adWordsServices,
AdWordsSession $session) {
$managedCustomerService =
$adWordsServices->get($session, ManagedCustomerService::class);

// Create a managed customer.
$customer = new ManagedCustomer();
$customer->setName('Account #' . uniqid());
$customer->setCurrencyCode('EUR');
$customer->setDateTimeZone('Europe/London');

// Create a managed customer operation and add it to the list.
$operations = [];
$operation = new ManagedCustomerOperation();
$operation->setOperator(Operator::ADD);
$operation->setOperand($customer);
$operations[] = $operation;

// Create a managed customer on the server and print out some information
// about it.
$customer = $managedCustomerService->mutate($operations)->getValue()[0];
printf("Account with customer ID %d was created.\n",
$customer->getCustomerId());
}

public static function main() {
// Generate a refreshable OAuth2 credential for authentication.
$oAuth2Credential = (new OAuth2TokenBuilder())
->fromFile()
->build();

// Construct an API session configured from a properties file and the OAuth2
// credentials above.
// You can use withClientCustomerId() of AdWordsSessionBuilder to specify
// your manager account ID under which you want to create an account.
$session = (new AdWordsSessionBuilder())
->fromFile()
->withOAuth2Credential($oAuth2Credential)
->build();
self::runExample(new AdWordsServices(), $session);
}
}

CreateAccount::main();
Loading

0 comments on commit 4308d6b

Please sign in to comment.