Skip to content
This repository was archived by the owner on Feb 18, 2024. It is now read-only.

Commit d27fa0c

Browse files
author
Matthias Linder
committed
[Issue 520] Update command-line + AppEngine samples for 1.10
http://codereview.appspot.com/6297067/
1 parent ceaccc8 commit d27fa0c

File tree

66 files changed

+578
-560
lines changed

Some content is hidden

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

66 files changed

+578
-560
lines changed

adexchangebuyer-cmdline-sample/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@
126126
<dependency>
127127
<groupId>com.google.apis</groupId>
128128
<artifactId>google-api-services-adexchangebuyer</artifactId>
129-
<version>v1-rev5-1.6.0-beta</version>
129+
<version>v1-rev6-1.7.0-beta</version>
130130
</dependency>
131131
<dependency>
132132
<groupId>com.google.apis-samples</groupId>
133133
<artifactId>shared-sample-cmdline</artifactId>
134-
<version>1.2.0</version>
134+
<version>1.3.0</version>
135135
</dependency>
136136
</dependencies>
137137
<properties>

adexchangebuyer-cmdline-sample/src/main/java/com/google/api/services/samples/adexchangebuyer/cmdline/AdExchangeBuyerSample.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ HTTP_TRANSPORT, JSON_FACTORY, new LocalServerReceiver(),
6262
Arrays.asList(AdexchangebuyerScopes.ADEXCHANGE_BUYER));
6363

6464
// Set up API client.
65-
Adexchangebuyer client = Adexchangebuyer.builder(HTTP_TRANSPORT, JSON_FACTORY)
66-
.setApplicationName("Google-AdExchangeBuyerSample/1.0")
67-
.setHttpRequestInitializer(credential).build();
65+
Adexchangebuyer client = new Adexchangebuyer.Builder(
66+
HTTP_TRANSPORT, JSON_FACTORY, credential).setApplicationName(
67+
"Google-AdExchangeBuyerSample/1.0").build();
6868

6969
return client;
7070
}

adexchangebuyer-cmdline-sample/src/main/java/com/google/api/services/samples/adexchangebuyer/cmdline/GetAllAccounts.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public String getDescription() {
6161
public void execute(Adexchangebuyer client) throws IOException {
6262
List<Account> allAccounts = client.accounts().list().execute().getItems();
6363

64-
if (allAccounts.size() > 0) {
64+
if (allAccounts != null && allAccounts.size() > 0) {
6565
System.out.printf("========================================\n");
6666
System.out.printf("Listing of user associated accounts\n");
6767
System.out.printf("========================================\n");

adsense-cmdline-sample/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@
126126
<dependency>
127127
<groupId>com.google.apis</groupId>
128128
<artifactId>google-api-services-adsense</artifactId>
129-
<version>v1.1-rev13-1.6.0-beta</version>
129+
<version>v1.1-rev17-1.7.0-beta</version>
130130
</dependency>
131131
<dependency>
132132
<groupId>com.google.apis-samples</groupId>
133133
<artifactId>shared-sample-cmdline</artifactId>
134-
<version>1.2.0</version>
134+
<version>1.3.0</version>
135135
</dependency>
136136
</dependencies>
137137
<properties>

adsense-cmdline-sample/src/main/java/com/google/api/services/samples/adsense/cmdline/AdSenseSample.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,9 @@ HTTP_TRANSPORT, JSON_FACTORY, new LocalServerReceiver(),
7272
Arrays.asList(AdsenseScopes.ADSENSE_READONLY));
7373

7474
// Set up AdSense Management API client.
75-
Adsense adsense = Adsense.builder(new NetHttpTransport(), new JacksonFactory())
76-
.setApplicationName("Google-AdSenseSample/1.1")
77-
.setHttpRequestInitializer(credential)
78-
.build();
75+
Adsense adsense = new Adsense.Builder(
76+
new NetHttpTransport(), new JacksonFactory(), credential).setApplicationName(
77+
"Google-AdSenseSample/1.1").build();
7978

8079
return adsense;
8180
}

analytics-cmdline-sample/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@
126126
<dependency>
127127
<groupId>com.google.apis</groupId>
128128
<artifactId>google-api-services-analytics</artifactId>
129-
<version>v3-rev7-1.6.0-beta</version>
129+
<version>v3-rev9-1.7.0-beta</version>
130130
</dependency>
131131
<dependency>
132132
<groupId>com.google.apis-samples</groupId>
133133
<artifactId>shared-sample-cmdline</artifactId>
134-
<version>1.2.0</version>
134+
<version>1.3.0</version>
135135
</dependency>
136136
</dependencies>
137137
<properties>

analytics-cmdline-sample/src/main/java/com/google/api/services/samples/analytics/cmdline/CoreReportingApiReferenceSample.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,8 @@ HTTP_TRANSPORT, JSON_FACTORY, new LocalServerReceiver(),
101101
Arrays.asList(AnalyticsScopes.ANALYTICS_READONLY));
102102

103103
// Set up and return Google Analytics API client.
104-
return Analytics.builder(HTTP_TRANSPORT, JSON_FACTORY)
104+
return new Analytics.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential)
105105
.setApplicationName("Google-Analytics-Core-Reporting-API-Sample")
106-
.setHttpRequestInitializer(credential)
107106
.build();
108107
}
109108

analytics-cmdline-sample/src/main/java/com/google/api/services/samples/analytics/cmdline/HelloAnalyticsApiSample.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,8 @@ HTTP_TRANSPORT, JSON_FACTORY, new LocalServerReceiver(),
9696
Arrays.asList(AnalyticsScopes.ANALYTICS_READONLY));
9797

9898
// Set up and return Google Analytics API client.
99-
return Analytics.builder(HTTP_TRANSPORT, JSON_FACTORY)
99+
return new Analytics.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential)
100100
.setApplicationName("Google-Analytics-Hello-Analytics-API-Sample")
101-
.setHttpRequestInitializer(credential)
102101
.build();
103102
}
104103

analytics-cmdline-sample/src/main/java/com/google/api/services/samples/analytics/cmdline/ManagementApiReferenceSample.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ HTTP_TRANSPORT, JSON_FACTORY, new LocalServerReceiver(),
9292
Arrays.asList(AnalyticsScopes.ANALYTICS_READONLY));
9393

9494
// Set up and return Google Analytics API client.
95-
return Analytics.builder(HTTP_TRANSPORT, JSON_FACTORY)
95+
return new Analytics.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential)
9696
.setApplicationName("Google-Analytics-Management-API-Sample")
9797
.setHttpRequestInitializer(credential)
9898
.build();
@@ -143,7 +143,7 @@ private static void printManagementEntities(Analytics analytics) throws IOExcept
143143
Goals goals = analytics.management().goals()
144144
.list(firstAccountId, firstWebpropertyId, firstProfileId).execute();
145145

146-
if (goals.getItems().isEmpty()) {
146+
if (goals.getItems() == null || goals.getItems().isEmpty()) {
147147
System.err.println("No goals found");
148148
} else {
149149
printGoals(goals);
@@ -313,7 +313,7 @@ private static void printVisitNumPagesDetails(VisitNumPagesDetails visitNumPages
313313
/**
314314
* Prints details for EVENT type goals.
315315
*
316-
* @param goalEventDetails the details of an EVENT type goal.
316+
* @param eventDetails the details of an EVENT type goal.
317317
*/
318318
private static void printGoalEventDetails(EventDetails eventDetails) {
319319
System.out.println("Goal Type: EVENT");

bigquery-appengine-sample/instructions.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ <h3>Settings</h3>
2929
<ul>
3030
<li>Add the client ID and client secret of your project to <code>shared/shared-sample-appengine/src/main/resources/client_secrets.json</code>. You can find your client id and secret on your <a href="https://code.google.com/apis/console">API console</a> for your Bigquery project under API Access</li>
3131
<li>Run <code>mvn source:jar install</code> in <code>shared/shared-sample-appengine/</code></li>
32-
<li>Add your Bigquery project ID as a system property to <code>bigquery-appengine-sample/src/main/webapp/WEB-INF/appengine-web.xml</code>. If deploying to App Engine, also add your App Engine application ID at the top of the file.</li>
32+
<li>Add your API console project ID as a system property to <code>bigquery-appengine-sample/src/main/webapp/WEB-INF/appengine-web.xml</code>. If deploying to App Engine, also add your App Engine application ID at the top of the file.</li>
3333
<li>Run <code>mvn clean package</code> in <code>bigquery-appengine-sample/</code></li>
3434
</ul>
3535

@@ -61,7 +61,8 @@ <h3>Setup project in Eclipse 3.7</h3>
6161
<h3>FAQ</h3>
6262
<ul>
6363
<li>I keep getting redirected to /denied! What do I do?<br/>Make sure your client secret/ID are correctly set and that you re-installed samples/shared-sample-appengine.</li>
64-
<li>I get a 404 when I run my query. What could be wrong?<br/>Make sure you've added your </li>
64+
<li>I get a 403 Forbidden when trying to run my query. What causes this?<br/>The user who is trying to run the query has to be added as a team member to the project in the API console in order to access the data associated with the project.</li>
65+
<li>I get a 404 when I run my query. What could be wrong?<br/>Make sure you've added your API Console project ID to the appengine-web.xml.</li>
6566
</ul>
6667

6768
</body>

0 commit comments

Comments
 (0)