google-adwords-api 0.5.1 → 0.5.2
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 +4 -0
- data/README +2 -1
- data/examples/v201109/account_management/create_account.rb +2 -2
- data/examples/v201109/account_management/get_account_alerts.rb +3 -3
- data/examples/v201109/account_management/get_account_changes.rb +2 -2
- data/examples/v201109/account_management/get_account_hierarchy.rb +2 -2
- data/examples/v201109/account_management/get_client_customer_id.rb +6 -8
- data/examples/v201109/account_management/get_client_unit_usage.rb +6 -7
- data/examples/v201109/basic_operations/add_ad_groups.rb +111 -0
- data/examples/v201109/basic_operations/add_campaigns.rb +125 -0
- data/examples/v201109/basic_operations/add_keywords.rb +16 -11
- data/examples/v201109/basic_operations/add_text_ads.rb +23 -19
- data/examples/v201109/basic_operations/delete_ad.rb +7 -7
- data/examples/v201109/basic_operations/delete_ad_group.rb +7 -7
- data/examples/v201109/basic_operations/delete_campaign.rb +7 -7
- data/examples/v201109/basic_operations/delete_keyword.rb +7 -7
- data/examples/v201109/basic_operations/get_ad_groups.rb +7 -7
- data/examples/v201109/basic_operations/get_campaigns.rb +3 -3
- data/examples/v201109/basic_operations/get_keywords.rb +7 -7
- data/examples/v201109/basic_operations/get_text_ads.rb +7 -7
- data/examples/v201109/basic_operations/pause_ad.rb +7 -7
- data/examples/v201109/basic_operations/update_ad_group.rb +6 -6
- data/examples/v201109/basic_operations/update_campaign.rb +6 -6
- data/examples/v201109/basic_operations/update_keyword.rb +7 -7
- data/examples/v201109/campaign_management/add_experiment.rb +14 -9
- data/examples/v201109/campaign_management/add_keywords_in_bulk.rb +5 -5
- data/examples/v201109/campaign_management/add_location_extension.rb +13 -7
- data/examples/v201109/campaign_management/add_location_extension_override.rb +7 -7
- data/examples/v201109/campaign_management/get_all_disapproved_ads.rb +6 -6
- data/examples/v201109/campaign_management/promote_experiment.rb +5 -6
- data/examples/v201109/campaign_management/set_ad_parameters.rb +8 -8
- data/examples/v201109/campaign_management/validate_text_ad.rb +7 -9
- data/examples/v201109/error_handling/handle_captcha_challenge.rb +3 -4
- data/examples/v201109/error_handling/handle_partial_failures.rb +5 -6
- data/examples/v201109/error_handling/handle_policy_violation_error.rb +5 -6
- data/examples/v201109/error_handling/handle_two_factor_authorization_error.rb +2 -2
- data/examples/v201109/misc/get_all_images_and_videos.rb +3 -3
- data/examples/v201109/misc/upload_image.rb +2 -2
- data/examples/v201109/misc/use_oauth.rb +3 -3
- data/examples/v201109/optimization/estimate_keyword_traffic.rb +2 -2
- data/examples/v201109/optimization/get_keyword_bid_simulations.rb +6 -7
- data/examples/v201109/optimization/get_keyword_ideas.rb +6 -7
- data/examples/v201109/optimization/get_placement_ideas.rb +6 -7
- data/examples/v201109/remarketing/add_audience.rb +5 -3
- data/examples/v201109/remarketing/add_conversion_tracker.rb +12 -3
- data/examples/v201109/reporting/download_criteria_report.rb +7 -8
- data/examples/v201109/reporting/download_defined_report.rb +6 -7
- data/examples/v201109/reporting/get_campaign_stats.rb +105 -0
- data/examples/v201109/reporting/get_defined_reports.rb +2 -2
- data/examples/v201109/reporting/get_report_fields.rb +6 -7
- data/examples/v201109/reporting/parallel_report_download.rb +8 -8
- data/examples/v201109/targeting/add_campaign_targeting_criteria.rb +5 -6
- data/examples/v201109/targeting/get_campaign_targeting_criteria.rb +7 -8
- data/examples/v201109/targeting/get_targetable_languages_and_carriers.rb +2 -2
- data/examples/v201109/targeting/lookup_location.rb +2 -2
- data/lib/adwords_api/version.rb +1 -1
- data/test/examples/v201109/test_account_management.rb +60 -0
- data/test/examples/v201109/test_basic_operations.rb +172 -0
- data/test/examples/v201109/test_campaign_management.rb +116 -0
- data/test/examples/v201109/test_error_handling.rb +63 -0
- data/test/examples/v201109/test_misc.rb +45 -0
- data/test/examples/v201109/test_optimization.rb +63 -0
- data/test/examples/v201109/test_remarketing.rb +39 -0
- data/test/examples/v201109/test_reporting.rb +89 -0
- data/test/examples/v201109/test_targeting.rb +60 -0
- data/test/examples/v201109/utils.rb +239 -0
- data/test/suite_exampletests.rb +31 -0
- metadata +18 -6
- data/examples/v201109/basic_operations/add_ad_group.rb +0 -89
- data/examples/v201109/basic_operations/add_campaign.rb +0 -99
@@ -0,0 +1,31 @@
|
|
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
|
+
# Test suite for example tests.
|
22
|
+
|
23
|
+
lib = File.expand_path('../../lib/', __FILE__)
|
24
|
+
$:.unshift lib unless $:.include?(lib)
|
25
|
+
|
26
|
+
require 'test/unit'
|
27
|
+
|
28
|
+
# v201109 example tests.
|
29
|
+
$:.unshift File.expand_path('../../examples/v201109', __FILE__)
|
30
|
+
Dir.glob('./test/examples/v201109/utils.rb').each {|file| require file}
|
31
|
+
Dir.glob('./test/examples/v201109/test*.rb').each {|file| require file}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-adwords-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 2
|
10
|
+
version: 0.5.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Danial Klimkin
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-03-
|
18
|
+
date: 2012-03-20 00:00:00 +04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- examples/v201109/reporting/download_criteria_report.rb
|
64
64
|
- examples/v201109/reporting/download_defined_report.rb
|
65
65
|
- examples/v201109/reporting/get_defined_reports.rb
|
66
|
+
- examples/v201109/reporting/get_campaign_stats.rb
|
66
67
|
- examples/v201109/reporting/parallel_report_download.rb
|
67
68
|
- examples/v201109/reporting/get_report_fields.rb
|
68
69
|
- examples/v201109/error_handling/handle_policy_violation_error.rb
|
@@ -94,11 +95,11 @@ files:
|
|
94
95
|
- examples/v201109/basic_operations/update_campaign.rb
|
95
96
|
- examples/v201109/basic_operations/get_campaigns.rb
|
96
97
|
- examples/v201109/basic_operations/get_ad_groups.rb
|
97
|
-
- examples/v201109/basic_operations/
|
98
|
-
- examples/v201109/basic_operations/add_ad_group.rb
|
98
|
+
- examples/v201109/basic_operations/add_campaigns.rb
|
99
99
|
- examples/v201109/basic_operations/delete_ad_group.rb
|
100
100
|
- examples/v201109/basic_operations/delete_keyword.rb
|
101
101
|
- examples/v201109/basic_operations/delete_ad.rb
|
102
|
+
- examples/v201109/basic_operations/add_ad_groups.rb
|
102
103
|
- examples/v201109/basic_operations/update_ad_group.rb
|
103
104
|
- examples/v201109/basic_operations/get_keywords.rb
|
104
105
|
- examples/v201109/basic_operations/delete_campaign.rb
|
@@ -176,11 +177,22 @@ files:
|
|
176
177
|
- lib/adwords_api/client_login_header_handler.rb
|
177
178
|
- lib/adwords_api/v13_login_handler.rb
|
178
179
|
- lib/adwords_api.rb
|
180
|
+
- test/examples/v201109/utils.rb
|
181
|
+
- test/examples/v201109/test_error_handling.rb
|
182
|
+
- test/examples/v201109/test_targeting.rb
|
183
|
+
- test/examples/v201109/test_misc.rb
|
184
|
+
- test/examples/v201109/test_remarketing.rb
|
185
|
+
- test/examples/v201109/test_account_management.rb
|
186
|
+
- test/examples/v201109/test_optimization.rb
|
187
|
+
- test/examples/v201109/test_reporting.rb
|
188
|
+
- test/examples/v201109/test_basic_operations.rb
|
189
|
+
- test/examples/v201109/test_campaign_management.rb
|
179
190
|
- test/bugs/test_issue_00000031.rb
|
180
191
|
- test/suite_unittests.rb
|
181
192
|
- test/adwords_api/test_report_utils.rb
|
182
193
|
- test/adwords_api/test_api_config.rb
|
183
194
|
- test/adwords_api/test_utils.rb
|
195
|
+
- test/suite_exampletests.rb
|
184
196
|
- COPYING
|
185
197
|
- README
|
186
198
|
- ChangeLog
|
@@ -1,89 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# Encoding: utf-8
|
3
|
-
#
|
4
|
-
# Author:: api.sgomes@gmail.com (Sérgio Gomes)
|
5
|
-
#
|
6
|
-
# Copyright:: Copyright 2011, 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
|
-
# This example illustrates how to create an ad group. To create a campaign, run
|
22
|
-
# add_campaign.rb.
|
23
|
-
#
|
24
|
-
# Tags: AdGroupService.mutate
|
25
|
-
|
26
|
-
require 'adwords_api'
|
27
|
-
|
28
|
-
API_VERSION = :v201109
|
29
|
-
|
30
|
-
def add_ad_group()
|
31
|
-
# AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
|
32
|
-
# when called without parameters.
|
33
|
-
adwords = AdwordsApi::Api.new
|
34
|
-
|
35
|
-
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
36
|
-
# the configuration file or provide your own logger:
|
37
|
-
# adwords.logger = Logger.new('adwords_xml.log')
|
38
|
-
|
39
|
-
ad_group_srv = adwords.service(:AdGroupService, API_VERSION)
|
40
|
-
|
41
|
-
campaign_id = 'INSERT_CAMPAIGN_ID_HERE'.to_i
|
42
|
-
|
43
|
-
# Prepare for adding ad group.
|
44
|
-
operation = {
|
45
|
-
:operator => 'ADD',
|
46
|
-
:operand => {
|
47
|
-
:name => "Earth to Mars Cruises #%d" % (Time.new.to_f * 1000).to_i,
|
48
|
-
:status => 'ENABLED',
|
49
|
-
:campaign_id => campaign_id,
|
50
|
-
:bids => {
|
51
|
-
# The 'xsi_type' field allows you to specify the xsi:type of the object
|
52
|
-
# being created. It's only necessary when you must provide an explicit
|
53
|
-
# type that the client library can't infer.
|
54
|
-
:xsi_type => 'ManualCPCAdGroupBids',
|
55
|
-
:keyword_max_cpc => {
|
56
|
-
:amount => {
|
57
|
-
:micro_amount => 10000000
|
58
|
-
}
|
59
|
-
}
|
60
|
-
},
|
61
|
-
}
|
62
|
-
}
|
63
|
-
|
64
|
-
# Add ad group.
|
65
|
-
response = ad_group_srv.mutate([operation])
|
66
|
-
ad_group = response[:value].first
|
67
|
-
puts "Ad group ID %d was successfully added." % ad_group[:id]
|
68
|
-
end
|
69
|
-
|
70
|
-
if __FILE__ == $0
|
71
|
-
begin
|
72
|
-
add_ad_group()
|
73
|
-
|
74
|
-
# HTTP errors.
|
75
|
-
rescue AdsCommon::Errors::HttpError => e
|
76
|
-
puts "HTTP Error: %s" % e
|
77
|
-
|
78
|
-
# API errors.
|
79
|
-
rescue AdwordsApi::Errors::ApiException => e
|
80
|
-
puts "Message: %s" % e.message
|
81
|
-
puts 'Errors:'
|
82
|
-
e.errors.each_with_index do |error, index|
|
83
|
-
puts "\tError [%d]:" % (index + 1)
|
84
|
-
error.each do |field, value|
|
85
|
-
puts "\t\t%s: %s" % [field, value]
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
@@ -1,99 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# Encoding: utf-8
|
3
|
-
#
|
4
|
-
# Author:: api.sgomes@gmail.com (Sérgio Gomes)
|
5
|
-
#
|
6
|
-
# Copyright:: Copyright 2011, 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
|
-
# This example illustrates how to create a campaign.
|
22
|
-
#
|
23
|
-
# Tags: CampaignService.mutate
|
24
|
-
|
25
|
-
require 'adwords_api'
|
26
|
-
|
27
|
-
API_VERSION = :v201109
|
28
|
-
|
29
|
-
def add_campaign()
|
30
|
-
# AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
|
31
|
-
# when called without parameters.
|
32
|
-
adwords = AdwordsApi::Api.new
|
33
|
-
|
34
|
-
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
35
|
-
# the configuration file or provide your own logger:
|
36
|
-
# adwords.logger = Logger.new('adwords_xml.log')
|
37
|
-
|
38
|
-
campaign_srv = adwords.service(:CampaignService, API_VERSION)
|
39
|
-
|
40
|
-
# Prepare for adding campaign.
|
41
|
-
operation = {
|
42
|
-
:operator => 'ADD',
|
43
|
-
:operand => {
|
44
|
-
:name => "Interplanetary Cruise #%d" % (Time.new.to_f * 1000).to_i,
|
45
|
-
:status => 'PAUSED',
|
46
|
-
:bidding_strategy => {
|
47
|
-
# The 'xsi_type' field allows you to specify the xsi:type of the object
|
48
|
-
# being created. It's only necessary when you must provide an explicit
|
49
|
-
# type that the client library can't infer.
|
50
|
-
:xsi_type => 'ManualCPC'
|
51
|
-
},
|
52
|
-
:budget => {
|
53
|
-
:period => 'DAILY',
|
54
|
-
:amount => {
|
55
|
-
:micro_amount => 50000000
|
56
|
-
},
|
57
|
-
:delivery_method => 'STANDARD'
|
58
|
-
},
|
59
|
-
# Set the campaign network options to Search and Search Network.
|
60
|
-
:network_setting => {
|
61
|
-
:target_google_search => true,
|
62
|
-
:target_search_network => true,
|
63
|
-
:target_content_network => false,
|
64
|
-
:target_content_contextual => false
|
65
|
-
}
|
66
|
-
}
|
67
|
-
}
|
68
|
-
|
69
|
-
# Add campaign.
|
70
|
-
response = campaign_srv.mutate([operation])
|
71
|
-
if response and response[:value]
|
72
|
-
campaign = response[:value].first
|
73
|
-
puts "Campaign with name '%s' and ID %d was added." %
|
74
|
-
[campaign[:name], campaign[:id]]
|
75
|
-
else
|
76
|
-
puts 'No campaigns were added.'
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
if __FILE__ == $0
|
81
|
-
begin
|
82
|
-
add_campaign()
|
83
|
-
|
84
|
-
# HTTP errors.
|
85
|
-
rescue AdsCommon::Errors::HttpError => e
|
86
|
-
puts "HTTP Error: %s" % e
|
87
|
-
|
88
|
-
# API errors.
|
89
|
-
rescue AdwordsApi::Errors::ApiException => e
|
90
|
-
puts "Message: %s" % e.message
|
91
|
-
puts 'Errors:'
|
92
|
-
e.errors.each_with_index do |error, index|
|
93
|
-
puts "\tError [%d]:" % (index + 1)
|
94
|
-
error.each do |field, value|
|
95
|
-
puts "\t\t%s: %s" % [field, value]
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|