google-adwords-api 0.4.5 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (519) hide show
  1. data/ChangeLog +4 -0
  2. data/README +3 -3
  3. data/Rakefile +3 -3
  4. data/examples/v201109/{create_account.rb → account_management/create_account.rb} +2 -1
  5. data/examples/v201109/{get_campaign_alerts.rb → account_management/get_account_alerts.rb} +38 -21
  6. data/examples/v201109/{get_all_account_changes.rb → account_management/get_account_changes.rb} +40 -39
  7. data/examples/v201109/{get_account_hierarchy.rb → account_management/get_account_hierarchy.rb} +2 -1
  8. data/examples/v201109/{get_client_customer_id.rb → account_management/get_client_customer_id.rb} +2 -1
  9. data/examples/v201109/{get_unit_count.rb → account_management/get_client_unit_usage.rb} +15 -7
  10. data/examples/v201109/{add_ad_group.rb → basic_operations/add_ad_group.rb} +2 -1
  11. data/examples/v201109/{add_campaign.rb → basic_operations/add_campaign.rb} +2 -1
  12. data/examples/v201109/{add_ad_group_criteria.rb → basic_operations/add_keywords.rb} +32 -37
  13. data/examples/{v200909/update_ad.rb → v201109/basic_operations/add_text_ads.rb} +41 -25
  14. data/examples/v201109/{delete_ad.rb → basic_operations/delete_ad.rb} +5 -4
  15. data/examples/v201109/{delete_ad_group.rb → basic_operations/delete_ad_group.rb} +34 -8
  16. data/examples/v201109/{delete_campaign.rb → basic_operations/delete_campaign.rb} +32 -6
  17. data/examples/v201109/{delete_ad_group_criterion.rb → basic_operations/delete_keyword.rb} +15 -10
  18. data/examples/v201109/{get_all_ad_groups.rb → basic_operations/get_ad_groups.rb} +32 -18
  19. data/examples/v201109/{get_all_campaigns.rb → basic_operations/get_campaigns.rb} +31 -14
  20. data/examples/v201109/{get_all_active_ad_group_criteria.rb → basic_operations/get_keywords.rb} +41 -34
  21. data/examples/v201109/{get_all_ads.rb → basic_operations/get_text_ads.rb} +39 -22
  22. data/examples/v201109/{update_ad.rb → basic_operations/pause_ad.rb} +9 -10
  23. data/examples/v201109/{update_ad_group.rb → basic_operations/update_ad_group.rb} +2 -1
  24. data/examples/v201109/{update_campaign.rb → basic_operations/update_campaign.rb} +2 -1
  25. data/examples/v201109/{update_ad_group_criterion.rb → basic_operations/update_keyword.rb} +10 -9
  26. data/examples/v201109/{add_experiment.rb → campaign_management/add_experiment.rb} +4 -3
  27. data/examples/v201109/{perform_mutate_job.rb → campaign_management/add_keywords_in_bulk.rb} +17 -43
  28. data/examples/v201109/{add_campaign_ad_extension.rb → campaign_management/add_location_extension.rb} +28 -37
  29. data/examples/v201109/{add_ad_extension_override.rb → campaign_management/add_location_extension_override.rb} +12 -10
  30. data/examples/v201109/{get_all_disapproved_ads.rb → campaign_management/get_all_disapproved_ads.rb} +3 -2
  31. data/examples/v201109/{promote_experiment.rb → campaign_management/promote_experiment.rb} +4 -4
  32. data/examples/v201109/{set_ad_params.rb → campaign_management/set_ad_parameters.rb} +7 -7
  33. data/examples/{v201003/delete_ad.rb → v201109/campaign_management/validate_text_ad.rb} +40 -16
  34. data/examples/v201109/{handle_partial_failures.rb → error_handling/handle_partial_failures.rb} +2 -1
  35. data/examples/v201109/{handle_policy_violation_error.rb → error_handling/handle_policy_violation_error.rb} +2 -1
  36. data/examples/v201109/{handle_second_factor.rb → error_handling/handle_two_factor_authorization_error.rb} +5 -4
  37. data/examples/v201109/{get_all_images.rb → misc/get_all_images_and_videos.rb} +40 -20
  38. data/examples/v201109/{upload_image.rb → misc/upload_image.rb} +2 -1
  39. data/examples/v201109/{oauth_handling.rb → misc/use_oauth.rb} +10 -7
  40. data/examples/v201109/{get_traffic_estimates.rb → optimization/estimate_keyword_traffic.rb} +4 -3
  41. data/examples/v201109/{get_criterion_bid_landscape.rb → optimization/get_keyword_bid_simulations.rb} +21 -20
  42. data/examples/v201109/{get_related_keywords.rb → optimization/get_keyword_ideas.rb} +6 -5
  43. data/examples/v201109/{get_keyword_opportunities.rb → optimization/get_keyword_opportunities.rb} +2 -1
  44. data/examples/v201109/{get_related_placements.rb → optimization/get_placement_ideas.rb} +5 -4
  45. data/examples/v201109/{add_user_list.rb → remarketing/add_audience.rb} +6 -5
  46. data/examples/v201109/{add_conversion.rb → remarketing/add_conversion_tracker.rb} +8 -7
  47. data/examples/v201109/{download_adhoc_report.rb → reporting/download_criteria_report.rb} +19 -17
  48. data/examples/v201109/{download_report.rb → reporting/download_defined_report.rb} +7 -5
  49. data/examples/v201109/{get_all_report_definitions.rb → reporting/get_defined_reports.rb} +7 -6
  50. data/examples/v201109/{get_report_fields.rb → reporting/get_report_fields.rb} +2 -1
  51. data/examples/v201109/{parallel_report_download.rb → reporting/parallel_report_download.rb} +2 -1
  52. data/examples/v201109/{add_campaign_targeting_criteria.rb → targeting/add_campaign_targeting_criteria.rb} +22 -4
  53. data/examples/v201109/{add_negative_campaign_criterion.rb → targeting/get_campaign_targeting_criteria.rb} +43 -26
  54. data/examples/v201109/{get_all_carriers.rb → targeting/get_targetable_languages_and_carriers.rb} +19 -4
  55. data/examples/v201109/{get_location_criteria.rb → targeting/lookup_location.rb} +4 -3
  56. data/lib/adwords_api.rb +2 -2
  57. data/lib/adwords_api/api_config.rb +3 -130
  58. data/lib/adwords_api/client_login_header_handler.rb +1 -1
  59. data/lib/adwords_api/credential_handler.rb +2 -2
  60. data/lib/adwords_api/errors.rb +2 -2
  61. data/lib/adwords_api/extensions.rb +3 -2
  62. data/lib/adwords_api/report_utils.rb +1 -1
  63. data/lib/adwords_api/utils.rb +2 -2
  64. data/lib/adwords_api/v13_login_handler.rb +1 -1
  65. data/lib/adwords_api/v201109/ad_extension_override_service.rb +10 -8
  66. data/lib/adwords_api/v201109/ad_extension_override_service_registry.rb +8 -6
  67. data/lib/adwords_api/v201109/ad_group_ad_service.rb +10 -8
  68. data/lib/adwords_api/v201109/ad_group_ad_service_registry.rb +8 -6
  69. data/lib/adwords_api/v201109/ad_group_criterion_service.rb +10 -8
  70. data/lib/adwords_api/v201109/ad_group_criterion_service_registry.rb +8 -6
  71. data/lib/adwords_api/v201109/ad_group_service.rb +10 -8
  72. data/lib/adwords_api/v201109/ad_group_service_registry.rb +8 -6
  73. data/lib/adwords_api/v201109/ad_param_service.rb +10 -8
  74. data/lib/adwords_api/v201109/ad_param_service_registry.rb +8 -6
  75. data/lib/adwords_api/v201109/alert_service.rb +6 -4
  76. data/lib/adwords_api/v201109/alert_service_registry.rb +8 -6
  77. data/lib/adwords_api/v201109/bulk_mutate_job_service.rb +10 -8
  78. data/lib/adwords_api/v201109/bulk_mutate_job_service_registry.rb +8 -6
  79. data/lib/adwords_api/v201109/bulk_opportunity_service.rb +6 -4
  80. data/lib/adwords_api/v201109/bulk_opportunity_service_registry.rb +8 -6
  81. data/lib/adwords_api/v201109/campaign_ad_extension_service.rb +10 -8
  82. data/lib/adwords_api/v201109/campaign_ad_extension_service_registry.rb +8 -6
  83. data/lib/adwords_api/v201109/campaign_criterion_service.rb +10 -8
  84. data/lib/adwords_api/v201109/campaign_criterion_service_registry.rb +8 -6
  85. data/lib/adwords_api/v201109/campaign_service.rb +10 -8
  86. data/lib/adwords_api/v201109/campaign_service_registry.rb +8 -6
  87. data/lib/adwords_api/v201109/campaign_target_service.rb +10 -8
  88. data/lib/adwords_api/v201109/campaign_target_service_registry.rb +8 -6
  89. data/lib/adwords_api/v201109/constant_data_service.rb +6 -4
  90. data/lib/adwords_api/v201109/constant_data_service_registry.rb +8 -6
  91. data/lib/adwords_api/v201109/conversion_tracker_service.rb +10 -8
  92. data/lib/adwords_api/v201109/conversion_tracker_service_registry.rb +8 -6
  93. data/lib/adwords_api/v201109/create_account_service.rb +6 -4
  94. data/lib/adwords_api/v201109/create_account_service_registry.rb +8 -6
  95. data/lib/adwords_api/v201109/customer_sync_service.rb +6 -4
  96. data/lib/adwords_api/v201109/customer_sync_service_registry.rb +8 -6
  97. data/lib/adwords_api/v201109/data_service.rb +10 -8
  98. data/lib/adwords_api/v201109/data_service_registry.rb +8 -6
  99. data/lib/adwords_api/v201109/experiment_service.rb +10 -8
  100. data/lib/adwords_api/v201109/experiment_service_registry.rb +8 -6
  101. data/lib/adwords_api/v201109/geo_location_service.rb +6 -4
  102. data/lib/adwords_api/v201109/geo_location_service_registry.rb +8 -6
  103. data/lib/adwords_api/v201109/info_service.rb +6 -4
  104. data/lib/adwords_api/v201109/info_service_registry.rb +8 -6
  105. data/lib/adwords_api/v201109/location_criterion_service.rb +6 -4
  106. data/lib/adwords_api/v201109/location_criterion_service_registry.rb +8 -6
  107. data/lib/adwords_api/v201109/media_service.rb +10 -8
  108. data/lib/adwords_api/v201109/media_service_registry.rb +8 -6
  109. data/lib/adwords_api/v201109/mutate_job_service.rb +10 -8
  110. data/lib/adwords_api/v201109/mutate_job_service_registry.rb +8 -6
  111. data/lib/adwords_api/v201109/report_definition_service.rb +10 -8
  112. data/lib/adwords_api/v201109/report_definition_service_registry.rb +8 -6
  113. data/lib/adwords_api/v201109/serviced_account_service.rb +6 -4
  114. data/lib/adwords_api/v201109/serviced_account_service_registry.rb +8 -6
  115. data/lib/adwords_api/v201109/targeting_idea_service.rb +10 -8
  116. data/lib/adwords_api/v201109/targeting_idea_service_registry.rb +8 -6
  117. data/lib/adwords_api/v201109/traffic_estimator_service.rb +6 -4
  118. data/lib/adwords_api/v201109/traffic_estimator_service_registry.rb +8 -6
  119. data/lib/adwords_api/v201109/user_list_service.rb +10 -8
  120. data/lib/adwords_api/v201109/user_list_service_registry.rb +8 -6
  121. data/test/adwords_api/test_api_config.rb +2 -7
  122. data/test/adwords_api/test_report_utils.rb +2 -1
  123. data/test/adwords_api/test_utils.rb +1 -0
  124. data/test/bugs/test_issue_00000031.rb +2 -1
  125. metadata +116 -481
  126. data/examples/v200909/add_ad_extension_override.rb +0 -82
  127. data/examples/v200909/add_ad_group.rb +0 -89
  128. data/examples/v200909/add_ad_group_criteria.rb +0 -108
  129. data/examples/v200909/add_ads.rb +0 -121
  130. data/examples/v200909/add_campaign.rb +0 -92
  131. data/examples/v200909/add_campaign_ad_extension.rb +0 -121
  132. data/examples/v200909/add_negative_campaign_criterion.rb +0 -87
  133. data/examples/v200909/check_campaigns.rb +0 -123
  134. data/examples/v200909/delete_ad.rb +0 -85
  135. data/examples/v200909/delete_ad_group.rb +0 -77
  136. data/examples/v200909/delete_ad_group_criterion.rb +0 -86
  137. data/examples/v200909/delete_campaign.rb +0 -78
  138. data/examples/v200909/get_all_active_ad_group_criteria.rb +0 -84
  139. data/examples/v200909/get_all_ad_extension_overrides.rb +0 -82
  140. data/examples/v200909/get_all_ad_group_criteria.rb +0 -82
  141. data/examples/v200909/get_all_ad_groups.rb +0 -79
  142. data/examples/v200909/get_all_ad_params.rb +0 -80
  143. data/examples/v200909/get_all_ads.rb +0 -79
  144. data/examples/v200909/get_all_campaign_ad_extensions.rb +0 -81
  145. data/examples/v200909/get_all_campaign_targets.rb +0 -74
  146. data/examples/v200909/get_all_campaigns.rb +0 -74
  147. data/examples/v200909/get_all_disapproved_ads.rb +0 -85
  148. data/examples/v200909/get_all_paused_campaigns.rb +0 -77
  149. data/examples/v200909/get_conversion_optimizer_eligibility.rb +0 -103
  150. data/examples/v200909/get_geo_location_info.rb +0 -99
  151. data/examples/v200909/get_method_cost.rb +0 -87
  152. data/examples/v200909/get_operation_count.rb +0 -79
  153. data/examples/v200909/get_related_keywords.rb +0 -108
  154. data/examples/v200909/get_related_placements.rb +0 -107
  155. data/examples/v200909/get_total_usage_units_per_month.rb +0 -74
  156. data/examples/v200909/get_unit_count.rb +0 -79
  157. data/examples/v200909/perform_bulk_mutate_job.rb +0 -212
  158. data/examples/v200909/set_ad_params.rb +0 -115
  159. data/examples/v200909/set_campaign_targets.rb +0 -116
  160. data/examples/v200909/update_ad_group.rb +0 -81
  161. data/examples/v200909/update_ad_group_criterion.rb +0 -99
  162. data/examples/v200909/update_campaign.rb +0 -84
  163. data/examples/v201003/add_ad_extension_override.rb +0 -82
  164. data/examples/v201003/add_ad_group.rb +0 -89
  165. data/examples/v201003/add_ad_group_criteria.rb +0 -108
  166. data/examples/v201003/add_ads.rb +0 -174
  167. data/examples/v201003/add_campaign.rb +0 -92
  168. data/examples/v201003/add_campaign_ad_extension.rb +0 -121
  169. data/examples/v201003/add_keywords_performance_report_definition.rb +0 -99
  170. data/examples/v201003/add_negative_campaign_criterion.rb +0 -87
  171. data/examples/v201003/check_campaigns.rb +0 -123
  172. data/examples/v201003/delete_ad_group.rb +0 -77
  173. data/examples/v201003/delete_ad_group_criterion.rb +0 -86
  174. data/examples/v201003/delete_campaign.rb +0 -78
  175. data/examples/v201003/download_report.rb +0 -67
  176. data/examples/v201003/get_all_active_ad_group_criteria.rb +0 -84
  177. data/examples/v201003/get_all_ad_extension_overrides.rb +0 -82
  178. data/examples/v201003/get_all_ad_group_criteria.rb +0 -82
  179. data/examples/v201003/get_all_ad_groups.rb +0 -79
  180. data/examples/v201003/get_all_ad_params.rb +0 -80
  181. data/examples/v201003/get_all_ads.rb +0 -82
  182. data/examples/v201003/get_all_campaign_ad_extensions.rb +0 -81
  183. data/examples/v201003/get_all_campaign_targets.rb +0 -74
  184. data/examples/v201003/get_all_campaigns.rb +0 -74
  185. data/examples/v201003/get_all_disapproved_ads.rb +0 -85
  186. data/examples/v201003/get_all_images.rb +0 -80
  187. data/examples/v201003/get_all_paused_campaigns.rb +0 -77
  188. data/examples/v201003/get_all_report_definitions.rb +0 -75
  189. data/examples/v201003/get_all_videos.rb +0 -76
  190. data/examples/v201003/get_conversion_optimizer_eligibility.rb +0 -103
  191. data/examples/v201003/get_criterion_bid_landscape.rb +0 -96
  192. data/examples/v201003/get_geo_location_info.rb +0 -99
  193. data/examples/v201003/get_method_cost.rb +0 -87
  194. data/examples/v201003/get_operation_count.rb +0 -79
  195. data/examples/v201003/get_related_keywords.rb +0 -108
  196. data/examples/v201003/get_related_placements.rb +0 -107
  197. data/examples/v201003/get_report_fields.rb +0 -72
  198. data/examples/v201003/get_total_usage_units_per_month.rb +0 -74
  199. data/examples/v201003/get_unit_count.rb +0 -79
  200. data/examples/v201003/perform_bulk_mutate_job.rb +0 -212
  201. data/examples/v201003/set_ad_params.rb +0 -115
  202. data/examples/v201003/set_campaign_targets.rb +0 -116
  203. data/examples/v201003/update_ad.rb +0 -86
  204. data/examples/v201003/update_ad_group.rb +0 -81
  205. data/examples/v201003/update_ad_group_criterion.rb +0 -99
  206. data/examples/v201003/update_campaign.rb +0 -83
  207. data/examples/v201003/upload_image.rb +0 -90
  208. data/examples/v201008/add_ad_extension_override.rb +0 -82
  209. data/examples/v201008/add_ad_group.rb +0 -89
  210. data/examples/v201008/add_ad_group_criteria.rb +0 -108
  211. data/examples/v201008/add_ads.rb +0 -174
  212. data/examples/v201008/add_campaign.rb +0 -92
  213. data/examples/v201008/add_campaign_ad_extension.rb +0 -121
  214. data/examples/v201008/add_experiment.rb +0 -153
  215. data/examples/v201008/add_keywords_performance_report_definition.rb +0 -99
  216. data/examples/v201008/add_negative_campaign_criterion.rb +0 -87
  217. data/examples/v201008/add_user_list.rb +0 -87
  218. data/examples/v201008/check_campaigns.rb +0 -123
  219. data/examples/v201008/delete_ad.rb +0 -85
  220. data/examples/v201008/delete_ad_group.rb +0 -77
  221. data/examples/v201008/delete_ad_group_criterion.rb +0 -86
  222. data/examples/v201008/delete_bulk_mutate_job.rb +0 -87
  223. data/examples/v201008/delete_campaign.rb +0 -78
  224. data/examples/v201008/delete_experiment.rb +0 -78
  225. data/examples/v201008/delete_user_list.rb +0 -78
  226. data/examples/v201008/download_report.rb +0 -67
  227. data/examples/v201008/get_account_hierarchy.rb +0 -101
  228. data/examples/v201008/get_all_account_changes.rb +0 -135
  229. data/examples/v201008/get_all_active_ad_group_criteria.rb +0 -84
  230. data/examples/v201008/get_all_ad_extension_overrides.rb +0 -82
  231. data/examples/v201008/get_all_ad_group_criteria.rb +0 -82
  232. data/examples/v201008/get_all_ad_groups.rb +0 -79
  233. data/examples/v201008/get_all_ad_params.rb +0 -80
  234. data/examples/v201008/get_all_ads.rb +0 -82
  235. data/examples/v201008/get_all_campaign_ad_extensions.rb +0 -81
  236. data/examples/v201008/get_all_campaign_targets.rb +0 -74
  237. data/examples/v201008/get_all_campaigns.rb +0 -74
  238. data/examples/v201008/get_all_disapproved_ads.rb +0 -85
  239. data/examples/v201008/get_all_experiments.rb +0 -84
  240. data/examples/v201008/get_all_images.rb +0 -80
  241. data/examples/v201008/get_all_paused_campaigns.rb +0 -77
  242. data/examples/v201008/get_all_report_definitions.rb +0 -75
  243. data/examples/v201008/get_all_user_lists.rb +0 -75
  244. data/examples/v201008/get_all_videos.rb +0 -76
  245. data/examples/v201008/get_bulk_mutate_job.rb +0 -97
  246. data/examples/v201008/get_campaign_alerts.rb +0 -95
  247. data/examples/v201008/get_conversion_optimizer_eligibility.rb +0 -88
  248. data/examples/v201008/get_criterion_bid_landscape.rb +0 -96
  249. data/examples/v201008/get_geo_location_info.rb +0 -99
  250. data/examples/v201008/get_method_cost.rb +0 -87
  251. data/examples/v201008/get_operation_count.rb +0 -79
  252. data/examples/v201008/get_related_keywords.rb +0 -108
  253. data/examples/v201008/get_related_placements.rb +0 -107
  254. data/examples/v201008/get_report_fields.rb +0 -72
  255. data/examples/v201008/get_total_usage_units_per_month.rb +0 -74
  256. data/examples/v201008/get_traffic_estimates.rb +0 -147
  257. data/examples/v201008/get_unit_count.rb +0 -79
  258. data/examples/v201008/handle_partial_failures.rb +0 -127
  259. data/examples/v201008/handle_policy_violation_error.rb +0 -138
  260. data/examples/v201008/perform_bulk_mutate_job.rb +0 -212
  261. data/examples/v201008/promote_experiment.rb +0 -79
  262. data/examples/v201008/set_ad_params.rb +0 -115
  263. data/examples/v201008/set_campaign_targets.rb +0 -116
  264. data/examples/v201008/update_ad.rb +0 -86
  265. data/examples/v201008/update_ad_group.rb +0 -81
  266. data/examples/v201008/update_ad_group_criterion.rb +0 -99
  267. data/examples/v201008/update_campaign.rb +0 -84
  268. data/examples/v201008/update_user_list.rb +0 -82
  269. data/examples/v201008/upload_image.rb +0 -90
  270. data/examples/v201101/add_ad_extension_override.rb +0 -82
  271. data/examples/v201101/add_ad_group.rb +0 -89
  272. data/examples/v201101/add_ad_group_criteria.rb +0 -108
  273. data/examples/v201101/add_ads.rb +0 -174
  274. data/examples/v201101/add_campaign.rb +0 -99
  275. data/examples/v201101/add_campaign_ad_extension.rb +0 -121
  276. data/examples/v201101/add_conversion.rb +0 -88
  277. data/examples/v201101/add_experiment.rb +0 -153
  278. data/examples/v201101/add_keywords_performance_report_definition.rb +0 -99
  279. data/examples/v201101/add_negative_campaign_criterion.rb +0 -87
  280. data/examples/v201101/add_user_list.rb +0 -113
  281. data/examples/v201101/check_campaigns.rb +0 -123
  282. data/examples/v201101/delete_ad.rb +0 -85
  283. data/examples/v201101/delete_ad_group.rb +0 -77
  284. data/examples/v201101/delete_ad_group_criterion.rb +0 -86
  285. data/examples/v201101/delete_bulk_mutate_job.rb +0 -87
  286. data/examples/v201101/delete_campaign.rb +0 -78
  287. data/examples/v201101/delete_experiment.rb +0 -78
  288. data/examples/v201101/delete_user_list.rb +0 -78
  289. data/examples/v201101/download_report.rb +0 -67
  290. data/examples/v201101/get_account_hierarchy.rb +0 -102
  291. data/examples/v201101/get_ad_group_bid_landscape.rb +0 -94
  292. data/examples/v201101/get_all_account_changes.rb +0 -137
  293. data/examples/v201101/get_all_active_ad_group_criteria.rb +0 -97
  294. data/examples/v201101/get_all_ad_extension_overrides.rb +0 -82
  295. data/examples/v201101/get_all_ad_group_criteria.rb +0 -88
  296. data/examples/v201101/get_all_ad_groups.rb +0 -85
  297. data/examples/v201101/get_all_ad_params.rb +0 -80
  298. data/examples/v201101/get_all_ads.rb +0 -90
  299. data/examples/v201101/get_all_campaign_ad_extensions.rb +0 -87
  300. data/examples/v201101/get_all_campaign_targets.rb +0 -74
  301. data/examples/v201101/get_all_campaigns.rb +0 -77
  302. data/examples/v201101/get_all_conversions.rb +0 -79
  303. data/examples/v201101/get_all_disapproved_ads.rb +0 -93
  304. data/examples/v201101/get_all_experiments.rb +0 -89
  305. data/examples/v201101/get_all_images.rb +0 -82
  306. data/examples/v201101/get_all_paused_campaigns.rb +0 -83
  307. data/examples/v201101/get_all_report_definitions.rb +0 -75
  308. data/examples/v201101/get_all_user_lists.rb +0 -78
  309. data/examples/v201101/get_all_videos.rb +0 -78
  310. data/examples/v201101/get_bulk_mutate_job.rb +0 -97
  311. data/examples/v201101/get_campaign_alerts.rb +0 -95
  312. data/examples/v201101/get_conversion_optimizer_eligibility.rb +0 -93
  313. data/examples/v201101/get_criterion_bid_landscape.rb +0 -93
  314. data/examples/v201101/get_geo_location_info.rb +0 -99
  315. data/examples/v201101/get_keyword_opportunities.rb +0 -95
  316. data/examples/v201101/get_method_cost.rb +0 -87
  317. data/examples/v201101/get_operation_count.rb +0 -79
  318. data/examples/v201101/get_related_keywords.rb +0 -108
  319. data/examples/v201101/get_related_placements.rb +0 -107
  320. data/examples/v201101/get_report_fields.rb +0 -72
  321. data/examples/v201101/get_total_usage_units_per_month.rb +0 -74
  322. data/examples/v201101/get_traffic_estimates.rb +0 -148
  323. data/examples/v201101/get_unit_count.rb +0 -79
  324. data/examples/v201101/handle_partial_failures.rb +0 -127
  325. data/examples/v201101/handle_policy_violation_error.rb +0 -138
  326. data/examples/v201101/handle_second_factor.rb +0 -87
  327. data/examples/v201101/oauth_handling.rb +0 -95
  328. data/examples/v201101/perform_bulk_mutate_job.rb +0 -212
  329. data/examples/v201101/promote_experiment.rb +0 -79
  330. data/examples/v201101/set_ad_params.rb +0 -115
  331. data/examples/v201101/set_campaign_targets.rb +0 -102
  332. data/examples/v201101/update_ad.rb +0 -86
  333. data/examples/v201101/update_ad_group.rb +0 -81
  334. data/examples/v201101/update_ad_group_criterion.rb +0 -99
  335. data/examples/v201101/update_campaign.rb +0 -84
  336. data/examples/v201101/update_conversion.rb +0 -87
  337. data/examples/v201101/update_user_list.rb +0 -82
  338. data/examples/v201101/upload_image.rb +0 -90
  339. data/examples/v201109/add_ads.rb +0 -174
  340. data/examples/v201109/check_campaigns.rb +0 -123
  341. data/examples/v201109/delete_bulk_mutate_job.rb +0 -87
  342. data/examples/v201109/delete_experiment.rb +0 -78
  343. data/examples/v201109/delete_user_list.rb +0 -78
  344. data/examples/v201109/get_ad_group_bid_landscape.rb +0 -94
  345. data/examples/v201109/get_all_ad_extension_overrides.rb +0 -82
  346. data/examples/v201109/get_all_ad_group_criteria.rb +0 -90
  347. data/examples/v201109/get_all_ad_params.rb +0 -86
  348. data/examples/v201109/get_all_campaign_ad_extensions.rb +0 -87
  349. data/examples/v201109/get_all_campaign_targets.rb +0 -74
  350. data/examples/v201109/get_all_conversions.rb +0 -79
  351. data/examples/v201109/get_all_experiments.rb +0 -89
  352. data/examples/v201109/get_all_languages.rb +0 -73
  353. data/examples/v201109/get_all_paused_campaigns.rb +0 -83
  354. data/examples/v201109/get_all_user_lists.rb +0 -78
  355. data/examples/v201109/get_all_videos.rb +0 -78
  356. data/examples/v201109/get_bulk_mutate_job.rb +0 -97
  357. data/examples/v201109/get_conversion_optimizer_eligibility.rb +0 -93
  358. data/examples/v201109/get_geo_location_info.rb +0 -99
  359. data/examples/v201109/get_method_cost.rb +0 -87
  360. data/examples/v201109/get_operation_count.rb +0 -79
  361. data/examples/v201109/get_total_usage_units_per_month.rb +0 -74
  362. data/examples/v201109/oauth_report_download.rb +0 -97
  363. data/examples/v201109/perform_bulk_mutate_job.rb +0 -212
  364. data/examples/v201109/update_conversion.rb +0 -87
  365. data/examples/v201109/update_user_list.rb +0 -82
  366. data/lib/adwords_api/v13/account_service.rb +0 -48
  367. data/lib/adwords_api/v13/account_service_registry.rb +0 -41
  368. data/lib/adwords_api/v13/report_service.rb +0 -65
  369. data/lib/adwords_api/v13/report_service_registry.rb +0 -41
  370. data/lib/adwords_api/v200909/ad_extension_override_service.rb +0 -36
  371. data/lib/adwords_api/v200909/ad_extension_override_service_registry.rb +0 -44
  372. data/lib/adwords_api/v200909/ad_group_ad_service.rb +0 -36
  373. data/lib/adwords_api/v200909/ad_group_ad_service_registry.rb +0 -44
  374. data/lib/adwords_api/v200909/ad_group_criterion_service.rb +0 -36
  375. data/lib/adwords_api/v200909/ad_group_criterion_service_registry.rb +0 -44
  376. data/lib/adwords_api/v200909/ad_group_service.rb +0 -36
  377. data/lib/adwords_api/v200909/ad_group_service_registry.rb +0 -44
  378. data/lib/adwords_api/v200909/ad_param_service.rb +0 -36
  379. data/lib/adwords_api/v200909/ad_param_service_registry.rb +0 -44
  380. data/lib/adwords_api/v200909/bulk_mutate_job_service.rb +0 -36
  381. data/lib/adwords_api/v200909/bulk_mutate_job_service_registry.rb +0 -44
  382. data/lib/adwords_api/v200909/campaign_ad_extension_service.rb +0 -36
  383. data/lib/adwords_api/v200909/campaign_ad_extension_service_registry.rb +0 -44
  384. data/lib/adwords_api/v200909/campaign_criterion_service.rb +0 -36
  385. data/lib/adwords_api/v200909/campaign_criterion_service_registry.rb +0 -44
  386. data/lib/adwords_api/v200909/campaign_service.rb +0 -36
  387. data/lib/adwords_api/v200909/campaign_service_registry.rb +0 -44
  388. data/lib/adwords_api/v200909/campaign_target_service.rb +0 -36
  389. data/lib/adwords_api/v200909/campaign_target_service_registry.rb +0 -44
  390. data/lib/adwords_api/v200909/geo_location_service.rb +0 -32
  391. data/lib/adwords_api/v200909/geo_location_service_registry.rb +0 -44
  392. data/lib/adwords_api/v200909/info_service.rb +0 -32
  393. data/lib/adwords_api/v200909/info_service_registry.rb +0 -44
  394. data/lib/adwords_api/v200909/targeting_idea_service.rb +0 -36
  395. data/lib/adwords_api/v200909/targeting_idea_service_registry.rb +0 -44
  396. data/lib/adwords_api/v201003/ad_extension_override_service.rb +0 -36
  397. data/lib/adwords_api/v201003/ad_extension_override_service_registry.rb +0 -44
  398. data/lib/adwords_api/v201003/ad_group_ad_service.rb +0 -36
  399. data/lib/adwords_api/v201003/ad_group_ad_service_registry.rb +0 -44
  400. data/lib/adwords_api/v201003/ad_group_criterion_service.rb +0 -36
  401. data/lib/adwords_api/v201003/ad_group_criterion_service_registry.rb +0 -44
  402. data/lib/adwords_api/v201003/ad_group_service.rb +0 -36
  403. data/lib/adwords_api/v201003/ad_group_service_registry.rb +0 -44
  404. data/lib/adwords_api/v201003/ad_param_service.rb +0 -36
  405. data/lib/adwords_api/v201003/ad_param_service_registry.rb +0 -44
  406. data/lib/adwords_api/v201003/bid_landscape_service.rb +0 -32
  407. data/lib/adwords_api/v201003/bid_landscape_service_registry.rb +0 -44
  408. data/lib/adwords_api/v201003/bulk_mutate_job_service.rb +0 -36
  409. data/lib/adwords_api/v201003/bulk_mutate_job_service_registry.rb +0 -44
  410. data/lib/adwords_api/v201003/campaign_ad_extension_service.rb +0 -36
  411. data/lib/adwords_api/v201003/campaign_ad_extension_service_registry.rb +0 -44
  412. data/lib/adwords_api/v201003/campaign_criterion_service.rb +0 -36
  413. data/lib/adwords_api/v201003/campaign_criterion_service_registry.rb +0 -44
  414. data/lib/adwords_api/v201003/campaign_service.rb +0 -36
  415. data/lib/adwords_api/v201003/campaign_service_registry.rb +0 -44
  416. data/lib/adwords_api/v201003/campaign_target_service.rb +0 -36
  417. data/lib/adwords_api/v201003/campaign_target_service_registry.rb +0 -44
  418. data/lib/adwords_api/v201003/geo_location_service.rb +0 -32
  419. data/lib/adwords_api/v201003/geo_location_service_registry.rb +0 -44
  420. data/lib/adwords_api/v201003/info_service.rb +0 -32
  421. data/lib/adwords_api/v201003/info_service_registry.rb +0 -44
  422. data/lib/adwords_api/v201003/media_service.rb +0 -36
  423. data/lib/adwords_api/v201003/media_service_registry.rb +0 -44
  424. data/lib/adwords_api/v201003/report_definition_service.rb +0 -49
  425. data/lib/adwords_api/v201003/report_definition_service_registry.rb +0 -44
  426. data/lib/adwords_api/v201003/targeting_idea_service.rb +0 -36
  427. data/lib/adwords_api/v201003/targeting_idea_service_registry.rb +0 -44
  428. data/lib/adwords_api/v201008/ad_extension_override_service.rb +0 -36
  429. data/lib/adwords_api/v201008/ad_extension_override_service_registry.rb +0 -44
  430. data/lib/adwords_api/v201008/ad_group_ad_service.rb +0 -36
  431. data/lib/adwords_api/v201008/ad_group_ad_service_registry.rb +0 -44
  432. data/lib/adwords_api/v201008/ad_group_criterion_service.rb +0 -36
  433. data/lib/adwords_api/v201008/ad_group_criterion_service_registry.rb +0 -44
  434. data/lib/adwords_api/v201008/ad_group_service.rb +0 -36
  435. data/lib/adwords_api/v201008/ad_group_service_registry.rb +0 -44
  436. data/lib/adwords_api/v201008/ad_param_service.rb +0 -36
  437. data/lib/adwords_api/v201008/ad_param_service_registry.rb +0 -44
  438. data/lib/adwords_api/v201008/alert_service.rb +0 -32
  439. data/lib/adwords_api/v201008/alert_service_registry.rb +0 -44
  440. data/lib/adwords_api/v201008/bid_landscape_service.rb +0 -32
  441. data/lib/adwords_api/v201008/bid_landscape_service_registry.rb +0 -44
  442. data/lib/adwords_api/v201008/bulk_mutate_job_service.rb +0 -36
  443. data/lib/adwords_api/v201008/bulk_mutate_job_service_registry.rb +0 -44
  444. data/lib/adwords_api/v201008/campaign_ad_extension_service.rb +0 -36
  445. data/lib/adwords_api/v201008/campaign_ad_extension_service_registry.rb +0 -44
  446. data/lib/adwords_api/v201008/campaign_criterion_service.rb +0 -36
  447. data/lib/adwords_api/v201008/campaign_criterion_service_registry.rb +0 -44
  448. data/lib/adwords_api/v201008/campaign_service.rb +0 -36
  449. data/lib/adwords_api/v201008/campaign_service_registry.rb +0 -44
  450. data/lib/adwords_api/v201008/campaign_target_service.rb +0 -36
  451. data/lib/adwords_api/v201008/campaign_target_service_registry.rb +0 -44
  452. data/lib/adwords_api/v201008/customer_sync_service.rb +0 -32
  453. data/lib/adwords_api/v201008/customer_sync_service_registry.rb +0 -45
  454. data/lib/adwords_api/v201008/experiment_service.rb +0 -36
  455. data/lib/adwords_api/v201008/experiment_service_registry.rb +0 -44
  456. data/lib/adwords_api/v201008/geo_location_service.rb +0 -32
  457. data/lib/adwords_api/v201008/geo_location_service_registry.rb +0 -44
  458. data/lib/adwords_api/v201008/info_service.rb +0 -32
  459. data/lib/adwords_api/v201008/info_service_registry.rb +0 -44
  460. data/lib/adwords_api/v201008/media_service.rb +0 -36
  461. data/lib/adwords_api/v201008/media_service_registry.rb +0 -44
  462. data/lib/adwords_api/v201008/report_definition_service.rb +0 -49
  463. data/lib/adwords_api/v201008/report_definition_service_registry.rb +0 -44
  464. data/lib/adwords_api/v201008/serviced_account_service.rb +0 -32
  465. data/lib/adwords_api/v201008/serviced_account_service_registry.rb +0 -44
  466. data/lib/adwords_api/v201008/targeting_idea_service.rb +0 -36
  467. data/lib/adwords_api/v201008/targeting_idea_service_registry.rb +0 -44
  468. data/lib/adwords_api/v201008/traffic_estimator_service.rb +0 -32
  469. data/lib/adwords_api/v201008/traffic_estimator_service_registry.rb +0 -44
  470. data/lib/adwords_api/v201008/user_list_service.rb +0 -36
  471. data/lib/adwords_api/v201008/user_list_service_registry.rb +0 -44
  472. data/lib/adwords_api/v201101/ad_extension_override_service.rb +0 -36
  473. data/lib/adwords_api/v201101/ad_extension_override_service_registry.rb +0 -44
  474. data/lib/adwords_api/v201101/ad_group_ad_service.rb +0 -36
  475. data/lib/adwords_api/v201101/ad_group_ad_service_registry.rb +0 -44
  476. data/lib/adwords_api/v201101/ad_group_criterion_service.rb +0 -36
  477. data/lib/adwords_api/v201101/ad_group_criterion_service_registry.rb +0 -44
  478. data/lib/adwords_api/v201101/ad_group_service.rb +0 -36
  479. data/lib/adwords_api/v201101/ad_group_service_registry.rb +0 -44
  480. data/lib/adwords_api/v201101/ad_param_service.rb +0 -36
  481. data/lib/adwords_api/v201101/ad_param_service_registry.rb +0 -44
  482. data/lib/adwords_api/v201101/alert_service.rb +0 -32
  483. data/lib/adwords_api/v201101/alert_service_registry.rb +0 -44
  484. data/lib/adwords_api/v201101/bulk_mutate_job_service.rb +0 -36
  485. data/lib/adwords_api/v201101/bulk_mutate_job_service_registry.rb +0 -44
  486. data/lib/adwords_api/v201101/bulk_opportunity_service.rb +0 -32
  487. data/lib/adwords_api/v201101/bulk_opportunity_service_registry.rb +0 -44
  488. data/lib/adwords_api/v201101/campaign_ad_extension_service.rb +0 -36
  489. data/lib/adwords_api/v201101/campaign_ad_extension_service_registry.rb +0 -44
  490. data/lib/adwords_api/v201101/campaign_criterion_service.rb +0 -36
  491. data/lib/adwords_api/v201101/campaign_criterion_service_registry.rb +0 -44
  492. data/lib/adwords_api/v201101/campaign_service.rb +0 -36
  493. data/lib/adwords_api/v201101/campaign_service_registry.rb +0 -44
  494. data/lib/adwords_api/v201101/campaign_target_service.rb +0 -36
  495. data/lib/adwords_api/v201101/campaign_target_service_registry.rb +0 -44
  496. data/lib/adwords_api/v201101/conversion_tracker_service.rb +0 -36
  497. data/lib/adwords_api/v201101/conversion_tracker_service_registry.rb +0 -44
  498. data/lib/adwords_api/v201101/customer_sync_service.rb +0 -32
  499. data/lib/adwords_api/v201101/customer_sync_service_registry.rb +0 -45
  500. data/lib/adwords_api/v201101/data_service.rb +0 -36
  501. data/lib/adwords_api/v201101/data_service_registry.rb +0 -44
  502. data/lib/adwords_api/v201101/experiment_service.rb +0 -36
  503. data/lib/adwords_api/v201101/experiment_service_registry.rb +0 -44
  504. data/lib/adwords_api/v201101/geo_location_service.rb +0 -32
  505. data/lib/adwords_api/v201101/geo_location_service_registry.rb +0 -44
  506. data/lib/adwords_api/v201101/info_service.rb +0 -32
  507. data/lib/adwords_api/v201101/info_service_registry.rb +0 -44
  508. data/lib/adwords_api/v201101/media_service.rb +0 -36
  509. data/lib/adwords_api/v201101/media_service_registry.rb +0 -44
  510. data/lib/adwords_api/v201101/report_definition_service.rb +0 -49
  511. data/lib/adwords_api/v201101/report_definition_service_registry.rb +0 -44
  512. data/lib/adwords_api/v201101/serviced_account_service.rb +0 -32
  513. data/lib/adwords_api/v201101/serviced_account_service_registry.rb +0 -44
  514. data/lib/adwords_api/v201101/targeting_idea_service.rb +0 -36
  515. data/lib/adwords_api/v201101/targeting_idea_service_registry.rb +0 -44
  516. data/lib/adwords_api/v201101/traffic_estimator_service.rb +0 -32
  517. data/lib/adwords_api/v201101/traffic_estimator_service_registry.rb +0 -44
  518. data/lib/adwords_api/v201101/user_list_service.rb +0 -36
  519. data/lib/adwords_api/v201101/user_list_service_registry.rb +0 -44
@@ -1,6 +1,7 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
+ # Encoding: utf-8
2
3
  #
3
- # Author:: api.sgomes@gmail.com (Sérgio Gomes)
4
+ # Author:: api.dklimkin@gmail.com (Danial Klimkin)
4
5
  #
5
6
  # Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
6
7
  #
@@ -17,8 +18,8 @@
17
18
  # See the License for the specific language governing permissions and
18
19
  # limitations under the License.
19
20
  #
20
- # This example illustrates how to retrieve all the active criteria for an ad
21
- # group. To add criteria to an existing ad group, run add_ad_group_criteria.rb.
21
+ # This example illustrates how to retrieve all keywords for an ad group. To add
22
+ # keywords to an existing ad group, run add_keywords.rb.
22
23
  #
23
24
  # Tags: AdGroupCriterionService.get
24
25
 
@@ -26,8 +27,9 @@ require 'rubygems'
26
27
  require 'adwords_api'
27
28
 
28
29
  API_VERSION = :v201109
30
+ PAGE_SIZE = 500
29
31
 
30
- def get_all_active_ad_group_criteria()
32
+ def get_keywords()
31
33
  # AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
32
34
  # when called without parameters.
33
35
  adwords = AdwordsApi::Api.new
@@ -41,44 +43,49 @@ def get_all_active_ad_group_criteria()
41
43
 
42
44
  ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
43
45
 
44
- # Get all the active criteria for this ad group
46
+ # Get all keywords for this ad group.
45
47
  selector = {
46
- :fields => ['Id'],
47
- :ordering => [{
48
- :field => 'AdGroupId',
49
- :sort_order => 'ASCENDING'
50
- }],
48
+ :fields => ['Id', 'CriteriaType', 'KeywordText'],
49
+ :ordering => [
50
+ {:field => 'Id', :sort_order => 'ASCENDING'}
51
+ ],
51
52
  :predicates => [
52
- {
53
- :field => 'AdGroupId',
54
- :operator => 'IN',
55
- :values => [ad_group_id]
56
- },
57
- {
58
- :field => 'Status',
59
- :operator => 'IN',
60
- :values => ['ACTIVE']
61
- }
62
- ]
53
+ {:field => 'AdGroupId', :operator => 'EQUALS', :values => [ad_group_id]},
54
+ {:field => 'CriteriaType', :operator => 'EQUALS', :values => ['KEYWORD']}
55
+ ],
56
+ :paging => {
57
+ :start_index => 0,
58
+ :number_results => PAGE_SIZE
59
+ }
63
60
  }
64
- response = ad_group_criterion_srv.get(selector)
65
- if response and response[:entries]
66
- ad_group_criteria = response[:entries]
67
- puts "Ad group ID %d has %d active criteria." % [ad_group_id,
68
- ad_group_criteria.length]
69
- ad_group_criteria.each do |ad_group_criterion|
70
- puts "\tCriterion ID is %d and type is '%s'" %
71
- [ad_group_criterion[:criterion][:id],
72
- ad_group_criterion[:criterion][:type]]
61
+
62
+ # Set initial values.
63
+ offset, page = 0, {}
64
+
65
+ begin
66
+ page = ad_group_criterion_srv.get(selector)
67
+ if page[:entries]
68
+ page[:entries].each do |keyword|
69
+ puts "Keyword ID %d, type '%s' and text '%s'" %
70
+ [keyword[:criterion][:id],
71
+ keyword[:criterion][:type],
72
+ keyword[:criterion][:text]]
73
+ end
74
+ # Increment values to request the next page.
75
+ offset += PAGE_SIZE
76
+ selector[:paging][:start_index] = offset
73
77
  end
74
- else
75
- puts "No active criteria found for ad group %d" % ad_group_id
78
+ end while page[:total_num_entries] > offset
79
+
80
+ if page.include?(:total_num_entries)
81
+ puts "\tAd group ID %d has %d keyword(s)." %
82
+ [ad_group_id, page[:total_num_entries]]
76
83
  end
77
84
  end
78
85
 
79
86
  if __FILE__ == $0
80
87
  begin
81
- get_all_active_ad_group_criteria()
88
+ get_keywords()
82
89
 
83
90
  # HTTP errors.
84
91
  rescue AdsCommon::Errors::HttpError => e
@@ -1,6 +1,7 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
+ # Encoding: utf-8
2
3
  #
3
- # Author:: api.sgomes@gmail.com (Sérgio Gomes)
4
+ # Author:: api.dklimkin@gmail.com (Danial Klimkin)
4
5
  #
5
6
  # Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
6
7
  #
@@ -17,8 +18,8 @@
17
18
  # See the License for the specific language governing permissions and
18
19
  # limitations under the License.
19
20
  #
20
- # This example illustrates how to retrieve all the ads for an ad group. To add
21
- # ads to an existing ad group, run add_ads.rb.
21
+ # This example illustrates how to retrieve all text ads for an ad group. To add
22
+ # ads to an existing ad group, run add_text_ads.rb.
22
23
  #
23
24
  # Tags: AdGroupAdService.get
24
25
 
@@ -26,8 +27,9 @@ require 'rubygems'
26
27
  require 'adwords_api'
27
28
 
28
29
  API_VERSION = :v201109
30
+ PAGE_SIZE = 500
29
31
 
30
- def get_all_ads()
32
+ def get_text_ads()
31
33
  # AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
32
34
  # when called without parameters.
33
35
  adwords = AdwordsApi::Api.new
@@ -42,35 +44,50 @@ def get_all_ads()
42
44
 
43
45
  # Get all the ads for this ad group.
44
46
  selector = {
45
- :fields => ['Id', 'Status'],
47
+ :fields => ['Id', 'Status', 'AdType'],
46
48
  :ordering => [{:field => 'Id', :sort_order => 'ASCENDING'}],
47
49
  # By default, disabled ads aren't returned by the selector. To return them,
48
50
  # include the DISABLED status in a predicate.
49
51
  :predicates => [
50
52
  {:field => 'AdGroupId', :operator => 'IN', :values => [ad_group_id]},
51
- {
52
- :field => 'Status',
53
- :operator => 'IN',
54
- :values => ['ENABLED', 'PAUSED', 'DISABLED']
55
- }
56
- ]
53
+ {:field => 'Status',
54
+ :operator => 'IN',
55
+ :values => ['ENABLED', 'PAUSED', 'DISABLED']},
56
+ {:field => 'AdType',
57
+ :operator => 'EQUALS',
58
+ :values => ['TEXT_AD']}
59
+ ],
60
+ :paging => {
61
+ :start_index => 0,
62
+ :number_results => PAGE_SIZE
63
+ }
57
64
  }
58
- response = ad_group_ad_srv.get(selector)
59
- if response and response[:entries]
60
- ads = response[:entries]
61
- puts "Ad group ##{ad_group_id} has #{ads.length} ad(s)."
62
- ads.each do |ad|
63
- puts " Ad id is #{ad[:ad][:id]}, type is #{ad[:ad][:xsi_type]} and " +
64
- "status is \"#{ad[:status]}\"."
65
+
66
+ # Set initial values.
67
+ offset, page = 0, {}
68
+
69
+ begin
70
+ page = ad_group_ad_srv.get(selector)
71
+ if page[:entries]
72
+ page[:entries].each do |ad|
73
+ puts "Ad ID is %d, type is '%s' and status is '%s'" %
74
+ [ad[:ad][:id], ad[:ad][:ad_type], ad[:status]]
75
+ end
76
+ # Increment values to request the next page.
77
+ offset += PAGE_SIZE
78
+ selector[:paging][:start_index] = offset
65
79
  end
66
- else
67
- puts "No ads found for ad group ##{ad_group_id}."
80
+ end while page[:total_num_entries] > offset
81
+
82
+ if page.include?(:total_num_entries)
83
+ puts "\tAd group ID %d has %d ad(s)." %
84
+ [ad_group_id, page[:total_num_entries]]
68
85
  end
69
86
  end
70
87
 
71
88
  if __FILE__ == $0
72
89
  begin
73
- get_all_ads()
90
+ get_text_ads()
74
91
 
75
92
  # HTTP errors.
76
93
  rescue AdsCommon::Errors::HttpError => e
@@ -1,6 +1,7 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
+ # Encoding: utf-8
2
3
  #
3
- # Author:: api.sgomes@gmail.com (Sérgio Gomes)
4
+ # Author:: api.dklimkin@gmail.com (Danial Klimkin)
4
5
  #
5
6
  # Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
6
7
  #
@@ -18,7 +19,7 @@
18
19
  # limitations under the License.
19
20
  #
20
21
  # This example illustrates how to update an ad, setting its status to 'PAUSED'.
21
- # To create ads, run add_ads.rb.
22
+ # To create ads, run add_text_ads.rb.
22
23
  #
23
24
  # Tags: AdGroupAdService.mutate
24
25
 
@@ -27,7 +28,7 @@ require 'adwords_api'
27
28
 
28
29
  API_VERSION = :v201109
29
30
 
30
- def update_ad()
31
+ def pause_ad()
31
32
  # AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
32
33
  # when called without parameters.
33
34
  adwords = AdwordsApi::Api.new
@@ -41,15 +42,13 @@ def update_ad()
41
42
  ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
42
43
  ad_id = 'INSERT_AD_ID_HERE'.to_i
43
44
 
44
- # Prepare for updating ad.
45
+ # Prepare operation for updating ad.
45
46
  operation = {
46
47
  :operator => 'SET',
47
48
  :operand => {
48
49
  :ad_group_id => ad_group_id,
49
50
  :status => 'PAUSED',
50
- :ad => {
51
- :id => ad_id
52
- }
51
+ :ad => {:id => ad_id}
53
52
  }
54
53
  }
55
54
 
@@ -57,7 +56,7 @@ def update_ad()
57
56
  response = ad_group_ad_srv.mutate([operation])
58
57
  if response and response[:value]
59
58
  ad = response[:value].first
60
- puts 'Ad id %d was successfully updated, status set to %s.' %
59
+ puts "Ad ID %d was successfully updated, status set to '%s'." %
61
60
  [ad[:ad][:id], ad[:status]]
62
61
  else
63
62
  puts 'No ads were updated.'
@@ -66,7 +65,7 @@ end
66
65
 
67
66
  if __FILE__ == $0
68
67
  begin
69
- update_ad()
68
+ pause_ad()
70
69
 
71
70
  # HTTP errors.
72
71
  rescue AdsCommon::Errors::HttpError => e
@@ -1,4 +1,5 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
+ # Encoding: utf-8
2
3
  #
3
4
  # Author:: api.sgomes@gmail.com (Sérgio Gomes)
4
5
  #
@@ -1,4 +1,5 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
+ # Encoding: utf-8
2
3
  #
3
4
  # Author:: api.sgomes@gmail.com (Sérgio Gomes)
4
5
  #
@@ -1,6 +1,7 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
+ # Encoding: utf-8
2
3
  #
3
- # Author:: api.sgomes@gmail.com (Sérgio Gomes)
4
+ # Author:: api.dklimkin@gmail.com (Danial Klimkin)
4
5
  #
5
6
  # Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
6
7
  #
@@ -17,8 +18,8 @@
17
18
  # See the License for the specific language governing permissions and
18
19
  # limitations under the License.
19
20
  #
20
- # This example illustrates how to update an ad group criterion, setting its
21
- # bid. To create an ad group criterion, run add_ad_group_criterion.rb.
21
+ # This example updates the bid of a keyword. To create a keyword, run
22
+ # add_keywords.rb.
22
23
  #
23
24
  # Tags: AdGroupCriterionService.mutate
24
25
 
@@ -27,7 +28,7 @@ require 'adwords_api'
27
28
 
28
29
  API_VERSION = :v201109
29
30
 
30
- def update_ad_group_criterion()
31
+ def update_keyword()
31
32
  # AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
32
33
  # when called without parameters.
33
34
  adwords = AdwordsApi::Api.new
@@ -42,7 +43,7 @@ def update_ad_group_criterion()
42
43
  ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
43
44
  criterion_id = 'INSERT_CRITERION_ID_HERE'.to_i
44
45
 
45
- # Prepare for updating ad group criterion.
46
+ # Prepare for updating a keyword.
46
47
  operation = {
47
48
  :operator => 'SET',
48
49
  :operand => {
@@ -69,17 +70,17 @@ def update_ad_group_criterion()
69
70
  response = ad_group_criterion_srv.mutate([operation])
70
71
  if response and response[:value]
71
72
  ad_group_criterion = response[:value].first
72
- puts 'Criterion id %d was successfully updated, bid set to %d.' %
73
+ puts "Keyword ID %d was successfully updated, bid set to %d." %
73
74
  [ad_group_criterion[:criterion][:id],
74
75
  ad_group_criterion[:bids][:max_cpc][:amount][:micro_amount]]
75
76
  else
76
- puts 'No criteria were updated.'
77
+ puts 'No keywords were updated.'
77
78
  end
78
79
  end
79
80
 
80
81
  if __FILE__ == $0
81
82
  begin
82
- update_ad_group_criterion()
83
+ update_keyword()
83
84
 
84
85
  # HTTP errors.
85
86
  rescue AdsCommon::Errors::HttpError => e
@@ -1,4 +1,5 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
+ # Encoding: utf-8
2
3
  #
3
4
  # Author:: api.sgomes@gmail.com (Sérgio Gomes)
4
5
  #
@@ -20,8 +21,8 @@
20
21
  # This example creates an experiment using a query percentage of 10, which
21
22
  # defines what fraction of auctions should go to the control split (90%) vs.
22
23
  # the experiment split (10%), then adds experimental bid changes for criteria
23
- # and ad groups. To get campaigns, run get_all_campaigns.rb. To get ad groups,
24
- # run get_all_ad_groups.rb. To get criteria, run get_all_ad_group_criteria.rb.
24
+ # and ad groups. To get campaigns, run get_campaigns.rb. To get ad groups,
25
+ # run get_ad_groups.rb. To get keywords, run get_keywords.rb.
25
26
  #
26
27
  # Tags: ExperimentService.mutate
27
28
 
@@ -1,4 +1,5 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
+ # Encoding: utf-8
2
3
  #
3
4
  # Author:: api.dklimkin@gmail.com (Danial Klimkin)
4
5
  #
@@ -17,8 +18,8 @@
17
18
  # See the License for the specific language governing permissions and
18
19
  # limitations under the License.
19
20
  #
20
- # This code sample illustrates how to perform asynchronous requests using the
21
- # MutateJobService.
21
+ # This code sample illustrates how to add many keywords using asynchronous
22
+ # requests and MutateJobService.
22
23
  #
23
24
  # Tags: MutateJobService.mutate, MutateJobService.get,
24
25
  # MutateJobService.getResult
@@ -31,7 +32,7 @@ RETRY_INTERVAL = 30
31
32
  RETRIES_COUNT = 30
32
33
  KEYWORD_NUMBER = 100
33
34
 
34
- def perform_mutate_job()
35
+ def add_keywords_in_bulk()
35
36
  # AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
36
37
  # when called without parameters.
37
38
  adwords = AdwordsApi::Api.new
@@ -44,44 +45,17 @@ def perform_mutate_job()
44
45
 
45
46
  ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
46
47
 
47
- # Create list of all operations for the job.
48
- operations = []
49
-
50
- # Create an AdGroupAdOperation to add a text ad.
51
- operations << {
52
- # The 'xsi_type' field allows you to specify the xsi:type of the object
53
- # being created. It's only necessary when you must provide an explicit
54
- # type that the client library can't infer.
55
- :xsi_type => 'AdGroupAdOperation',
56
- :operator => 'ADD',
57
- :operand => {
58
- :ad_group_id => ad_group_id,
59
- :ad => {
60
- :xsi_type => 'TextAd',
61
- :headline => 'Luxury Cruise to Mars',
62
- :description1 => 'Visit the Red Planet in style.',
63
- :description2 => 'Low-gravity fun for everyone!',
64
- :url => 'http://www.example.com',
65
- :display_url => 'www.example.com',
66
- }
67
- }
68
- }
69
-
70
48
  # Create AdGroupCriterionOperations to add keywords.
71
- KEYWORD_NUMBER.times do |index|
72
- operations << {
73
- :xsi_type => 'AdGroupCriterionOperation',
74
- :operator => 'ADD',
75
- :operand => {
76
- :xsi_type => 'BiddableAdGroupCriterion',
77
- :ad_group_id => ad_group_id,
78
- :criterion => {
79
- :xsi_type => 'Keyword',
80
- :match_type => 'BROAD',
81
- :text => "mars%d" % index
82
- }
83
- }
84
- }
49
+ operations = (1..KEYWORD_NUMBER).map do |index|
50
+ {:xsi_type => 'AdGroupCriterionOperation',
51
+ :operator => 'ADD',
52
+ :operand => {
53
+ :xsi_type => 'BiddableAdGroupCriterion',
54
+ :ad_group_id => ad_group_id,
55
+ :criterion => {
56
+ :xsi_type => 'Keyword',
57
+ :match_type => 'BROAD',
58
+ :text => "mars%d" % index}}}
85
59
  end
86
60
 
87
61
  # You can specify up to 3 job IDs that must successfully complete before
@@ -151,13 +125,13 @@ def perform_mutate_job()
151
125
  raise StandardError, 'Error retrieving job results; aborting.'
152
126
  end
153
127
  else
154
- puts "Job failed to complete after %d retries" % RETRY_COUNT
128
+ puts "Job failed to complete after %d retries." % RETRY_COUNT
155
129
  end
156
130
  end
157
131
 
158
132
  if __FILE__ == $0
159
133
  begin
160
- perform_mutate_job()
134
+ add_keywords_in_bulk()
161
135
 
162
136
  # HTTP errors.
163
137
  rescue AdsCommon::Errors::HttpError => e