google-adx-buyer-api 0.4.6 → 0.4.7
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 +5 -0
- data/README +35 -24
- data/examples/{v201206 → v201306}/account_management/get_account_changes.rb +9 -1
- data/examples/{v201206 → v201306}/basic_operations/add_ad_group.rb +19 -11
- data/examples/{v201206 → v201306}/basic_operations/add_campaign.rb +27 -14
- data/examples/{v201206 → v201306}/basic_operations/add_placements.rb +9 -1
- data/examples/{v201206 → v201306}/basic_operations/add_thirdparty_redirect_ad.rb +16 -6
- data/examples/{v201206 → v201306}/basic_operations/delete_ad.rb +9 -1
- data/examples/{v201206 → v201306}/basic_operations/delete_ad_group.rb +9 -1
- data/examples/{v201206 → v201306}/basic_operations/delete_campaign.rb +9 -1
- data/examples/{v201206 → v201306}/basic_operations/delete_placement.rb +9 -1
- data/examples/{v201206 → v201306}/basic_operations/get_ad_groups.rb +9 -1
- data/examples/{v201206 → v201306}/basic_operations/get_campaigns.rb +9 -1
- data/examples/{v201206 → v201306}/basic_operations/get_placements.rb +9 -1
- data/examples/{v201206 → v201306}/basic_operations/get_thirdparty_redirect_ads.rb +9 -1
- data/examples/{v201206 → v201306}/basic_operations/pause_ad.rb +9 -1
- data/examples/{v201206 → v201306}/basic_operations/update_ad_group.rb +9 -1
- data/examples/{v201206 → v201306}/basic_operations/update_campaign.rb +9 -1
- data/examples/{v201206 → v201306}/basic_operations/update_placement.rb +15 -7
- data/examples/{v201206 → v201306}/campaign_management/add_placements_in_bulk.rb +10 -2
- data/examples/{v201206 → v201306}/campaign_management/get_all_disapproved_ads.rb +10 -2
- data/examples/{v201206 → v201306}/error_handling/handle_captcha_challenge.rb +1 -1
- data/examples/{v201206 → v201306}/error_handling/handle_partial_failures.rb +9 -1
- data/examples/{v201206 → v201306}/error_handling/handle_policy_violation_error.rb +9 -1
- data/examples/{v201206 → v201306}/error_handling/handle_two_factor_authorization_error.rb +3 -2
- data/examples/{v201206 → v201306}/misc/get_all_images_and_videos.rb +12 -5
- data/examples/v201306/misc/setup_oauth2.rb +88 -0
- data/examples/{v201206 → v201306}/misc/upload_image.rb +20 -10
- data/examples/{v201206/misc/use_oauth.rb → v201306/misc/use_oauth2_jwt.rb} +20 -24
- data/examples/{v201206 → v201306}/optimization/get_placement_ideas.rb +10 -4
- data/examples/{v201206 → v201306}/remarketing/add_audience.rb +38 -26
- data/examples/{v201206 → v201306}/remarketing/add_conversion_tracker.rb +17 -6
- data/examples/{v201206 → v201306}/reporting/download_criteria_report.rb +9 -1
- data/examples/{v201206 → v201306}/reporting/get_campaign_stats.rb +9 -1
- data/examples/{v201206 → v201306}/reporting/get_report_fields.rb +9 -1
- data/examples/{v201206 → v201306}/targeting/add_campaign_targeting_criteria.rb +10 -5
- data/examples/{v201206 → v201306}/targeting/get_campaign_targeting_criteria.rb +9 -1
- data/examples/{v201206 → v201306}/targeting/get_targetable_languages_and_carriers.rb +16 -4
- data/examples/{v201206 → v201306}/targeting/lookup_location.rb +9 -1
- metadata +41 -41
- data/examples/v201206/reporting/parallel_report_download.rb +0 -159
data/ChangeLog
CHANGED
data/README
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Welcome to the next generation Google-developed Ruby client library for the
|
4
4
|
AdWords and DoubleClick Ad Exchange Buyer API!
|
5
5
|
|
6
|
-
It contains full support for
|
6
|
+
It contains full support for v201209, v201302 and v201306, with full stubs, and
|
7
7
|
a simplified programming interface that lets you handle everything in native
|
8
8
|
Ruby collections.
|
9
9
|
|
@@ -45,20 +45,25 @@ There is an example configuration file shipped with these libraries.
|
|
45
45
|
You can also pass API a manually constructed config hash like:
|
46
46
|
adwords = AdwordsApi::Api.new({
|
47
47
|
:authentication => {
|
48
|
-
:method => '
|
48
|
+
:method => 'OAuth2',
|
49
|
+
:oauth2_client_id: 'INSERT_OAUTH2_CLIENT_ID_HERE'
|
50
|
+
:oauth2_client_secret: 'INSERT_OAUTH2_CLIENT_SECRET_HERE'
|
49
51
|
:developer_token => 'DEVELOPER_TOKEN',
|
50
|
-
:
|
51
|
-
:
|
52
|
-
:email => 'user@domain.com',
|
53
|
-
:client_customer_id => '012-345-6789'
|
52
|
+
:client_customer_id => '012-345-6789',
|
53
|
+
:user_agent => 'Ruby Sample'
|
54
54
|
},
|
55
55
|
:service => {
|
56
56
|
:environment => 'PRODUCTION'
|
57
57
|
}
|
58
58
|
})
|
59
59
|
|
60
|
-
|
61
|
-
|
60
|
+
To obtain OAuth2 client credentials, follow instructions on the wiki:
|
61
|
+
|
62
|
+
http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2
|
63
|
+
|
64
|
+
Once the library instance is create, specify which service you're looking to
|
65
|
+
use, and which version:
|
66
|
+
campaign_srv = adwords.service(:CampaignService, :v201306)
|
62
67
|
|
63
68
|
and you should now be able to just use the API methods in the object you were
|
64
69
|
returned:
|
@@ -91,14 +96,12 @@ In order to make things more Ruby-like for our Ruby developers, we've renamed
|
|
91
96
|
API objects and methods to more closely match Ruby conventions. This means using
|
92
97
|
snake_case for methods and parameters, and UpperCamelCase for class names.
|
93
98
|
|
94
|
-
For example, the '
|
95
|
-
|
96
|
-
|
99
|
+
For example, the 'startDate' field of the Campaign object is named 'start_date'
|
100
|
+
in the client library. The 'get' method, returns a CampaignPage object which has
|
101
|
+
an 'entries' and a 'total_num_entries' field. So, to access the return
|
102
|
+
values, you would do this:
|
97
103
|
|
98
|
-
|
99
|
-
has an 'entries' and a 'total_num_entries' field. So, to access the return
|
100
|
-
values, you would do:
|
101
|
-
response = report_def_srv.get(selector)
|
104
|
+
response = campaign_srv.get(selector)
|
102
105
|
num_entries = response[:total_num_entries]
|
103
106
|
|
104
107
|
Essentially, all you have to do is follow Ruby conventions, and the library will
|
@@ -142,20 +145,23 @@ Request details and units spend are logged at the INFO log level, while raw HTTP
|
|
142
145
|
headers and XML dumps are logged at the DEBUG log level. For more details on
|
143
146
|
using Logger refer to the Ruby Logger documentation.
|
144
147
|
|
145
|
-
=== 2.4 - Calculating
|
148
|
+
=== 2.4 - Calculating operations usage
|
149
|
+
|
150
|
+
Each AdWords API operation performed consumes a certain number of operations as
|
151
|
+
described in the rate sheet:
|
146
152
|
|
147
|
-
|
148
|
-
specified in the rate sheet:
|
149
|
-
http://code.google.com/apis/adwords/docs/ratesheet.html
|
153
|
+
https://developers.google.com/adwords/api/docs/ratesheet
|
150
154
|
|
151
|
-
The amount of
|
152
|
-
This information can be obtained by passing a user block during
|
153
|
-
|
154
|
-
|
155
|
+
The amount of operations consumed is returned in the header part of the SOAP
|
156
|
+
response. This information can be obtained by passing a user block during the
|
157
|
+
method call:
|
158
|
+
|
159
|
+
response = campaign_srv.get(selector) do |header|
|
160
|
+
puts "Operations consumed: %d" % header[:operations]
|
155
161
|
end
|
156
162
|
|
157
163
|
You can also retrieve the response body as the second block parameter:
|
158
|
-
|
164
|
+
campaign_srv.get(selector) {|header, body| ... }
|
159
165
|
|
160
166
|
=== 2.5 - GZip compression
|
161
167
|
|
@@ -195,6 +201,11 @@ Questions can be asked on forum
|
|
195
201
|
|
196
202
|
http://groups.google.com/group/adwords-api
|
197
203
|
|
204
|
+
Make sure to subscribe to our Google Plus page for API change announcements and
|
205
|
+
other news:
|
206
|
+
|
207
|
+
https://plus.google.com/+GoogleAdsDevelopers
|
208
|
+
|
198
209
|
|
199
210
|
= Copyright/License Info
|
200
211
|
|
@@ -114,11 +114,19 @@ def get_account_changes()
|
|
114
114
|
end
|
115
115
|
|
116
116
|
if __FILE__ == $0
|
117
|
-
API_VERSION = :
|
117
|
+
API_VERSION = :v201306
|
118
118
|
|
119
119
|
begin
|
120
120
|
get_account_changes()
|
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
|
@@ -43,17 +43,17 @@ def add_ad_group(campaign_id)
|
|
43
43
|
:name => 'Earth to Mars Cruises #%s' % (Time.new.to_f * 1000).to_i,
|
44
44
|
:status => 'ENABLED',
|
45
45
|
:campaign_id => campaign_id,
|
46
|
-
:
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
:micro_amount => 10000000
|
46
|
+
:bidding_strategy_configuration => {
|
47
|
+
:bids => [
|
48
|
+
{
|
49
|
+
# The 'xsi_type' field allows you to specify the xsi:type of the
|
50
|
+
# object being created. It's only necessary when you must provide
|
51
|
+
# an explicit type that the client library can't infer.
|
52
|
+
:xsi_type => 'CpmBid',
|
53
|
+
:bid => {:micro_amount => 10000000},
|
54
54
|
}
|
55
|
-
|
56
|
-
}
|
55
|
+
]
|
56
|
+
}
|
57
57
|
}
|
58
58
|
}
|
59
59
|
|
@@ -64,12 +64,20 @@ def add_ad_group(campaign_id)
|
|
64
64
|
end
|
65
65
|
|
66
66
|
if __FILE__ == $0
|
67
|
-
API_VERSION = :
|
67
|
+
API_VERSION = :v201306
|
68
68
|
|
69
69
|
begin
|
70
70
|
campaign_id = 'INSERT_CAMPAIGN_ID_HERE'.to_i
|
71
71
|
add_ad_group(campaign_id)
|
72
72
|
|
73
|
+
# Authorization error.
|
74
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
75
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
76
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
77
|
+
"to retrieve and store OAuth2 tokens."
|
78
|
+
puts "See this wiki page for more details:\n\n " +
|
79
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
80
|
+
|
73
81
|
# HTTP errors.
|
74
82
|
rescue AdsCommon::Errors::HttpError => e
|
75
83
|
puts "HTTP Error: %s" % e
|
@@ -20,7 +20,7 @@
|
|
20
20
|
#
|
21
21
|
# This example illustrates how to create a campaign.
|
22
22
|
#
|
23
|
-
# Tags: CampaignService.mutate
|
23
|
+
# Tags: CampaignService.mutate, BudgetService.mutate
|
24
24
|
|
25
25
|
require 'adwords_api'
|
26
26
|
|
@@ -33,27 +33,32 @@ def add_campaign()
|
|
33
33
|
# the configuration file or provide your own logger:
|
34
34
|
# adwords.logger = Logger.new('adwords_xml.log')
|
35
35
|
|
36
|
+
budget_srv = adwords.service(:BudgetService, API_VERSION)
|
36
37
|
campaign_srv = adwords.service(:CampaignService, API_VERSION)
|
37
38
|
|
39
|
+
# Create a budget, which can be shared by multiple campaigns.
|
40
|
+
budget = {
|
41
|
+
:name => 'Interplanetary budget #%d' % (Time.new.to_f * 1000).to_i,
|
42
|
+
:amount => {:micro_amount => 50000000},
|
43
|
+
:delivery_method => 'STANDARD',
|
44
|
+
:period => 'DAILY'
|
45
|
+
}
|
46
|
+
budget_operation = {:operator => 'ADD', :operand => budget}
|
47
|
+
|
48
|
+
# Add budget.
|
49
|
+
return_budget = budget_srv.mutate([budget_operation])
|
50
|
+
budget_id = return_budget[:value].first[:budget_id]
|
51
|
+
|
38
52
|
# Prepare for adding campaign.
|
39
53
|
operation = {
|
40
54
|
:operator => 'ADD',
|
41
55
|
:operand => {
|
42
56
|
:name => 'Interplanetary Cruise #%s' % (Time.new.to_f * 1000).to_i,
|
43
57
|
:status => 'PAUSED',
|
44
|
-
:
|
45
|
-
|
46
|
-
# being created. It's only necessary when you must provide an explicit
|
47
|
-
# type that the client library can't infer.
|
48
|
-
:xsi_type => 'ManualCPM'
|
49
|
-
},
|
50
|
-
:budget => {
|
51
|
-
:period => 'DAILY',
|
52
|
-
:amount => {
|
53
|
-
:micro_amount => 50000000
|
54
|
-
},
|
55
|
-
:delivery_method => 'STANDARD'
|
58
|
+
:bidding_strategy_configuration => {
|
59
|
+
:bidding_strategy_type => 'MANUAL_CPM'
|
56
60
|
},
|
61
|
+
:budget => {:budget_id => budget_id},
|
57
62
|
# Set the campaign network options to Search and Search Network.
|
58
63
|
:network_setting => {
|
59
64
|
:target_google_search => false,
|
@@ -74,11 +79,19 @@ def add_campaign()
|
|
74
79
|
end
|
75
80
|
|
76
81
|
if __FILE__ == $0
|
77
|
-
API_VERSION = :
|
82
|
+
API_VERSION = :v201306
|
78
83
|
|
79
84
|
begin
|
80
85
|
add_campaign()
|
81
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
|
+
|
82
95
|
# HTTP errors.
|
83
96
|
rescue AdsCommon::Errors::HttpError => e
|
84
97
|
puts "HTTP Error: %s" % e
|
@@ -75,12 +75,20 @@ def add_placements(ad_group_id)
|
|
75
75
|
end
|
76
76
|
|
77
77
|
if __FILE__ == $0
|
78
|
-
API_VERSION = :
|
78
|
+
API_VERSION = :v201306
|
79
79
|
|
80
80
|
begin
|
81
81
|
ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
|
82
82
|
add_placements(ad_group_id)
|
83
83
|
|
84
|
+
# Authorization error.
|
85
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
86
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
87
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
88
|
+
"to retrieve and store OAuth2 tokens."
|
89
|
+
puts "See this wiki page for more details:\n\n " +
|
90
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
91
|
+
|
84
92
|
# HTTP errors.
|
85
93
|
rescue AdsCommon::Errors::HttpError => e
|
86
94
|
puts "HTTP Error: %s" % e
|
@@ -49,13 +49,15 @@ def add_thirdparty_redirect_ad(ad_group_id)
|
|
49
49
|
:width => 300
|
50
50
|
},
|
51
51
|
# This field normally contains the javascript ad tag.
|
52
|
-
:snippet =>
|
53
|
-
|
54
|
-
:
|
55
|
-
:certified_vendor_format_id => 119,
|
52
|
+
:snippet => '<img src="http://goo.gl/HJM3L"/>',
|
53
|
+
# DoubleClick Rich Media Expandable format ID.
|
54
|
+
:certified_vendor_format_id => 232,
|
56
55
|
:is_cookie_targeted => false,
|
57
56
|
:is_user_interest_targeted => false,
|
58
|
-
:is_tagged => false
|
57
|
+
:is_tagged => false,
|
58
|
+
# Expandable Ad properties.
|
59
|
+
:expanding_directions => ['EXPANDING_UP', 'EXPANDING_DOWN'],
|
60
|
+
:ad_attributes => ['ROLL_OVER_TO_EXPAND']
|
59
61
|
}
|
60
62
|
|
61
63
|
# Create in-stream third party redirect ad.
|
@@ -102,13 +104,21 @@ def add_thirdparty_redirect_ad(ad_group_id)
|
|
102
104
|
end
|
103
105
|
|
104
106
|
if __FILE__ == $0
|
105
|
-
API_VERSION = :
|
107
|
+
API_VERSION = :v201306
|
106
108
|
|
107
109
|
begin
|
108
110
|
# Ad group ID to add text ads to.
|
109
111
|
ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
|
110
112
|
add_thirdparty_redirect_ad(ad_group_id)
|
111
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
|
+
|
112
122
|
# HTTP errors.
|
113
123
|
rescue AdsCommon::Errors::HttpError => e
|
114
124
|
puts "HTTP Error: %s" % e
|
@@ -55,13 +55,21 @@ def delete_ad(ad_group_id, ad_id)
|
|
55
55
|
end
|
56
56
|
|
57
57
|
if __FILE__ == $0
|
58
|
-
API_VERSION = :
|
58
|
+
API_VERSION = :v201306
|
59
59
|
|
60
60
|
begin
|
61
61
|
ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
|
62
62
|
ad_id = 'INSERT_AD_ID_HERE'.to_i
|
63
63
|
delete_ad(ad_group_id, ad_id)
|
64
64
|
|
65
|
+
# Authorization error.
|
66
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
67
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
68
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
69
|
+
"to retrieve and store OAuth2 tokens."
|
70
|
+
puts "See this wiki page for more details:\n\n " +
|
71
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
72
|
+
|
65
73
|
# HTTP errors.
|
66
74
|
rescue AdsCommon::Errors::HttpError => e
|
67
75
|
puts "HTTP Error: %s" % e
|
@@ -52,12 +52,20 @@ def delete_ad_group(ad_group_id)
|
|
52
52
|
end
|
53
53
|
|
54
54
|
if __FILE__ == $0
|
55
|
-
API_VERSION = :
|
55
|
+
API_VERSION = :v201306
|
56
56
|
|
57
57
|
begin
|
58
58
|
ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
|
59
59
|
delete_ad_group(ad_group_id)
|
60
60
|
|
61
|
+
# Authorization error.
|
62
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
63
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
64
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
65
|
+
"to retrieve and store OAuth2 tokens."
|
66
|
+
puts "See this wiki page for more details:\n\n " +
|
67
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
68
|
+
|
61
69
|
# HTTP errors.
|
62
70
|
rescue AdsCommon::Errors::HttpError => e
|
63
71
|
puts "HTTP Error: %s" % e
|
@@ -53,12 +53,20 @@ def delete_campaign(campaign_id)
|
|
53
53
|
end
|
54
54
|
|
55
55
|
if __FILE__ == $0
|
56
|
-
API_VERSION = :
|
56
|
+
API_VERSION = :v201306
|
57
57
|
|
58
58
|
begin
|
59
59
|
campaign_id = 'INSERT_CAMPAIGN_ID_HERE'.to_i
|
60
60
|
delete_campaign(campaign_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
|
@@ -60,7 +60,7 @@ def delete_placement(ad_group_id, criterion_id)
|
|
60
60
|
end
|
61
61
|
|
62
62
|
if __FILE__ == $0
|
63
|
-
API_VERSION = :
|
63
|
+
API_VERSION = :v201306
|
64
64
|
|
65
65
|
begin
|
66
66
|
# IDs of criterion to delete and its ad group.
|
@@ -68,6 +68,14 @@ if __FILE__ == $0
|
|
68
68
|
criterion_id = 'INSERT_CRITERION_ID_HERE'.to_i
|
69
69
|
delete_placement(ad_group_id, criterion_id)
|
70
70
|
|
71
|
+
# Authorization error.
|
72
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
73
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
74
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
75
|
+
"to retrieve and store OAuth2 tokens."
|
76
|
+
puts "See this wiki page for more details:\n\n " +
|
77
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
78
|
+
|
71
79
|
# HTTP errors.
|
72
80
|
rescue AdsCommon::Errors::HttpError => e
|
73
81
|
puts "HTTP Error: %s" % e
|
@@ -56,12 +56,20 @@ def get_all_ad_groups(campaign_id)
|
|
56
56
|
end
|
57
57
|
|
58
58
|
if __FILE__ == $0
|
59
|
-
API_VERSION = :
|
59
|
+
API_VERSION = :v201306
|
60
60
|
|
61
61
|
begin
|
62
62
|
campaign_id = 'INSERT_CAMPAIGN_ID_HERE'.to_i
|
63
63
|
get_all_ad_groups(campaign_id)
|
64
64
|
|
65
|
+
# Authorization error.
|
66
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
67
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
68
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
69
|
+
"to retrieve and store OAuth2 tokens."
|
70
|
+
puts "See this wiki page for more details:\n\n " +
|
71
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
72
|
+
|
65
73
|
# HTTP errors.
|
66
74
|
rescue AdsCommon::Errors::HttpError => e
|
67
75
|
puts "HTTP Error: %s" % e
|
@@ -54,11 +54,19 @@ def get_all_campaigns()
|
|
54
54
|
end
|
55
55
|
|
56
56
|
if __FILE__ == $0
|
57
|
-
API_VERSION = :
|
57
|
+
API_VERSION = :v201306
|
58
58
|
|
59
59
|
begin
|
60
60
|
get_all_campaigns()
|
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
|