Package com.google.api.adwords.v201008.cm

Examples of com.google.api.adwords.v201008.cm.Address


  /**
   * Test getting the cost of a method.
   */
  public void testGetMethodCost() throws Exception {
    // Create selector.
    DateRange range = new DateRange(TestUtils.firstDayOfMonth(), TestUtils.today());
    InfoSelector selector = new InfoSelector("CampaignService", "mutate", Operator.ADD, range,
        null, ApiUsageType.METHOD_COST);

    ApiUsageInfo apiUsageInfo = service.get(selector);

View Full Code Here


    address.setProvinceCode("US-CA");
    address.setPostalCode("94043");
    address.setCountryCode("US");

    // Create geo location selector.
    GeoLocationSelector selector = new GeoLocationSelector();
    selector.setAddresses(new Address[] {address});

    GeoLocation[] geoLocations = service.get(selector);

    assertNotNull(geoLocations);
    assertTrue("Expected at least 1 entry", geoLocations.length >= 1);
View Full Code Here

  private AdExtension[] adExtensionProvider() {
    // Create location extension.
    LocationExtension locationExtension = new LocationExtension();
    locationExtension.setAddress(new Address("76 9th Ave", null, "New York", "NY", "NY", "10011",
        "US"));
    locationExtension.setGeoPoint(new GeoPoint(new Integer(40742412), new Integer(-74004378)));
    String encoded = "qrvM3QDB3iJsdO58XYyix7YGjYhU+jHs3GR0J6uqpGp55fMTsorT5ZLH69crnCWnM3"
        + "FVAFDO9Un4HNbc5/ORF0Y8hZL/sPevCyxMrjZ2gmwbQwi2fvDB2J7RhyWSV4uWA3LT"
        + "0sdG2b22nH34uDh88XZyTyZMk0Fgc6wmmIwKSlUdYlyCzJ00Qd2JGboNgcWnVeHC8c"
        + "bGd4BzGR839qM7tGXlW5TvuGUs/lz3WjScPbHY8L0TfYcv2JV3c88di7qZJem7XV9I"
        + "Qqm3SFfWOwyC6K3y1v9p+V3twZoBCf02QVZFiohpTzau9Bj6hbXNoB7LKMHK1skduI"
View Full Code Here

    languageTargetList.setCampaignId(campaignId);
    languageTargetList.setTargets(new LanguageTarget[] {new LanguageTarget(null, "fr"),
        new LanguageTarget(null, "ja")});

    // Create geo targets.
    GeoTargetList geoTargetList = new GeoTargetList();
    geoTargetList.setCampaignId(campaignId);
    geoTargetList.setTargets(new GeoTarget[] {new CountryTarget(null, false, "US"),
        new CountryTarget(null, false, "JP")});

    // Create network targets.
    NetworkTargetList networkTargetList = new NetworkTargetList();
    networkTargetList.setCampaignId(campaignId);
    networkTargetList.setTargets(new NetworkTarget[] {
        // Specifying GOOGLE_SEARCH is necessary if you want to target
        // SEARCH_NETWORK.
        new NetworkTarget(null, NetworkCoverageType.GOOGLE_SEARCH),
        new NetworkTarget(null, NetworkCoverageType.SEARCH_NETWORK)});

    CampaignTargetOperation languageTargetOperation = new CampaignTargetOperation();
    languageTargetOperation.setOperand(languageTargetList);
    languageTargetOperation.setOperator(Operator.SET);

    CampaignTargetOperation geoTargetOperation = new CampaignTargetOperation();
    geoTargetOperation.setOperand(geoTargetList);
    geoTargetOperation.setOperator(Operator.SET);

    CampaignTargetOperation networkTargetOperation = new CampaignTargetOperation();
    networkTargetOperation.setOperand(networkTargetList);
    networkTargetOperation.setOperator(Operator.SET);

    CampaignTargetOperation[] operations = new CampaignTargetOperation[] {languageTargetOperation,
        geoTargetOperation, networkTargetOperation};

    // Set campaign targets.
    CampaignTargetReturnValue result = service.mutate(operations);

    // Exclude generated fields and test objects.
    if (result != null && result.getValue() != null) {
      for (TargetList testList : result.getValue()) {

        if (testList.getTargetListType().equals("LanguageTargetList")) {
          languageTargetList.setTargetListType(testList.getTargetListType());
          for (LanguageTarget languageTarget : languageTargetList.getTargets()) {
            languageTarget.setTargetType(((LanguageTarget) ((LanguageTargetList) testList)
                .getTargets()[0]).getTargetType());
          }
          TestUtils.assertDeepReflectionEquals(languageTargetList, testList);

        } else if (testList.getTargetListType().equals("GeoTargetList")) {
          geoTargetList.setTargetListType(testList.getTargetListType());
          for (GeoTarget geoTarget : geoTargetList.getTargets()){
            geoTarget.setTargetType(((GeoTarget)((GeoTargetList) testList)
                .getTargets()[0]).getTargetType());
          }
          TestUtils.assertDeepReflectionEquals(geoTargetList, testList);
View Full Code Here

    service = user.getService(AdWordsService.V201008.CAMPAIGN_TARGET_SERVICE);

    // Create language targets.
    LanguageTargetList languageTargetList = new LanguageTargetList();
    languageTargetList.setCampaignId(campaignId);
    languageTargetList.setTargets(new LanguageTarget[] {new LanguageTarget(null, "fr"),
        new LanguageTarget(null, "ja")});

    // Create geo targets.
    GeoTargetList geoTargetList = new GeoTargetList();
    geoTargetList.setCampaignId(campaignId);
    geoTargetList.setTargets(new GeoTarget[] {new CountryTarget(null, false, "US"),
View Full Code Here

   */
  public void testSet() throws Exception {
    service = user.getService(AdWordsService.V201008.CAMPAIGN_TARGET_SERVICE);

    // Create language targets.
    LanguageTargetList languageTargetList = new LanguageTargetList();
    languageTargetList.setCampaignId(campaignId);
    languageTargetList.setTargets(new LanguageTarget[] {new LanguageTarget(null, "fr"),
        new LanguageTarget(null, "ja")});

    // Create geo targets.
    GeoTargetList geoTargetList = new GeoTargetList();
    geoTargetList.setCampaignId(campaignId);
    geoTargetList.setTargets(new GeoTarget[] {new CountryTarget(null, false, "US"),
        new CountryTarget(null, false, "JP")});

    // Create network targets.
    NetworkTargetList networkTargetList = new NetworkTargetList();
    networkTargetList.setCampaignId(campaignId);
    networkTargetList.setTargets(new NetworkTarget[] {
        // Specifying GOOGLE_SEARCH is necessary if you want to target
        // SEARCH_NETWORK.
        new NetworkTarget(null, NetworkCoverageType.GOOGLE_SEARCH),
        new NetworkTarget(null, NetworkCoverageType.SEARCH_NETWORK)});

    CampaignTargetOperation languageTargetOperation = new CampaignTargetOperation();
    languageTargetOperation.setOperand(languageTargetList);
    languageTargetOperation.setOperator(Operator.SET);

    CampaignTargetOperation geoTargetOperation = new CampaignTargetOperation();
    geoTargetOperation.setOperand(geoTargetList);
    geoTargetOperation.setOperator(Operator.SET);

    CampaignTargetOperation networkTargetOperation = new CampaignTargetOperation();
    networkTargetOperation.setOperand(networkTargetList);
    networkTargetOperation.setOperator(Operator.SET);

    CampaignTargetOperation[] operations = new CampaignTargetOperation[] {languageTargetOperation,
        geoTargetOperation, networkTargetOperation};

    // Set campaign targets.
    CampaignTargetReturnValue result = service.mutate(operations);

    // Exclude generated fields and test objects.
    if (result != null && result.getValue() != null) {
      for (TargetList testList : result.getValue()) {

        if (testList.getTargetListType().equals("LanguageTargetList")) {
          languageTargetList.setTargetListType(testList.getTargetListType());
          for (LanguageTarget languageTarget : languageTargetList.getTargets()) {
            languageTarget.setTargetType(((LanguageTarget) ((LanguageTargetList) testList)
                .getTargets()[0]).getTargetType());
          }
          TestUtils.assertDeepReflectionEquals(languageTargetList, testList);

View Full Code Here

  /**
   * Provides ad extensions.
   */
  private AdExtension[] adExtensionProvider() {
    // Create location extension.
    LocationExtension locationExtension = new LocationExtension();
    locationExtension.setAddress(new Address("76 9th Ave", null, "New York", "NY", "NY", "10011",
        "US"));
    locationExtension.setGeoPoint(new GeoPoint(new Integer(40742412), new Integer(-74004378)));
    String encoded = "qrvM3QDB3iJsdO58XYyix7YGjYhU+jHs3GR0J6uqpGp55fMTsorT5ZLH69crnCWnM3"
        + "FVAFDO9Un4HNbc5/ORF0Y8hZL/sPevCyxMrjZ2gmwbQwi2fvDB2J7RhyWSV4uWA3LT"
        + "0sdG2b22nH34uDh88XZyTyZMk0Fgc6wmmIwKSlUdYlyCzJ00Qd2JGboNgcWnVeHC8c"
        + "bGd4BzGR839qM7tGXlW5TvuGUs/lz3WjScPbHY8L0TfYcv2JV3c88di7qZJem7XV9I"
        + "Qqm3SFfWOwyC6K3y1v9p+V3twZoBCf02QVZFiohpTzau9Bj6hbXNoB7LKMHK1skduI"
        + "gs854r83tIp1FevrxVNp3S7npNDcQaNAMHoYzX8iDGASwR8sWg2JUYeiTns6AihCAp"
        + "QmwNTdYHhhgh75B9PqYpSA5ghBWr0xWpiZBnM9713DwvG4LCD2smG43VAGUUrCVknw"
        + "rMxS/XSoF6NMzAFi648SglPozoGrLPdQ/4IbaIr91yAJpegOGivQPQ7NMLc2ClnYt5"
        + "mj/IzHjNK7u1WDJFW2CF0Kw+/50zljzvWDVUiBxGha7da7ihyuR32D+uCJOM+HsCgA==";
    locationExtension.setEncodedLocation(Base64.decodeBase64(encoded.getBytes()));

    locationExtension.setCompanyName("Google");
    locationExtension.setPhoneNumber("(212) 565-0000");
    locationExtension.setSource(LocationExtensionSource.ADWORDS_FRONTEND);

    return new AdExtension[] {locationExtension};
  }
View Full Code Here

        user.getService(AdWordsService.V201008.CAMPAIGN_SERVICE);

    // Create campaign.
    Campaign campaign = new Campaign();
    campaign.setName("Test Campaign #" + System.currentTimeMillis());
    campaign.setBiddingStrategy(new ManualCPC());
    campaign.setStatus(CampaignStatus.PAUSED);

    // Create budget
    Budget budget = new Budget();
    budget.setPeriod(BudgetBudgetPeriod.DAILY);
View Full Code Here

   */
  public void testValidCreateCampaign() throws Exception {
    Campaign campaign = new Campaign();
    campaign.setName("Test Campaign " + System.currentTimeMillis());
    campaign.setStatus(CampaignStatus.PAUSED);
    campaign.setBiddingStrategy(new ManualCPC());

    // Create budget.
    Budget budget = new Budget();
    budget.setPeriod(BudgetBudgetPeriod.DAILY);
    budget.setAmount(new Money(null, 50000000L));
View Full Code Here

    adGroup.setName("Earth to Mars Cruises #" + System.currentTimeMillis());
    adGroup.setStatus(AdGroupStatus.ENABLED);
    adGroup.setCampaignId(campaignId);

    // Create ad group bid.
    ManualCPCAdGroupBids adGroupBids = new ManualCPCAdGroupBids();
    adGroupBids.setKeywordMaxCpc(new Bid(new Money(null, 10000000L)));
    adGroup.setBids(adGroupBids);

    // Create operations.
    AdGroupOperation operation = new AdGroupOperation();
    operation.setOperand(adGroup);
View Full Code Here

TOP

Related Classes of com.google.api.adwords.v201008.cm.Address

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.