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
@@ -53,12 +53,20 @@ def promote_experiment(experiment_id)
|
|
53
53
|
end
|
54
54
|
|
55
55
|
if __FILE__ == $0
|
56
|
-
API_VERSION = :
|
56
|
+
API_VERSION = :v201309
|
57
57
|
|
58
58
|
begin
|
59
59
|
experiment_id = 'INSERT_EXPERIMENT_ID_HERE'.to_i
|
60
60
|
promote_experiment(experiment_id)
|
61
61
|
|
62
|
+
# Authorization error.
|
63
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
64
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
65
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
66
|
+
"to retrieve and store OAuth2 tokens."
|
67
|
+
puts "See this wiki page for more details:\n\n " +
|
68
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
69
|
+
|
62
70
|
# HTTP errors.
|
63
71
|
rescue AdsCommon::Errors::HttpError => e
|
64
72
|
puts "HTTP Error: %s" % e
|
@@ -88,7 +88,7 @@ def set_ad_parameters(ad_group_id, criterion_id)
|
|
88
88
|
end
|
89
89
|
|
90
90
|
if __FILE__ == $0
|
91
|
-
API_VERSION = :
|
91
|
+
API_VERSION = :v201309
|
92
92
|
|
93
93
|
begin
|
94
94
|
# IDs of ad group and criterion to set ad parameter for.
|
@@ -96,6 +96,14 @@ if __FILE__ == $0
|
|
96
96
|
criterion_id = 'INSERT_CRITERION_ID_HERE'.to_i
|
97
97
|
set_ad_parameters(ad_group_id, criterion_id)
|
98
98
|
|
99
|
+
# Authorization error.
|
100
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
101
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
102
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
103
|
+
"to retrieve and store OAuth2 tokens."
|
104
|
+
puts "See this wiki page for more details:\n\n " +
|
105
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
106
|
+
|
99
107
|
# HTTP errors.
|
100
108
|
rescue AdsCommon::Errors::HttpError => e
|
101
109
|
puts "HTTP Error: %s" % e
|
@@ -19,9 +19,7 @@
|
|
19
19
|
# limitations under the License.
|
20
20
|
#
|
21
21
|
# This example sets a bid modifier for the mobile platform on given campaign.
|
22
|
-
#
|
23
|
-
# NOTE: the campaign must be an enhanced type of campaign. To get campaigns, run
|
24
|
-
# get_campaigns.rb. To enhance a campaign, run set_campaign_enhanced.rb.
|
22
|
+
# To get campaigns, run get_campaigns.rb.
|
25
23
|
#
|
26
24
|
# Tags: CampaignCriterionService.mutate
|
27
25
|
|
@@ -73,10 +71,10 @@ def set_criterion_bid_modifier(campaign_id, bid_modifier)
|
|
73
71
|
end
|
74
72
|
|
75
73
|
if __FILE__ == $0
|
76
|
-
API_VERSION = :
|
74
|
+
API_VERSION = :v201309
|
77
75
|
|
78
76
|
begin
|
79
|
-
# ID of a campaign to
|
77
|
+
# ID of a campaign to use mobile bid modifier for.
|
80
78
|
campaign_id = 'INSERT_CAMPAIGN_ID_HERE'.to_i
|
81
79
|
|
82
80
|
# Bid modifier to set.
|
@@ -84,6 +82,14 @@ if __FILE__ == $0
|
|
84
82
|
|
85
83
|
set_criterion_bid_modifier(campaign_id, bid_modifier)
|
86
84
|
|
85
|
+
# Authorization error.
|
86
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
87
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
88
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
89
|
+
"to retrieve and store OAuth2 tokens."
|
90
|
+
puts "See this wiki page for more details:\n\n " +
|
91
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
92
|
+
|
87
93
|
# HTTP errors.
|
88
94
|
rescue AdsCommon::Errors::HttpError => e
|
89
95
|
puts "HTTP Error: %s" % e
|
@@ -82,12 +82,20 @@ def validate_text_ad(ad_group_id)
|
|
82
82
|
end
|
83
83
|
|
84
84
|
if __FILE__ == $0
|
85
|
-
API_VERSION = :
|
85
|
+
API_VERSION = :v201309
|
86
86
|
|
87
87
|
begin
|
88
88
|
ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
|
89
89
|
validate_text_ad(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
|
@@ -102,12 +102,20 @@ def handle_partial_failures(ad_group_id)
|
|
102
102
|
end
|
103
103
|
|
104
104
|
if __FILE__ == $0
|
105
|
-
API_VERSION = :
|
105
|
+
API_VERSION = :v201309
|
106
106
|
|
107
107
|
begin
|
108
108
|
ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
|
109
109
|
handle_partial_failures(ad_group_id)
|
110
110
|
|
111
|
+
# Authorization error.
|
112
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
113
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
114
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
115
|
+
"to retrieve and store OAuth2 tokens."
|
116
|
+
puts "See this wiki page for more details:\n\n " +
|
117
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
118
|
+
|
111
119
|
# HTTP errors.
|
112
120
|
rescue AdsCommon::Errors::HttpError => e
|
113
121
|
puts "HTTP Error: %s" % e
|
@@ -113,12 +113,20 @@ def handle_policy_violation_error(ad_group_id)
|
|
113
113
|
end
|
114
114
|
|
115
115
|
if __FILE__ == $0
|
116
|
-
API_VERSION = :
|
116
|
+
API_VERSION = :v201309
|
117
117
|
|
118
118
|
begin
|
119
119
|
ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
|
120
120
|
handle_policy_violation_error(ad_group_id)
|
121
121
|
|
122
|
+
# Authorization error.
|
123
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
124
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
125
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
126
|
+
"to retrieve and store OAuth2 tokens."
|
127
|
+
puts "See this wiki page for more details:\n\n " +
|
128
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
129
|
+
|
122
130
|
# HTTP errors.
|
123
131
|
rescue AdsCommon::Errors::HttpError => e
|
124
132
|
puts "HTTP Error: %s" % e
|
@@ -76,12 +76,20 @@ def get_all_images_and_videos()
|
|
76
76
|
end
|
77
77
|
|
78
78
|
if __FILE__ == $0
|
79
|
-
API_VERSION = :
|
79
|
+
API_VERSION = :v201309
|
80
80
|
PAGE_SIZE = 500
|
81
81
|
|
82
82
|
begin
|
83
83
|
get_all_images_and_videos()
|
84
84
|
|
85
|
+
# Authorization error.
|
86
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
87
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
88
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
89
|
+
"to retrieve and store OAuth2 tokens."
|
90
|
+
puts "See this wiki page for more details:\n\n " +
|
91
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
92
|
+
|
85
93
|
# HTTP errors.
|
86
94
|
rescue AdsCommon::Errors::HttpError => e
|
87
95
|
puts "HTTP Error: %s" % e
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: api.dklimkin@gmail.com (Danial Klimkin)
|
5
5
|
#
|
6
|
-
# Copyright:: Copyright
|
6
|
+
# Copyright:: Copyright 2013, Google Inc. All Rights Reserved.
|
7
7
|
#
|
8
8
|
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
9
9
|
# you may not use this file except in compliance with the License.
|
@@ -18,13 +18,13 @@
|
|
18
18
|
# See the License for the specific language governing permissions and
|
19
19
|
# limitations under the License.
|
20
20
|
#
|
21
|
-
# This example illustrates how to
|
21
|
+
# This example illustrates how to set up OAuth2.0 authentication credentials.
|
22
22
|
#
|
23
23
|
# Tags: CampaignService.get
|
24
24
|
|
25
25
|
require 'adwords_api'
|
26
26
|
|
27
|
-
def
|
27
|
+
def setup_oauth2()
|
28
28
|
# AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
|
29
29
|
# when called without parameters.
|
30
30
|
adwords = AdwordsApi::Api.new
|
@@ -42,6 +42,17 @@ def use_oauth2()
|
|
42
42
|
verification_code = gets.chomp
|
43
43
|
verification_code
|
44
44
|
end
|
45
|
+
if token
|
46
|
+
print "\nWould you like to update your adwords_api.yml to save " +
|
47
|
+
"OAuth2 crdentials? (y/N): "
|
48
|
+
response = gets.chomp
|
49
|
+
if ('y'.casecmp(response) == 0) or ('yes'.casecmp(response) == 0)
|
50
|
+
adwords.save_oauth2_token(token)
|
51
|
+
puts 'OAuth2 token is now saved to ~/adwords_api.yml and will be ' +
|
52
|
+
'automatically used by the library.'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
45
56
|
# Alternatively, you can provide one within the parameters:
|
46
57
|
#token = adwords.authorize({:oauth2_verification_code => verification_code})
|
47
58
|
|
@@ -50,34 +61,14 @@ def use_oauth2()
|
|
50
61
|
# should persist it to be used in subsequent invocations like this:
|
51
62
|
#adwords.authorize({:oauth2_token => token})
|
52
63
|
|
53
|
-
# No exception thrown - we are good to make
|
54
|
-
campaign_srv = adwords.service(:CampaignService, API_VERSION)
|
55
|
-
|
56
|
-
# Get all the campaigns for this account; empty selector.
|
57
|
-
selector = {
|
58
|
-
:fields => ['Id', 'Name', 'Status'],
|
59
|
-
:ordering => [
|
60
|
-
{:field => 'Name', :sort_order => 'ASCENDING'}
|
61
|
-
]
|
62
|
-
}
|
63
|
-
|
64
|
-
response = campaign_srv.get(selector)
|
65
|
-
if response and response[:entries]
|
66
|
-
campaigns = response[:entries]
|
67
|
-
campaigns.each do |campaign|
|
68
|
-
puts "Campaign ID %d, name '%s' and status '%s'" %
|
69
|
-
[campaign[:id], campaign[:name], campaign[:status]]
|
70
|
-
end
|
71
|
-
else
|
72
|
-
puts 'No campaigns were found.'
|
73
|
-
end
|
64
|
+
# No exception thrown - we are good to make a request.
|
74
65
|
end
|
75
66
|
|
76
67
|
if __FILE__ == $0
|
77
|
-
API_VERSION = :
|
68
|
+
API_VERSION = :v201309
|
78
69
|
|
79
70
|
begin
|
80
|
-
|
71
|
+
setup_oauth2()
|
81
72
|
|
82
73
|
# HTTP errors.
|
83
74
|
rescue AdsCommon::Errors::HttpError => e
|
@@ -66,11 +66,19 @@ def upload_image()
|
|
66
66
|
end
|
67
67
|
|
68
68
|
if __FILE__ == $0
|
69
|
-
API_VERSION = :
|
69
|
+
API_VERSION = :v201309
|
70
70
|
|
71
71
|
begin
|
72
72
|
upload_image()
|
73
73
|
|
74
|
+
# Authorization error.
|
75
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
76
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
77
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
78
|
+
"to retrieve and store OAuth2 tokens."
|
79
|
+
puts "See this wiki page for more details:\n\n " +
|
80
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
81
|
+
|
74
82
|
# HTTP errors.
|
75
83
|
rescue AdsCommon::Errors::HttpError => e
|
76
84
|
puts "HTTP Error: %s" % e
|
@@ -106,11 +106,19 @@ def estimate_keyword_traffic()
|
|
106
106
|
end
|
107
107
|
|
108
108
|
if __FILE__ == $0
|
109
|
-
API_VERSION = :
|
109
|
+
API_VERSION = :v201309
|
110
110
|
|
111
111
|
begin
|
112
112
|
estimate_keyword_traffic()
|
113
113
|
|
114
|
+
# Authorization error.
|
115
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
116
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
117
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
118
|
+
"to retrieve and store OAuth2 tokens."
|
119
|
+
puts "See this wiki page for more details:\n\n " +
|
120
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
121
|
+
|
114
122
|
# HTTP errors.
|
115
123
|
rescue AdsCommon::Errors::HttpError => e
|
116
124
|
puts "HTTP Error: %s" % e
|
@@ -67,13 +67,21 @@ def get_criterion_bid_landscapes(ad_group_id, keyword_id)
|
|
67
67
|
end
|
68
68
|
|
69
69
|
if __FILE__ == $0
|
70
|
-
API_VERSION = :
|
70
|
+
API_VERSION = :v201309
|
71
71
|
|
72
72
|
begin
|
73
73
|
ad_group_id = 'INSERT_ADGROUP_ID_HERE'.to_i
|
74
74
|
keyword_id = 'INSERT_KEYWORD_ID_HERE'.to_i
|
75
75
|
get_criterion_bid_landscapes(ad_group_id, keyword_id)
|
76
76
|
|
77
|
+
# Authorization error.
|
78
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
79
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
80
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
81
|
+
"to retrieve and store OAuth2 tokens."
|
82
|
+
puts "See this wiki page for more details:\n\n " +
|
83
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
84
|
+
|
77
85
|
# HTTP errors.
|
78
86
|
rescue AdsCommon::Errors::HttpError => e
|
79
87
|
puts "HTTP Error: %s" % e
|
@@ -48,6 +48,14 @@ def get_keyword_ideas(keyword_text)
|
|
48
48
|
# type that the client library can't infer.
|
49
49
|
:xsi_type => 'RelatedToQuerySearchParameter',
|
50
50
|
:queries => [keyword_text]
|
51
|
+
},
|
52
|
+
{
|
53
|
+
# Language setting (optional).
|
54
|
+
# The ID can be found in the documentation:
|
55
|
+
# https://developers.google.com/adwords/api/docs/appendix/languagecodes
|
56
|
+
# As of v201302 only one LanguageSearchParameter is allowed per request.
|
57
|
+
:xsi_type => 'LanguageSearchParameter',
|
58
|
+
:languages => [{:id => 1000}]
|
51
59
|
}
|
52
60
|
],
|
53
61
|
:paging => {
|
@@ -89,13 +97,21 @@ def get_keyword_ideas(keyword_text)
|
|
89
97
|
end
|
90
98
|
|
91
99
|
if __FILE__ == $0
|
92
|
-
API_VERSION = :
|
100
|
+
API_VERSION = :v201309
|
93
101
|
PAGE_SIZE = 100
|
94
102
|
|
95
103
|
begin
|
96
104
|
keyword_text = 'INSERT_KEYWORD_TEXT_HERE'
|
97
105
|
get_keyword_ideas(keyword_text)
|
98
106
|
|
107
|
+
# Authorization error.
|
108
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
109
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
110
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
111
|
+
"to retrieve and store OAuth2 tokens."
|
112
|
+
puts "See this wiki page for more details:\n\n " +
|
113
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
114
|
+
|
99
115
|
# HTTP errors.
|
100
116
|
rescue AdsCommon::Errors::HttpError => e
|
101
117
|
puts "HTTP Error: %s" % e
|
@@ -79,13 +79,21 @@ def get_placement_ideas(url)
|
|
79
79
|
end
|
80
80
|
|
81
81
|
if __FILE__ == $0
|
82
|
-
API_VERSION = :
|
82
|
+
API_VERSION = :v201309
|
83
83
|
PAGE_SIZE = 100
|
84
84
|
|
85
85
|
begin
|
86
86
|
url = 'INSERT_PLACEMENT_URL_HERE'
|
87
87
|
get_placement_ideas(url)
|
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
|
@@ -34,7 +34,7 @@ def add_audience()
|
|
34
34
|
# the configuration file or provide your own logger:
|
35
35
|
# adwords.logger = Logger.new('adwords_xml.log')
|
36
36
|
|
37
|
-
user_list_srv = adwords.service(:
|
37
|
+
user_list_srv = adwords.service(:AdwordsUserListService, API_VERSION)
|
38
38
|
conv_tracker_srv = adwords.service(:ConversionTrackerService, API_VERSION)
|
39
39
|
|
40
40
|
# Prepare for adding remarketing user list.
|
@@ -45,7 +45,7 @@ def add_audience()
|
|
45
45
|
# The 'xsi_type' field allows you to specify the xsi:type of the object
|
46
46
|
# being created. It's only necessary when you must provide an explicit
|
47
47
|
# type that the client library can't infer.
|
48
|
-
:xsi_type => '
|
48
|
+
:xsi_type => 'BasicUserList',
|
49
49
|
:name => name,
|
50
50
|
:description => 'A list of mars cruise customers in the last year',
|
51
51
|
:status => 'OPEN',
|
@@ -92,11 +92,19 @@ def add_audience()
|
|
92
92
|
end
|
93
93
|
|
94
94
|
if __FILE__ == $0
|
95
|
-
API_VERSION = :
|
95
|
+
API_VERSION = :v201309
|
96
96
|
|
97
97
|
begin
|
98
98
|
add_audience()
|
99
99
|
|
100
|
+
# Authorization error.
|
101
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
102
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
103
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
104
|
+
"to retrieve and store OAuth2 tokens."
|
105
|
+
puts "See this wiki page for more details:\n\n " +
|
106
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
107
|
+
|
100
108
|
# HTTP errors.
|
101
109
|
rescue AdsCommon::Errors::HttpError => e
|
102
110
|
puts "HTTP Error: %s" % e
|