google-adwords-api 0.7.2 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +6 -0
- data/README +12 -9
- data/adwords_api.yml +3 -17
- data/examples/v201206/account_management/create_account.rb +3 -0
- data/examples/v201206/account_management/get_account_alerts.rb +3 -0
- data/examples/v201206/account_management/get_account_hierarchy.rb +3 -0
- data/examples/v201206/account_management/get_client_customer_id.rb +3 -0
- data/examples/v201206/account_management/get_client_unit_usage.rb +3 -0
- data/examples/v201206/reporting/parallel_report_download.rb +3 -0
- data/examples/v201209/account_management/create_account.rb +3 -0
- data/examples/v201209/account_management/get_account_alerts.rb +3 -0
- data/examples/v201209/account_management/get_account_hierarchy.rb +3 -0
- data/examples/v201209/account_management/get_client_customer_id.rb +3 -0
- data/examples/v201209/account_management/get_client_unit_usage.rb +3 -0
- data/examples/{v201109/misc/use_oauth2.rb → v201209/misc/use_oauth2_jwt.rb} +19 -23
- data/examples/v201209/reporting/parallel_report_download.rb +3 -0
- data/lib/adwords_api.rb +8 -3
- data/lib/adwords_api/api_config.rb +0 -132
- data/lib/adwords_api/credential_handler.rb +3 -17
- data/lib/adwords_api/report_header_handler.rb +1 -2
- data/lib/adwords_api/report_utils.rb +1 -8
- data/lib/adwords_api/version.rb +1 -1
- data/test/adwords_api/test_adwords_api.rb +23 -9
- data/test/adwords_api/test_api_config.rb +0 -8
- data/test/adwords_api/test_credential_handler.rb +45 -9
- data/test/adwords_api/test_report_utils.rb +3 -2
- data/test/{suite_exampletests_v201109.rb → suite_integration.rb} +14 -11
- data/test/templates/v201209/basic_operations_get_campaigns.def +114 -0
- data/test/test_utils.rb +105 -0
- metadata +8 -250
- data/examples/v201109/account_management/create_account.rb +0 -80
- data/examples/v201109/account_management/get_account_alerts.rb +0 -111
- data/examples/v201109/account_management/get_account_changes.rb +0 -137
- data/examples/v201109/account_management/get_account_hierarchy.rb +0 -93
- data/examples/v201109/account_management/get_client_customer_id.rb +0 -85
- data/examples/v201109/account_management/get_client_unit_usage.rb +0 -87
- data/examples/v201109/basic_operations/add_ad_groups.rb +0 -111
- data/examples/v201109/basic_operations/add_campaigns.rb +0 -125
- data/examples/v201109/basic_operations/add_keywords.rb +0 -108
- data/examples/v201109/basic_operations/add_text_ads.rb +0 -105
- data/examples/v201109/basic_operations/delete_ad.rb +0 -85
- data/examples/v201109/basic_operations/delete_ad_group.rb +0 -102
- data/examples/v201109/basic_operations/delete_campaign.rb +0 -103
- data/examples/v201109/basic_operations/delete_keyword.rb +0 -90
- data/examples/v201109/basic_operations/get_ad_groups.rb +0 -98
- data/examples/v201109/basic_operations/get_campaigns.rb +0 -93
- data/examples/v201109/basic_operations/get_keywords.rb +0 -104
- data/examples/v201109/basic_operations/get_text_ads.rb +0 -106
- data/examples/v201109/basic_operations/pause_ad.rb +0 -84
- data/examples/v201109/basic_operations/update_ad_group.rb +0 -81
- data/examples/v201109/basic_operations/update_campaign.rb +0 -84
- data/examples/v201109/basic_operations/update_keyword.rb +0 -99
- data/examples/v201109/campaign_management/add_experiment.rb +0 -158
- data/examples/v201109/campaign_management/add_keywords_in_bulk.rb +0 -150
- data/examples/v201109/campaign_management/add_location_extension.rb +0 -117
- data/examples/v201109/campaign_management/add_location_extension_override.rb +0 -83
- data/examples/v201109/campaign_management/get_all_disapproved_ads.rb +0 -93
- data/examples/v201109/campaign_management/promote_experiment.rb +0 -77
- data/examples/v201109/campaign_management/set_ad_parameters.rb +0 -114
- data/examples/v201109/campaign_management/validate_text_ad.rb +0 -106
- data/examples/v201109/error_handling/handle_captcha_challenge.rb +0 -93
- data/examples/v201109/error_handling/handle_partial_failures.rb +0 -126
- data/examples/v201109/error_handling/handle_policy_violation_error.rb +0 -137
- data/examples/v201109/error_handling/handle_two_factor_authorization_error.rb +0 -87
- data/examples/v201109/misc/get_all_images_and_videos.rb +0 -100
- data/examples/v201109/misc/upload_image.rb +0 -89
- data/examples/v201109/misc/use_oauth.rb +0 -100
- data/examples/v201109/optimization/estimate_keyword_traffic.rb +0 -129
- data/examples/v201109/optimization/get_keyword_bid_simulations.rb +0 -92
- data/examples/v201109/optimization/get_keyword_ideas.rb +0 -106
- data/examples/v201109/optimization/get_placement_ideas.rb +0 -104
- data/examples/v201109/remarketing/add_audience.rb +0 -115
- data/examples/v201109/remarketing/add_conversion_tracker.rb +0 -97
- data/examples/v201109/reporting/download_criteria_report.rb +0 -79
- data/examples/v201109/reporting/get_campaign_stats.rb +0 -105
- data/examples/v201109/reporting/get_defined_reports.rb +0 -75
- data/examples/v201109/reporting/get_report_fields.rb +0 -71
- data/examples/v201109/reporting/parallel_report_download.rb +0 -159
- data/examples/v201109/targeting/add_campaign_targeting_criteria.rb +0 -118
- data/examples/v201109/targeting/get_campaign_targeting_criteria.rb +0 -102
- data/examples/v201109/targeting/get_targetable_languages_and_carriers.rb +0 -86
- data/examples/v201109/targeting/lookup_location.rb +0 -103
- data/examples/v201109_1/account_management/create_account.rb +0 -80
- data/examples/v201109_1/account_management/get_account_alerts.rb +0 -111
- data/examples/v201109_1/account_management/get_account_changes.rb +0 -137
- data/examples/v201109_1/account_management/get_account_hierarchy.rb +0 -93
- data/examples/v201109_1/account_management/get_client_customer_id.rb +0 -85
- data/examples/v201109_1/account_management/get_client_unit_usage.rb +0 -87
- data/examples/v201109_1/basic_operations/add_ad_groups.rb +0 -111
- data/examples/v201109_1/basic_operations/add_campaigns.rb +0 -140
- data/examples/v201109_1/basic_operations/add_keywords.rb +0 -108
- data/examples/v201109_1/basic_operations/add_text_ads.rb +0 -105
- data/examples/v201109_1/basic_operations/delete_ad.rb +0 -85
- data/examples/v201109_1/basic_operations/delete_ad_group.rb +0 -102
- data/examples/v201109_1/basic_operations/delete_campaign.rb +0 -103
- data/examples/v201109_1/basic_operations/delete_keyword.rb +0 -90
- data/examples/v201109_1/basic_operations/get_ad_groups.rb +0 -98
- data/examples/v201109_1/basic_operations/get_campaigns.rb +0 -93
- data/examples/v201109_1/basic_operations/get_keywords.rb +0 -104
- data/examples/v201109_1/basic_operations/get_text_ads.rb +0 -106
- data/examples/v201109_1/basic_operations/pause_ad.rb +0 -84
- data/examples/v201109_1/basic_operations/update_ad_group.rb +0 -81
- data/examples/v201109_1/basic_operations/update_campaign.rb +0 -84
- data/examples/v201109_1/basic_operations/update_keyword.rb +0 -99
- data/examples/v201109_1/campaign_management/add_experiment.rb +0 -158
- data/examples/v201109_1/campaign_management/add_keywords_in_bulk.rb +0 -150
- data/examples/v201109_1/campaign_management/add_location_extension.rb +0 -117
- data/examples/v201109_1/campaign_management/add_location_extension_override.rb +0 -83
- data/examples/v201109_1/campaign_management/get_all_disapproved_ads.rb +0 -93
- data/examples/v201109_1/campaign_management/promote_experiment.rb +0 -77
- data/examples/v201109_1/campaign_management/set_ad_parameters.rb +0 -114
- data/examples/v201109_1/campaign_management/validate_text_ad.rb +0 -106
- data/examples/v201109_1/error_handling/handle_captcha_challenge.rb +0 -93
- data/examples/v201109_1/error_handling/handle_partial_failures.rb +0 -126
- data/examples/v201109_1/error_handling/handle_policy_violation_error.rb +0 -137
- data/examples/v201109_1/error_handling/handle_two_factor_authorization_error.rb +0 -87
- data/examples/v201109_1/misc/get_all_images_and_videos.rb +0 -100
- data/examples/v201109_1/misc/upload_image.rb +0 -89
- data/examples/v201109_1/misc/use_oauth.rb +0 -100
- data/examples/v201109_1/misc/use_oauth2.rb +0 -97
- data/examples/v201109_1/optimization/estimate_keyword_traffic.rb +0 -129
- data/examples/v201109_1/optimization/get_keyword_bid_simulations.rb +0 -92
- data/examples/v201109_1/optimization/get_keyword_ideas.rb +0 -112
- data/examples/v201109_1/optimization/get_placement_ideas.rb +0 -104
- data/examples/v201109_1/remarketing/add_audience.rb +0 -115
- data/examples/v201109_1/remarketing/add_conversion_tracker.rb +0 -97
- data/examples/v201109_1/reporting/download_criteria_report.rb +0 -79
- data/examples/v201109_1/reporting/get_campaign_stats.rb +0 -105
- data/examples/v201109_1/reporting/get_defined_reports.rb +0 -75
- data/examples/v201109_1/reporting/get_report_fields.rb +0 -71
- data/examples/v201109_1/reporting/parallel_report_download.rb +0 -159
- data/examples/v201109_1/targeting/add_campaign_targeting_criteria.rb +0 -118
- data/examples/v201109_1/targeting/get_campaign_targeting_criteria.rb +0 -102
- data/examples/v201109_1/targeting/get_targetable_languages_and_carriers.rb +0 -86
- data/examples/v201109_1/targeting/lookup_location.rb +0 -103
- data/examples/v201206/misc/use_oauth.rb +0 -100
- data/examples/v201209/misc/use_oauth.rb +0 -100
- data/lib/adwords_api/v201109/ad_extension_override_service.rb +0 -38
- data/lib/adwords_api/v201109/ad_extension_override_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/ad_group_ad_service.rb +0 -38
- data/lib/adwords_api/v201109/ad_group_ad_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/ad_group_criterion_service.rb +0 -38
- data/lib/adwords_api/v201109/ad_group_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/ad_group_service.rb +0 -38
- data/lib/adwords_api/v201109/ad_group_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/ad_param_service.rb +0 -38
- data/lib/adwords_api/v201109/ad_param_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/alert_service.rb +0 -34
- data/lib/adwords_api/v201109/alert_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/budget_order_service.rb +0 -42
- data/lib/adwords_api/v201109/budget_order_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/bulk_mutate_job_service.rb +0 -38
- data/lib/adwords_api/v201109/bulk_mutate_job_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/campaign_ad_extension_service.rb +0 -38
- data/lib/adwords_api/v201109/campaign_ad_extension_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/campaign_criterion_service.rb +0 -38
- data/lib/adwords_api/v201109/campaign_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/campaign_service.rb +0 -38
- data/lib/adwords_api/v201109/campaign_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/campaign_target_service.rb +0 -38
- data/lib/adwords_api/v201109/campaign_target_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/constant_data_service.rb +0 -38
- data/lib/adwords_api/v201109/constant_data_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/conversion_tracker_service.rb +0 -38
- data/lib/adwords_api/v201109/conversion_tracker_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/create_account_service.rb +0 -34
- data/lib/adwords_api/v201109/create_account_service_registry.rb +0 -47
- data/lib/adwords_api/v201109/customer_sync_service.rb +0 -34
- data/lib/adwords_api/v201109/customer_sync_service_registry.rb +0 -47
- data/lib/adwords_api/v201109/data_service.rb +0 -38
- data/lib/adwords_api/v201109/data_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/experiment_service.rb +0 -38
- data/lib/adwords_api/v201109/experiment_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/geo_location_service.rb +0 -34
- data/lib/adwords_api/v201109/geo_location_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/info_service.rb +0 -34
- data/lib/adwords_api/v201109/info_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/location_criterion_service.rb +0 -34
- data/lib/adwords_api/v201109/location_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/media_service.rb +0 -38
- data/lib/adwords_api/v201109/media_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/mutate_job_service.rb +0 -42
- data/lib/adwords_api/v201109/mutate_job_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/report_definition_service.rb +0 -38
- data/lib/adwords_api/v201109/report_definition_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/serviced_account_service.rb +0 -34
- data/lib/adwords_api/v201109/serviced_account_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/targeting_idea_service.rb +0 -38
- data/lib/adwords_api/v201109/targeting_idea_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/traffic_estimator_service.rb +0 -34
- data/lib/adwords_api/v201109/traffic_estimator_service_registry.rb +0 -46
- data/lib/adwords_api/v201109/user_list_service.rb +0 -38
- data/lib/adwords_api/v201109/user_list_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/ad_extension_override_service.rb +0 -38
- data/lib/adwords_api/v201109_1/ad_extension_override_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/ad_group_ad_service.rb +0 -38
- data/lib/adwords_api/v201109_1/ad_group_ad_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/ad_group_criterion_service.rb +0 -38
- data/lib/adwords_api/v201109_1/ad_group_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/ad_group_service.rb +0 -38
- data/lib/adwords_api/v201109_1/ad_group_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/ad_param_service.rb +0 -38
- data/lib/adwords_api/v201109_1/ad_param_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/alert_service.rb +0 -34
- data/lib/adwords_api/v201109_1/alert_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/budget_order_service.rb +0 -42
- data/lib/adwords_api/v201109_1/budget_order_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/bulk_mutate_job_service.rb +0 -38
- data/lib/adwords_api/v201109_1/bulk_mutate_job_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/campaign_ad_extension_service.rb +0 -38
- data/lib/adwords_api/v201109_1/campaign_ad_extension_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/campaign_criterion_service.rb +0 -38
- data/lib/adwords_api/v201109_1/campaign_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/campaign_service.rb +0 -38
- data/lib/adwords_api/v201109_1/campaign_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/campaign_target_service.rb +0 -38
- data/lib/adwords_api/v201109_1/campaign_target_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/constant_data_service.rb +0 -38
- data/lib/adwords_api/v201109_1/constant_data_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/conversion_tracker_service.rb +0 -38
- data/lib/adwords_api/v201109_1/conversion_tracker_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/create_account_service.rb +0 -34
- data/lib/adwords_api/v201109_1/create_account_service_registry.rb +0 -47
- data/lib/adwords_api/v201109_1/customer_service.rb +0 -34
- data/lib/adwords_api/v201109_1/customer_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/customer_sync_service.rb +0 -34
- data/lib/adwords_api/v201109_1/customer_sync_service_registry.rb +0 -47
- data/lib/adwords_api/v201109_1/data_service.rb +0 -38
- data/lib/adwords_api/v201109_1/data_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/experiment_service.rb +0 -38
- data/lib/adwords_api/v201109_1/experiment_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/geo_location_service.rb +0 -34
- data/lib/adwords_api/v201109_1/geo_location_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/info_service.rb +0 -34
- data/lib/adwords_api/v201109_1/info_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/location_criterion_service.rb +0 -34
- data/lib/adwords_api/v201109_1/location_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/managed_customer_service.rb +0 -38
- data/lib/adwords_api/v201109_1/managed_customer_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/media_service.rb +0 -38
- data/lib/adwords_api/v201109_1/media_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/mutate_job_service.rb +0 -42
- data/lib/adwords_api/v201109_1/mutate_job_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/report_definition_service.rb +0 -38
- data/lib/adwords_api/v201109_1/report_definition_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/serviced_account_service.rb +0 -34
- data/lib/adwords_api/v201109_1/serviced_account_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/targeting_idea_service.rb +0 -38
- data/lib/adwords_api/v201109_1/targeting_idea_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/traffic_estimator_service.rb +0 -34
- data/lib/adwords_api/v201109_1/traffic_estimator_service_registry.rb +0 -46
- data/lib/adwords_api/v201109_1/user_list_service.rb +0 -38
- data/lib/adwords_api/v201109_1/user_list_service_registry.rb +0 -46
- data/test/examples/v201109/test_account_management.rb +0 -60
- data/test/examples/v201109/test_basic_operations.rb +0 -172
- data/test/examples/v201109/test_campaign_management.rb +0 -116
- data/test/examples/v201109/test_error_handling.rb +0 -63
- data/test/examples/v201109/test_misc.rb +0 -45
- data/test/examples/v201109/test_optimization.rb +0 -63
- data/test/examples/v201109/test_remarketing.rb +0 -39
- data/test/examples/v201109/test_reporting.rb +0 -72
- data/test/examples/v201109/test_targeting.rb +0 -60
- data/test/examples/v201109/utils.rb +0 -238
- data/test/examples/v201109_1/test_account_management.rb +0 -60
- data/test/examples/v201109_1/test_basic_operations.rb +0 -172
- data/test/examples/v201109_1/test_campaign_management.rb +0 -116
- data/test/examples/v201109_1/test_error_handling.rb +0 -63
- data/test/examples/v201109_1/test_misc.rb +0 -45
- data/test/examples/v201109_1/test_optimization.rb +0 -63
- data/test/examples/v201109_1/test_remarketing.rb +0 -39
- data/test/examples/v201109_1/test_reporting.rb +0 -72
- data/test/examples/v201109_1/test_targeting.rb +0 -60
- data/test/examples/v201109_1/utils.rb +0 -238
- data/test/suite_exampletests_v201109_1.rb +0 -37
@@ -1,39 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# Encoding: utf-8
|
3
|
-
#
|
4
|
-
# Author:: api.dklimkin@gmail.com (Danial Klimkin)
|
5
|
-
#
|
6
|
-
# Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
|
7
|
-
#
|
8
|
-
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
-
# you may not use this file except in compliance with the License.
|
10
|
-
# You may obtain a copy of the License at
|
11
|
-
#
|
12
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
-
#
|
14
|
-
# Unless required by applicable law or agreed to in writing, software
|
15
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
17
|
-
# implied.
|
18
|
-
# See the License for the specific language governing permissions and
|
19
|
-
# limitations under the License.
|
20
|
-
#
|
21
|
-
# Tests the remarketing examples.
|
22
|
-
|
23
|
-
require 'test/unit'
|
24
|
-
|
25
|
-
require 'remarketing/add_audience'
|
26
|
-
require 'remarketing/add_conversion_tracker'
|
27
|
-
|
28
|
-
class TestRemarketingV201109 < Test::Unit::TestCase
|
29
|
-
def setup
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_add_audience
|
33
|
-
add_audience()
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_add_conversion_tracker
|
37
|
-
add_conversion_tracker()
|
38
|
-
end
|
39
|
-
end
|
@@ -1,72 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# Encoding: utf-8
|
3
|
-
#
|
4
|
-
# Author:: api.dklimkin@gmail.com (Danial Klimkin)
|
5
|
-
#
|
6
|
-
# Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
|
7
|
-
#
|
8
|
-
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
-
# you may not use this file except in compliance with the License.
|
10
|
-
# You may obtain a copy of the License at
|
11
|
-
#
|
12
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
-
#
|
14
|
-
# Unless required by applicable law or agreed to in writing, software
|
15
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
17
|
-
# implied.
|
18
|
-
# See the License for the specific language governing permissions and
|
19
|
-
# limitations under the License.
|
20
|
-
#
|
21
|
-
# Tests the reporting examples.
|
22
|
-
|
23
|
-
require 'test/unit'
|
24
|
-
require 'tempfile'
|
25
|
-
|
26
|
-
require 'reporting/download_criteria_report'
|
27
|
-
require 'reporting/get_campaign_stats'
|
28
|
-
require 'reporting/get_report_fields'
|
29
|
-
require 'reporting/parallel_report_download'
|
30
|
-
|
31
|
-
THREADS = 3
|
32
|
-
MAX_RETRIES = 3
|
33
|
-
BACKOFF_FACTOR = 3
|
34
|
-
|
35
|
-
class TestReportingV201109 < Test::Unit::TestCase
|
36
|
-
def setup
|
37
|
-
@logger = Logger.new(STDOUT)
|
38
|
-
@logger.level = Logger::ERROR
|
39
|
-
@adwords = AdwordsApi::Api.new
|
40
|
-
@adwords.logger = @logger
|
41
|
-
@utils = UtilsV201109.new(@adwords)
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_download_criteria_report
|
45
|
-
file = Tempfile.new('ruby-examples')
|
46
|
-
begin
|
47
|
-
file.close()
|
48
|
-
download_criteria_report(file.path)
|
49
|
-
ensure
|
50
|
-
file.unlink()
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_get_campaign_stats
|
55
|
-
get_campaign_stats()
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_get_report_fields
|
59
|
-
report_type = 'ACCOUNT_PERFORMANCE_REPORT'
|
60
|
-
get_report_fields(report_type)
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_parallel_report_download
|
64
|
-
old_dir = Dir.pwd
|
65
|
-
Dir.chdir('/tmp')
|
66
|
-
begin
|
67
|
-
parallel_report_download()
|
68
|
-
ensure
|
69
|
-
Dir.chdir(old_dir)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# Encoding: utf-8
|
3
|
-
#
|
4
|
-
# Author:: api.dklimkin@gmail.com (Danial Klimkin)
|
5
|
-
#
|
6
|
-
# Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
|
7
|
-
#
|
8
|
-
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
-
# you may not use this file except in compliance with the License.
|
10
|
-
# You may obtain a copy of the License at
|
11
|
-
#
|
12
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
-
#
|
14
|
-
# Unless required by applicable law or agreed to in writing, software
|
15
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
17
|
-
# implied.
|
18
|
-
# See the License for the specific language governing permissions and
|
19
|
-
# limitations under the License.
|
20
|
-
#
|
21
|
-
# Tests the targeting examples.
|
22
|
-
|
23
|
-
require 'test/unit'
|
24
|
-
|
25
|
-
require 'targeting/add_campaign_targeting_criteria'
|
26
|
-
require 'targeting/get_campaign_targeting_criteria'
|
27
|
-
require 'targeting/get_targetable_languages_and_carriers'
|
28
|
-
require 'targeting/lookup_location'
|
29
|
-
|
30
|
-
class TestTargetingV201109 < Test::Unit::TestCase
|
31
|
-
def setup
|
32
|
-
@logger = Logger.new(STDOUT)
|
33
|
-
@logger.level = Logger::ERROR
|
34
|
-
@adwords = AdwordsApi::Api.new
|
35
|
-
@adwords.logger = @logger
|
36
|
-
@utils = UtilsV201109.new(@adwords)
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_add_campaign_targeting_criteria
|
40
|
-
campaign = @utils.get_campaign()
|
41
|
-
assert_not_nil(campaign)
|
42
|
-
assert_not_nil(campaign[:id])
|
43
|
-
add_campaign_targeting_criteria(campaign[:id])
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_get_campaign_targeting_criteria
|
47
|
-
campaign = @utils.get_campaign()
|
48
|
-
assert_not_nil(campaign)
|
49
|
-
assert_not_nil(campaign[:id])
|
50
|
-
get_campaign_targeting_criteria(campaign[:id])
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_get_targetable_languages_and_carriers
|
54
|
-
get_targetable_languages_and_carriers()
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_lookup_location
|
58
|
-
lookup_location()
|
59
|
-
end
|
60
|
-
end
|
@@ -1,238 +0,0 @@
|
|
1
|
-
# Encoding: utf-8
|
2
|
-
#
|
3
|
-
# Author:: api.dklimkin@gmail.com (Danial Klimkin)
|
4
|
-
#
|
5
|
-
# Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
|
6
|
-
#
|
7
|
-
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
16
|
-
# implied.
|
17
|
-
# See the License for the specific language governing permissions and
|
18
|
-
# limitations under the License.
|
19
|
-
#
|
20
|
-
# Utilities and constants for example tests.
|
21
|
-
|
22
|
-
API_VERSION = :v201109
|
23
|
-
PAGE_SIZE = 500
|
24
|
-
|
25
|
-
class UtilsV201109
|
26
|
-
def initialize(adwords)
|
27
|
-
@adwords = adwords
|
28
|
-
end
|
29
|
-
|
30
|
-
def get_campaign
|
31
|
-
@campaign ||= create_campaign()
|
32
|
-
return @campaign
|
33
|
-
end
|
34
|
-
|
35
|
-
def get_ad_group
|
36
|
-
@ad_group ||= create_ad_group()
|
37
|
-
return @ad_group
|
38
|
-
end
|
39
|
-
|
40
|
-
def get_ad
|
41
|
-
@ad ||= create_ad(get_ad_group()[:id])
|
42
|
-
return @ad
|
43
|
-
end
|
44
|
-
|
45
|
-
def get_keyword
|
46
|
-
@keyword ||= create_keyword(get_ad_group()[:id])
|
47
|
-
return @keyword
|
48
|
-
end
|
49
|
-
|
50
|
-
def get_location_extension
|
51
|
-
@location_extension ||= create_location_extension(get_campaign()[:id])
|
52
|
-
return @location_extension
|
53
|
-
end
|
54
|
-
|
55
|
-
def get_experiment
|
56
|
-
@experiment ||= create_experiment(
|
57
|
-
get_campaign()[:id], get_ad_group()[:id], get_keyword[:criterion][:id])
|
58
|
-
return @experiment
|
59
|
-
end
|
60
|
-
|
61
|
-
private
|
62
|
-
|
63
|
-
def create_campaign
|
64
|
-
campaign_srv = @adwords.service(:CampaignService, API_VERSION)
|
65
|
-
campaign = {
|
66
|
-
:name => "Example tests campaign #%d" % (Time.new.to_f * 1000).to_i,
|
67
|
-
:status => 'PAUSED',
|
68
|
-
:bidding_strategy => {:xsi_type => 'ManualCPC'},
|
69
|
-
:budget => {
|
70
|
-
:period => 'DAILY',
|
71
|
-
:amount => {:micro_amount => 50000000},
|
72
|
-
:delivery_method => 'STANDARD'
|
73
|
-
},
|
74
|
-
:network_setting => {
|
75
|
-
:target_google_search => true,
|
76
|
-
:target_search_network => true,
|
77
|
-
:target_content_network => true
|
78
|
-
}
|
79
|
-
}
|
80
|
-
operation = {:operator => 'ADD', :operand => campaign}
|
81
|
-
response = campaign_srv.mutate([operation])
|
82
|
-
return response[:value].first
|
83
|
-
end
|
84
|
-
|
85
|
-
def create_ad_group
|
86
|
-
campaign = get_campaign()
|
87
|
-
ad_group_srv = @adwords.service(:AdGroupService, API_VERSION)
|
88
|
-
ad_group = {
|
89
|
-
:name => "Example tests ad group #%d" % (Time.new.to_f * 1000).to_i,
|
90
|
-
:status => 'ENABLED',
|
91
|
-
:campaign_id => campaign[:id],
|
92
|
-
:bids => {
|
93
|
-
:xsi_type => 'ManualCPCAdGroupBids',
|
94
|
-
:keyword_max_cpc => {:amount => {:micro_amount => 10000000}},
|
95
|
-
}
|
96
|
-
}
|
97
|
-
operation = {:operator => 'ADD', :operand => ad_group}
|
98
|
-
response = ad_group_srv.mutate([operation])
|
99
|
-
return response[:value].first
|
100
|
-
end
|
101
|
-
|
102
|
-
def create_ad(ad_group_id)
|
103
|
-
ad_group_ad_srv = @adwords.service(:AdGroupAdService, API_VERSION)
|
104
|
-
text_ad = {
|
105
|
-
:xsi_type => 'TextAd',
|
106
|
-
:headline => 'Examples test ad %d' % (Time.new.to_f * 1000).to_i,
|
107
|
-
:description1 => 'testing ruby examples',
|
108
|
-
:description2 => 'all your base are belong to us',
|
109
|
-
:url => 'http://www.example.com',
|
110
|
-
:display_url => 'www.example.com'
|
111
|
-
}
|
112
|
-
operation = {:operator => 'ADD',
|
113
|
-
:operand => {:ad_group_id => ad_group_id, :ad => text_ad}}
|
114
|
-
response = ad_group_ad_srv.mutate([operation])
|
115
|
-
return response[:value].first
|
116
|
-
end
|
117
|
-
|
118
|
-
def create_keyword(ad_group_id)
|
119
|
-
ad_group_criterion_srv =
|
120
|
-
@adwords.service(:AdGroupCriterionService, API_VERSION)
|
121
|
-
keyword = {
|
122
|
-
:xsi_type => 'BiddableAdGroupCriterion',
|
123
|
-
:ad_group_id => ad_group_id,
|
124
|
-
:criterion => {
|
125
|
-
:xsi_type => 'Keyword',
|
126
|
-
:text => 'mars cruise',
|
127
|
-
:match_type => 'BROAD'
|
128
|
-
}
|
129
|
-
}
|
130
|
-
operation = {:operator => 'ADD', :operand => keyword}
|
131
|
-
response = ad_group_criterion_srv.mutate([operation])
|
132
|
-
return response[:value].first
|
133
|
-
end
|
134
|
-
|
135
|
-
def create_location_extension(campaign_id)
|
136
|
-
campaign_ad_ext_srv =
|
137
|
-
@adwords.service(:CampaignAdExtensionService, API_VERSION)
|
138
|
-
geo_location_srv = @adwords.service(:GeoLocationService, API_VERSION)
|
139
|
-
|
140
|
-
selector = {
|
141
|
-
:addresses => [
|
142
|
-
{
|
143
|
-
:street_address => '1600 Amphitheatre Parkway',
|
144
|
-
:city_name => 'Mountain View',
|
145
|
-
:province_code => 'CA',
|
146
|
-
:postal_code => '94043',
|
147
|
-
:country_code => 'US'
|
148
|
-
}
|
149
|
-
]
|
150
|
-
}
|
151
|
-
|
152
|
-
locations = geo_location_srv.get(selector)
|
153
|
-
raise StandardError, 'Unable to retrieve geo locations.' if locations.nil?
|
154
|
-
|
155
|
-
operations = locations.map do |location|
|
156
|
-
{
|
157
|
-
:operator => 'ADD',
|
158
|
-
:operand => {
|
159
|
-
:campaign_id => campaign_id,
|
160
|
-
:status => 'ACTIVE',
|
161
|
-
:ad_extension => {
|
162
|
-
:xsi_type => 'LocationExtension',
|
163
|
-
:address => location[:address],
|
164
|
-
:geo_point => location[:geo_point],
|
165
|
-
:encoded_location => location[:encoded_location],
|
166
|
-
:source => 'ADWORDS_FRONTEND'
|
167
|
-
}
|
168
|
-
}
|
169
|
-
}
|
170
|
-
end
|
171
|
-
|
172
|
-
response = campaign_ad_ext_srv.mutate(operations)
|
173
|
-
extension = response[:value].first
|
174
|
-
return extension
|
175
|
-
end
|
176
|
-
|
177
|
-
def create_experiment(campaign_id, ad_group_id, criterion_id)
|
178
|
-
experiment_srv = @adwords.service(:ExperimentService, API_VERSION)
|
179
|
-
ad_group_srv = @adwords.service(:AdGroupService, API_VERSION)
|
180
|
-
ad_group_criterion_srv =
|
181
|
-
@adwords.service(:AdGroupCriterionService, API_VERSION)
|
182
|
-
|
183
|
-
operation = {
|
184
|
-
:operator => 'ADD',
|
185
|
-
:operand => {
|
186
|
-
:campaign_id => campaign_id,
|
187
|
-
:name => "Examples test experiment #%d" % (Time.new.to_f * 1000).to_i,
|
188
|
-
:query_percentage => 10,
|
189
|
-
:start_date_time => Time.now.strftime('%Y%m%d %H%M%S'),
|
190
|
-
}
|
191
|
-
}
|
192
|
-
response = experiment_srv.mutate([operation])
|
193
|
-
experiment = response[:value].first
|
194
|
-
|
195
|
-
raise StandardError, 'Failed to create experiment' if experiment.nil?
|
196
|
-
|
197
|
-
ad_group = {
|
198
|
-
:id => ad_group_id,
|
199
|
-
:experiment_data => {
|
200
|
-
:experiment_id => experiment[:id],
|
201
|
-
:experiment_delta_status => 'MODIFIED',
|
202
|
-
:experiment_bid_multipliers => {
|
203
|
-
:xsi_type => 'ManualCPCAdGroupExperimentBidMultipliers',
|
204
|
-
:max_cpc_multiplier => {:multiplier => 1.5}
|
205
|
-
}
|
206
|
-
}
|
207
|
-
}
|
208
|
-
|
209
|
-
operation = {:operator => 'SET', :operand => ad_group}
|
210
|
-
response = ad_group_srv.mutate([operation])
|
211
|
-
ad_group = response[:value].first
|
212
|
-
|
213
|
-
raise StandardError, 'Failed to assign experiment' if ad_group.nil?
|
214
|
-
|
215
|
-
ad_group_criterion = {
|
216
|
-
:xsi_type => 'BiddableAdGroupCriterion',
|
217
|
-
:ad_group_id => ad_group_id,
|
218
|
-
:criterion => {:id => criterion_id},
|
219
|
-
:experiment_data => {
|
220
|
-
:xsi_type => 'BiddableAdGroupCriterionExperimentData',
|
221
|
-
:experiment_id => experiment[:id],
|
222
|
-
:experiment_delta_status => 'MODIFIED',
|
223
|
-
:experiment_bid_multiplier => {
|
224
|
-
:xsi_type => 'ManualCPCAdGroupCriterionExperimentBidMultiplier',
|
225
|
-
:max_cpc_multiplier => {:multiplier => 1.5}
|
226
|
-
}
|
227
|
-
}
|
228
|
-
}
|
229
|
-
|
230
|
-
operation = {:operator => 'SET', :operand => ad_group_criterion}
|
231
|
-
response = ad_group_criterion_srv.mutate([operation])
|
232
|
-
criterion = response[:value].first
|
233
|
-
|
234
|
-
raise StandardError, 'Failed to assign criterion' if criterion.nil?
|
235
|
-
|
236
|
-
return experiment
|
237
|
-
end
|
238
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# Encoding: utf-8
|
3
|
-
#
|
4
|
-
# Author:: api.dklimkin@gmail.com (Danial Klimkin)
|
5
|
-
#
|
6
|
-
# Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
|
7
|
-
#
|
8
|
-
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
-
# you may not use this file except in compliance with the License.
|
10
|
-
# You may obtain a copy of the License at
|
11
|
-
#
|
12
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
-
#
|
14
|
-
# Unless required by applicable law or agreed to in writing, software
|
15
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
17
|
-
# implied.
|
18
|
-
# See the License for the specific language governing permissions and
|
19
|
-
# limitations under the License.
|
20
|
-
#
|
21
|
-
# Tests the account managements examples.
|
22
|
-
|
23
|
-
require 'test/unit'
|
24
|
-
|
25
|
-
require 'account_management/create_account'
|
26
|
-
require 'account_management/get_account_alerts'
|
27
|
-
require 'account_management/get_account_changes'
|
28
|
-
require 'account_management/get_account_hierarchy'
|
29
|
-
require 'account_management/get_client_customer_id'
|
30
|
-
require 'account_management/get_client_unit_usage'
|
31
|
-
|
32
|
-
class TestAccountManagementV201109_1 < Test::Unit::TestCase
|
33
|
-
def setup
|
34
|
-
end
|
35
|
-
|
36
|
-
# This test is disabled to avoid creating too many accounts.
|
37
|
-
def disabled_test_create_account
|
38
|
-
create_account()
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_get_account_alerts
|
42
|
-
get_account_alerts()
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_get_account_changes
|
46
|
-
get_account_changes()
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_get_account_hierarchy
|
50
|
-
get_account_hierarchy()
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_get_client_customer_id
|
54
|
-
get_client_customer_id('user@example.com')
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_get_client_unit_usage
|
58
|
-
get_client_unit_usage(1234567890)
|
59
|
-
end
|
60
|
-
end
|