google-adwords-api 0.9.3 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +4 -0
- data/README +4 -4
- data/examples/{v201209 → v201309}/account_management/create_account.rb +9 -1
- data/examples/{v201209 → v201309}/account_management/get_account_alerts.rb +9 -1
- data/examples/{v201209 → v201309}/account_management/get_account_changes.rb +9 -1
- data/examples/{v201209 → v201309}/account_management/get_account_hierarchy.rb +9 -1
- data/examples/v201309/advanced_operations/add_ad_group_bid_modifier.rb +105 -0
- data/examples/v201309/advanced_operations/add_click_to_download_ad.rb +137 -0
- data/examples/v201309/advanced_operations/add_site_links.rb +244 -0
- data/examples/v201309/advanced_operations/create_and_attach_shared_keyword_set.rb +147 -0
- data/examples/v201309/advanced_operations/find_and_remove_criteria_from_shared_set.rb +181 -0
- data/examples/{v201209/adwords_for_video/get_video_campaign_criteria.rb → v201309/advanced_operations/get_ad_group_bid_modifiers.rb} +30 -23
- data/examples/v201309/advanced_operations/upload_offline_conversions.rb +117 -0
- data/examples/v201309/advanced_operations/use_shared_bidding_strategy.rb +163 -0
- data/examples/{v201209 → v201309}/basic_operations/add_ad_groups.rb +28 -21
- data/examples/{v201209 → v201309}/basic_operations/add_campaigns.rb +18 -15
- data/examples/{v201209 → v201309}/basic_operations/add_keywords.rb +9 -1
- data/examples/{v201209 → v201309}/basic_operations/add_text_ads.rb +9 -1
- data/examples/{v201209 → v201309}/basic_operations/delete_ad.rb +9 -1
- data/examples/{v201209 → v201309}/basic_operations/delete_ad_group.rb +9 -1
- data/examples/{v201209 → v201309}/basic_operations/delete_campaign.rb +9 -1
- data/examples/{v201209 → v201309}/basic_operations/delete_keyword.rb +9 -1
- data/examples/{v201209 → v201309}/basic_operations/get_ad_groups.rb +9 -1
- data/examples/{v201209 → v201309}/basic_operations/get_campaigns.rb +9 -1
- data/examples/{v201209 → v201309}/basic_operations/get_campaigns_with_awql.rb +9 -1
- data/examples/{v201209 → v201309}/basic_operations/get_keywords.rb +9 -1
- data/examples/{v201209 → v201309}/basic_operations/get_text_ads.rb +9 -1
- data/examples/{v201209 → v201309}/basic_operations/pause_ad.rb +9 -1
- data/examples/{v201209 → v201309}/basic_operations/update_ad_group.rb +9 -1
- data/examples/{v201209 → v201309}/basic_operations/update_campaign.rb +9 -1
- data/examples/{v201209 → v201309}/basic_operations/update_keyword.rb +21 -10
- data/examples/{v201209 → v201309}/campaign_management/add_experiment.rb +9 -1
- data/examples/{v201209 → v201309}/campaign_management/add_keywords_in_bulk.rb +10 -2
- data/examples/{v201209 → v201309}/campaign_management/add_location_extension.rb +9 -1
- data/examples/{v201209 → v201309}/campaign_management/add_location_extension_override.rb +9 -1
- data/examples/{v201209 → v201309}/campaign_management/get_all_disapproved_ads.rb +21 -13
- data/examples/{v201209 → v201309}/campaign_management/get_all_disapproved_ads_with_awql.rb +17 -8
- data/examples/{v201209 → v201309}/campaign_management/promote_experiment.rb +9 -1
- data/examples/{v201209 → v201309}/campaign_management/set_ad_parameters.rb +9 -1
- data/examples/{v201209 → v201309}/campaign_management/set_criterion_bid_modifier.rb +11 -5
- data/examples/{v201209 → v201309}/campaign_management/validate_text_ad.rb +9 -1
- data/examples/{v201209 → v201309}/error_handling/handle_captcha_challenge.rb +1 -1
- data/examples/{v201209 → v201309}/error_handling/handle_partial_failures.rb +9 -1
- data/examples/{v201209 → v201309}/error_handling/handle_policy_violation_error.rb +9 -1
- data/examples/{v201209 → v201309}/error_handling/handle_two_factor_authorization_error.rb +1 -1
- data/examples/{v201209 → v201309}/misc/get_all_images_and_videos.rb +9 -1
- data/examples/{v201209/misc/use_oauth2.rb → v201309/misc/setup_oauth2.rb} +17 -26
- data/examples/{v201209 → v201309}/misc/upload_image.rb +9 -1
- data/examples/{v201209 → v201309}/misc/use_oauth2_jwt.rb +1 -1
- data/examples/{v201209 → v201309}/optimization/estimate_keyword_traffic.rb +9 -1
- data/examples/{v201209 → v201309}/optimization/get_keyword_bid_simulations.rb +9 -1
- data/examples/{v201209 → v201309}/optimization/get_keyword_ideas.rb +17 -1
- data/examples/{v201209 → v201309}/optimization/get_placement_ideas.rb +9 -1
- data/examples/{v201209 → v201309}/remarketing/add_audience.rb +11 -3
- data/examples/{v201209 → v201309}/remarketing/add_conversion_tracker.rb +9 -2
- data/examples/{v201209 → v201309}/reporting/download_criteria_report.rb +9 -1
- data/examples/{v201209 → v201309}/reporting/download_criteria_report_with_awql.rb +9 -1
- data/examples/{v201209 → v201309}/reporting/get_campaign_stats.rb +9 -1
- data/examples/{v201209 → v201309}/reporting/get_report_fields.rb +9 -1
- data/examples/{v201209 → v201309}/reporting/parallel_report_download.rb +9 -1
- data/examples/{v201209 → v201309}/targeting/add_campaign_targeting_criteria.rb +10 -5
- data/examples/{v201209 → v201309}/targeting/add_demographic_targeting_criteria.rb +9 -1
- data/examples/{v201209 → v201309}/targeting/get_campaign_targeting_criteria.rb +9 -1
- data/examples/{v201209 → v201309}/targeting/get_targetable_languages_and_carriers.rb +9 -1
- data/examples/{v201209 → v201309}/targeting/lookup_location.rb +9 -1
- data/lib/adwords_api/api_config.rb +57 -55
- data/lib/adwords_api/{v201209 → v201309}/ad_group_ad_service.rb +7 -7
- data/lib/adwords_api/v201309/ad_group_ad_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209 → v201309}/ad_group_bid_modifier_service.rb +6 -6
- data/lib/adwords_api/v201309/ad_group_bid_modifier_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209 → v201309}/ad_group_criterion_service.rb +7 -7
- data/lib/adwords_api/v201309/ad_group_criterion_service_registry.rb +46 -0
- data/lib/adwords_api/v201309/ad_group_feed_service.rb +38 -0
- data/lib/adwords_api/v201309/ad_group_feed_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209 → v201309}/ad_group_service.rb +7 -7
- data/lib/adwords_api/v201309/ad_group_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209 → v201309}/ad_param_service.rb +7 -7
- data/lib/adwords_api/v201309/ad_param_service_registry.rb +46 -0
- data/lib/adwords_api/v201309/adwords_user_list_service.rb +38 -0
- data/lib/adwords_api/v201309/adwords_user_list_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209 → v201309}/alert_service.rb +7 -7
- data/lib/adwords_api/v201309/alert_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209/managed_customer_service.rb → v201309/bidding_strategy_service.rb} +9 -9
- data/lib/adwords_api/v201309/bidding_strategy_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209 → v201309}/budget_order_service.rb +7 -7
- data/lib/adwords_api/v201309/budget_order_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209 → v201309}/budget_service.rb +7 -7
- data/lib/adwords_api/v201309/budget_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209 → v201309}/campaign_ad_extension_service.rb +7 -7
- data/lib/adwords_api/v201309/campaign_ad_extension_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209 → v201309}/campaign_criterion_service.rb +7 -7
- data/lib/adwords_api/v201309/campaign_criterion_service_registry.rb +46 -0
- data/lib/adwords_api/v201309/campaign_feed_service.rb +38 -0
- data/lib/adwords_api/v201309/campaign_feed_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209 → v201309}/campaign_service.rb +7 -7
- data/lib/adwords_api/v201309/campaign_service_registry.rb +46 -0
- data/lib/adwords_api/v201309/campaign_shared_set_service.rb +38 -0
- data/lib/adwords_api/v201309/campaign_shared_set_service_registry.rb +47 -0
- data/lib/adwords_api/{v201209 → v201309}/constant_data_service.rb +7 -7
- data/lib/adwords_api/v201309/constant_data_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209 → v201309}/conversion_tracker_service.rb +7 -7
- data/lib/adwords_api/v201309/conversion_tracker_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209 → v201309}/customer_service.rb +7 -7
- data/lib/adwords_api/v201309/customer_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209 → v201309}/customer_sync_service.rb +7 -7
- data/lib/adwords_api/v201309/customer_sync_service_registry.rb +47 -0
- data/lib/adwords_api/{v201209 → v201309}/data_service.rb +7 -7
- data/lib/adwords_api/v201309/data_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209 → v201309}/experiment_service.rb +7 -7
- data/lib/adwords_api/v201309/experiment_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209/user_list_service.rb → v201309/feed_item_service.rb} +9 -9
- data/lib/adwords_api/v201309/feed_item_service_registry.rb +46 -0
- data/lib/adwords_api/v201309/feed_mapping_service.rb +38 -0
- data/lib/adwords_api/v201309/feed_mapping_service_registry.rb +46 -0
- data/lib/adwords_api/v201309/feed_service.rb +38 -0
- data/lib/adwords_api/v201309/feed_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209 → v201309}/geo_location_service.rb +7 -7
- data/lib/adwords_api/v201309/geo_location_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209 → v201309}/location_criterion_service.rb +7 -7
- data/lib/adwords_api/v201309/location_criterion_service_registry.rb +46 -0
- data/lib/adwords_api/v201309/managed_customer_service.rb +50 -0
- data/lib/adwords_api/v201309/managed_customer_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209 → v201309}/media_service.rb +7 -7
- data/lib/adwords_api/v201309/media_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209 → v201309}/mutate_job_service.rb +7 -7
- data/lib/adwords_api/v201309/mutate_job_service_registry.rb +46 -0
- data/lib/adwords_api/v201309/offline_conversion_feed_service.rb +34 -0
- data/lib/adwords_api/v201309/offline_conversion_feed_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209 → v201309}/report_definition_service.rb +7 -7
- data/lib/adwords_api/v201309/report_definition_service_registry.rb +46 -0
- data/lib/adwords_api/v201309/shared_criterion_service.rb +38 -0
- data/lib/adwords_api/v201309/shared_criterion_service_registry.rb +47 -0
- data/lib/adwords_api/v201309/shared_set_service.rb +38 -0
- data/lib/adwords_api/v201309/shared_set_service_registry.rb +47 -0
- data/lib/adwords_api/{v201209 → v201309}/targeting_idea_service.rb +7 -7
- data/lib/adwords_api/v201309/targeting_idea_service_registry.rb +46 -0
- data/lib/adwords_api/{v201209 → v201309}/traffic_estimator_service.rb +7 -7
- data/lib/adwords_api/{v201209 → v201309}/traffic_estimator_service_registry.rb +5 -5
- data/lib/adwords_api/version.rb +1 -1
- data/test/adwords_api/test_adwords_api.rb +1 -1
- data/test/adwords_api/test_api_config.rb +8 -8
- data/test/adwords_api/test_report_utils.rb +1 -1
- data/test/bugs/test_issue_00000031.rb +2 -2
- data/test/bugs/test_issue_00000063.rb +6 -6
- data/test/templates/v201302/basic_operations_get_campaigns.def +1 -1
- data/test/templates/v201302/misc_use_oauth2_jwt.def +1 -1
- data/test/templates/v201306/basic_operations_get_campaigns.def +1 -1
- data/test/templates/v201306/misc_use_oauth2_jwt.def +1 -1
- data/test/templates/{v201209 → v201309}/basic_operations_get_campaigns.def +7 -7
- data/test/templates/v201309/misc_use_oauth2_jwt.def +131 -0
- metadata +416 -430
- data/examples/v201209/account_management/get_client_customer_id.rb +0 -88
- data/examples/v201209/account_management/get_client_unit_usage.rb +0 -90
- data/examples/v201209/adwords_for_video/add_video_campaign.rb +0 -103
- data/examples/v201209/adwords_for_video/find_videos.rb +0 -92
- data/examples/v201209/adwords_for_video/get_keyword_criteria.rb +0 -101
- data/examples/v201209/adwords_for_video/get_targeting_groups.rb +0 -93
- data/examples/v201209/adwords_for_video/get_video_campaign_stats.rb +0 -126
- data/examples/v201209/adwords_for_video/get_video_campaigns.rb +0 -94
- data/examples/v201209/campaign_management/set_campaign_enhanced.rb +0 -89
- data/lib/adwords_api/v201209/ad_extension_override_service.rb +0 -38
- data/lib/adwords_api/v201209/ad_extension_override_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/ad_group_ad_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/ad_group_bid_modifier_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/ad_group_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/ad_group_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/ad_param_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/alert_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/budget_order_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/budget_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/campaign_ad_extension_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/campaign_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/campaign_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/constant_data_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/conversion_tracker_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/customer_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/customer_sync_service_registry.rb +0 -47
- data/lib/adwords_api/v201209/data_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/experiment_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/geo_location_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/info_service.rb +0 -34
- data/lib/adwords_api/v201209/info_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/location_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/managed_customer_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/media_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/mutate_job_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/report_definition_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/targeting_idea_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/user_list_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/video_ad_service.rb +0 -38
- data/lib/adwords_api/v201209/video_ad_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/video_campaign_criterion_service.rb +0 -38
- data/lib/adwords_api/v201209/video_campaign_criterion_service_registry.rb +0 -47
- data/lib/adwords_api/v201209/video_campaign_service.rb +0 -38
- data/lib/adwords_api/v201209/video_campaign_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/video_service.rb +0 -42
- data/lib/adwords_api/v201209/video_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/video_targeting_group_criterion_service.rb +0 -38
- data/lib/adwords_api/v201209/video_targeting_group_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201209/video_targeting_group_service.rb +0 -38
- data/lib/adwords_api/v201209/video_targeting_group_service_registry.rb +0 -46
- data/test/examples/v201209/test_account_management.rb +0 -60
- data/test/examples/v201209/test_basic_operations.rb +0 -177
- data/test/examples/v201209/test_campaign_management.rb +0 -124
- data/test/examples/v201209/test_error_handling.rb +0 -63
- data/test/examples/v201209/test_misc.rb +0 -39
- data/test/examples/v201209/test_optimization.rb +0 -63
- data/test/examples/v201209/test_remarketing.rb +0 -39
- data/test/examples/v201209/test_reporting.rb +0 -84
- data/test/examples/v201209/test_targeting.rb +0 -60
- data/test/examples/v201209/utils.rb +0 -261
- data/test/suite_exampletests_v201209.rb +0 -37
- data/test/suite_exampletests_v201306.rb +0 -37
@@ -72,7 +72,7 @@ def get_ad_groups(campaign_id)
|
|
72
72
|
end
|
73
73
|
|
74
74
|
if __FILE__ == $0
|
75
|
-
API_VERSION = :
|
75
|
+
API_VERSION = :v201309
|
76
76
|
PAGE_SIZE = 500
|
77
77
|
|
78
78
|
begin
|
@@ -80,6 +80,14 @@ if __FILE__ == $0
|
|
80
80
|
campaign_id = 'INSERT_CAMPAIGN_ID_HERE'.to_i
|
81
81
|
get_ad_groups(campaign_id)
|
82
82
|
|
83
|
+
# Authorization error.
|
84
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
85
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
86
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
87
|
+
"to retrieve and store OAuth2 tokens."
|
88
|
+
puts "See this wiki page for more details:\n\n " +
|
89
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
90
|
+
|
83
91
|
# HTTP errors.
|
84
92
|
rescue AdsCommon::Errors::HttpError => e
|
85
93
|
puts "HTTP Error: %s" % e
|
@@ -69,12 +69,20 @@ def get_campaigns()
|
|
69
69
|
end
|
70
70
|
|
71
71
|
if __FILE__ == $0
|
72
|
-
API_VERSION = :
|
72
|
+
API_VERSION = :v201309
|
73
73
|
PAGE_SIZE = 500
|
74
74
|
|
75
75
|
begin
|
76
76
|
get_campaigns()
|
77
77
|
|
78
|
+
# Authorization error.
|
79
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
80
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
81
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
82
|
+
"to retrieve and store OAuth2 tokens."
|
83
|
+
puts "See this wiki page for more details:\n\n " +
|
84
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
85
|
+
|
78
86
|
# HTTP errors.
|
79
87
|
rescue AdsCommon::Errors::HttpError => e
|
80
88
|
puts "HTTP Error: %s" % e
|
@@ -61,12 +61,20 @@ def get_campaigns_with_awql()
|
|
61
61
|
end
|
62
62
|
|
63
63
|
if __FILE__ == $0
|
64
|
-
API_VERSION = :
|
64
|
+
API_VERSION = :v201309
|
65
65
|
PAGE_SIZE = 500
|
66
66
|
|
67
67
|
begin
|
68
68
|
get_campaigns_with_awql()
|
69
69
|
|
70
|
+
# Authorization error.
|
71
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
72
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
73
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
74
|
+
"to retrieve and store OAuth2 tokens."
|
75
|
+
puts "See this wiki page for more details:\n\n " +
|
76
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
77
|
+
|
70
78
|
# HTTP errors.
|
71
79
|
rescue AdsCommon::Errors::HttpError => e
|
72
80
|
puts 'HTTP Error: %s' % e
|
@@ -78,7 +78,7 @@ def get_keywords(ad_group_id)
|
|
78
78
|
end
|
79
79
|
|
80
80
|
if __FILE__ == $0
|
81
|
-
API_VERSION = :
|
81
|
+
API_VERSION = :v201309
|
82
82
|
PAGE_SIZE = 500
|
83
83
|
|
84
84
|
begin
|
@@ -86,6 +86,14 @@ if __FILE__ == $0
|
|
86
86
|
ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
|
87
87
|
get_keywords(ad_group_id)
|
88
88
|
|
89
|
+
# Authorization error.
|
90
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
91
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
92
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
93
|
+
"to retrieve and store OAuth2 tokens."
|
94
|
+
puts "See this wiki page for more details:\n\n " +
|
95
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
96
|
+
|
89
97
|
# HTTP errors.
|
90
98
|
rescue AdsCommon::Errors::HttpError => e
|
91
99
|
puts "HTTP Error: %s" % e
|
@@ -80,7 +80,7 @@ def get_text_ads(ad_group_id)
|
|
80
80
|
end
|
81
81
|
|
82
82
|
if __FILE__ == $0
|
83
|
-
API_VERSION = :
|
83
|
+
API_VERSION = :v201309
|
84
84
|
PAGE_SIZE = 500
|
85
85
|
|
86
86
|
begin
|
@@ -88,6 +88,14 @@ if __FILE__ == $0
|
|
88
88
|
ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
|
89
89
|
get_text_ads(ad_group_id)
|
90
90
|
|
91
|
+
# Authorization error.
|
92
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
93
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
94
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
95
|
+
"to retrieve and store OAuth2 tokens."
|
96
|
+
puts "See this wiki page for more details:\n\n " +
|
97
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
98
|
+
|
91
99
|
# HTTP errors.
|
92
100
|
rescue AdsCommon::Errors::HttpError => e
|
93
101
|
puts "HTTP Error: %s" % e
|
@@ -58,7 +58,7 @@ def pause_ad(ad_group_id, ad_id)
|
|
58
58
|
end
|
59
59
|
|
60
60
|
if __FILE__ == $0
|
61
|
-
API_VERSION = :
|
61
|
+
API_VERSION = :v201309
|
62
62
|
|
63
63
|
begin
|
64
64
|
# IDs of ad to pause and its ad group.
|
@@ -66,6 +66,14 @@ if __FILE__ == $0
|
|
66
66
|
ad_id = 'INSERT_AD_ID_HERE'.to_i
|
67
67
|
pause_ad(ad_group_id, ad_id)
|
68
68
|
|
69
|
+
# Authorization error.
|
70
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
71
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
72
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
73
|
+
"to retrieve and store OAuth2 tokens."
|
74
|
+
puts "See this wiki page for more details:\n\n " +
|
75
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
76
|
+
|
69
77
|
# HTTP errors.
|
70
78
|
rescue AdsCommon::Errors::HttpError => e
|
71
79
|
puts "HTTP Error: %s" % e
|
@@ -56,13 +56,21 @@ def update_ad_group(ad_group_id)
|
|
56
56
|
end
|
57
57
|
|
58
58
|
if __FILE__ == $0
|
59
|
-
API_VERSION = :
|
59
|
+
API_VERSION = :v201309
|
60
60
|
|
61
61
|
begin
|
62
62
|
# ID of an ad group to update.
|
63
63
|
ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
|
64
64
|
update_ad_group(ad_group_id)
|
65
65
|
|
66
|
+
# Authorization error.
|
67
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
68
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
69
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
70
|
+
"to retrieve and store OAuth2 tokens."
|
71
|
+
puts "See this wiki page for more details:\n\n " +
|
72
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
73
|
+
|
66
74
|
# HTTP errors.
|
67
75
|
rescue AdsCommon::Errors::HttpError => e
|
68
76
|
puts "HTTP Error: %s" % e
|
@@ -57,13 +57,21 @@ def update_campaign(campaign_id)
|
|
57
57
|
end
|
58
58
|
|
59
59
|
if __FILE__ == $0
|
60
|
-
API_VERSION = :
|
60
|
+
API_VERSION = :v201309
|
61
61
|
|
62
62
|
begin
|
63
63
|
# ID of a campaign to update.
|
64
64
|
campaign_id = 'INSERT_CAMPAIGN_ID_HERE'.to_i
|
65
65
|
update_campaign(campaign_id)
|
66
66
|
|
67
|
+
# Authorization error.
|
68
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
69
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
70
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
71
|
+
"to retrieve and store OAuth2 tokens."
|
72
|
+
puts "See this wiki page for more details:\n\n " +
|
73
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
74
|
+
|
67
75
|
# HTTP errors.
|
68
76
|
rescue AdsCommon::Errors::HttpError => e
|
69
77
|
puts "HTTP Error: %s" % e
|
@@ -49,13 +49,13 @@ def update_keyword(ad_group_id, criterion_id)
|
|
49
49
|
:criterion => {
|
50
50
|
:id => criterion_id
|
51
51
|
},
|
52
|
-
:
|
53
|
-
:
|
54
|
-
|
55
|
-
|
56
|
-
:micro_amount => 1000000
|
52
|
+
:bidding_strategy_configuration => {
|
53
|
+
:bids => [
|
54
|
+
{
|
55
|
+
:xsi_type => 'CpcBid',
|
56
|
+
:bid => {:micro_amount => 1000000}
|
57
57
|
}
|
58
|
-
|
58
|
+
]
|
59
59
|
}
|
60
60
|
}
|
61
61
|
}
|
@@ -64,16 +64,19 @@ def update_keyword(ad_group_id, criterion_id)
|
|
64
64
|
response = ad_group_criterion_srv.mutate([operation])
|
65
65
|
if response and response[:value]
|
66
66
|
ad_group_criterion = response[:value].first
|
67
|
-
puts "Keyword ID %d was successfully updated,
|
68
|
-
|
69
|
-
|
67
|
+
puts "Keyword ID %d was successfully updated, current bids are:" %
|
68
|
+
ad_group_criterion[:criterion][:id]
|
69
|
+
ad_group_criterion[:bidding_strategy_configuration][:bids].each do |bid|
|
70
|
+
puts "\tType: '%s', value: %d" %
|
71
|
+
[bid[:bids_type], bid[:bid][:micro_amount]]
|
72
|
+
end
|
70
73
|
else
|
71
74
|
puts 'No keywords were updated.'
|
72
75
|
end
|
73
76
|
end
|
74
77
|
|
75
78
|
if __FILE__ == $0
|
76
|
-
API_VERSION = :
|
79
|
+
API_VERSION = :v201309
|
77
80
|
|
78
81
|
begin
|
79
82
|
# IDs of a criterion to update and its ad group.
|
@@ -81,6 +84,14 @@ if __FILE__ == $0
|
|
81
84
|
criterion_id = 'INSERT_CRITERION_ID_HERE'.to_i
|
82
85
|
update_keyword(ad_group_id, criterion_id)
|
83
86
|
|
87
|
+
# Authorization error.
|
88
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
89
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
90
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
91
|
+
"to retrieve and store OAuth2 tokens."
|
92
|
+
puts "See this wiki page for more details:\n\n " +
|
93
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
94
|
+
|
84
95
|
# HTTP errors.
|
85
96
|
rescue AdsCommon::Errors::HttpError => e
|
86
97
|
puts "HTTP Error: %s" % e
|
@@ -131,7 +131,7 @@ def add_experiment(campaign_id, ad_group_id, criterion_id)
|
|
131
131
|
end
|
132
132
|
|
133
133
|
if __FILE__ == $0
|
134
|
-
API_VERSION = :
|
134
|
+
API_VERSION = :v201309
|
135
135
|
|
136
136
|
begin
|
137
137
|
# IDs of the required objects.
|
@@ -140,6 +140,14 @@ if __FILE__ == $0
|
|
140
140
|
criterion_id = 'INSERT_CRITERION_ID_HERE'.to_i
|
141
141
|
add_experiment(campaign_id, ad_group_id, criterion_id)
|
142
142
|
|
143
|
+
# Authorization error.
|
144
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
145
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
146
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
147
|
+
"to retrieve and store OAuth2 tokens."
|
148
|
+
puts "See this wiki page for more details:\n\n " +
|
149
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
150
|
+
|
143
151
|
# HTTP errors.
|
144
152
|
rescue AdsCommon::Errors::HttpError => e
|
145
153
|
puts "HTTP Error: %s" % e
|
@@ -119,12 +119,12 @@ def add_keywords_in_bulk()
|
|
119
119
|
raise StandardError, 'Error retrieving job results; aborting.'
|
120
120
|
end
|
121
121
|
else
|
122
|
-
puts "Job failed to complete after %d retries." %
|
122
|
+
puts "Job failed to complete after %d retries." % RETRY_COUNT
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
126
126
|
if __FILE__ == $0
|
127
|
-
API_VERSION = :
|
127
|
+
API_VERSION = :v201309
|
128
128
|
RETRY_INTERVAL = 30
|
129
129
|
RETRIES_COUNT = 30
|
130
130
|
KEYWORD_NUMBER = 100
|
@@ -132,6 +132,14 @@ if __FILE__ == $0
|
|
132
132
|
begin
|
133
133
|
add_keywords_in_bulk()
|
134
134
|
|
135
|
+
# Authorization error.
|
136
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
137
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
138
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
139
|
+
"to retrieve and store OAuth2 tokens."
|
140
|
+
puts "See this wiki page for more details:\n\n " +
|
141
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
142
|
+
|
135
143
|
# HTTP errors.
|
136
144
|
rescue AdsCommon::Errors::HttpError => e
|
137
145
|
puts "HTTP Error: %s" % e
|
@@ -92,13 +92,21 @@ def add_location_extension(campaign_id)
|
|
92
92
|
end
|
93
93
|
|
94
94
|
if __FILE__ == $0
|
95
|
-
API_VERSION = :
|
95
|
+
API_VERSION = :v201309
|
96
96
|
|
97
97
|
begin
|
98
98
|
# ID of campaign to add location extension to.
|
99
99
|
campaign_id = 'INSERT_CAMPAIGN_ID_HERE'.to_i
|
100
100
|
add_location_extension(campaign_id)
|
101
101
|
|
102
|
+
# Authorization error.
|
103
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
104
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
105
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
106
|
+
"to retrieve and store OAuth2 tokens."
|
107
|
+
puts "See this wiki page for more details:\n\n " +
|
108
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
109
|
+
|
102
110
|
# HTTP errors.
|
103
111
|
rescue AdsCommon::Errors::HttpError => e
|
104
112
|
puts "HTTP Error: %s" % e
|
@@ -57,7 +57,7 @@ def add_location_extension_override(ad_id, location_extension_id)
|
|
57
57
|
end
|
58
58
|
|
59
59
|
if __FILE__ == $0
|
60
|
-
API_VERSION = :
|
60
|
+
API_VERSION = :v201309
|
61
61
|
|
62
62
|
begin
|
63
63
|
# IDs of ad and location extension override to add.
|
@@ -65,6 +65,14 @@ if __FILE__ == $0
|
|
65
65
|
location_extension_id = 'INSERT_LOCATION_EXTENSION_ID_HERE'.to_i
|
66
66
|
add_location_extension_override(ad_id, location_extension_id)
|
67
67
|
|
68
|
+
# Authorization error.
|
69
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
70
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
71
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
72
|
+
"to retrieve and store OAuth2 tokens."
|
73
|
+
puts "See this wiki page for more details:\n\n " +
|
74
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
75
|
+
|
68
76
|
# HTTP errors.
|
69
77
|
rescue AdsCommon::Errors::HttpError => e
|
70
78
|
puts "HTTP Error: %s" % e
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Encoding: utf-8
|
3
3
|
#
|
4
|
-
# Author:: api.
|
4
|
+
# Author:: api.dklimkin@gmail.com (Danial Klimkin)
|
5
5
|
#
|
6
6
|
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
|
7
7
|
#
|
@@ -38,7 +38,7 @@ def get_all_disapproved_ads(ad_group_id)
|
|
38
38
|
|
39
39
|
# Get all the disapproved ads for this campaign.
|
40
40
|
selector = {
|
41
|
-
:fields => ['Id', '
|
41
|
+
:fields => ['Id', 'AdGroupAdDisapprovalReasons'],
|
42
42
|
:ordering => [{:field => 'Id', :sort_order => 'ASCENDING'}],
|
43
43
|
:predicates => [
|
44
44
|
{:field => 'AdGroupId', :operator => 'IN', :values => [ad_group_id]},
|
@@ -51,30 +51,38 @@ def get_all_disapproved_ads(ad_group_id)
|
|
51
51
|
}
|
52
52
|
response = ad_group_ad_srv.get(selector)
|
53
53
|
if response and response[:entries]
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
puts "
|
54
|
+
puts 'Ad group %d has %d disapproved ad(s).' %
|
55
|
+
[ad_group_id, response[:total_num_entries]]
|
56
|
+
response[:entries].each do |ad_group_ad|
|
57
|
+
puts ("\tAd with ID %d and type '%s' was disapproved for the following " +
|
58
|
+
'reasons:') % [ad_group_ad[:ad][:id], ad_group_ad[:ad][:xsi_type]]
|
59
|
+
if ad_group_ad.include?(:disapproval_reasons)
|
60
|
+
ad_group_ad[:disapproval_reasons].each {|reason| puts "\t\t%s" % reason}
|
61
|
+
else
|
62
|
+
puts "\t\tReason not provided."
|
63
63
|
end
|
64
64
|
end
|
65
65
|
else
|
66
|
-
puts
|
66
|
+
puts 'No disapproved ads found for ad group %d.' % ad_group_id
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
70
|
if __FILE__ == $0
|
71
|
-
API_VERSION = :
|
71
|
+
API_VERSION = :v201309
|
72
72
|
|
73
73
|
begin
|
74
74
|
# ID of an ad group to get disapproved ads for.
|
75
75
|
ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
|
76
76
|
get_all_disapproved_ads(ad_group_id)
|
77
77
|
|
78
|
+
# Authorization error.
|
79
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
80
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
81
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
82
|
+
"to retrieve and store OAuth2 tokens."
|
83
|
+
puts "See this wiki page for more details:\n\n " +
|
84
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
85
|
+
|
78
86
|
# HTTP errors.
|
79
87
|
rescue AdsCommon::Errors::HttpError => e
|
80
88
|
puts "HTTP Error: %s" % e
|
@@ -37,20 +37,21 @@ def get_all_disapproved_ads_with_awql(ad_group_id)
|
|
37
37
|
ad_group_ad_srv = adwords.service(:AdGroupAdService, API_VERSION)
|
38
38
|
|
39
39
|
# Get all the disapproved ads for this campaign.
|
40
|
-
query = ('SELECT Id,
|
40
|
+
query = ('SELECT Id, AdGroupAdDisapprovalReasons ' +
|
41
41
|
'WHERE AdGroupId = %d AND AdGroupCreativeApprovalStatus = DISAPPROVED ' +
|
42
42
|
'ORDER BY Id') % ad_group_id
|
43
43
|
|
44
44
|
response = ad_group_ad_srv.query(query)
|
45
45
|
if response and response[:entries]
|
46
|
-
ad_group_ads = response[:entries]
|
47
46
|
puts 'Ad group ID %d has %d disapproved ad(s).' %
|
48
|
-
[ad_group_id,
|
49
|
-
|
47
|
+
[ad_group_id, response[:total_num_entries]]
|
48
|
+
response[:entries].each do |ad_group_ad|
|
50
49
|
puts ("\tAd with ID %d and type '%s' was disapproved for the following " +
|
51
|
-
|
52
|
-
ad_group_ad
|
53
|
-
puts "\t\t%s" % reason
|
50
|
+
'reasons:') % [ad_group_ad[:ad][:id], ad_group_ad[:ad][:xsi_type]]
|
51
|
+
if ad_group_ad.include?(:disapproval_reasons)
|
52
|
+
ad_group_ad[:disapproval_reasons].each {|reason| puts "\t\t%s" % reason}
|
53
|
+
else
|
54
|
+
puts "\t\tReason not provided."
|
54
55
|
end
|
55
56
|
end
|
56
57
|
else
|
@@ -59,13 +60,21 @@ def get_all_disapproved_ads_with_awql(ad_group_id)
|
|
59
60
|
end
|
60
61
|
|
61
62
|
if __FILE__ == $0
|
62
|
-
API_VERSION = :
|
63
|
+
API_VERSION = :v201309
|
63
64
|
|
64
65
|
begin
|
65
66
|
# ID of an ad group to get disapproved ads for.
|
66
67
|
ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
|
67
68
|
get_all_disapproved_ads_with_awql(ad_group_id)
|
68
69
|
|
70
|
+
# Authorization error.
|
71
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
72
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
73
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
74
|
+
"to retrieve and store OAuth2 tokens."
|
75
|
+
puts "See this wiki page for more details:\n\n " +
|
76
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
77
|
+
|
69
78
|
# HTTP errors.
|
70
79
|
rescue AdsCommon::Errors::HttpError => e
|
71
80
|
puts 'HTTP Error: %s' % e
|