.setTransport(TRANSPORT)
.setClientSecrets(Constants.GOOGLE_PROJECT_CLIENT_ID, Constants.GOOGLE_PROJECT_CLIENT_SECRET).build()
.setAccessToken(userModel.getAccessToken())
.setRefreshToken(userModel.getRefreshToken());
AdSense adSense = new AdSense(TRANSPORT, JSON_FACTORY, credential);
// アカウントIDを取得
System.out.println("Account ID:" + asString("id"));
// 対象クライアントID
String adClientId = "ca-" + accountId;
// AdSense Unit の取得(有効な広告のみ)
AdUnits adUnits = adSense.adunits().list(adClientId).setIncludeInactive(false).execute();
if(adUnits.getItems() == null || adUnits.getItems().size() <= 0) {
return forward("select_ad_unit.jsp");
}
List<AdUnit> targetUnits = new ArrayList<AdUnit>();