google-adwords-api 0.8.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +6 -0
- data/README +3 -3
- data/examples/{v201206/basic_operations/delete_ad_group.rb → v201209/adwords_for_video/add_video_campaign.rb} +41 -40
- data/examples/{v201206/basic_operations/pause_ad.rb → v201209/adwords_for_video/find_videos.rb} +33 -25
- data/examples/{v201206/basic_operations/get_keywords.rb → v201209/adwords_for_video/get_keyword_criteria.rb} +24 -27
- data/examples/{v201206/basic_operations/get_campaigns_with_awql.rb → v201209/adwords_for_video/get_targeting_groups.rb} +26 -18
- data/examples/{v201206/basic_operations/get_ad_groups.rb → v201209/adwords_for_video/get_video_campaign_criteria.rb} +22 -21
- data/examples/v201209/adwords_for_video/get_video_campaign_stats.rb +126 -0
- data/examples/{v201206/basic_operations/get_campaigns.rb → v201209/adwords_for_video/get_video_campaigns.rb} +16 -15
- data/examples/v201302/advanced_operations/create_and_attach_shared_keyword_set.rb +139 -0
- data/examples/v201302/advanced_operations/find_and_remove_criteria_from_shared_set.rb +173 -0
- data/lib/adwords_api/api_config.rb +17 -59
- data/lib/adwords_api/report_utils.rb +3 -19
- data/lib/adwords_api/{v201206/ad_param_service.rb → v201209/video_ad_service.rb} +8 -8
- data/lib/adwords_api/v201209/video_ad_service_registry.rb +46 -0
- data/lib/adwords_api/{v201206/campaign_ad_extension_service.rb → v201209/video_campaign_criterion_service.rb} +8 -8
- data/lib/adwords_api/v201209/video_campaign_criterion_service_registry.rb +47 -0
- data/lib/adwords_api/{v201206/bulk_mutate_job_service.rb → v201209/video_campaign_service.rb} +8 -8
- data/lib/adwords_api/v201209/video_campaign_service_registry.rb +46 -0
- data/lib/adwords_api/v201209/video_service.rb +42 -0
- data/lib/adwords_api/v201209/video_service_registry.rb +46 -0
- data/lib/adwords_api/{v201206/ad_group_ad_service.rb → v201209/video_targeting_group_criterion_service.rb} +8 -12
- data/lib/adwords_api/v201209/video_targeting_group_criterion_service_registry.rb +46 -0
- data/lib/adwords_api/{v201206/ad_extension_override_service.rb → v201209/video_targeting_group_service.rb} +8 -8
- data/lib/adwords_api/v201209/video_targeting_group_service_registry.rb +46 -0
- data/lib/adwords_api/v201302/ad_group_feed_service.rb +1 -1
- data/lib/adwords_api/v201302/ad_group_feed_service_registry.rb +2 -2
- data/lib/adwords_api/v201302/campaign_feed_service.rb +1 -1
- data/lib/adwords_api/v201302/campaign_feed_service_registry.rb +2 -2
- data/lib/adwords_api/v201302/feed_item_service.rb +1 -1
- data/lib/adwords_api/v201302/feed_item_service_registry.rb +3 -4
- data/lib/adwords_api/v201302/feed_service.rb +1 -1
- data/lib/adwords_api/v201302/feed_service_registry.rb +4 -5
- data/lib/adwords_api/{v201206/user_list_service.rb → v201302/shared_set_service.rb} +9 -9
- data/lib/adwords_api/v201302/shared_set_service_registry.rb +47 -0
- data/lib/adwords_api/version.rb +1 -1
- data/test/adwords_api/test_report_utils.rb +0 -89
- data/test/examples/v201302/test_advanced_operations.rb +10 -0
- data/test/templates/v201209/basic_operations_get_campaigns.def +1 -1
- data/test/templates/v201302/basic_operations_get_campaigns.def +1 -1
- data/test/templates/v201302/misc_use_oauth2_jwt.def +131 -0
- data/test/test_utils.rb +6 -2
- metadata +26 -121
- data/examples/v201206/account_management/create_account.rb +0 -87
- data/examples/v201206/account_management/get_account_alerts.rb +0 -114
- data/examples/v201206/account_management/get_account_changes.rb +0 -137
- data/examples/v201206/account_management/get_account_hierarchy.rb +0 -95
- data/examples/v201206/account_management/get_client_customer_id.rb +0 -88
- data/examples/v201206/account_management/get_client_unit_usage.rb +0 -90
- data/examples/v201206/basic_operations/add_ad_groups.rb +0 -136
- data/examples/v201206/basic_operations/add_campaigns.rb +0 -151
- data/examples/v201206/basic_operations/add_keywords.rb +0 -108
- data/examples/v201206/basic_operations/add_text_ads.rb +0 -105
- data/examples/v201206/basic_operations/delete_ad.rb +0 -85
- data/examples/v201206/basic_operations/delete_campaign.rb +0 -103
- data/examples/v201206/basic_operations/delete_keyword.rb +0 -90
- data/examples/v201206/basic_operations/get_text_ads.rb +0 -106
- data/examples/v201206/basic_operations/update_ad_group.rb +0 -81
- data/examples/v201206/basic_operations/update_campaign.rb +0 -84
- data/examples/v201206/basic_operations/update_keyword.rb +0 -99
- data/examples/v201206/campaign_management/add_experiment.rb +0 -158
- data/examples/v201206/campaign_management/add_keywords_in_bulk.rb +0 -150
- data/examples/v201206/campaign_management/add_location_extension.rb +0 -117
- data/examples/v201206/campaign_management/add_location_extension_override.rb +0 -83
- data/examples/v201206/campaign_management/get_all_disapproved_ads.rb +0 -93
- data/examples/v201206/campaign_management/get_all_disapproved_ads_with_awql.rb +0 -84
- data/examples/v201206/campaign_management/promote_experiment.rb +0 -77
- data/examples/v201206/campaign_management/set_ad_parameters.rb +0 -114
- data/examples/v201206/campaign_management/validate_text_ad.rb +0 -106
- data/examples/v201206/error_handling/handle_captcha_challenge.rb +0 -93
- data/examples/v201206/error_handling/handle_partial_failures.rb +0 -126
- data/examples/v201206/error_handling/handle_policy_violation_error.rb +0 -137
- data/examples/v201206/error_handling/handle_two_factor_authorization_error.rb +0 -88
- data/examples/v201206/misc/get_all_images_and_videos.rb +0 -100
- data/examples/v201206/misc/upload_image.rb +0 -89
- data/examples/v201206/misc/use_oauth2.rb +0 -97
- data/examples/v201206/optimization/estimate_keyword_traffic.rb +0 -129
- data/examples/v201206/optimization/get_keyword_bid_simulations.rb +0 -92
- data/examples/v201206/optimization/get_keyword_ideas.rb +0 -114
- data/examples/v201206/optimization/get_placement_ideas.rb +0 -104
- data/examples/v201206/remarketing/add_audience.rb +0 -115
- data/examples/v201206/remarketing/add_conversion_tracker.rb +0 -97
- data/examples/v201206/reporting/download_criteria_report.rb +0 -79
- data/examples/v201206/reporting/download_criteria_report_with_awql.rb +0 -78
- data/examples/v201206/reporting/get_campaign_stats.rb +0 -105
- data/examples/v201206/reporting/get_report_fields.rb +0 -71
- data/examples/v201206/reporting/parallel_report_download.rb +0 -162
- data/examples/v201206/targeting/add_campaign_targeting_criteria.rb +0 -118
- data/examples/v201206/targeting/get_campaign_targeting_criteria.rb +0 -102
- data/examples/v201206/targeting/get_targetable_languages_and_carriers.rb +0 -86
- data/examples/v201206/targeting/lookup_location.rb +0 -104
- data/lib/adwords_api/v201206/ad_extension_override_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/ad_group_ad_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/ad_group_criterion_service.rb +0 -42
- data/lib/adwords_api/v201206/ad_group_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/ad_group_service.rb +0 -42
- data/lib/adwords_api/v201206/ad_group_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/ad_param_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/alert_service.rb +0 -34
- data/lib/adwords_api/v201206/alert_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/budget_order_service.rb +0 -42
- data/lib/adwords_api/v201206/budget_order_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/bulk_mutate_job_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/campaign_ad_extension_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/campaign_criterion_service.rb +0 -42
- data/lib/adwords_api/v201206/campaign_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/campaign_service.rb +0 -42
- data/lib/adwords_api/v201206/campaign_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/constant_data_service.rb +0 -62
- data/lib/adwords_api/v201206/constant_data_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/conversion_tracker_service.rb +0 -38
- data/lib/adwords_api/v201206/conversion_tracker_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/customer_service.rb +0 -34
- data/lib/adwords_api/v201206/customer_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/customer_sync_service.rb +0 -34
- data/lib/adwords_api/v201206/customer_sync_service_registry.rb +0 -47
- data/lib/adwords_api/v201206/data_service.rb +0 -38
- data/lib/adwords_api/v201206/data_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/experiment_service.rb +0 -38
- data/lib/adwords_api/v201206/experiment_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/geo_location_service.rb +0 -34
- data/lib/adwords_api/v201206/geo_location_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/info_service.rb +0 -34
- data/lib/adwords_api/v201206/info_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/location_criterion_service.rb +0 -34
- data/lib/adwords_api/v201206/location_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/managed_customer_service.rb +0 -38
- data/lib/adwords_api/v201206/managed_customer_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/media_service.rb +0 -38
- data/lib/adwords_api/v201206/media_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/mutate_job_service.rb +0 -42
- data/lib/adwords_api/v201206/mutate_job_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/report_definition_service.rb +0 -34
- data/lib/adwords_api/v201206/report_definition_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/targeting_idea_service.rb +0 -38
- data/lib/adwords_api/v201206/targeting_idea_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/traffic_estimator_service.rb +0 -34
- data/lib/adwords_api/v201206/traffic_estimator_service_registry.rb +0 -46
- data/lib/adwords_api/v201206/user_list_service_registry.rb +0 -46
- data/test/examples/v201206/test_account_management.rb +0 -60
- data/test/examples/v201206/test_basic_operations.rb +0 -177
- data/test/examples/v201206/test_campaign_management.rb +0 -124
- data/test/examples/v201206/test_error_handling.rb +0 -63
- data/test/examples/v201206/test_misc.rb +0 -39
- data/test/examples/v201206/test_optimization.rb +0 -63
- data/test/examples/v201206/test_remarketing.rb +0 -39
- data/test/examples/v201206/test_reporting.rb +0 -84
- data/test/examples/v201206/test_targeting.rb +0 -60
- data/test/examples/v201206/utils.rb +0 -244
- data/test/suite_exampletests_v201206.rb +0 -37
|
@@ -1,124 +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 campaign management examples.
|
|
22
|
-
|
|
23
|
-
require 'test/unit'
|
|
24
|
-
|
|
25
|
-
require 'campaign_management/add_experiment'
|
|
26
|
-
require 'campaign_management/add_keywords_in_bulk'
|
|
27
|
-
require 'campaign_management/add_location_extension'
|
|
28
|
-
require 'campaign_management/add_location_extension_override'
|
|
29
|
-
require 'campaign_management/get_all_disapproved_ads'
|
|
30
|
-
require 'campaign_management/get_all_disapproved_ads_with_awql'
|
|
31
|
-
require 'campaign_management/promote_experiment'
|
|
32
|
-
require 'campaign_management/set_ad_parameters'
|
|
33
|
-
require 'campaign_management/validate_text_ad'
|
|
34
|
-
|
|
35
|
-
RETRY_INTERVAL = 5
|
|
36
|
-
RETRIES_COUNT = 3
|
|
37
|
-
KEYWORD_NUMBER = 3
|
|
38
|
-
|
|
39
|
-
class TestCampaignManagementV201206 < Test::Unit::TestCase
|
|
40
|
-
def setup
|
|
41
|
-
@logger = Logger.new(STDOUT)
|
|
42
|
-
@logger.level = Logger::ERROR
|
|
43
|
-
@adwords = AdwordsApi::Api.new
|
|
44
|
-
@adwords.logger = @logger
|
|
45
|
-
@utils = UtilsV201206.new(@adwords)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def test_add_experiment
|
|
49
|
-
campaign = @utils.get_campaign()
|
|
50
|
-
ad_group = @utils.get_ad_group()
|
|
51
|
-
criterion = @utils.get_keyword()
|
|
52
|
-
assert_not_nil(campaign)
|
|
53
|
-
assert_not_nil(campaign[:id])
|
|
54
|
-
assert_not_nil(ad_group)
|
|
55
|
-
assert_not_nil(ad_group[:id])
|
|
56
|
-
assert_not_nil(criterion)
|
|
57
|
-
assert_not_nil(criterion[:criterion])
|
|
58
|
-
assert_not_nil(criterion[:criterion][:id])
|
|
59
|
-
add_experiment(campaign[:id], ad_group[:id], criterion[:criterion][:id])
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def test_add_keywords_in_bulk
|
|
63
|
-
add_keywords_in_bulk()
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def test_add_location_extension
|
|
67
|
-
campaign = @utils.get_campaign()
|
|
68
|
-
assert_not_nil(campaign)
|
|
69
|
-
assert_not_nil(campaign[:id])
|
|
70
|
-
add_location_extension(campaign[:id])
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def test_add_location_extension_override
|
|
74
|
-
ad = @utils.get_ad()
|
|
75
|
-
location_extension = @utils.get_location_extension()
|
|
76
|
-
assert_not_nil(ad)
|
|
77
|
-
assert_not_nil(ad[:ad])
|
|
78
|
-
assert_not_nil(ad[:ad][:id])
|
|
79
|
-
assert_not_nil(location_extension)
|
|
80
|
-
assert_not_nil(location_extension[:ad_extension])
|
|
81
|
-
assert_not_nil(location_extension[:ad_extension][:id])
|
|
82
|
-
add_location_extension_override(
|
|
83
|
-
ad[:ad][:id], location_extension[:ad_extension][:id])
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def test_get_all_disapproved_ads
|
|
87
|
-
ad_group = @utils.get_ad_group()
|
|
88
|
-
assert_not_nil(ad_group)
|
|
89
|
-
assert_not_nil(ad_group[:id])
|
|
90
|
-
get_all_disapproved_ads(ad_group[:id])
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
def test_get_all_disapproved_ads_with_awql
|
|
94
|
-
ad_group = @utils.get_ad_group()
|
|
95
|
-
assert_not_nil(ad_group)
|
|
96
|
-
assert_not_nil(ad_group[:id])
|
|
97
|
-
get_all_disapproved_ads_with_awql(ad_group[:id])
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
def test_promote_experiment
|
|
101
|
-
experiment = @utils.get_experiment()
|
|
102
|
-
assert_not_nil(experiment)
|
|
103
|
-
assert_not_nil(experiment[:id])
|
|
104
|
-
promote_experiment(experiment[:id])
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
def test_set_ad_parameters
|
|
108
|
-
ad_group = @utils.get_ad_group()
|
|
109
|
-
assert_not_nil(ad_group)
|
|
110
|
-
assert_not_nil(ad_group[:id])
|
|
111
|
-
criterion = @utils.get_keyword()
|
|
112
|
-
assert_not_nil(criterion)
|
|
113
|
-
assert_not_nil(criterion[:criterion])
|
|
114
|
-
assert_not_nil(criterion[:criterion][:id])
|
|
115
|
-
set_ad_parameters(ad_group[:id], criterion[:criterion][:id])
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
def test_validate_text_ad
|
|
119
|
-
ad_group = @utils.get_ad_group()
|
|
120
|
-
assert_not_nil(ad_group)
|
|
121
|
-
assert_not_nil(ad_group[:id])
|
|
122
|
-
validate_text_ad(ad_group[:id])
|
|
123
|
-
end
|
|
124
|
-
end
|
|
@@ -1,63 +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 error handling examples.
|
|
22
|
-
|
|
23
|
-
require 'test/unit'
|
|
24
|
-
|
|
25
|
-
require 'error_handling/handle_captcha_challenge'
|
|
26
|
-
require 'error_handling/handle_partial_failures'
|
|
27
|
-
require 'error_handling/handle_policy_violation_error'
|
|
28
|
-
require 'error_handling/handle_two_factor_authorization_error'
|
|
29
|
-
|
|
30
|
-
MAX_RETRIES = 50
|
|
31
|
-
|
|
32
|
-
class TestErrorHandlingV201206 < Test::Unit::TestCase
|
|
33
|
-
def setup
|
|
34
|
-
@logger = Logger.new(STDOUT)
|
|
35
|
-
@logger.level = Logger::ERROR
|
|
36
|
-
@adwords = AdwordsApi::Api.new
|
|
37
|
-
@adwords.logger = @logger
|
|
38
|
-
@utils = UtilsV201206.new(@adwords)
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
# This test is disabled as it requires user input.
|
|
42
|
-
def disabled_test_handle_captcha_challenge
|
|
43
|
-
handle_captcha_challenge()
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def test_handle_partial_failures
|
|
47
|
-
ad_group = @utils.get_ad_group()
|
|
48
|
-
assert_not_nil(ad_group)
|
|
49
|
-
assert_not_nil(ad_group[:id])
|
|
50
|
-
handle_partial_failures(ad_group[:id])
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def test_handle_policy_violation_error
|
|
54
|
-
ad_group = @utils.get_ad_group()
|
|
55
|
-
assert_not_nil(ad_group)
|
|
56
|
-
assert_not_nil(ad_group[:id])
|
|
57
|
-
handle_policy_violation_error(ad_group[:id])
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def test_handle_two_factor_authorization_error
|
|
61
|
-
handle_two_factor_authorization_error()
|
|
62
|
-
end
|
|
63
|
-
end
|
|
@@ -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 misc examples.
|
|
22
|
-
|
|
23
|
-
require 'test/unit'
|
|
24
|
-
|
|
25
|
-
require 'misc/get_all_images_and_videos'
|
|
26
|
-
require 'misc/upload_image'
|
|
27
|
-
|
|
28
|
-
class TestMiscV201206 < Test::Unit::TestCase
|
|
29
|
-
def setup
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def test_get_all_images_and_videos
|
|
33
|
-
get_all_images_and_videos()
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def test_upload_image
|
|
37
|
-
upload_image()
|
|
38
|
-
end
|
|
39
|
-
end
|
|
@@ -1,63 +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 optimization examples.
|
|
22
|
-
|
|
23
|
-
require 'test/unit'
|
|
24
|
-
|
|
25
|
-
require 'optimization/estimate_keyword_traffic'
|
|
26
|
-
require 'optimization/get_keyword_bid_simulations'
|
|
27
|
-
require 'optimization/get_keyword_ideas'
|
|
28
|
-
require 'optimization/get_placement_ideas'
|
|
29
|
-
|
|
30
|
-
class TestOptimizationV201206 < 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 = UtilsV201206.new(@adwords)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def test_estimate_keyword_traffic
|
|
40
|
-
estimate_keyword_traffic()
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def test_get_keyword_bid_simulations
|
|
44
|
-
ad_group = @utils.get_ad_group()
|
|
45
|
-
assert_not_nil(ad_group)
|
|
46
|
-
assert_not_nil(ad_group[:id])
|
|
47
|
-
keyword = @utils.get_keyword()
|
|
48
|
-
assert_not_nil(keyword)
|
|
49
|
-
assert_not_nil(keyword[:criterion])
|
|
50
|
-
assert_not_nil(keyword[:criterion][:id])
|
|
51
|
-
get_criterion_bid_landscapes(ad_group[:id], keyword[:criterion][:id])
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def test_get_keyword_ideas
|
|
55
|
-
keyword_text = 'orion tours'
|
|
56
|
-
get_keyword_ideas(keyword_text)
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def test_get_placement_ideas
|
|
60
|
-
url = 'http://example.google.com'
|
|
61
|
-
get_placement_ideas(url)
|
|
62
|
-
end
|
|
63
|
-
end
|
|
@@ -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 TestRemarketingV201206 < 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,84 +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/download_criteria_report_with_awql'
|
|
28
|
-
require 'reporting/get_campaign_stats'
|
|
29
|
-
require 'reporting/get_report_fields'
|
|
30
|
-
require 'reporting/parallel_report_download'
|
|
31
|
-
|
|
32
|
-
THREADS = 3
|
|
33
|
-
MAX_RETRIES = 3
|
|
34
|
-
BACKOFF_FACTOR = 3
|
|
35
|
-
|
|
36
|
-
class TestReportingV201206 < Test::Unit::TestCase
|
|
37
|
-
def setup()
|
|
38
|
-
@logger = Logger.new(STDOUT)
|
|
39
|
-
@logger.level = Logger::ERROR
|
|
40
|
-
@adwords = AdwordsApi::Api.new()
|
|
41
|
-
@adwords.logger = @logger
|
|
42
|
-
@utils = UtilsV201206.new(@adwords)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def test_download_criteria_report()
|
|
46
|
-
file = Tempfile.new('ruby-examples')
|
|
47
|
-
begin
|
|
48
|
-
file.close()
|
|
49
|
-
download_criteria_report(file.path)
|
|
50
|
-
ensure
|
|
51
|
-
file.unlink()
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def test_download_criteria_report_with_awql()
|
|
56
|
-
file = Tempfile.new('ruby-examples')
|
|
57
|
-
begin
|
|
58
|
-
file.close()
|
|
59
|
-
download_criteria_report_with_awql(file.path, 'CSV')
|
|
60
|
-
ensure
|
|
61
|
-
file.unlink()
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
def test_get_campaign_stats()
|
|
66
|
-
get_campaign_stats()
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
def test_get_report_fields()
|
|
70
|
-
report_type = 'ACCOUNT_PERFORMANCE_REPORT'
|
|
71
|
-
get_report_fields(report_type)
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
def test_parallel_report_download()
|
|
75
|
-
old_dir = Dir.pwd
|
|
76
|
-
Dir.chdir('/tmp')
|
|
77
|
-
begin
|
|
78
|
-
parallel_report_download()
|
|
79
|
-
ensure
|
|
80
|
-
Dir.chdir(old_dir)
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
|
|
@@ -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 TestTargetingV201206 < 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 = UtilsV201206.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
|