google-adx-buyer-api 0.4.4 → 0.4.5
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 -1
- data/README +12 -9
- data/examples/v201206/campaign_management/add_placements_in_bulk.rb +1 -1
- data/examples/v201209/campaign_management/add_placements_in_bulk.rb +1 -1
- data/examples/v201209/error_handling/handle_two_factor_authorization_error.rb +2 -1
- data/examples/v201209/misc/get_all_images_and_videos.rb +3 -4
- data/examples/v201209/misc/upload_image.rb +11 -9
- data/examples/{v201109_1/misc/use_oauth.rb → v201209/misc/use_oauth2.rb} +24 -24
- data/examples/v201209/misc/{use_oauth.rb → use_oauth2_jwt.rb} +19 -23
- data/examples/v201209/optimization/get_placement_ideas.rb +1 -3
- data/examples/v201209/remarketing/add_audience.rb +27 -23
- data/examples/v201209/remarketing/add_conversion_tracker.rb +8 -4
- data/examples/v201209/targeting/get_targetable_languages_and_carriers.rb +7 -3
- metadata +34 -132
- data/examples/v201109/account_management/get_account_changes.rb +0 -137
- data/examples/v201109/basic_operations/add_ad_group.rb +0 -88
- data/examples/v201109/basic_operations/add_campaign.rb +0 -98
- data/examples/v201109/basic_operations/add_placements.rb +0 -99
- data/examples/v201109/basic_operations/add_thirdparty_redirect_ad.rb +0 -105
- data/examples/v201109/basic_operations/delete_ad.rb +0 -80
- data/examples/v201109/basic_operations/delete_ad_group.rb +0 -76
- data/examples/v201109/basic_operations/delete_campaign.rb +0 -77
- data/examples/v201109/basic_operations/delete_placement.rb +0 -86
- data/examples/v201109/basic_operations/get_ad_groups.rb +0 -80
- data/examples/v201109/basic_operations/get_campaigns.rb +0 -77
- data/examples/v201109/basic_operations/get_placements.rb +0 -92
- data/examples/v201109/basic_operations/get_thirdparty_redirect_ads.rb +0 -100
- data/examples/v201109/basic_operations/pause_ad.rb +0 -81
- data/examples/v201109/basic_operations/update_ad_group.rb +0 -76
- data/examples/v201109/basic_operations/update_campaign.rb +0 -79
- data/examples/v201109/basic_operations/update_placement.rb +0 -94
- data/examples/v201109/campaign_management/add_placements_in_bulk.rb +0 -151
- data/examples/v201109/campaign_management/get_all_disapproved_ads.rb +0 -92
- data/examples/v201109/error_handling/handle_captcha_challenge.rb +0 -93
- data/examples/v201109/error_handling/handle_partial_failures.rb +0 -117
- data/examples/v201109/error_handling/handle_policy_violation_error.rb +0 -138
- data/examples/v201109/error_handling/handle_two_factor_authorization_error.rb +0 -87
- data/examples/v201109/misc/get_all_images_and_videos.rb +0 -101
- data/examples/v201109/misc/upload_image.rb +0 -87
- data/examples/v201109/misc/use_oauth.rb +0 -97
- data/examples/v201109/optimization/get_placement_ideas.rb +0 -106
- data/examples/v201109/remarketing/add_audience.rb +0 -111
- data/examples/v201109/remarketing/add_conversion_tracker.rb +0 -93
- data/examples/v201109/reporting/download_criteria_report.rb +0 -79
- data/examples/v201109/reporting/download_defined_report.rb +0 -67
- data/examples/v201109/reporting/get_campaign_stats.rb +0 -105
- data/examples/v201109/reporting/get_defined_reports.rb +0 -75
- data/examples/v201109/reporting/get_report_fields.rb +0 -71
- data/examples/v201109/reporting/parallel_report_download.rb +0 -159
- data/examples/v201109/targeting/add_campaign_targeting_criteria.rb +0 -110
- data/examples/v201109/targeting/get_campaign_targeting_criteria.rb +0 -104
- data/examples/v201109/targeting/get_targetable_languages_and_carriers.rb +0 -82
- data/examples/v201109/targeting/lookup_location.rb +0 -103
- data/examples/v201109_1/account_management/get_account_changes.rb +0 -137
- data/examples/v201109_1/basic_operations/add_ad_group.rb +0 -88
- data/examples/v201109_1/basic_operations/add_campaign.rb +0 -98
- data/examples/v201109_1/basic_operations/add_placements.rb +0 -99
- data/examples/v201109_1/basic_operations/add_thirdparty_redirect_ad.rb +0 -105
- data/examples/v201109_1/basic_operations/delete_ad.rb +0 -80
- data/examples/v201109_1/basic_operations/delete_ad_group.rb +0 -76
- data/examples/v201109_1/basic_operations/delete_campaign.rb +0 -77
- data/examples/v201109_1/basic_operations/delete_placement.rb +0 -86
- data/examples/v201109_1/basic_operations/get_ad_groups.rb +0 -80
- data/examples/v201109_1/basic_operations/get_campaigns.rb +0 -77
- data/examples/v201109_1/basic_operations/get_placements.rb +0 -92
- data/examples/v201109_1/basic_operations/get_thirdparty_redirect_ads.rb +0 -100
- data/examples/v201109_1/basic_operations/pause_ad.rb +0 -81
- data/examples/v201109_1/basic_operations/update_ad_group.rb +0 -76
- data/examples/v201109_1/basic_operations/update_campaign.rb +0 -79
- data/examples/v201109_1/basic_operations/update_placement.rb +0 -94
- data/examples/v201109_1/campaign_management/add_placements_in_bulk.rb +0 -151
- data/examples/v201109_1/campaign_management/get_all_disapproved_ads.rb +0 -92
- data/examples/v201109_1/error_handling/handle_captcha_challenge.rb +0 -93
- data/examples/v201109_1/error_handling/handle_partial_failures.rb +0 -117
- data/examples/v201109_1/error_handling/handle_policy_violation_error.rb +0 -138
- data/examples/v201109_1/error_handling/handle_two_factor_authorization_error.rb +0 -87
- data/examples/v201109_1/misc/get_all_images_and_videos.rb +0 -101
- data/examples/v201109_1/misc/upload_image.rb +0 -87
- data/examples/v201109_1/optimization/get_placement_ideas.rb +0 -106
- data/examples/v201109_1/remarketing/add_audience.rb +0 -111
- data/examples/v201109_1/remarketing/add_conversion_tracker.rb +0 -93
- data/examples/v201109_1/reporting/download_criteria_report.rb +0 -79
- data/examples/v201109_1/reporting/download_defined_report.rb +0 -67
- data/examples/v201109_1/reporting/get_campaign_stats.rb +0 -105
- data/examples/v201109_1/reporting/get_defined_reports.rb +0 -75
- data/examples/v201109_1/reporting/get_report_fields.rb +0 -71
- data/examples/v201109_1/reporting/parallel_report_download.rb +0 -159
- data/examples/v201109_1/targeting/add_campaign_targeting_criteria.rb +0 -110
- data/examples/v201109_1/targeting/get_campaign_targeting_criteria.rb +0 -104
- data/examples/v201109_1/targeting/get_targetable_languages_and_carriers.rb +0 -82
- data/examples/v201109_1/targeting/lookup_location.rb +0 -103
- data/examples/v201209/reporting/parallel_report_download.rb +0 -159
data/ChangeLog
CHANGED
data/README
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
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
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
It contains full support for v201206 and v201209, with full stubs, and a
|
|
7
|
+
simplified programming interface that lets you handle everything in native
|
|
8
|
+
Ruby collections.
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
= Docs for Users
|
|
@@ -105,13 +105,16 @@ Essentially, all you have to do is follow Ruby conventions, and the library will
|
|
|
105
105
|
do the rest. All of the examples are written following this standard.
|
|
106
106
|
|
|
107
107
|
|
|
108
|
-
=== 2.2 - Using the
|
|
108
|
+
=== 2.2 - Using the Test Account:
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
For testing purposes, obtain a Test Account in the production environment. Any
|
|
111
|
+
request against a Test Account inccurs no API units charge. See this guide for
|
|
112
|
+
more details:
|
|
113
|
+
|
|
114
|
+
https://developers.google.com/adwords/api/docs/test-accounts
|
|
115
|
+
|
|
116
|
+
To use the library against a Test Account, set client_customer_id property in
|
|
117
|
+
the configuration file to its client customer ID.
|
|
115
118
|
|
|
116
119
|
|
|
117
120
|
=== 2.3 - Logging:
|
|
@@ -119,7 +119,7 @@ def add_placements_in_bulk(ad_group_id)
|
|
|
119
119
|
raise StandardError, 'Error retrieving job results; aborting.'
|
|
120
120
|
end
|
|
121
121
|
else
|
|
122
|
-
puts "Job failed to complete after %d retries" %
|
|
122
|
+
puts "Job failed to complete after %d retries" % RETRIES_COUNT
|
|
123
123
|
end
|
|
124
124
|
end
|
|
125
125
|
|
|
@@ -119,7 +119,7 @@ def add_placements_in_bulk(ad_group_id)
|
|
|
119
119
|
raise StandardError, 'Error retrieving job results; aborting.'
|
|
120
120
|
end
|
|
121
121
|
else
|
|
122
|
-
puts "Job failed to complete after %d retries" %
|
|
122
|
+
puts "Job failed to complete after %d retries" % RETRIES_COUNT
|
|
123
123
|
end
|
|
124
124
|
end
|
|
125
125
|
|
|
@@ -29,7 +29,8 @@ def handle_two_factor_authorization_error()
|
|
|
29
29
|
:method => 'ClientLogin',
|
|
30
30
|
:email => '2steptester@gmail.com',
|
|
31
31
|
:password => 'testaccount',
|
|
32
|
-
:user_agent => 'Ruby 2 Factor Sample'
|
|
32
|
+
:user_agent => 'Ruby 2 Factor Sample',
|
|
33
|
+
:developer_token => 'qwerty'
|
|
33
34
|
},
|
|
34
35
|
:service => {
|
|
35
36
|
:environment => 'PRODUCTION'
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
# Tags: MediaService.get
|
|
26
26
|
|
|
27
27
|
require 'adwords_api'
|
|
28
|
-
require 'adwords_api/utils'
|
|
29
28
|
|
|
30
29
|
def get_all_images_and_videos()
|
|
31
30
|
# AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
|
|
@@ -60,10 +59,10 @@ def get_all_images_and_videos()
|
|
|
60
59
|
page = media_srv.get(selector)
|
|
61
60
|
if page[:entries]
|
|
62
61
|
page[:entries].each do |entry|
|
|
63
|
-
|
|
62
|
+
full_dimensions = entry[:dimensions]['FULL']
|
|
64
63
|
puts "Entry ID %d with dimensions %dx%d and MIME type is '%s'" %
|
|
65
|
-
[entry[:media_id],
|
|
66
|
-
|
|
64
|
+
[entry[:media_id], full_dimensions[:height],
|
|
65
|
+
full_dimensions[:width], entry[:mime_type]]
|
|
67
66
|
end
|
|
68
67
|
# Increment values to request the next page.
|
|
69
68
|
offset += PAGE_SIZE
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# Encoding: utf-8
|
|
3
3
|
#
|
|
4
|
-
# Author:: api.
|
|
4
|
+
# Author:: api.dklimkin@gmail.com (Danial Klimkin)
|
|
5
5
|
#
|
|
6
6
|
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
|
|
7
7
|
#
|
|
@@ -18,13 +18,11 @@
|
|
|
18
18
|
# See the License for the specific language governing permissions and
|
|
19
19
|
# limitations under the License.
|
|
20
20
|
#
|
|
21
|
-
# This example uploads an image. To get images, run
|
|
22
|
-
# get_all_images_and_videos.rb.
|
|
21
|
+
# This example uploads an image. To get images, run get_all_images.rb.
|
|
23
22
|
#
|
|
24
23
|
# Tags: MediaService.upload
|
|
25
24
|
|
|
26
25
|
require 'adwords_api'
|
|
27
|
-
require 'adwords_api/utils'
|
|
28
26
|
require 'base64'
|
|
29
27
|
|
|
30
28
|
def upload_image()
|
|
@@ -56,11 +54,15 @@ def upload_image()
|
|
|
56
54
|
|
|
57
55
|
# Upload image.
|
|
58
56
|
response = media_srv.upload([image])
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
if response and !response.empty?
|
|
58
|
+
ret_image = response.first
|
|
59
|
+
full_dimensions = ret_image[:dimensions]['FULL']
|
|
60
|
+
puts ("Image with ID %d, dimensions %dx%d and MIME type '%s' uploaded " +
|
|
61
|
+
"successfully.") % [ret_image[:media_id], full_dimensions[:height],
|
|
62
|
+
full_dimensions[:width], ret_image[:mime_type]]
|
|
63
|
+
else
|
|
64
|
+
puts 'No images uploaded.'
|
|
65
|
+
end
|
|
64
66
|
end
|
|
65
67
|
|
|
66
68
|
if __FILE__ == $0
|
|
@@ -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,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 use
|
|
21
|
+
# This example illustrates how to use OAuth2.0 authentication method.
|
|
22
22
|
#
|
|
23
23
|
# Tags: CampaignService.get
|
|
24
24
|
|
|
25
25
|
require 'adwords_api'
|
|
26
26
|
|
|
27
|
-
def
|
|
27
|
+
def use_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
|
|
@@ -33,6 +33,24 @@ def use_oauth()
|
|
|
33
33
|
# the configuration file or provide your own logger:
|
|
34
34
|
# adwords.logger = Logger.new('adwords_xml.log')
|
|
35
35
|
|
|
36
|
+
# You can call authorize explicitely to obtain the access token. Otherwise, it
|
|
37
|
+
# will be invoked automatically on the first API call.
|
|
38
|
+
# There are two ways to provide verification code, first one is via the block:
|
|
39
|
+
token = adwords.authorize() do |auth_url|
|
|
40
|
+
puts "Hit Auth error, please navigate to URL:\n\t%s" % auth_url
|
|
41
|
+
print 'log in and type the verification code: '
|
|
42
|
+
verification_code = gets.chomp
|
|
43
|
+
verification_code
|
|
44
|
+
end
|
|
45
|
+
# Alternatively, you can provide one within the parameters:
|
|
46
|
+
#token = adwords.authorize({:oauth2_verification_code => verification_code})
|
|
47
|
+
|
|
48
|
+
# Note, 'token' is a Hash. Its value is not used in this example. If you need
|
|
49
|
+
# to be able to access the API in offline mode, with no user present, you
|
|
50
|
+
# should persist it to be used in subsequent invocations like this:
|
|
51
|
+
#adwords.authorize({:oauth2_token => token})
|
|
52
|
+
|
|
53
|
+
# No exception thrown - we are good to make the request.
|
|
36
54
|
campaign_srv = adwords.service(:CampaignService, API_VERSION)
|
|
37
55
|
|
|
38
56
|
# Get all the campaigns for this account; empty selector.
|
|
@@ -43,24 +61,7 @@ def use_oauth()
|
|
|
43
61
|
]
|
|
44
62
|
}
|
|
45
63
|
|
|
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
|
-
|
|
64
|
+
response = campaign_srv.get(selector)
|
|
64
65
|
if response and response[:entries]
|
|
65
66
|
campaigns = response[:entries]
|
|
66
67
|
campaigns.each do |campaign|
|
|
@@ -73,11 +74,10 @@ def use_oauth()
|
|
|
73
74
|
end
|
|
74
75
|
|
|
75
76
|
if __FILE__ == $0
|
|
76
|
-
API_VERSION = :
|
|
77
|
-
MAX_RETRIES = 3
|
|
77
|
+
API_VERSION = :v201209
|
|
78
78
|
|
|
79
79
|
begin
|
|
80
|
-
|
|
80
|
+
use_oauth2()
|
|
81
81
|
|
|
82
82
|
# HTTP errors.
|
|
83
83
|
rescue AdsCommon::Errors::HttpError => e
|
|
@@ -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|
|
|
@@ -74,10 +71,9 @@ end
|
|
|
74
71
|
|
|
75
72
|
if __FILE__ == $0
|
|
76
73
|
API_VERSION = :v201209
|
|
77
|
-
MAX_RETRIES = 3
|
|
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." %
|
|
@@ -58,32 +58,36 @@ 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
|
|
|
@@ -63,10 +63,14 @@ def add_conversion_tracker()
|
|
|
63
63
|
|
|
64
64
|
# Add conversion.
|
|
65
65
|
response = conv_tracker_srv.mutate([operation])
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
if response and response[:value]
|
|
67
|
+
conversion = response[:value].first
|
|
68
|
+
puts ("Conversion with ID %d, name '%s', status '%s' and category '%s'" +
|
|
69
|
+
" was added.") % [conversion[:id], conversion[:name],
|
|
70
|
+
conversion[:status], conversion[:category]]
|
|
71
|
+
else
|
|
72
|
+
puts 'No conversions were added.'
|
|
73
|
+
end
|
|
70
74
|
end
|
|
71
75
|
|
|
72
76
|
if __FILE__ == $0
|
|
@@ -52,9 +52,13 @@ 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
|
|
metadata
CHANGED
|
@@ -1,129 +1,42 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: google-adx-buyer-api
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.4.5
|
|
5
5
|
prerelease:
|
|
6
|
-
segments:
|
|
7
|
-
- 0
|
|
8
|
-
- 4
|
|
9
|
-
- 4
|
|
10
|
-
version: 0.4.4
|
|
11
6
|
platform: ruby
|
|
12
|
-
authors:
|
|
7
|
+
authors:
|
|
13
8
|
- Danial Klimkin
|
|
14
9
|
autorequire:
|
|
15
10
|
bindir: bin
|
|
16
11
|
cert_chain: []
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- !ruby/object:Gem::Dependency
|
|
12
|
+
date: 2013-02-20 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
21
15
|
name: google-adwords-api
|
|
22
|
-
|
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
24
17
|
none: false
|
|
25
|
-
requirements:
|
|
18
|
+
requirements:
|
|
26
19
|
- - ~>
|
|
27
|
-
- !ruby/object:Gem::Version
|
|
28
|
-
|
|
29
|
-
segments:
|
|
30
|
-
- 0
|
|
31
|
-
- 7
|
|
32
|
-
- 1
|
|
33
|
-
version: 0.7.1
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: 0.8.1
|
|
34
22
|
type: :runtime
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
26
|
+
requirements:
|
|
27
|
+
- - ~>
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: 0.8.1
|
|
30
|
+
description: AdWords API and DoubleClick Ad Exchange Buyer API client library for
|
|
31
|
+
Ruby
|
|
32
|
+
email:
|
|
38
33
|
- api.dklimkin@gmail.com
|
|
39
34
|
executables: []
|
|
40
|
-
|
|
41
35
|
extensions: []
|
|
42
|
-
|
|
43
36
|
extra_rdoc_files: []
|
|
44
|
-
|
|
45
|
-
files:
|
|
46
|
-
- examples/v201109_1/reporting/download_criteria_report.rb
|
|
47
|
-
- examples/v201109_1/reporting/download_defined_report.rb
|
|
48
|
-
- examples/v201109_1/reporting/get_defined_reports.rb
|
|
49
|
-
- examples/v201109_1/reporting/get_campaign_stats.rb
|
|
50
|
-
- examples/v201109_1/reporting/parallel_report_download.rb
|
|
51
|
-
- examples/v201109_1/reporting/get_report_fields.rb
|
|
52
|
-
- examples/v201109_1/error_handling/handle_policy_violation_error.rb
|
|
53
|
-
- examples/v201109_1/error_handling/handle_two_factor_authorization_error.rb
|
|
54
|
-
- examples/v201109_1/error_handling/handle_captcha_challenge.rb
|
|
55
|
-
- examples/v201109_1/error_handling/handle_partial_failures.rb
|
|
56
|
-
- examples/v201109_1/targeting/lookup_location.rb
|
|
57
|
-
- examples/v201109_1/targeting/get_targetable_languages_and_carriers.rb
|
|
58
|
-
- examples/v201109_1/targeting/add_campaign_targeting_criteria.rb
|
|
59
|
-
- examples/v201109_1/targeting/get_campaign_targeting_criteria.rb
|
|
60
|
-
- examples/v201109_1/campaign_management/add_placements_in_bulk.rb
|
|
61
|
-
- examples/v201109_1/campaign_management/get_all_disapproved_ads.rb
|
|
62
|
-
- examples/v201109_1/account_management/get_account_changes.rb
|
|
63
|
-
- examples/v201109_1/optimization/get_placement_ideas.rb
|
|
64
|
-
- examples/v201109_1/basic_operations/update_campaign.rb
|
|
65
|
-
- examples/v201109_1/basic_operations/get_thirdparty_redirect_ads.rb
|
|
66
|
-
- examples/v201109_1/basic_operations/get_campaigns.rb
|
|
67
|
-
- examples/v201109_1/basic_operations/get_ad_groups.rb
|
|
68
|
-
- examples/v201109_1/basic_operations/add_campaign.rb
|
|
69
|
-
- examples/v201109_1/basic_operations/add_placements.rb
|
|
70
|
-
- examples/v201109_1/basic_operations/add_ad_group.rb
|
|
71
|
-
- examples/v201109_1/basic_operations/delete_ad_group.rb
|
|
72
|
-
- examples/v201109_1/basic_operations/update_placement.rb
|
|
73
|
-
- examples/v201109_1/basic_operations/delete_ad.rb
|
|
74
|
-
- examples/v201109_1/basic_operations/add_thirdparty_redirect_ad.rb
|
|
75
|
-
- examples/v201109_1/basic_operations/update_ad_group.rb
|
|
76
|
-
- examples/v201109_1/basic_operations/delete_campaign.rb
|
|
77
|
-
- examples/v201109_1/basic_operations/delete_placement.rb
|
|
78
|
-
- examples/v201109_1/basic_operations/pause_ad.rb
|
|
79
|
-
- examples/v201109_1/basic_operations/get_placements.rb
|
|
80
|
-
- examples/v201109_1/misc/upload_image.rb
|
|
81
|
-
- examples/v201109_1/misc/get_all_images_and_videos.rb
|
|
82
|
-
- examples/v201109_1/misc/use_oauth.rb
|
|
83
|
-
- examples/v201109_1/remarketing/add_conversion_tracker.rb
|
|
84
|
-
- examples/v201109_1/remarketing/add_audience.rb
|
|
85
|
-
- examples/v201109/reporting/download_criteria_report.rb
|
|
86
|
-
- examples/v201109/reporting/download_defined_report.rb
|
|
87
|
-
- examples/v201109/reporting/get_defined_reports.rb
|
|
88
|
-
- examples/v201109/reporting/get_campaign_stats.rb
|
|
89
|
-
- examples/v201109/reporting/parallel_report_download.rb
|
|
90
|
-
- examples/v201109/reporting/get_report_fields.rb
|
|
91
|
-
- examples/v201109/error_handling/handle_policy_violation_error.rb
|
|
92
|
-
- examples/v201109/error_handling/handle_two_factor_authorization_error.rb
|
|
93
|
-
- examples/v201109/error_handling/handle_captcha_challenge.rb
|
|
94
|
-
- examples/v201109/error_handling/handle_partial_failures.rb
|
|
95
|
-
- examples/v201109/targeting/lookup_location.rb
|
|
96
|
-
- examples/v201109/targeting/get_targetable_languages_and_carriers.rb
|
|
97
|
-
- examples/v201109/targeting/add_campaign_targeting_criteria.rb
|
|
98
|
-
- examples/v201109/targeting/get_campaign_targeting_criteria.rb
|
|
99
|
-
- examples/v201109/campaign_management/add_placements_in_bulk.rb
|
|
100
|
-
- examples/v201109/campaign_management/get_all_disapproved_ads.rb
|
|
101
|
-
- examples/v201109/account_management/get_account_changes.rb
|
|
102
|
-
- examples/v201109/optimization/get_placement_ideas.rb
|
|
103
|
-
- examples/v201109/basic_operations/update_campaign.rb
|
|
104
|
-
- examples/v201109/basic_operations/get_thirdparty_redirect_ads.rb
|
|
105
|
-
- examples/v201109/basic_operations/get_campaigns.rb
|
|
106
|
-
- examples/v201109/basic_operations/get_ad_groups.rb
|
|
107
|
-
- examples/v201109/basic_operations/add_campaign.rb
|
|
108
|
-
- examples/v201109/basic_operations/add_placements.rb
|
|
109
|
-
- examples/v201109/basic_operations/add_ad_group.rb
|
|
110
|
-
- examples/v201109/basic_operations/delete_ad_group.rb
|
|
111
|
-
- examples/v201109/basic_operations/update_placement.rb
|
|
112
|
-
- examples/v201109/basic_operations/delete_ad.rb
|
|
113
|
-
- examples/v201109/basic_operations/add_thirdparty_redirect_ad.rb
|
|
114
|
-
- examples/v201109/basic_operations/update_ad_group.rb
|
|
115
|
-
- examples/v201109/basic_operations/delete_campaign.rb
|
|
116
|
-
- examples/v201109/basic_operations/delete_placement.rb
|
|
117
|
-
- examples/v201109/basic_operations/pause_ad.rb
|
|
118
|
-
- examples/v201109/basic_operations/get_placements.rb
|
|
119
|
-
- examples/v201109/misc/upload_image.rb
|
|
120
|
-
- examples/v201109/misc/get_all_images_and_videos.rb
|
|
121
|
-
- examples/v201109/misc/use_oauth.rb
|
|
122
|
-
- examples/v201109/remarketing/add_conversion_tracker.rb
|
|
123
|
-
- examples/v201109/remarketing/add_audience.rb
|
|
37
|
+
files:
|
|
124
38
|
- examples/v201209/reporting/download_criteria_report.rb
|
|
125
39
|
- examples/v201209/reporting/get_campaign_stats.rb
|
|
126
|
-
- examples/v201209/reporting/parallel_report_download.rb
|
|
127
40
|
- examples/v201209/reporting/get_report_fields.rb
|
|
128
41
|
- examples/v201209/error_handling/handle_policy_violation_error.rb
|
|
129
42
|
- examples/v201209/error_handling/handle_two_factor_authorization_error.rb
|
|
@@ -154,8 +67,9 @@ files:
|
|
|
154
67
|
- examples/v201209/basic_operations/pause_ad.rb
|
|
155
68
|
- examples/v201209/basic_operations/get_placements.rb
|
|
156
69
|
- examples/v201209/misc/upload_image.rb
|
|
70
|
+
- examples/v201209/misc/use_oauth2_jwt.rb
|
|
157
71
|
- examples/v201209/misc/get_all_images_and_videos.rb
|
|
158
|
-
- examples/v201209/misc/
|
|
72
|
+
- examples/v201209/misc/use_oauth2.rb
|
|
159
73
|
- examples/v201209/remarketing/add_conversion_tracker.rb
|
|
160
74
|
- examples/v201209/remarketing/add_audience.rb
|
|
161
75
|
- examples/v201206/reporting/download_criteria_report.rb
|
|
@@ -200,38 +114,26 @@ files:
|
|
|
200
114
|
- ChangeLog
|
|
201
115
|
homepage: http://code.google.com/p/google-api-ads-ruby/
|
|
202
116
|
licenses: []
|
|
203
|
-
|
|
204
117
|
post_install_message:
|
|
205
118
|
rdoc_options: []
|
|
206
|
-
|
|
207
|
-
require_paths:
|
|
119
|
+
require_paths:
|
|
208
120
|
- lib
|
|
209
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
210
122
|
none: false
|
|
211
|
-
requirements:
|
|
212
|
-
- -
|
|
213
|
-
- !ruby/object:Gem::Version
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
- 0
|
|
217
|
-
version: "0"
|
|
218
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
|
+
requirements:
|
|
124
|
+
- - ! '>='
|
|
125
|
+
- !ruby/object:Gem::Version
|
|
126
|
+
version: '0'
|
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
128
|
none: false
|
|
220
|
-
requirements:
|
|
221
|
-
- -
|
|
222
|
-
- !ruby/object:Gem::Version
|
|
223
|
-
hash: 23
|
|
224
|
-
segments:
|
|
225
|
-
- 1
|
|
226
|
-
- 3
|
|
227
|
-
- 6
|
|
129
|
+
requirements:
|
|
130
|
+
- - ! '>='
|
|
131
|
+
- !ruby/object:Gem::Version
|
|
228
132
|
version: 1.3.6
|
|
229
133
|
requirements: []
|
|
230
|
-
|
|
231
134
|
rubyforge_project: google-adx-buyer-api
|
|
232
135
|
rubygems_version: 1.8.24
|
|
233
136
|
signing_key:
|
|
234
137
|
specification_version: 3
|
|
235
138
|
summary: Ruby examples for DoubleClick Ad Exchange Buyer API
|
|
236
139
|
test_files: []
|
|
237
|
-
|