google-adx-buyer-api 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/ChangeLog +4 -0
  2. data/README +3 -3
  3. data/examples/v201209/account_management/get_account_changes.rb +137 -0
  4. data/examples/v201209/basic_operations/add_ad_group.rb +88 -0
  5. data/examples/v201209/basic_operations/add_campaign.rb +105 -0
  6. data/examples/v201209/basic_operations/add_placements.rb +99 -0
  7. data/examples/v201209/basic_operations/add_thirdparty_redirect_ad.rb +126 -0
  8. data/examples/v201209/basic_operations/delete_ad.rb +80 -0
  9. data/examples/{v201206/reporting/download_defined_report.rb → v201209/basic_operations/delete_ad_group.rb} +21 -12
  10. data/examples/v201209/basic_operations/delete_campaign.rb +77 -0
  11. data/examples/v201209/basic_operations/delete_placement.rb +86 -0
  12. data/examples/v201209/basic_operations/get_ad_groups.rb +80 -0
  13. data/examples/v201209/basic_operations/get_campaigns.rb +77 -0
  14. data/examples/v201209/basic_operations/get_placements.rb +92 -0
  15. data/examples/v201209/basic_operations/get_thirdparty_redirect_ads.rb +100 -0
  16. data/examples/v201209/basic_operations/pause_ad.rb +81 -0
  17. data/examples/v201209/basic_operations/update_ad_group.rb +76 -0
  18. data/examples/v201209/basic_operations/update_campaign.rb +79 -0
  19. data/examples/v201209/basic_operations/update_placement.rb +94 -0
  20. data/examples/v201209/campaign_management/add_placements_in_bulk.rb +151 -0
  21. data/examples/v201209/campaign_management/get_all_disapproved_ads.rb +92 -0
  22. data/examples/v201209/error_handling/handle_captcha_challenge.rb +93 -0
  23. data/examples/v201209/error_handling/handle_partial_failures.rb +117 -0
  24. data/examples/v201209/error_handling/handle_policy_violation_error.rb +138 -0
  25. data/examples/v201209/error_handling/handle_two_factor_authorization_error.rb +87 -0
  26. data/examples/v201209/misc/get_all_images_and_videos.rb +101 -0
  27. data/examples/v201209/misc/upload_image.rb +87 -0
  28. data/examples/v201209/misc/use_oauth.rb +97 -0
  29. data/examples/v201209/optimization/get_placement_ideas.rb +106 -0
  30. data/examples/v201209/remarketing/add_audience.rb +111 -0
  31. data/examples/v201209/remarketing/add_conversion_tracker.rb +93 -0
  32. data/examples/v201209/reporting/download_criteria_report.rb +79 -0
  33. data/examples/v201209/reporting/get_campaign_stats.rb +105 -0
  34. data/examples/{v201206/reporting/get_defined_reports.rb → v201209/reporting/get_report_fields.rb} +13 -17
  35. data/examples/v201209/reporting/parallel_report_download.rb +159 -0
  36. data/examples/v201209/targeting/add_campaign_targeting_criteria.rb +110 -0
  37. data/examples/v201209/targeting/get_campaign_targeting_criteria.rb +104 -0
  38. data/examples/v201209/targeting/get_targetable_languages_and_carriers.rb +82 -0
  39. data/examples/v201209/targeting/lookup_location.rb +104 -0
  40. metadata +89 -34
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env ruby
2
+ # Encoding: utf-8
3
+ #
4
+ # Author:: api.dklimkin@gmail.com (Danial Klimkin)
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 gets location criteria by name.
22
+ #
23
+ # Tags: LocationCriterionService.get
24
+
25
+ require 'adwords_api'
26
+
27
+ def lookup_location()
28
+ # AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
29
+ # when called without parameters.
30
+ adwords = AdwordsApi::Api.new
31
+
32
+ # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
33
+ # the configuration file or provide your own logger:
34
+ # adwords.logger = Logger.new('adwords_xml.log')
35
+
36
+ location_criterion_srv =
37
+ adwords.service(:LocationCriterionService, API_VERSION)
38
+
39
+ # List of locations to look up.
40
+ location_names = ['Paris', 'Quebec', 'Spain', 'Deutschland']
41
+ # Locale to retrieve names in.
42
+ locale = 'en'
43
+
44
+ # Get the criteria by names.
45
+ selector = {
46
+ :fields => ['Id', 'LocationName', 'CanonicalName', 'DisplayType',
47
+ 'ParentLocations', 'Reach', 'TargetingStatus'],
48
+ :predicates => [
49
+ # Location names must match exactly, only EQUALS and IN are supported.
50
+ {:field => 'LocationName',
51
+ :operator => 'IN',
52
+ :values => location_names},
53
+ # Set the locale of the returned location names.
54
+ {:field => 'Locale', :operator => 'EQUALS', :values => [locale]}
55
+ ]
56
+ }
57
+ criteria = location_criterion_srv.get(selector)
58
+
59
+ if criteria
60
+ criteria.each do |criterion|
61
+ # Extract all parent location names as one comma-separated string.
62
+ parent_location = if criterion[:location][:parent_locations] and
63
+ !criterion[:location][:parent_locations].empty?
64
+ locations_array = criterion[:location][:parent_locations].map do |loc|
65
+ loc[:location_name]
66
+ end
67
+ locations_array.join(', ')
68
+ else
69
+ 'N/A'
70
+ end
71
+ puts ("The search term '%s' returned the location '%s' of type '%s' " +
72
+ "with ID %d, parent locations '%s' and reach %d (%s)") %
73
+ [criterion[:search_term], criterion[:location][:location_name],
74
+ criterion[:location][:criterion_type], criterion[:location][:id],
75
+ parent_location, criterion[:reach],
76
+ criterion[:location][:targeting_status]]
77
+ end
78
+ else
79
+ puts 'No criteria were returned.'
80
+ end
81
+ end
82
+
83
+ if __FILE__ == $0
84
+ API_VERSION = :v201209
85
+
86
+ begin
87
+ lookup_location()
88
+
89
+ # HTTP errors.
90
+ rescue AdsCommon::Errors::HttpError => e
91
+ puts "HTTP Error: %s" % e
92
+
93
+ # API errors.
94
+ rescue AdwordsApi::Errors::ApiException => e
95
+ puts "Message: %s" % e.message
96
+ puts 'Errors:'
97
+ e.errors.each_with_index do |error, index|
98
+ puts "\tError [%d]:" % (index + 1)
99
+ error.each do |field, value|
100
+ puts "\t\t%s: %s" % [field, value]
101
+ end
102
+ end
103
+ end
104
+ end
metadata CHANGED
@@ -1,40 +1,48 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: google-adx-buyer-api
3
- version: !ruby/object:Gem::Version
4
- version: 0.4.3
3
+ version: !ruby/object:Gem::Version
4
+ hash: 7
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 4
9
+ - 4
10
+ version: 0.4.4
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Danial Klimkin
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-08-03 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2012-10-16 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: google-adwords-api
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: 0.6.3
22
- type: :runtime
23
22
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
23
+ requirement: &id001 !ruby/object:Gem::Requirement
25
24
  none: false
26
- requirements:
25
+ requirements:
27
26
  - - ~>
28
- - !ruby/object:Gem::Version
29
- version: 0.6.3
30
- description: AdWords API and DoubleClick Ad Exchange Buyer API client library for
31
- Ruby
32
- email:
27
+ - !ruby/object:Gem::Version
28
+ hash: 1
29
+ segments:
30
+ - 0
31
+ - 7
32
+ - 1
33
+ version: 0.7.1
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ description: AdWords API and DoubleClick Ad Exchange Buyer API client library for Ruby
37
+ email:
33
38
  - api.dklimkin@gmail.com
34
39
  executables: []
40
+
35
41
  extensions: []
42
+
36
43
  extra_rdoc_files: []
37
- files:
44
+
45
+ files:
38
46
  - examples/v201109_1/reporting/download_criteria_report.rb
39
47
  - examples/v201109_1/reporting/download_defined_report.rb
40
48
  - examples/v201109_1/reporting/get_defined_reports.rb
@@ -113,9 +121,44 @@ files:
113
121
  - examples/v201109/misc/use_oauth.rb
114
122
  - examples/v201109/remarketing/add_conversion_tracker.rb
115
123
  - examples/v201109/remarketing/add_audience.rb
124
+ - examples/v201209/reporting/download_criteria_report.rb
125
+ - examples/v201209/reporting/get_campaign_stats.rb
126
+ - examples/v201209/reporting/parallel_report_download.rb
127
+ - examples/v201209/reporting/get_report_fields.rb
128
+ - examples/v201209/error_handling/handle_policy_violation_error.rb
129
+ - examples/v201209/error_handling/handle_two_factor_authorization_error.rb
130
+ - examples/v201209/error_handling/handle_captcha_challenge.rb
131
+ - examples/v201209/error_handling/handle_partial_failures.rb
132
+ - examples/v201209/targeting/lookup_location.rb
133
+ - examples/v201209/targeting/get_targetable_languages_and_carriers.rb
134
+ - examples/v201209/targeting/add_campaign_targeting_criteria.rb
135
+ - examples/v201209/targeting/get_campaign_targeting_criteria.rb
136
+ - examples/v201209/campaign_management/add_placements_in_bulk.rb
137
+ - examples/v201209/campaign_management/get_all_disapproved_ads.rb
138
+ - examples/v201209/account_management/get_account_changes.rb
139
+ - examples/v201209/optimization/get_placement_ideas.rb
140
+ - examples/v201209/basic_operations/update_campaign.rb
141
+ - examples/v201209/basic_operations/get_thirdparty_redirect_ads.rb
142
+ - examples/v201209/basic_operations/get_campaigns.rb
143
+ - examples/v201209/basic_operations/get_ad_groups.rb
144
+ - examples/v201209/basic_operations/add_campaign.rb
145
+ - examples/v201209/basic_operations/add_placements.rb
146
+ - examples/v201209/basic_operations/add_ad_group.rb
147
+ - examples/v201209/basic_operations/delete_ad_group.rb
148
+ - examples/v201209/basic_operations/update_placement.rb
149
+ - examples/v201209/basic_operations/delete_ad.rb
150
+ - examples/v201209/basic_operations/add_thirdparty_redirect_ad.rb
151
+ - examples/v201209/basic_operations/update_ad_group.rb
152
+ - examples/v201209/basic_operations/delete_campaign.rb
153
+ - examples/v201209/basic_operations/delete_placement.rb
154
+ - examples/v201209/basic_operations/pause_ad.rb
155
+ - examples/v201209/basic_operations/get_placements.rb
156
+ - examples/v201209/misc/upload_image.rb
157
+ - examples/v201209/misc/get_all_images_and_videos.rb
158
+ - examples/v201209/misc/use_oauth.rb
159
+ - examples/v201209/remarketing/add_conversion_tracker.rb
160
+ - examples/v201209/remarketing/add_audience.rb
116
161
  - examples/v201206/reporting/download_criteria_report.rb
117
- - examples/v201206/reporting/download_defined_report.rb
118
- - examples/v201206/reporting/get_defined_reports.rb
119
162
  - examples/v201206/reporting/get_campaign_stats.rb
120
163
  - examples/v201206/reporting/parallel_report_download.rb
121
164
  - examples/v201206/reporting/get_report_fields.rb
@@ -157,26 +200,38 @@ files:
157
200
  - ChangeLog
158
201
  homepage: http://code.google.com/p/google-api-ads-ruby/
159
202
  licenses: []
203
+
160
204
  post_install_message:
161
205
  rdoc_options: []
162
- require_paths:
206
+
207
+ require_paths:
163
208
  - lib
164
- required_ruby_version: !ruby/object:Gem::Requirement
209
+ required_ruby_version: !ruby/object:Gem::Requirement
165
210
  none: false
166
- requirements:
167
- - - ! '>='
168
- - !ruby/object:Gem::Version
169
- version: '0'
170
- required_rubygems_version: !ruby/object:Gem::Requirement
211
+ requirements:
212
+ - - ">="
213
+ - !ruby/object:Gem::Version
214
+ hash: 3
215
+ segments:
216
+ - 0
217
+ version: "0"
218
+ required_rubygems_version: !ruby/object:Gem::Requirement
171
219
  none: false
172
- requirements:
173
- - - ! '>='
174
- - !ruby/object:Gem::Version
220
+ requirements:
221
+ - - ">="
222
+ - !ruby/object:Gem::Version
223
+ hash: 23
224
+ segments:
225
+ - 1
226
+ - 3
227
+ - 6
175
228
  version: 1.3.6
176
229
  requirements: []
230
+
177
231
  rubyforge_project: google-adx-buyer-api
178
232
  rubygems_version: 1.8.24
179
233
  signing_key:
180
234
  specification_version: 3
181
235
  summary: Ruby examples for DoubleClick Ad Exchange Buyer API
182
236
  test_files: []
237
+