google-adwords-api 0.14.2 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +8 -8
  2. data/ChangeLog +7 -0
  3. data/README.md +3 -3
  4. data/adwords_api.yml +5 -0
  5. data/examples/v201409/account_management/get_account_hierarchy.rb +2 -2
  6. data/examples/v201409/advanced_operations/{add_ad_customizer.rb → add_ad_customizers.rb} +4 -4
  7. data/examples/v201409/extensions/add_site_links_using_feeds.rb +12 -12
  8. data/examples/v201409/migration/migrate_to_extension_settings.rb +29 -2
  9. data/examples/v201409/reporting/parallel_report_download.rb +1 -1
  10. data/examples/v201502/advanced_operations/{add_ad_customizer.rb → add_ad_customizers.rb} +37 -125
  11. data/examples/v201502/extensions/add_site_links_using_feeds.rb +22 -52
  12. data/examples/v201502/migration/migrate_to_extension_settings.rb +29 -2
  13. data/lib/adwords_api.rb +9 -29
  14. data/lib/adwords_api/api_config.rb +0 -80
  15. data/lib/adwords_api/credential_handler.rb +8 -9
  16. data/lib/adwords_api/report_header_handler.rb +6 -2
  17. data/lib/adwords_api/version.rb +1 -1
  18. data/test/adwords_api/test_adwords_api.rb +0 -9
  19. data/test/adwords_api/test_api_config.rb +8 -8
  20. data/test/adwords_api/test_credential_handler.rb +17 -0
  21. data/test/adwords_api/test_report_utils.rb +1 -1
  22. data/test/templates/v201409/basic_operations_get_campaigns.def +1 -1
  23. data/test/templates/v201409/misc_use_oauth2_jwt.def +1 -1
  24. data/test/templates/v201502/basic_operations_get_campaigns.def +1 -1
  25. data/test/templates/v201502/misc_use_oauth2_jwt.def +1 -1
  26. metadata +4 -153
  27. data/examples/v201406/account_management/create_account.rb +0 -92
  28. data/examples/v201406/account_management/get_account_alerts.rb +0 -122
  29. data/examples/v201406/account_management/get_account_changes.rb +0 -145
  30. data/examples/v201406/account_management/get_account_hierarchy.rb +0 -103
  31. data/examples/v201406/advanced_operations/add_ad_customizer.rb +0 -277
  32. data/examples/v201406/advanced_operations/add_ad_group_bid_modifier.rb +0 -105
  33. data/examples/v201406/advanced_operations/add_click_to_download_ad.rb +0 -137
  34. data/examples/v201406/advanced_operations/add_google_my_business_location_extensions.rb +0 -167
  35. data/examples/v201406/advanced_operations/add_site_links.rb +0 -306
  36. data/examples/v201406/advanced_operations/add_text_ad_with_upgraded_urls.rb +0 -137
  37. data/examples/v201406/advanced_operations/get_ad_group_bid_modifiers.rb +0 -106
  38. data/examples/v201406/advanced_operations/upload_offline_conversions.rb +0 -117
  39. data/examples/v201406/advanced_operations/use_shared_bidding_strategy.rb +0 -164
  40. data/examples/v201406/basic_operations/add_ad_groups.rb +0 -144
  41. data/examples/v201406/basic_operations/add_campaigns.rb +0 -153
  42. data/examples/v201406/basic_operations/add_keywords.rb +0 -116
  43. data/examples/v201406/basic_operations/add_text_ads.rb +0 -113
  44. data/examples/v201406/basic_operations/get_ad_groups.rb +0 -106
  45. data/examples/v201406/basic_operations/get_campaigns.rb +0 -101
  46. data/examples/v201406/basic_operations/get_campaigns_with_awql.rb +0 -93
  47. data/examples/v201406/basic_operations/get_keywords.rb +0 -112
  48. data/examples/v201406/basic_operations/get_text_ads.rb +0 -114
  49. data/examples/v201406/basic_operations/pause_ad.rb +0 -92
  50. data/examples/v201406/basic_operations/remove_ad.rb +0 -93
  51. data/examples/v201406/basic_operations/remove_ad_group.rb +0 -89
  52. data/examples/v201406/basic_operations/remove_campaign.rb +0 -91
  53. data/examples/v201406/basic_operations/remove_keyword.rb +0 -98
  54. data/examples/v201406/basic_operations/update_ad_group.rb +0 -89
  55. data/examples/v201406/basic_operations/update_campaign.rb +0 -90
  56. data/examples/v201406/basic_operations/update_keyword.rb +0 -110
  57. data/examples/v201406/campaign_management/add_campaign_labels.rb +0 -86
  58. data/examples/v201406/campaign_management/add_experiment.rb +0 -166
  59. data/examples/v201406/campaign_management/add_keywords_in_bulk.rb +0 -158
  60. data/examples/v201406/campaign_management/add_location_extension.rb +0 -125
  61. data/examples/v201406/campaign_management/get_all_disapproved_ads.rb +0 -101
  62. data/examples/v201406/campaign_management/get_all_disapproved_ads_with_awql.rb +0 -93
  63. data/examples/v201406/campaign_management/get_campaigns_by_label.rb +0 -112
  64. data/examples/v201406/campaign_management/promote_experiment.rb +0 -85
  65. data/examples/v201406/campaign_management/set_ad_parameters.rb +0 -122
  66. data/examples/v201406/campaign_management/set_criterion_bid_modifier.rb +0 -108
  67. data/examples/v201406/campaign_management/validate_text_ad.rb +0 -114
  68. data/examples/v201406/error_handling/handle_captcha_challenge.rb +0 -93
  69. data/examples/v201406/error_handling/handle_partial_failures.rb +0 -134
  70. data/examples/v201406/error_handling/handle_policy_violation_error.rb +0 -145
  71. data/examples/v201406/error_handling/handle_two_factor_authorization_error.rb +0 -88
  72. data/examples/v201406/misc/create_ad_words_session_without_properties_file.rb +0 -94
  73. data/examples/v201406/misc/get_all_images_and_videos.rb +0 -108
  74. data/examples/v201406/misc/setup_oauth2.rb +0 -88
  75. data/examples/v201406/misc/upload_image.rb +0 -97
  76. data/examples/v201406/misc/use_oauth2_jwt.rb +0 -97
  77. data/examples/v201406/optimization/estimate_keyword_traffic.rb +0 -155
  78. data/examples/v201406/optimization/get_keyword_bid_simulations.rb +0 -100
  79. data/examples/v201406/optimization/get_keyword_ideas.rb +0 -130
  80. data/examples/v201406/optimization/get_placement_ideas.rb +0 -112
  81. data/examples/v201406/remarketing/add_audience.rb +0 -123
  82. data/examples/v201406/remarketing/add_conversion_tracker.rb +0 -105
  83. data/examples/v201406/reporting/download_criteria_report.rb +0 -87
  84. data/examples/v201406/reporting/download_criteria_report_with_awql.rb +0 -86
  85. data/examples/v201406/reporting/get_report_fields.rb +0 -79
  86. data/examples/v201406/reporting/parallel_report_download.rb +0 -171
  87. data/examples/v201406/shopping_campaigns/add_product_partition_tree.rb +0 -269
  88. data/examples/v201406/shopping_campaigns/add_product_scope.rb +0 -133
  89. data/examples/v201406/shopping_campaigns/add_shopping_campaign.rb +0 -135
  90. data/examples/v201406/shopping_campaigns/get_product_category_taxonomy.rb +0 -117
  91. data/examples/v201406/shopping_campaigns/set_product_sales_channel.rb +0 -98
  92. data/examples/v201406/targeting/add_campaign_targeting_criteria.rb +0 -173
  93. data/examples/v201406/targeting/add_demographic_targeting_criteria.rb +0 -116
  94. data/examples/v201406/targeting/get_campaign_targeting_criteria.rb +0 -110
  95. data/examples/v201406/targeting/get_targetable_languages_and_carriers.rb +0 -94
  96. data/examples/v201406/targeting/lookup_location.rb +0 -112
  97. data/examples/v201502/campaign_management/add_location_extension.rb +0 -125
  98. data/lib/adwords_api/v201406/ad_group_ad_service.rb +0 -46
  99. data/lib/adwords_api/v201406/ad_group_ad_service_registry.rb +0 -46
  100. data/lib/adwords_api/v201406/ad_group_bid_modifier_service.rb +0 -42
  101. data/lib/adwords_api/v201406/ad_group_bid_modifier_service_registry.rb +0 -46
  102. data/lib/adwords_api/v201406/ad_group_criterion_service.rb +0 -46
  103. data/lib/adwords_api/v201406/ad_group_criterion_service_registry.rb +0 -46
  104. data/lib/adwords_api/v201406/ad_group_feed_service.rb +0 -42
  105. data/lib/adwords_api/v201406/ad_group_feed_service_registry.rb +0 -46
  106. data/lib/adwords_api/v201406/ad_group_service.rb +0 -46
  107. data/lib/adwords_api/v201406/ad_group_service_registry.rb +0 -46
  108. data/lib/adwords_api/v201406/ad_param_service.rb +0 -38
  109. data/lib/adwords_api/v201406/ad_param_service_registry.rb +0 -46
  110. data/lib/adwords_api/v201406/adwords_user_list_service.rb +0 -38
  111. data/lib/adwords_api/v201406/adwords_user_list_service_registry.rb +0 -46
  112. data/lib/adwords_api/v201406/alert_service.rb +0 -34
  113. data/lib/adwords_api/v201406/alert_service_registry.rb +0 -46
  114. data/lib/adwords_api/v201406/bidding_strategy_service.rb +0 -42
  115. data/lib/adwords_api/v201406/bidding_strategy_service_registry.rb +0 -46
  116. data/lib/adwords_api/v201406/budget_order_service.rb +0 -42
  117. data/lib/adwords_api/v201406/budget_order_service_registry.rb +0 -46
  118. data/lib/adwords_api/v201406/budget_service.rb +0 -42
  119. data/lib/adwords_api/v201406/budget_service_registry.rb +0 -46
  120. data/lib/adwords_api/v201406/campaign_ad_extension_service.rb +0 -38
  121. data/lib/adwords_api/v201406/campaign_ad_extension_service_registry.rb +0 -46
  122. data/lib/adwords_api/v201406/campaign_criterion_service.rb +0 -42
  123. data/lib/adwords_api/v201406/campaign_criterion_service_registry.rb +0 -46
  124. data/lib/adwords_api/v201406/campaign_feed_service.rb +0 -42
  125. data/lib/adwords_api/v201406/campaign_feed_service_registry.rb +0 -46
  126. data/lib/adwords_api/v201406/campaign_service.rb +0 -46
  127. data/lib/adwords_api/v201406/campaign_service_registry.rb +0 -46
  128. data/lib/adwords_api/v201406/campaign_shared_set_service.rb +0 -38
  129. data/lib/adwords_api/v201406/campaign_shared_set_service_registry.rb +0 -47
  130. data/lib/adwords_api/v201406/constant_data_service.rb +0 -66
  131. data/lib/adwords_api/v201406/constant_data_service_registry.rb +0 -46
  132. data/lib/adwords_api/v201406/conversion_tracker_service.rb +0 -38
  133. data/lib/adwords_api/v201406/conversion_tracker_service_registry.rb +0 -46
  134. data/lib/adwords_api/v201406/customer_feed_service.rb +0 -42
  135. data/lib/adwords_api/v201406/customer_feed_service_registry.rb +0 -46
  136. data/lib/adwords_api/v201406/customer_service.rb +0 -38
  137. data/lib/adwords_api/v201406/customer_service_registry.rb +0 -46
  138. data/lib/adwords_api/v201406/customer_sync_service.rb +0 -34
  139. data/lib/adwords_api/v201406/customer_sync_service_registry.rb +0 -47
  140. data/lib/adwords_api/v201406/data_service.rb +0 -54
  141. data/lib/adwords_api/v201406/data_service_registry.rb +0 -46
  142. data/lib/adwords_api/v201406/experiment_service.rb +0 -38
  143. data/lib/adwords_api/v201406/experiment_service_registry.rb +0 -46
  144. data/lib/adwords_api/v201406/feed_item_service.rb +0 -42
  145. data/lib/adwords_api/v201406/feed_item_service_registry.rb +0 -46
  146. data/lib/adwords_api/v201406/feed_mapping_service.rb +0 -42
  147. data/lib/adwords_api/v201406/feed_mapping_service_registry.rb +0 -46
  148. data/lib/adwords_api/v201406/feed_service.rb +0 -42
  149. data/lib/adwords_api/v201406/feed_service_registry.rb +0 -46
  150. data/lib/adwords_api/v201406/geo_location_service.rb +0 -34
  151. data/lib/adwords_api/v201406/geo_location_service_registry.rb +0 -46
  152. data/lib/adwords_api/v201406/label_service.rb +0 -42
  153. data/lib/adwords_api/v201406/label_service_registry.rb +0 -46
  154. data/lib/adwords_api/v201406/location_criterion_service.rb +0 -38
  155. data/lib/adwords_api/v201406/location_criterion_service_registry.rb +0 -46
  156. data/lib/adwords_api/v201406/managed_customer_service.rb +0 -50
  157. data/lib/adwords_api/v201406/managed_customer_service_registry.rb +0 -46
  158. data/lib/adwords_api/v201406/media_service.rb +0 -42
  159. data/lib/adwords_api/v201406/media_service_registry.rb +0 -46
  160. data/lib/adwords_api/v201406/mutate_job_service.rb +0 -42
  161. data/lib/adwords_api/v201406/mutate_job_service_registry.rb +0 -46
  162. data/lib/adwords_api/v201406/offline_conversion_feed_service.rb +0 -34
  163. data/lib/adwords_api/v201406/offline_conversion_feed_service_registry.rb +0 -46
  164. data/lib/adwords_api/v201406/report_definition_service.rb +0 -34
  165. data/lib/adwords_api/v201406/report_definition_service_registry.rb +0 -46
  166. data/lib/adwords_api/v201406/shared_criterion_service.rb +0 -38
  167. data/lib/adwords_api/v201406/shared_criterion_service_registry.rb +0 -47
  168. data/lib/adwords_api/v201406/shared_set_service.rb +0 -38
  169. data/lib/adwords_api/v201406/shared_set_service_registry.rb +0 -47
  170. data/lib/adwords_api/v201406/targeting_idea_service.rb +0 -38
  171. data/lib/adwords_api/v201406/targeting_idea_service_registry.rb +0 -46
  172. data/lib/adwords_api/v201406/traffic_estimator_service.rb +0 -34
  173. data/lib/adwords_api/v201406/traffic_estimator_service_registry.rb +0 -46
  174. data/test/templates/v201406/basic_operations_get_campaigns.def +0 -114
  175. data/test/templates/v201406/misc_use_oauth2_jwt.def +0 -131
@@ -46,7 +46,7 @@ def add_site_links(campaign_id)
46
46
  :name => 'Feed For Site Links',
47
47
  :attributes => [
48
48
  {:type => 'STRING', :name => 'Link Text'},
49
- {:type => 'URL', :name => 'Link URL'},
49
+ {:type => 'URL_LIST', :name => 'Final URLs'},
50
50
  {:type => 'STRING', :name => 'Line 1 Description'},
51
51
  {:type => 'STRING', :name => 'Line 2 Description'}
52
52
  ]
@@ -59,7 +59,7 @@ def add_site_links(campaign_id)
59
59
  feed = response[:value].first
60
60
  # Attribute of type STRING.
61
61
  link_text_feed_attribute_id = feed[:attributes][0][:id]
62
- # Attribute of type URL.
62
+ # Attribute of type URL_LIST.
63
63
  final_url_feed_attribute_id = feed[:attributes][1][:id]
64
64
  # Attribute of type STRING.
65
65
  line_1_feed_attribute_id = feed[:attributes][2][:id]
@@ -67,7 +67,7 @@ def add_site_links(campaign_id)
67
67
  line_2_feed_attribute_id = feed[:attributes][3][:id]
68
68
  puts "Feed with name '%s' and ID %d was added with" %
69
69
  [feed[:name], feed[:id]]
70
- puts "\tText attribute ID %d and Final URL attribute ID %d " +
70
+ puts "\tText attribute ID %d and Final URLs attribute ID %d " +
71
71
  "and Line 1 attribute ID %d and Line 2 attribute ID %d." % [
72
72
  link_text_feed_attribute_id,
73
73
  final_url_feed_attribute_id,
@@ -88,37 +88,37 @@ def add_site_links(campaign_id)
88
88
  items_data = [
89
89
  {
90
90
  :text => 'Home',
91
- :url => 'http://www.example.com',
91
+ :final_urls => ['http://www.example.com'],
92
92
  :line_1 => 'Home line 1',
93
93
  :line_2 => 'Home line 2'
94
94
  },
95
95
  {
96
96
  :text => 'Stores',
97
- :url => 'http://www.example.com/stores',
97
+ :final_urls => ['http://www.example.com/stores'],
98
98
  :line_1 => 'Stores line 1',
99
99
  :line_2 => 'Stores line 2'
100
100
  },
101
101
  {
102
102
  :text => 'On Sale',
103
- :url => 'http://www.example.com/sale',
103
+ :final_urls => ['http://www.example.com/sale'],
104
104
  :line_1 => 'On Sale line 1',
105
105
  :line_2 => 'On Sale line 2'
106
106
  },
107
107
  {
108
108
  :text => 'Support',
109
- :url => 'http://www.example.com/support',
109
+ :final_urls => ['http://www.example.com/support'],
110
110
  :line_1 => 'Support line 1',
111
111
  :line_2 => 'Support line 2'
112
112
  },
113
113
  {
114
114
  :text => 'Products',
115
- :url => 'http://www.example.com/products',
115
+ :final_urls => ['http://www.example.com/products'],
116
116
  :line_1 => 'Products line 1',
117
117
  :line_2 => 'Products line 2'
118
118
  },
119
119
  {
120
120
  :text => 'About',
121
- :url => 'http://www.example.com/about',
121
+ :final_urls => ['http://www.example.com/about'],
122
122
  :line_1 => 'About line 1',
123
123
  :line_2 => 'About line 2'
124
124
  }
@@ -134,7 +134,7 @@ def add_site_links(campaign_id)
134
134
  },
135
135
  {
136
136
  :feed_attribute_id => sitelinks_data[:final_url_feed_id],
137
- :string_value => item[:url]
137
+ :string_values => item[:final_urls]
138
138
  },
139
139
  {
140
140
  :feed_attribute_id => sitelinks_data[:line_1_feed_id],
@@ -174,7 +174,7 @@ def add_site_links(campaign_id)
174
174
  },
175
175
  {
176
176
  :feed_attribute_id => sitelinks_data[:final_url_feed_id],
177
- :field_id => PLACEHOLDER_FIELD_SITELINK_FINAL_URL
177
+ :field_id => PLACEHOLDER_FIELD_SITELINK_FINAL_URLS
178
178
  },
179
179
  {
180
180
  :feed_attribute_id => sitelinks_data[:line_1_feed_id],
@@ -202,50 +202,20 @@ def add_site_links(campaign_id)
202
202
  raise new StandardError, 'No feed mappings were added.'
203
203
  end
204
204
 
205
- # Create site links campaign feed.
206
- operands = sitelinks_data[:feed_item_ids].map do |feed_item_id|
207
- {
208
- :xsi_type => 'ConstantOperand',
209
- :type => 'LONG',
210
- :long_value => feed_item_id
211
- }
212
- end
213
-
214
- feed_item_function = {
215
- :operator => 'IN',
216
- :lhs_operand => [
217
- {:xsi_type => 'RequestContextOperand', :context_type => 'FEED_ITEM_ID'}
218
- ],
219
- :rhs_operand => operands
220
- }
221
-
222
- # Optional: to target to a platform, define a function and 'AND' it with the
223
- # feed item ID link:
224
- platform_function = {
225
- :operator => 'EQUALS',
226
- :lhs_operand => [
227
- {:xsi_type => 'RequestContextOperand', :context_type => 'DEVICE_PLATFORM'}
228
- ],
229
- :rhs_operand => [
230
- {
231
- :xsi_type => 'ConstantOperand',
232
- :type => 'STRING',
233
- :string_value => 'Mobile'
234
- }
235
- ]
236
- }
237
- combined_function = {
238
- :operator => 'AND',
239
- :lhs_operand => [
240
- {:xsi_type => 'FunctionOperand', :value => feed_item_function},
241
- {:xsi_type => 'FunctionOperand', :value => platform_function}
242
- ]
243
- }
205
+ # Construct a matching function that associates the sitelink feeditems to the
206
+ # campaign, and set the device preference to Mobile. See the matching function
207
+ # guide at:
208
+ # https://developers.google.com/adwords/api/docs/guides/feed-matching-functions
209
+ # for more details.
210
+ matching_function_string =
211
+ "AND(IN(FEED_ITEM_ID, {%s}), EQUALS(CONTEXT.DEVICE, 'Mobile'))" %
212
+ sitelinks_data[:feed_item_ids].join(',')
244
213
 
214
+ # Create site links campaign feed.
245
215
  campaign_feed = {
246
216
  :feed_id => sitelinks_data[:feed_id],
247
217
  :campaign_id => campaign_id,
248
- :matching_function => combined_function,
218
+ :matching_function => {:function_string => matching_function_string},
249
219
  # Specifying placeholder types on the CampaignFeed allows the same feed
250
220
  # to be used for different placeholders in different Campaigns.
251
221
  :placeholder_types => [PLACEHOLDER_SITELINKS]
@@ -271,7 +241,7 @@ if __FILE__ == $0
271
241
  # https://developers.google.com/adwords/api/docs/appendix/placeholders
272
242
  PLACEHOLDER_SITELINKS = 1
273
243
  PLACEHOLDER_FIELD_SITELINK_LINK_TEXT = 1
274
- PLACEHOLDER_FIELD_SITELINK_FINAL_URL = 5
244
+ PLACEHOLDER_FIELD_SITELINK_FINAL_URLS = 5
275
245
  PLACEHOLDER_FIELD_SITELINK_LINE_1_TEXT = 3
276
246
  PLACEHOLDER_FIELD_SITELINK_LINE_2_TEXT = 4
277
247
 
@@ -64,13 +64,15 @@ def migrate_to_extension_settings()
64
64
  next
65
65
  end
66
66
 
67
+ platform_restrictions = get_platform_restrictions(campaign_feed)
68
+
67
69
  # Delete the campaign feed that associates the sitelinks from the
68
70
  # feed to the campaign.
69
71
  delete_campaign_feed(adwords, campaign_feed)
70
72
 
71
73
  # Create extension settings instead of sitelinks.
72
74
  create_extension_setting(adwords, feed_items, campaign_feed,
73
- feed_item_ids)
75
+ feed_item_ids, platform_restrictions)
74
76
 
75
77
  # Mark the sitelinks from the feed for deletion.
76
78
  feed_item_ids
@@ -201,6 +203,26 @@ def get_feed_items(adwords, feed)
201
203
  return feed_items
202
204
  end
203
205
 
206
+ def get_platform_restrictions(campaign_feed)
207
+ platform_restrictions = nil
208
+
209
+ if campaign_feed[:matching_function][:operator] == 'AND'
210
+ campaign_feed[:matching_function][:lhs_operand].each do |argument|
211
+ # Check if matchingFunction is EQUALS(CONTEXT.DEVICE, 'Mobile')
212
+ if argument[:value][:operator] == 'EQUALS'
213
+ request_context_operand = argument[:value][:lhs_operand].first()
214
+ if request_context_operand &&
215
+ request_context_operand == 'DEVICE_PLATFORM'
216
+ platform_restrictions =
217
+ argument[:value][:rhs_operand].first().upcase()
218
+ break
219
+ end
220
+ end
221
+ end
222
+ end
223
+ return platform_restrictions
224
+ end
225
+
204
226
  def delete_old_feed_items(adwords, feed_item_ids, feed)
205
227
  return if feed_item_ids.empty?
206
228
 
@@ -219,7 +241,8 @@ def delete_old_feed_items(adwords, feed_item_ids, feed)
219
241
  feed_item_srv.mutate(operations)
220
242
  end
221
243
 
222
- def create_extension_setting(adwords, feed_items, campaign_feed, feed_item_ids)
244
+ def create_extension_setting(
245
+ adwords, feed_items, campaign_feed, feed_item_ids, platform_restrictions)
223
246
  campaign_extension_setting_srv = adwords.service(
224
247
  :CampaignExtensionSettingService, API_VERSION)
225
248
 
@@ -254,6 +277,10 @@ def create_extension_setting(adwords, feed_items, campaign_feed, feed_item_ids)
254
277
  :extensions => extension_feed_items
255
278
  }
256
279
 
280
+ unless platform_restrictions.nil?
281
+ extension_setting[:platform_restrictions] = platform_restrictions
282
+ end
283
+
257
284
  campaign_extension_setting = {
258
285
  :campaign_id => campaign_feed[:campaign_id],
259
286
  :extension_type => 'SITELINK',
data/lib/adwords_api.rb CHANGED
@@ -72,35 +72,6 @@ module AdwordsApi
72
72
  default_ns, version)
73
73
  end
74
74
 
75
- # Helper method to provide a simple way of doing an MCC-level operation
76
- # without the need to change credentials. Executes a block of code as an
77
- # MCC-level operation and/or returns the current status of the property.
78
- #
79
- # Args:
80
- # - accepts a block, which it will execute as an MCC-level operation
81
- #
82
- # Returns:
83
- # - block execution result, if block given
84
- # - boolean indicating whether MCC-level operations are currently
85
- # enabled or disabled, if no block provided
86
- #
87
- def use_mcc(&block)
88
- return (block_given?) ?
89
- run_with_temporary_flag(:@use_mcc, true, block) :
90
- @credential_handler.use_mcc
91
- end
92
-
93
- # Helper method to provide a simple way of doing an MCC-level operation
94
- # without the need to change credentials. Sets the value of the property
95
- # that controls whether MCC-level operations are enabled or disabled.
96
- #
97
- # Args:
98
- # - value: the new value for the property (boolean)
99
- #
100
- def use_mcc=(value)
101
- @credential_handler.use_mcc = value
102
- end
103
-
104
75
  # Helper method to provide a simple way of doing a validate-only operation
105
76
  # without the need to change credentials. Executes a block of code as an
106
77
  # validate-only operation and/or returns the current status of the property.
@@ -148,6 +119,15 @@ module AdwordsApi
148
119
  @config.set('library.skip_report_summary', value)
149
120
  end
150
121
 
122
+ # Helper method to skip the column header when downloading reports.
123
+ #
124
+ # Args:
125
+ # - value: whether to skip the column header (boolean)
126
+ #
127
+ def skip_column_header=(value)
128
+ @config.set('library.skip_column_header', value)
129
+ end
130
+
151
131
  # Helper method to provide a simple way of performing requests with support
152
132
  # for partial failures. Executes a block of code with partial failures
153
133
  # enabled and/or returns the current status of the property.
@@ -45,46 +45,6 @@ module AdwordsApi
45
45
 
46
46
  # Configure the services available to each version
47
47
  @@service_config = {
48
- :v201406 => [
49
- :AdGroupAdService,
50
- :AdGroupBidModifierService,
51
- :AdGroupCriterionService,
52
- :AdGroupFeedService,
53
- :AdGroupService,
54
- :AdParamService,
55
- :AdwordsUserListService,
56
- :AlertService,
57
- :BiddingStrategyService,
58
- :BudgetOrderService,
59
- :BudgetService,
60
- :CampaignAdExtensionService,
61
- :CampaignCriterionService,
62
- :CampaignFeedService,
63
- :CampaignService,
64
- :CampaignSharedSetService,
65
- :ConstantDataService,
66
- :ConversionTrackerService,
67
- :CustomerFeedService,
68
- :CustomerService,
69
- :CustomerSyncService,
70
- :DataService,
71
- :ExperimentService,
72
- :FeedItemService,
73
- :FeedMappingService,
74
- :FeedService,
75
- :GeoLocationService,
76
- :LabelService,
77
- :LocationCriterionService,
78
- :ManagedCustomerService,
79
- :MediaService,
80
- :MutateJobService,
81
- :OfflineConversionFeedService,
82
- :ReportDefinitionService,
83
- :SharedCriterionService,
84
- :SharedSetService,
85
- :TargetingIdeaService,
86
- :TrafficEstimatorService
87
- ],
88
48
  :v201409 => [
89
49
  :AdCustomizerFeedService,
90
50
  :AdGroupAdService,
@@ -178,7 +138,6 @@ module AdwordsApi
178
138
  :PRODUCTION => {
179
139
  :oauth_scope => 'https://www.googleapis.com/auth/adwords',
180
140
  :header_ns => 'https://adwords.google.com/api/adwords/cm/',
181
- :v201406 => 'https://adwords.google.com/api/adwords/',
182
141
  :v201409 => 'https://adwords.google.com/api/adwords/',
183
142
  :v201502 => 'https://adwords.google.com/api/adwords/'
184
143
  }
@@ -187,45 +146,6 @@ module AdwordsApi
187
146
  # Configure the subdirectories for each version / service pair.
188
147
  # A missing pair means that only the base URL is used.
189
148
  @@subdir_config = {
190
- # v201406
191
- [:v201406, :AdGroupAdService] => 'cm/',
192
- [:v201406, :AdGroupBidModifierService] => 'cm/',
193
- [:v201406, :AdGroupCriterionService] => 'cm/',
194
- [:v201406, :AdGroupFeedService] => 'cm/',
195
- [:v201406, :AdGroupService] => 'cm/',
196
- [:v201406, :AdParamService] => 'cm/',
197
- [:v201406, :AlertService] => 'mcm/',
198
- [:v201406, :BudgetOrderService] => 'billing/',
199
- [:v201406, :CampaignAdExtensionService] => 'cm/',
200
- [:v201406, :CampaignCriterionService] => 'cm/',
201
- [:v201406, :CampaignFeedService] => 'cm/',
202
- [:v201406, :CampaignService] => 'cm/',
203
- [:v201406, :CampaignSharedSetService] => 'cm/',
204
- [:v201406, :ConstantDataService] => 'cm/',
205
- [:v201406, :ConversionTrackerService] => 'cm/',
206
- [:v201406, :CustomerSyncService] => 'ch/',
207
- [:v201406, :DataService] => 'cm/',
208
- [:v201406, :ExperimentService] => 'cm/',
209
- [:v201406, :FeedItemService] => 'cm/',
210
- [:v201406, :FeedMappingService] => 'cm/',
211
- [:v201406, :FeedService] => 'cm/',
212
- [:v201406, :GeoLocationService] => 'cm/',
213
- [:v201406, :LocationCriterionService] => 'cm/',
214
- [:v201406, :MediaService] => 'cm/',
215
- [:v201406, :MutateJobService] => 'cm/',
216
- [:v201406, :OfflineConversionFeedService] => 'cm/',
217
- [:v201406, :ReportDefinitionService] => 'cm/',
218
- [:v201406, :SharedCriterionService] => 'cm/',
219
- [:v201406, :SharedSetService] => 'cm/',
220
- [:v201406, :TargetingIdeaService] => 'o/',
221
- [:v201406, :TrafficEstimatorService] => 'o/',
222
- [:v201406, :ManagedCustomerService] => 'mcm/',
223
- [:v201406, :CustomerService] => 'mcm/',
224
- [:v201406, :CustomerFeedService] => 'cm/',
225
- [:v201406, :BudgetService] => 'cm/',
226
- [:v201406, :BiddingStrategyService] => 'cm/',
227
- [:v201406, :AdwordsUserListService] => 'rm/',
228
- [:v201406, :LabelService] => 'cm/',
229
149
  # v201409
230
150
  [:v201409, :AdCustomizerFeedService] => 'cm/',
231
151
  [:v201409, :AdGroupAdService] => 'cm/',
@@ -24,8 +24,6 @@ require 'adwords_api/api_config'
24
24
 
25
25
  module AdwordsApi
26
26
  class CredentialHandler < AdsCommon::CredentialHandler
27
- # Whether we're making MCC-level requests.
28
- attr_accessor :use_mcc
29
27
  # Whether we're making validate-only requests.
30
28
  attr_accessor :validate_only
31
29
  # Whether we're making partial failure requests.
@@ -33,7 +31,6 @@ module AdwordsApi
33
31
 
34
32
  def initialize(config)
35
33
  super(config)
36
- @use_mcc = false
37
34
  @validate_only = false
38
35
  @partial_failure = false
39
36
  end
@@ -48,9 +45,7 @@ module AdwordsApi
48
45
  'userAgent' => generate_user_agent(),
49
46
  'developerToken' => result[:developer_token]
50
47
  }
51
- if !@use_mcc and result[:client_customer_id]
52
- extra_headers['clientCustomerId'] = result[:client_customer_id]
53
- end
48
+ extra_headers['clientCustomerId'] = result[:client_customer_id]
54
49
  extra_headers['validateOnly'] = 'true' if @validate_only
55
50
  extra_headers['partialFailure'] = 'true' if @partial_failure
56
51
  result[:extra_headers] = extra_headers
@@ -75,9 +70,13 @@ module AdwordsApi
75
70
  #
76
71
  def validate_headers_for_server(credentials)
77
72
  client_customer_id = credentials[:client_customer_id]
78
- if client_customer_id and
79
- !(client_customer_id.is_a?(Integer) or
80
- (client_customer_id =~ /^\d+(-\d+-\d+)?$/))
73
+ unless client_customer_id
74
+ raise AdwordsApi::Errors::BadCredentialsError,
75
+ 'Missing client customer ID for the request.'
76
+ end
77
+
78
+ if !(client_customer_id.is_a?(Integer) or
79
+ (client_customer_id =~ /^\d+(-\d+-\d+)?$/))
81
80
  raise AdwordsApi::Errors::BadCredentialsError,
82
81
  'Invalid client customer ID: %s' % client_customer_id.to_s
83
82
  end
@@ -56,11 +56,15 @@ module AdwordsApi
56
56
  }
57
57
  skip_report_header = @config.read('library.skip_report_header')
58
58
  unless skip_report_header.nil?
59
- headers['skipReportHeader'] = skip_report_header.to_s
59
+ headers['skipReportHeader'] = skip_report_header
60
60
  end
61
61
  skip_report_summary = @config.read('library.skip_report_summary')
62
62
  unless skip_report_summary.nil?
63
- headers['skipReportSummary'] = skip_report_summary.to_s
63
+ headers['skipReportSummary'] = skip_report_summary
64
+ end
65
+ skip_column_header = @config.read('library.skip_column_header')
66
+ unless skip_column_header.nil?
67
+ headers['skipColumnHeader'] = skip_column_header
64
68
  end
65
69
  return headers
66
70
  end
@@ -21,6 +21,6 @@
21
21
 
22
22
  module AdwordsApi
23
23
  module ApiConfig
24
- CLIENT_LIB_VERSION = '0.14.2'
24
+ CLIENT_LIB_VERSION = '0.15.0'
25
25
  end
26
26
  end
@@ -57,15 +57,6 @@ class TestAdwordsApi < Test::Unit::TestCase
57
57
  end
58
58
  end
59
59
 
60
- def test_use_mcc()
61
- adwords_api = AdwordsApi::Api.new({})
62
- adwords_api.use_mcc = false
63
- assert(!adwords_api.use_mcc)
64
- adwords_api.use_mcc do
65
- assert(adwords_api.use_mcc)
66
- end
67
- end
68
-
69
60
  def test_validate_only()
70
61
  adwords_api = AdwordsApi::Api.new({})
71
62
  adwords_api.validate_only = false