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
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: api.dklimkin@gmail.com (Danial Klimkin)
|
5
5
|
#
|
6
|
-
# Copyright:: Copyright
|
6
|
+
# Copyright:: Copyright 2012, 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,14 @@
|
|
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 use
|
21
|
+
# This example illustrates how to use OAuth2.0 authentication method with
|
22
|
+
# Service Account (JWT).
|
22
23
|
#
|
23
24
|
# Tags: CampaignService.get
|
24
25
|
|
25
26
|
require 'adwords_api'
|
26
27
|
|
27
|
-
def
|
28
|
+
def use_oauth2_jwt()
|
28
29
|
# AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
|
29
30
|
# when called without parameters.
|
30
31
|
adwords = AdwordsApi::Api.new
|
@@ -33,6 +34,19 @@ def use_oauth()
|
|
33
34
|
# the configuration file or provide your own logger:
|
34
35
|
# adwords.logger = Logger.new('adwords_xml.log')
|
35
36
|
|
37
|
+
# Option 1: provide key filename as authentication -> oauth2_keyfile in the
|
38
|
+
# configuration file. No additional code is necessary.
|
39
|
+
# To provide a file name at runtime, use authorize:
|
40
|
+
# adwords.authorize({:oauth2_keyfile => key_filename})
|
41
|
+
|
42
|
+
# Option 2: retrieve key manually and create OpenSSL::PKCS12 object.
|
43
|
+
# key_filename = 'INSERT_FILENAME_HERE'
|
44
|
+
# key_secret = 'INSERT_SECRET_HERE'
|
45
|
+
# key_file_data = File.read(key_filename)
|
46
|
+
# key = OpenSSL::PKCS12.new(key_file_data, key_secret).key
|
47
|
+
# adwords.authorize({:oauth2_key => key})
|
48
|
+
|
49
|
+
# Now you can make API calls.
|
36
50
|
campaign_srv = adwords.service(:CampaignService, API_VERSION)
|
37
51
|
|
38
52
|
# Get all the campaigns for this account; empty selector.
|
@@ -43,24 +57,7 @@ def use_oauth()
|
|
43
57
|
]
|
44
58
|
}
|
45
59
|
|
46
|
-
|
47
|
-
|
48
|
-
begin
|
49
|
-
response = campaign_srv.get(selector)
|
50
|
-
rescue AdsCommon::Errors::OAuthVerificationRequired => e
|
51
|
-
if retry_count < MAX_RETRIES
|
52
|
-
puts "Hit Auth error, please navigate to URL:\n\t%s" % e.oauth_url
|
53
|
-
print 'log in and type the verification code: '
|
54
|
-
verification_code = gets.chomp
|
55
|
-
adwords.credential_handler.set_credential(
|
56
|
-
:oauth_verification_code, verification_code)
|
57
|
-
retry_count += 1
|
58
|
-
retry
|
59
|
-
else
|
60
|
-
raise AdsCommon::Errors::AuthError, 'Failed to authenticate.'
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
60
|
+
response = campaign_srv.get(selector)
|
64
61
|
if response and response[:entries]
|
65
62
|
campaigns = response[:entries]
|
66
63
|
campaigns.each do |campaign|
|
@@ -73,11 +70,10 @@ def use_oauth()
|
|
73
70
|
end
|
74
71
|
|
75
72
|
if __FILE__ == $0
|
76
|
-
API_VERSION = :
|
77
|
-
MAX_RETRIES = 3
|
73
|
+
API_VERSION = :v201306
|
78
74
|
|
79
75
|
begin
|
80
|
-
|
76
|
+
use_oauth2_jwt()
|
81
77
|
|
82
78
|
# HTTP errors.
|
83
79
|
rescue AdsCommon::Errors::HttpError => e
|
@@ -24,7 +24,6 @@
|
|
24
24
|
# Tags: TargetingIdeaService.get
|
25
25
|
|
26
26
|
require 'adwords_api'
|
27
|
-
require 'adwords_api/utils'
|
28
27
|
|
29
28
|
def get_placement_ideas(url)
|
30
29
|
# AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
|
@@ -72,8 +71,7 @@ def get_placement_ideas(url)
|
|
72
71
|
|
73
72
|
# Display results.
|
74
73
|
results.each do |result|
|
75
|
-
|
76
|
-
placement = data['CRITERION'][:value]
|
74
|
+
placement = result[:data]['CRITERION'][:value]
|
77
75
|
puts "Related placement found at URL [%s]" % placement[:url]
|
78
76
|
end
|
79
77
|
puts "Total URLs found with keywords related to keywords at [%s]: %d." %
|
@@ -81,13 +79,21 @@ def get_placement_ideas(url)
|
|
81
79
|
end
|
82
80
|
|
83
81
|
if __FILE__ == $0
|
84
|
-
API_VERSION = :
|
82
|
+
API_VERSION = :v201306
|
85
83
|
PAGE_SIZE = 100
|
86
84
|
|
87
85
|
begin
|
88
86
|
url = 'INSERT_PLACEMENT_URL_HERE'
|
89
87
|
get_placement_ideas(url)
|
90
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
|
+
|
91
97
|
# HTTP errors.
|
92
98
|
rescue AdsCommon::Errors::HttpError => e
|
93
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',
|
@@ -58,41 +58,53 @@ def add_audience()
|
|
58
58
|
|
59
59
|
# Add user list.
|
60
60
|
response = user_list_srv.mutate([operation])
|
61
|
-
|
61
|
+
if response and response[:value]
|
62
|
+
user_list = response[:value].first
|
62
63
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
64
|
+
# Get conversion snippets.
|
65
|
+
if user_list and user_list[:conversion_types]
|
66
|
+
conversion_ids = user_list[:conversion_types].map {|type| type[:id]}
|
67
|
+
selector = {
|
68
|
+
# We're actually interested in the 'Snippet' field, which is returned
|
69
|
+
# automatically.
|
70
|
+
:fields => ['Id'],
|
71
|
+
:predicates => [
|
72
|
+
{:field => 'Id', :operator => 'IN', :values => conversion_ids}
|
73
|
+
]
|
74
|
+
}
|
75
|
+
conv_tracker_response = conv_tracker_srv.get(selector)
|
76
|
+
if conv_tracker_response and conv_tracker_response[:entries]
|
77
|
+
conversions = conv_tracker_response[:entries]
|
78
|
+
end
|
77
79
|
end
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
80
|
+
puts "User list with name '%s' and ID %d was added." %
|
81
|
+
[user_list[:name], user_list[:id]]
|
82
|
+
# Display user list associated conversion code snippets.
|
83
|
+
if conversions
|
84
|
+
conversions.each do |conversion|
|
85
|
+
puts "Conversion type code snipped associated to the list:\n\t\t%s\n" %
|
86
|
+
conversion[:snippet]
|
87
|
+
end
|
86
88
|
end
|
89
|
+
else
|
90
|
+
puts 'No user lists were added.'
|
87
91
|
end
|
88
92
|
end
|
89
93
|
|
90
94
|
if __FILE__ == $0
|
91
|
-
API_VERSION = :
|
95
|
+
API_VERSION = :v201306
|
92
96
|
|
93
97
|
begin
|
94
98
|
add_audience()
|
95
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
|
+
|
96
108
|
# HTTP errors.
|
97
109
|
rescue AdsCommon::Errors::HttpError => e
|
98
110
|
puts "HTTP Error: %s" % e
|
@@ -47,7 +47,6 @@ def add_conversion_tracker()
|
|
47
47
|
(Time.new.to_f * 1000).to_i,
|
48
48
|
:category => 'DEFAULT',
|
49
49
|
:markup_language => 'HTML',
|
50
|
-
:http_protocol => 'HTTP',
|
51
50
|
:text_format => 'HIDDEN',
|
52
51
|
# Optional fields:
|
53
52
|
:status => 'ENABLED',
|
@@ -63,18 +62,30 @@ def add_conversion_tracker()
|
|
63
62
|
|
64
63
|
# Add conversion.
|
65
64
|
response = conv_tracker_srv.mutate([operation])
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
65
|
+
if response and response[:value]
|
66
|
+
conversion = response[:value].first
|
67
|
+
puts ("Conversion with ID %d, name '%s', status '%s' and category '%s'" +
|
68
|
+
" was added.") % [conversion[:id], conversion[:name],
|
69
|
+
conversion[:status], conversion[:category]]
|
70
|
+
else
|
71
|
+
puts 'No conversions were added.'
|
72
|
+
end
|
70
73
|
end
|
71
74
|
|
72
75
|
if __FILE__ == $0
|
73
|
-
API_VERSION = :
|
76
|
+
API_VERSION = :v201306
|
74
77
|
|
75
78
|
begin
|
76
79
|
add_conversion_tracker()
|
77
80
|
|
81
|
+
# Authorization error.
|
82
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
83
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
84
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
85
|
+
"to retrieve and store OAuth2 tokens."
|
86
|
+
puts "See this wiki page for more details:\n\n " +
|
87
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
88
|
+
|
78
89
|
# HTTP errors.
|
79
90
|
rescue AdsCommon::Errors::HttpError => e
|
80
91
|
puts "HTTP Error: %s" % e
|
@@ -61,13 +61,21 @@ def download_criteria_report(file_name)
|
|
61
61
|
end
|
62
62
|
|
63
63
|
if __FILE__ == $0
|
64
|
-
API_VERSION = :
|
64
|
+
API_VERSION = :v201306
|
65
65
|
|
66
66
|
begin
|
67
67
|
# File name to write report to.
|
68
68
|
file_name = 'INSERT_OUTPUT_FILE_NAME_HERE'
|
69
69
|
download_criteria_report(file_name)
|
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
|
@@ -81,12 +81,20 @@ def get_campaign_stats()
|
|
81
81
|
end
|
82
82
|
|
83
83
|
if __FILE__ == $0
|
84
|
-
API_VERSION = :
|
84
|
+
API_VERSION = :v201306
|
85
85
|
PAGE_SIZE = 500
|
86
86
|
|
87
87
|
begin
|
88
88
|
get_campaign_stats()
|
89
89
|
|
90
|
+
# Authorization error.
|
91
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
92
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
93
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
94
|
+
"to retrieve and store OAuth2 tokens."
|
95
|
+
puts "See this wiki page for more details:\n\n " +
|
96
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
97
|
+
|
90
98
|
# HTTP errors.
|
91
99
|
rescue AdsCommon::Errors::HttpError => e
|
92
100
|
puts "HTTP Error: %s" % e
|
@@ -47,12 +47,20 @@ def get_report_fields(report_type)
|
|
47
47
|
end
|
48
48
|
|
49
49
|
if __FILE__ == $0
|
50
|
-
API_VERSION = :
|
50
|
+
API_VERSION = :v201306
|
51
51
|
|
52
52
|
begin
|
53
53
|
report_type = 'INSERT_REPORT_TYPE_HERE'
|
54
54
|
get_report_fields(report_type)
|
55
55
|
|
56
|
+
# Authorization error.
|
57
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
58
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
59
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
60
|
+
"to retrieve and store OAuth2 tokens."
|
61
|
+
puts "See this wiki page for more details:\n\n " +
|
62
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
63
|
+
|
56
64
|
# HTTP errors.
|
57
65
|
rescue AdsCommon::Errors::HttpError => e
|
58
66
|
puts "HTTP Error: %s" % e
|
@@ -46,10 +46,7 @@ def add_campaign_targeting_criteria(campaign_id)
|
|
46
46
|
# Language criteria. The IDs can be found in the documentation or retrieved
|
47
47
|
# with the ConstantDataService.
|
48
48
|
{:xsi_type => 'Language', :id => 1000}, # English
|
49
|
-
{:xsi_type => 'Language', :id => 1003}
|
50
|
-
# Platform criteria. The IDs can be found in the documentation.
|
51
|
-
{:xsi_type => 'Platform', :id => 30001}, # Mobile
|
52
|
-
{:xsi_type => 'Platform', :id => 30002} # Tablets
|
49
|
+
{:xsi_type => 'Language', :id => 1003} # Spanish
|
53
50
|
]
|
54
51
|
|
55
52
|
# Create operations.
|
@@ -86,12 +83,20 @@ def add_campaign_targeting_criteria(campaign_id)
|
|
86
83
|
end
|
87
84
|
|
88
85
|
if __FILE__ == $0
|
89
|
-
API_VERSION = :
|
86
|
+
API_VERSION = :v201306
|
90
87
|
|
91
88
|
begin
|
92
89
|
campaign_id = 'INSERT_CAMPAIGN_ID_HERE'
|
93
90
|
add_campaign_targeting_criteria(campaign_id)
|
94
91
|
|
92
|
+
# Authorization error.
|
93
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
94
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
95
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
96
|
+
"to retrieve and store OAuth2 tokens."
|
97
|
+
puts "See this wiki page for more details:\n\n " +
|
98
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
99
|
+
|
95
100
|
# HTTP errors.
|
96
101
|
rescue AdsCommon::Errors::HttpError => e
|
97
102
|
puts "HTTP Error: %s" % e
|
@@ -78,7 +78,7 @@ def get_campaign_targeting_criteria(campaign_id)
|
|
78
78
|
end
|
79
79
|
|
80
80
|
if __FILE__ == $0
|
81
|
-
API_VERSION = :
|
81
|
+
API_VERSION = :v201306
|
82
82
|
PAGE_SIZE = 500
|
83
83
|
|
84
84
|
begin
|
@@ -86,6 +86,14 @@ if __FILE__ == $0
|
|
86
86
|
campaign_id = 'INSERT_CAMPAIGN_ID_HERE'.to_i
|
87
87
|
get_campaign_targeting_criteria(campaign_id)
|
88
88
|
|
89
|
+
# Authorization error.
|
90
|
+
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
91
|
+
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
|
92
|
+
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
|
93
|
+
"to retrieve and store OAuth2 tokens."
|
94
|
+
puts "See this wiki page for more details:\n\n " +
|
95
|
+
'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
|
96
|
+
|
89
97
|
# HTTP errors.
|
90
98
|
rescue AdsCommon::Errors::HttpError => e
|
91
99
|
puts "HTTP Error: %s" % e
|
@@ -52,18 +52,30 @@ def get_targetable_languages_and_carriers()
|
|
52
52
|
# Get all carriers from ConstantDataService.
|
53
53
|
carriers = constant_data_srv.get_carrier_criterion()
|
54
54
|
|
55
|
-
carriers
|
56
|
-
|
57
|
-
|
55
|
+
if carriers
|
56
|
+
carriers.each do |carrier|
|
57
|
+
puts "Carrier name is '%s', ID is %d and country code is '%s'." %
|
58
|
+
[carrier[:name], carrier[:id], carrier[:country_code]]
|
59
|
+
end
|
60
|
+
else
|
61
|
+
puts 'No carriers were retrieved.'
|
58
62
|
end
|
59
63
|
end
|
60
64
|
|
61
65
|
if __FILE__ == $0
|
62
|
-
API_VERSION = :
|
66
|
+
API_VERSION = :v201306
|
63
67
|
|
64
68
|
begin
|
65
69
|
get_targetable_languages_and_carriers()
|
66
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
|
+
|
67
79
|
# HTTP errors.
|
68
80
|
rescue AdsCommon::Errors::HttpError => e
|
69
81
|
puts "HTTP Error: %s" % e
|
@@ -81,11 +81,19 @@ def lookup_location()
|
|
81
81
|
end
|
82
82
|
|
83
83
|
if __FILE__ == $0
|
84
|
-
API_VERSION = :
|
84
|
+
API_VERSION = :v201306
|
85
85
|
|
86
86
|
begin
|
87
87
|
lookup_location()
|
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
|