google-adwords-api 0.7.2 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (274) hide show
  1. data/ChangeLog +6 -0
  2. data/README +12 -9
  3. data/adwords_api.yml +3 -17
  4. data/examples/v201206/account_management/create_account.rb +3 -0
  5. data/examples/v201206/account_management/get_account_alerts.rb +3 -0
  6. data/examples/v201206/account_management/get_account_hierarchy.rb +3 -0
  7. data/examples/v201206/account_management/get_client_customer_id.rb +3 -0
  8. data/examples/v201206/account_management/get_client_unit_usage.rb +3 -0
  9. data/examples/v201206/reporting/parallel_report_download.rb +3 -0
  10. data/examples/v201209/account_management/create_account.rb +3 -0
  11. data/examples/v201209/account_management/get_account_alerts.rb +3 -0
  12. data/examples/v201209/account_management/get_account_hierarchy.rb +3 -0
  13. data/examples/v201209/account_management/get_client_customer_id.rb +3 -0
  14. data/examples/v201209/account_management/get_client_unit_usage.rb +3 -0
  15. data/examples/{v201109/misc/use_oauth2.rb → v201209/misc/use_oauth2_jwt.rb} +19 -23
  16. data/examples/v201209/reporting/parallel_report_download.rb +3 -0
  17. data/lib/adwords_api.rb +8 -3
  18. data/lib/adwords_api/api_config.rb +0 -132
  19. data/lib/adwords_api/credential_handler.rb +3 -17
  20. data/lib/adwords_api/report_header_handler.rb +1 -2
  21. data/lib/adwords_api/report_utils.rb +1 -8
  22. data/lib/adwords_api/version.rb +1 -1
  23. data/test/adwords_api/test_adwords_api.rb +23 -9
  24. data/test/adwords_api/test_api_config.rb +0 -8
  25. data/test/adwords_api/test_credential_handler.rb +45 -9
  26. data/test/adwords_api/test_report_utils.rb +3 -2
  27. data/test/{suite_exampletests_v201109.rb → suite_integration.rb} +14 -11
  28. data/test/templates/v201209/basic_operations_get_campaigns.def +114 -0
  29. data/test/test_utils.rb +105 -0
  30. metadata +8 -250
  31. data/examples/v201109/account_management/create_account.rb +0 -80
  32. data/examples/v201109/account_management/get_account_alerts.rb +0 -111
  33. data/examples/v201109/account_management/get_account_changes.rb +0 -137
  34. data/examples/v201109/account_management/get_account_hierarchy.rb +0 -93
  35. data/examples/v201109/account_management/get_client_customer_id.rb +0 -85
  36. data/examples/v201109/account_management/get_client_unit_usage.rb +0 -87
  37. data/examples/v201109/basic_operations/add_ad_groups.rb +0 -111
  38. data/examples/v201109/basic_operations/add_campaigns.rb +0 -125
  39. data/examples/v201109/basic_operations/add_keywords.rb +0 -108
  40. data/examples/v201109/basic_operations/add_text_ads.rb +0 -105
  41. data/examples/v201109/basic_operations/delete_ad.rb +0 -85
  42. data/examples/v201109/basic_operations/delete_ad_group.rb +0 -102
  43. data/examples/v201109/basic_operations/delete_campaign.rb +0 -103
  44. data/examples/v201109/basic_operations/delete_keyword.rb +0 -90
  45. data/examples/v201109/basic_operations/get_ad_groups.rb +0 -98
  46. data/examples/v201109/basic_operations/get_campaigns.rb +0 -93
  47. data/examples/v201109/basic_operations/get_keywords.rb +0 -104
  48. data/examples/v201109/basic_operations/get_text_ads.rb +0 -106
  49. data/examples/v201109/basic_operations/pause_ad.rb +0 -84
  50. data/examples/v201109/basic_operations/update_ad_group.rb +0 -81
  51. data/examples/v201109/basic_operations/update_campaign.rb +0 -84
  52. data/examples/v201109/basic_operations/update_keyword.rb +0 -99
  53. data/examples/v201109/campaign_management/add_experiment.rb +0 -158
  54. data/examples/v201109/campaign_management/add_keywords_in_bulk.rb +0 -150
  55. data/examples/v201109/campaign_management/add_location_extension.rb +0 -117
  56. data/examples/v201109/campaign_management/add_location_extension_override.rb +0 -83
  57. data/examples/v201109/campaign_management/get_all_disapproved_ads.rb +0 -93
  58. data/examples/v201109/campaign_management/promote_experiment.rb +0 -77
  59. data/examples/v201109/campaign_management/set_ad_parameters.rb +0 -114
  60. data/examples/v201109/campaign_management/validate_text_ad.rb +0 -106
  61. data/examples/v201109/error_handling/handle_captcha_challenge.rb +0 -93
  62. data/examples/v201109/error_handling/handle_partial_failures.rb +0 -126
  63. data/examples/v201109/error_handling/handle_policy_violation_error.rb +0 -137
  64. data/examples/v201109/error_handling/handle_two_factor_authorization_error.rb +0 -87
  65. data/examples/v201109/misc/get_all_images_and_videos.rb +0 -100
  66. data/examples/v201109/misc/upload_image.rb +0 -89
  67. data/examples/v201109/misc/use_oauth.rb +0 -100
  68. data/examples/v201109/optimization/estimate_keyword_traffic.rb +0 -129
  69. data/examples/v201109/optimization/get_keyword_bid_simulations.rb +0 -92
  70. data/examples/v201109/optimization/get_keyword_ideas.rb +0 -106
  71. data/examples/v201109/optimization/get_placement_ideas.rb +0 -104
  72. data/examples/v201109/remarketing/add_audience.rb +0 -115
  73. data/examples/v201109/remarketing/add_conversion_tracker.rb +0 -97
  74. data/examples/v201109/reporting/download_criteria_report.rb +0 -79
  75. data/examples/v201109/reporting/get_campaign_stats.rb +0 -105
  76. data/examples/v201109/reporting/get_defined_reports.rb +0 -75
  77. data/examples/v201109/reporting/get_report_fields.rb +0 -71
  78. data/examples/v201109/reporting/parallel_report_download.rb +0 -159
  79. data/examples/v201109/targeting/add_campaign_targeting_criteria.rb +0 -118
  80. data/examples/v201109/targeting/get_campaign_targeting_criteria.rb +0 -102
  81. data/examples/v201109/targeting/get_targetable_languages_and_carriers.rb +0 -86
  82. data/examples/v201109/targeting/lookup_location.rb +0 -103
  83. data/examples/v201109_1/account_management/create_account.rb +0 -80
  84. data/examples/v201109_1/account_management/get_account_alerts.rb +0 -111
  85. data/examples/v201109_1/account_management/get_account_changes.rb +0 -137
  86. data/examples/v201109_1/account_management/get_account_hierarchy.rb +0 -93
  87. data/examples/v201109_1/account_management/get_client_customer_id.rb +0 -85
  88. data/examples/v201109_1/account_management/get_client_unit_usage.rb +0 -87
  89. data/examples/v201109_1/basic_operations/add_ad_groups.rb +0 -111
  90. data/examples/v201109_1/basic_operations/add_campaigns.rb +0 -140
  91. data/examples/v201109_1/basic_operations/add_keywords.rb +0 -108
  92. data/examples/v201109_1/basic_operations/add_text_ads.rb +0 -105
  93. data/examples/v201109_1/basic_operations/delete_ad.rb +0 -85
  94. data/examples/v201109_1/basic_operations/delete_ad_group.rb +0 -102
  95. data/examples/v201109_1/basic_operations/delete_campaign.rb +0 -103
  96. data/examples/v201109_1/basic_operations/delete_keyword.rb +0 -90
  97. data/examples/v201109_1/basic_operations/get_ad_groups.rb +0 -98
  98. data/examples/v201109_1/basic_operations/get_campaigns.rb +0 -93
  99. data/examples/v201109_1/basic_operations/get_keywords.rb +0 -104
  100. data/examples/v201109_1/basic_operations/get_text_ads.rb +0 -106
  101. data/examples/v201109_1/basic_operations/pause_ad.rb +0 -84
  102. data/examples/v201109_1/basic_operations/update_ad_group.rb +0 -81
  103. data/examples/v201109_1/basic_operations/update_campaign.rb +0 -84
  104. data/examples/v201109_1/basic_operations/update_keyword.rb +0 -99
  105. data/examples/v201109_1/campaign_management/add_experiment.rb +0 -158
  106. data/examples/v201109_1/campaign_management/add_keywords_in_bulk.rb +0 -150
  107. data/examples/v201109_1/campaign_management/add_location_extension.rb +0 -117
  108. data/examples/v201109_1/campaign_management/add_location_extension_override.rb +0 -83
  109. data/examples/v201109_1/campaign_management/get_all_disapproved_ads.rb +0 -93
  110. data/examples/v201109_1/campaign_management/promote_experiment.rb +0 -77
  111. data/examples/v201109_1/campaign_management/set_ad_parameters.rb +0 -114
  112. data/examples/v201109_1/campaign_management/validate_text_ad.rb +0 -106
  113. data/examples/v201109_1/error_handling/handle_captcha_challenge.rb +0 -93
  114. data/examples/v201109_1/error_handling/handle_partial_failures.rb +0 -126
  115. data/examples/v201109_1/error_handling/handle_policy_violation_error.rb +0 -137
  116. data/examples/v201109_1/error_handling/handle_two_factor_authorization_error.rb +0 -87
  117. data/examples/v201109_1/misc/get_all_images_and_videos.rb +0 -100
  118. data/examples/v201109_1/misc/upload_image.rb +0 -89
  119. data/examples/v201109_1/misc/use_oauth.rb +0 -100
  120. data/examples/v201109_1/misc/use_oauth2.rb +0 -97
  121. data/examples/v201109_1/optimization/estimate_keyword_traffic.rb +0 -129
  122. data/examples/v201109_1/optimization/get_keyword_bid_simulations.rb +0 -92
  123. data/examples/v201109_1/optimization/get_keyword_ideas.rb +0 -112
  124. data/examples/v201109_1/optimization/get_placement_ideas.rb +0 -104
  125. data/examples/v201109_1/remarketing/add_audience.rb +0 -115
  126. data/examples/v201109_1/remarketing/add_conversion_tracker.rb +0 -97
  127. data/examples/v201109_1/reporting/download_criteria_report.rb +0 -79
  128. data/examples/v201109_1/reporting/get_campaign_stats.rb +0 -105
  129. data/examples/v201109_1/reporting/get_defined_reports.rb +0 -75
  130. data/examples/v201109_1/reporting/get_report_fields.rb +0 -71
  131. data/examples/v201109_1/reporting/parallel_report_download.rb +0 -159
  132. data/examples/v201109_1/targeting/add_campaign_targeting_criteria.rb +0 -118
  133. data/examples/v201109_1/targeting/get_campaign_targeting_criteria.rb +0 -102
  134. data/examples/v201109_1/targeting/get_targetable_languages_and_carriers.rb +0 -86
  135. data/examples/v201109_1/targeting/lookup_location.rb +0 -103
  136. data/examples/v201206/misc/use_oauth.rb +0 -100
  137. data/examples/v201209/misc/use_oauth.rb +0 -100
  138. data/lib/adwords_api/v201109/ad_extension_override_service.rb +0 -38
  139. data/lib/adwords_api/v201109/ad_extension_override_service_registry.rb +0 -46
  140. data/lib/adwords_api/v201109/ad_group_ad_service.rb +0 -38
  141. data/lib/adwords_api/v201109/ad_group_ad_service_registry.rb +0 -46
  142. data/lib/adwords_api/v201109/ad_group_criterion_service.rb +0 -38
  143. data/lib/adwords_api/v201109/ad_group_criterion_service_registry.rb +0 -46
  144. data/lib/adwords_api/v201109/ad_group_service.rb +0 -38
  145. data/lib/adwords_api/v201109/ad_group_service_registry.rb +0 -46
  146. data/lib/adwords_api/v201109/ad_param_service.rb +0 -38
  147. data/lib/adwords_api/v201109/ad_param_service_registry.rb +0 -46
  148. data/lib/adwords_api/v201109/alert_service.rb +0 -34
  149. data/lib/adwords_api/v201109/alert_service_registry.rb +0 -46
  150. data/lib/adwords_api/v201109/budget_order_service.rb +0 -42
  151. data/lib/adwords_api/v201109/budget_order_service_registry.rb +0 -46
  152. data/lib/adwords_api/v201109/bulk_mutate_job_service.rb +0 -38
  153. data/lib/adwords_api/v201109/bulk_mutate_job_service_registry.rb +0 -46
  154. data/lib/adwords_api/v201109/campaign_ad_extension_service.rb +0 -38
  155. data/lib/adwords_api/v201109/campaign_ad_extension_service_registry.rb +0 -46
  156. data/lib/adwords_api/v201109/campaign_criterion_service.rb +0 -38
  157. data/lib/adwords_api/v201109/campaign_criterion_service_registry.rb +0 -46
  158. data/lib/adwords_api/v201109/campaign_service.rb +0 -38
  159. data/lib/adwords_api/v201109/campaign_service_registry.rb +0 -46
  160. data/lib/adwords_api/v201109/campaign_target_service.rb +0 -38
  161. data/lib/adwords_api/v201109/campaign_target_service_registry.rb +0 -46
  162. data/lib/adwords_api/v201109/constant_data_service.rb +0 -38
  163. data/lib/adwords_api/v201109/constant_data_service_registry.rb +0 -46
  164. data/lib/adwords_api/v201109/conversion_tracker_service.rb +0 -38
  165. data/lib/adwords_api/v201109/conversion_tracker_service_registry.rb +0 -46
  166. data/lib/adwords_api/v201109/create_account_service.rb +0 -34
  167. data/lib/adwords_api/v201109/create_account_service_registry.rb +0 -47
  168. data/lib/adwords_api/v201109/customer_sync_service.rb +0 -34
  169. data/lib/adwords_api/v201109/customer_sync_service_registry.rb +0 -47
  170. data/lib/adwords_api/v201109/data_service.rb +0 -38
  171. data/lib/adwords_api/v201109/data_service_registry.rb +0 -46
  172. data/lib/adwords_api/v201109/experiment_service.rb +0 -38
  173. data/lib/adwords_api/v201109/experiment_service_registry.rb +0 -46
  174. data/lib/adwords_api/v201109/geo_location_service.rb +0 -34
  175. data/lib/adwords_api/v201109/geo_location_service_registry.rb +0 -46
  176. data/lib/adwords_api/v201109/info_service.rb +0 -34
  177. data/lib/adwords_api/v201109/info_service_registry.rb +0 -46
  178. data/lib/adwords_api/v201109/location_criterion_service.rb +0 -34
  179. data/lib/adwords_api/v201109/location_criterion_service_registry.rb +0 -46
  180. data/lib/adwords_api/v201109/media_service.rb +0 -38
  181. data/lib/adwords_api/v201109/media_service_registry.rb +0 -46
  182. data/lib/adwords_api/v201109/mutate_job_service.rb +0 -42
  183. data/lib/adwords_api/v201109/mutate_job_service_registry.rb +0 -46
  184. data/lib/adwords_api/v201109/report_definition_service.rb +0 -38
  185. data/lib/adwords_api/v201109/report_definition_service_registry.rb +0 -46
  186. data/lib/adwords_api/v201109/serviced_account_service.rb +0 -34
  187. data/lib/adwords_api/v201109/serviced_account_service_registry.rb +0 -46
  188. data/lib/adwords_api/v201109/targeting_idea_service.rb +0 -38
  189. data/lib/adwords_api/v201109/targeting_idea_service_registry.rb +0 -46
  190. data/lib/adwords_api/v201109/traffic_estimator_service.rb +0 -34
  191. data/lib/adwords_api/v201109/traffic_estimator_service_registry.rb +0 -46
  192. data/lib/adwords_api/v201109/user_list_service.rb +0 -38
  193. data/lib/adwords_api/v201109/user_list_service_registry.rb +0 -46
  194. data/lib/adwords_api/v201109_1/ad_extension_override_service.rb +0 -38
  195. data/lib/adwords_api/v201109_1/ad_extension_override_service_registry.rb +0 -46
  196. data/lib/adwords_api/v201109_1/ad_group_ad_service.rb +0 -38
  197. data/lib/adwords_api/v201109_1/ad_group_ad_service_registry.rb +0 -46
  198. data/lib/adwords_api/v201109_1/ad_group_criterion_service.rb +0 -38
  199. data/lib/adwords_api/v201109_1/ad_group_criterion_service_registry.rb +0 -46
  200. data/lib/adwords_api/v201109_1/ad_group_service.rb +0 -38
  201. data/lib/adwords_api/v201109_1/ad_group_service_registry.rb +0 -46
  202. data/lib/adwords_api/v201109_1/ad_param_service.rb +0 -38
  203. data/lib/adwords_api/v201109_1/ad_param_service_registry.rb +0 -46
  204. data/lib/adwords_api/v201109_1/alert_service.rb +0 -34
  205. data/lib/adwords_api/v201109_1/alert_service_registry.rb +0 -46
  206. data/lib/adwords_api/v201109_1/budget_order_service.rb +0 -42
  207. data/lib/adwords_api/v201109_1/budget_order_service_registry.rb +0 -46
  208. data/lib/adwords_api/v201109_1/bulk_mutate_job_service.rb +0 -38
  209. data/lib/adwords_api/v201109_1/bulk_mutate_job_service_registry.rb +0 -46
  210. data/lib/adwords_api/v201109_1/campaign_ad_extension_service.rb +0 -38
  211. data/lib/adwords_api/v201109_1/campaign_ad_extension_service_registry.rb +0 -46
  212. data/lib/adwords_api/v201109_1/campaign_criterion_service.rb +0 -38
  213. data/lib/adwords_api/v201109_1/campaign_criterion_service_registry.rb +0 -46
  214. data/lib/adwords_api/v201109_1/campaign_service.rb +0 -38
  215. data/lib/adwords_api/v201109_1/campaign_service_registry.rb +0 -46
  216. data/lib/adwords_api/v201109_1/campaign_target_service.rb +0 -38
  217. data/lib/adwords_api/v201109_1/campaign_target_service_registry.rb +0 -46
  218. data/lib/adwords_api/v201109_1/constant_data_service.rb +0 -38
  219. data/lib/adwords_api/v201109_1/constant_data_service_registry.rb +0 -46
  220. data/lib/adwords_api/v201109_1/conversion_tracker_service.rb +0 -38
  221. data/lib/adwords_api/v201109_1/conversion_tracker_service_registry.rb +0 -46
  222. data/lib/adwords_api/v201109_1/create_account_service.rb +0 -34
  223. data/lib/adwords_api/v201109_1/create_account_service_registry.rb +0 -47
  224. data/lib/adwords_api/v201109_1/customer_service.rb +0 -34
  225. data/lib/adwords_api/v201109_1/customer_service_registry.rb +0 -46
  226. data/lib/adwords_api/v201109_1/customer_sync_service.rb +0 -34
  227. data/lib/adwords_api/v201109_1/customer_sync_service_registry.rb +0 -47
  228. data/lib/adwords_api/v201109_1/data_service.rb +0 -38
  229. data/lib/adwords_api/v201109_1/data_service_registry.rb +0 -46
  230. data/lib/adwords_api/v201109_1/experiment_service.rb +0 -38
  231. data/lib/adwords_api/v201109_1/experiment_service_registry.rb +0 -46
  232. data/lib/adwords_api/v201109_1/geo_location_service.rb +0 -34
  233. data/lib/adwords_api/v201109_1/geo_location_service_registry.rb +0 -46
  234. data/lib/adwords_api/v201109_1/info_service.rb +0 -34
  235. data/lib/adwords_api/v201109_1/info_service_registry.rb +0 -46
  236. data/lib/adwords_api/v201109_1/location_criterion_service.rb +0 -34
  237. data/lib/adwords_api/v201109_1/location_criterion_service_registry.rb +0 -46
  238. data/lib/adwords_api/v201109_1/managed_customer_service.rb +0 -38
  239. data/lib/adwords_api/v201109_1/managed_customer_service_registry.rb +0 -46
  240. data/lib/adwords_api/v201109_1/media_service.rb +0 -38
  241. data/lib/adwords_api/v201109_1/media_service_registry.rb +0 -46
  242. data/lib/adwords_api/v201109_1/mutate_job_service.rb +0 -42
  243. data/lib/adwords_api/v201109_1/mutate_job_service_registry.rb +0 -46
  244. data/lib/adwords_api/v201109_1/report_definition_service.rb +0 -38
  245. data/lib/adwords_api/v201109_1/report_definition_service_registry.rb +0 -46
  246. data/lib/adwords_api/v201109_1/serviced_account_service.rb +0 -34
  247. data/lib/adwords_api/v201109_1/serviced_account_service_registry.rb +0 -46
  248. data/lib/adwords_api/v201109_1/targeting_idea_service.rb +0 -38
  249. data/lib/adwords_api/v201109_1/targeting_idea_service_registry.rb +0 -46
  250. data/lib/adwords_api/v201109_1/traffic_estimator_service.rb +0 -34
  251. data/lib/adwords_api/v201109_1/traffic_estimator_service_registry.rb +0 -46
  252. data/lib/adwords_api/v201109_1/user_list_service.rb +0 -38
  253. data/lib/adwords_api/v201109_1/user_list_service_registry.rb +0 -46
  254. data/test/examples/v201109/test_account_management.rb +0 -60
  255. data/test/examples/v201109/test_basic_operations.rb +0 -172
  256. data/test/examples/v201109/test_campaign_management.rb +0 -116
  257. data/test/examples/v201109/test_error_handling.rb +0 -63
  258. data/test/examples/v201109/test_misc.rb +0 -45
  259. data/test/examples/v201109/test_optimization.rb +0 -63
  260. data/test/examples/v201109/test_remarketing.rb +0 -39
  261. data/test/examples/v201109/test_reporting.rb +0 -72
  262. data/test/examples/v201109/test_targeting.rb +0 -60
  263. data/test/examples/v201109/utils.rb +0 -238
  264. data/test/examples/v201109_1/test_account_management.rb +0 -60
  265. data/test/examples/v201109_1/test_basic_operations.rb +0 -172
  266. data/test/examples/v201109_1/test_campaign_management.rb +0 -116
  267. data/test/examples/v201109_1/test_error_handling.rb +0 -63
  268. data/test/examples/v201109_1/test_misc.rb +0 -45
  269. data/test/examples/v201109_1/test_optimization.rb +0 -63
  270. data/test/examples/v201109_1/test_remarketing.rb +0 -39
  271. data/test/examples/v201109_1/test_reporting.rb +0 -72
  272. data/test/examples/v201109_1/test_targeting.rb +0 -60
  273. data/test/examples/v201109_1/utils.rb +0 -238
  274. data/test/suite_exampletests_v201109_1.rb +0 -37
data/ChangeLog CHANGED
@@ -1,3 +1,9 @@
1
+ 0.8.0:
2
+ - Removed deprecated API versions v201109, v201109_1.
3
+ - Removed support for deprecated Sandbox, see http://goo.gl/Plu3o
4
+ - Require google-ads-common 0.9.0 or later from now on.
5
+ - Added support for AOuth2.0 JWT, removed OAuth1.0a support.
6
+
1
7
  0.7.2:
2
8
  - Fixed issue #87 specific to ruby1.8.
3
9
 
data/README CHANGED
@@ -3,9 +3,9 @@
3
3
  Welcome to the next generation Google-developed Ruby client library for the
4
4
  AdWords and DoubleClick Ad Exchange Buyer API!
5
5
 
6
- It contains full support for v201109, v201109_1, v201206 and v201209, with full
7
- stubs, and a simplified programming interface that lets you handle everything in
8
- native Ruby collections.
6
+ It contains full support for v201206 and v201209, with full stubs, and a
7
+ simplified programming interface that lets you handle everything in native
8
+ Ruby collections.
9
9
 
10
10
 
11
11
  = Docs for Users
@@ -105,13 +105,16 @@ Essentially, all you have to do is follow Ruby conventions, and the library will
105
105
  do the rest. All of the examples are written following this standard.
106
106
 
107
107
 
108
- === 2.2 - Using the Sandbox:
108
+ === 2.2 - Using the Test Account:
109
109
 
110
- In order to use the sandbox, make sure that the 'environment' parameter under
111
- 'service' in the configuration is set to Sandbox.
112
- config[:service] = {
113
- :environment => 'SANDBOX'
114
- }
110
+ For testing purposes, obtain a Test Account in the production environment. Any
111
+ request against a Test Account inccurs no API units charge. See this guide for
112
+ more details:
113
+
114
+ https://developers.google.com/adwords/api/docs/test-accounts
115
+
116
+ To use the library against a Test Account, set client_customer_id property in
117
+ the configuration file to its client customer ID.
115
118
 
116
119
 
117
120
  === 2.3 - Logging:
data/adwords_api.yml CHANGED
@@ -2,8 +2,7 @@
2
2
  # This is an example configuration file for the AdWords API client library.
3
3
  # Please fill in the required fields, and copy it over to your home directory.
4
4
  :authentication:
5
- # Authentication method, methods currently supported:
6
- # OAuth2, OAuth, ClientLogin.
5
+ # Authentication method, methods currently supported: OAuth2, ClientLogin.
7
6
  :method: ClientLogin
8
7
 
9
8
  # Auth parameters for OAuth2.0 method.
@@ -18,20 +17,6 @@
18
17
  #:oauth2_access_type: INSERT_OAUTH2_ACCESS_TYPE_HERE
19
18
  #:oauth2_approval_prompt: INSERT_OAUTH2_APPROVAL_PROMPT_HERE
20
19
 
21
- # Auth parameters for OAuth1.0a method.
22
- # NOTE: OAuth1.0a method is deprecated, use OAuth2.0 instead.
23
- # Set the OAuth consumer key and secret. Anonymous values can be used for
24
- # testing, and real values can be obtained by registering your application:
25
- # http://code.google.com/apis/accounts/docs/RegistrationForWebAppsAuto.html
26
- #:oauth_consumer_key: anonymous
27
- #:oauth_consumer_secret: anonymous
28
- # If you manage or store access token manually, you can specify it here.
29
- #:oauth_token: INSERT_OAUTH_TOKEN_HERE
30
- # If you need to change signature method, specify it here.
31
- #:oauth_signature_method: HMAC-SHA1
32
- # Token secret for HMAC-SHA1 method.
33
- #:oauth_token_secret: INSERT_OAUTH_TOKEN_SECRET_HERE
34
-
35
20
  # Auth parameters for ClientLogin method.
36
21
  # NOTE: ClientLogin method is deprecated, use OAuth2.0 instead.
37
22
  :password: INSERT_YOUR_PASSWORD_HERE
@@ -44,7 +29,8 @@
44
29
  :client_customer_id: INSERT_YOUR_CLIENT_CUSTOMER_ID_HERE
45
30
  :user_agent: INSERT_YOUR_USER_AGENT_HERE
46
31
  :service:
47
- :environment: SANDBOX
32
+ # Only production environment is available now, see: http://goo.gl/Plu3o
33
+ :environment: PRODUCTION
48
34
  :connection:
49
35
  # Enable to request all responses to be compressed.
50
36
  :enable_gzip: false
@@ -21,6 +21,9 @@
21
21
  # This example illustrates how to create an account. Note by default this
22
22
  # account will only be accessible via parent MCC.
23
23
  #
24
+ # Note: This code example uses MCC-level calls and won't work with Test
25
+ # Accounts, see: https://developers.google.com/adwords/api/docs/test-accounts
26
+ #
24
27
  # Tags: ManagedCustomerService.mutate
25
28
 
26
29
  require 'adwords_api'
@@ -21,6 +21,9 @@
21
21
  # This example gets all alerts for all clients of an MCC account. The effective
22
22
  # user (clientCustomerId, or authToken) must be an MCC user to get results.
23
23
  #
24
+ # Note: This code example uses MCC-level calls and won't work with Test
25
+ # Accounts, see: https://developers.google.com/adwords/api/docs/test-accounts
26
+ #
24
27
  # Tags: AlertService.get
25
28
 
26
29
  require 'adwords_api'
@@ -21,6 +21,9 @@
21
21
  # This example illustrates how to retrieve the account hierarchy under an
22
22
  # account.
23
23
  #
24
+ # Note: This code example uses MCC-level calls and won't work with Test
25
+ # Accounts, see: https://developers.google.com/adwords/api/docs/test-accounts
26
+ #
24
27
  # Tags: ManagedCustomerService.get
25
28
 
26
29
  require 'adwords_api'
@@ -22,6 +22,9 @@
22
22
  # We recommend to use this script as a one off to convert your identifiers to
23
23
  # IDs and store them for future use.
24
24
  #
25
+ # Note: This code example uses MCC-level calls and won't work with Test
26
+ # Accounts, see: https://developers.google.com/adwords/api/docs/test-accounts
27
+ #
25
28
  # Tags: InfoService.get
26
29
 
27
30
  require 'adwords_api'
@@ -21,6 +21,9 @@
21
21
  # This example illustrates how to retrieve the number of API units usage for a
22
22
  # client account for the current month.
23
23
  #
24
+ # Note: This code example uses MCC-level calls and won't work with Test
25
+ # Accounts, see: https://developers.google.com/adwords/api/docs/test-accounts
26
+ #
24
27
  # Tags: InfoService.get
25
28
 
26
29
  require 'adwords_api'
@@ -19,6 +19,9 @@
19
19
  # limitations under the License.
20
20
  #
21
21
  # This example gets and downloads an Ad Hoc report from a XML report definition.
22
+ #
23
+ # Note: This code example uses MCC-level calls and won't work with Test
24
+ # Accounts, see: https://developers.google.com/adwords/api/docs/test-accounts
22
25
 
23
26
  require 'thread'
24
27
 
@@ -21,6 +21,9 @@
21
21
  # This example illustrates how to create an account. Note by default this
22
22
  # account will only be accessible via parent MCC.
23
23
  #
24
+ # Note: This code example uses MCC-level calls and won't work with Test
25
+ # Accounts, see: https://developers.google.com/adwords/api/docs/test-accounts
26
+ #
24
27
  # Tags: ManagedCustomerService.mutate
25
28
 
26
29
  require 'adwords_api'
@@ -21,6 +21,9 @@
21
21
  # This example gets all alerts for all clients of an MCC account. The effective
22
22
  # user (clientCustomerId, or authToken) must be an MCC user to get results.
23
23
  #
24
+ # Note: This code example uses MCC-level calls and won't work with Test
25
+ # Accounts, see: https://developers.google.com/adwords/api/docs/test-accounts
26
+ #
24
27
  # Tags: AlertService.get
25
28
 
26
29
  require 'adwords_api'
@@ -21,6 +21,9 @@
21
21
  # This example illustrates how to retrieve the account hierarchy under an
22
22
  # account.
23
23
  #
24
+ # Note: This code example uses MCC-level calls and won't work with Test
25
+ # Accounts, see: https://developers.google.com/adwords/api/docs/test-accounts
26
+ #
24
27
  # Tags: ManagedCustomerService.get
25
28
 
26
29
  require 'adwords_api'
@@ -22,6 +22,9 @@
22
22
  # We recommend to use this script as a one off to convert your identifiers to
23
23
  # IDs and store them for future use.
24
24
  #
25
+ # Note: This code example uses MCC-level calls and won't work with Test
26
+ # Accounts, see: https://developers.google.com/adwords/api/docs/test-accounts
27
+ #
25
28
  # Tags: InfoService.get
26
29
 
27
30
  require 'adwords_api'
@@ -21,6 +21,9 @@
21
21
  # This example illustrates how to retrieve the number of API units usage for a
22
22
  # client account for the current month.
23
23
  #
24
+ # Note: This code example uses MCC-level calls and won't work with Test
25
+ # Accounts, see: https://developers.google.com/adwords/api/docs/test-accounts
26
+ #
24
27
  # Tags: InfoService.get
25
28
 
26
29
  require 'adwords_api'
@@ -18,13 +18,14 @@
18
18
  # See the License for the specific language governing permissions and
19
19
  # limitations under the License.
20
20
  #
21
- # This example illustrates how to use OAuth2.0 authentication method.
21
+ # This example illustrates how to use OAuth2.0 authentication method with
22
+ # Service Account (JWT).
22
23
  #
23
24
  # Tags: CampaignService.get
24
25
 
25
26
  require 'adwords_api'
26
27
 
27
- def use_oauth2()
28
+ def use_oauth2_jwt()
28
29
  # AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
29
30
  # when called without parameters.
30
31
  adwords = AdwordsApi::Api.new
@@ -33,6 +34,19 @@ def use_oauth2()
33
34
  # the configuration file or provide your own logger:
34
35
  # adwords.logger = Logger.new('adwords_xml.log')
35
36
 
37
+ # Option 1: provide key filename as authentication -> oauth2_keyfile in the
38
+ # configuration file. No additional code is necessary.
39
+ # To provide a file name at runtime, use authorize:
40
+ # adwords.authorize({:oauth2_keyfile => key_filename})
41
+
42
+ # Option 2: retrieve key manually and create OpenSSL::PKCS12 object.
43
+ # key_filename = 'INSERT_FILENAME_HERE'
44
+ # key_secret = 'INSERT_SECRET_HERE'
45
+ # key_file_data = File.read(key_filename)
46
+ # key = OpenSSL::PKCS12.new(key_file_data, key_secret).key
47
+ # adwords.authorize({:oauth2_key => key})
48
+
49
+ # Now you can make API calls.
36
50
  campaign_srv = adwords.service(:CampaignService, API_VERSION)
37
51
 
38
52
  # Get all the campaigns for this account; empty selector.
@@ -43,24 +57,7 @@ def use_oauth2()
43
57
  ]
44
58
  }
45
59
 
46
- retry_count = 0
47
-
48
- begin
49
- response = campaign_srv.get(selector)
50
- rescue AdsCommon::Errors::OAuth2VerificationRequired => e
51
- if retry_count < MAX_RETRIES
52
- puts "Hit Auth error, please navigate to URL:\n\t%s" % e.oauth_url
53
- print 'log in and type the verification code: '
54
- verification_code = gets.chomp
55
- adwords.credential_handler.set_credential(
56
- :oauth2_verification_code, verification_code)
57
- retry_count += 1
58
- retry
59
- else
60
- raise AdsCommon::Errors::AuthError, 'Failed to authenticate.'
61
- end
62
- end
63
-
60
+ response = campaign_srv.get(selector)
64
61
  if response and response[:entries]
65
62
  campaigns = response[:entries]
66
63
  campaigns.each do |campaign|
@@ -73,11 +70,10 @@ def use_oauth2()
73
70
  end
74
71
 
75
72
  if __FILE__ == $0
76
- API_VERSION = :v201109
77
- MAX_RETRIES = 3
73
+ API_VERSION = :v201209
78
74
 
79
75
  begin
80
- use_oauth2()
76
+ use_oauth2_jwt()
81
77
 
82
78
  # HTTP errors.
83
79
  rescue AdsCommon::Errors::HttpError => e
@@ -20,6 +20,9 @@
20
20
  #
21
21
  # This example gets and downloads an Ad Hoc report from a XML report definition
22
22
  # for all accounts in hierarchy in multiple parallel threads.
23
+ #
24
+ # Note: This code example uses MCC-level calls and won't work with Test
25
+ # Accounts, see: https://developers.google.com/adwords/api/docs/test-accounts
23
26
 
24
27
  require 'thread'
25
28
 
data/lib/adwords_api.rb CHANGED
@@ -63,9 +63,14 @@ module AdwordsApi
63
63
  def soap_header_handler(auth_handler, version, header_ns, default_ns)
64
64
  auth_method = @config.read('authentication.method', :CLIENTLOGIN)
65
65
  handler_class = case auth_method
66
- when :CLIENTLOGIN then AdwordsApi::ClientLoginHeaderHandler
67
- when :OAUTH, :OAUTH2 then AdsCommon::SavonHeaders::OAuthHeaderHandler
68
- end
66
+ when :CLIENTLOGIN
67
+ AdwordsApi::ClientLoginHeaderHandler
68
+ when :OAUTH2, :OAUTH2_JWT
69
+ AdsCommon::SavonHeaders::OAuthHeaderHandler
70
+ else
71
+ raise AdsCommon::Errors::AuthError,
72
+ "Unknown auth method: %s" % auth_method
73
+ end
69
74
  return handler_class.new(@credential_handler, auth_handler, header_ns,
70
75
  default_ns, version)
71
76
  end
@@ -45,68 +45,6 @@ module AdwordsApi
45
45
 
46
46
  # Configure the services available to each version
47
47
  @@service_config = {
48
- :v201109 => [
49
- :AdExtensionOverrideService,
50
- :AdGroupAdService,
51
- :AdGroupCriterionService,
52
- :AdGroupService,
53
- :AdParamService,
54
- :AlertService,
55
- :BudgetOrderService,
56
- :BulkMutateJobService,
57
- :CampaignAdExtensionService,
58
- :CampaignCriterionService,
59
- :CampaignService,
60
- :CampaignTargetService,
61
- :ConstantDataService,
62
- :ConversionTrackerService,
63
- :CreateAccountService,
64
- :CustomerSyncService,
65
- :DataService,
66
- :ExperimentService,
67
- :GeoLocationService,
68
- :InfoService,
69
- :LocationCriterionService,
70
- :MediaService,
71
- :MutateJobService,
72
- :ReportDefinitionService,
73
- :ServicedAccountService,
74
- :TargetingIdeaService,
75
- :TrafficEstimatorService,
76
- :UserListService
77
- ],
78
- :v201109_1 => [
79
- :AdExtensionOverrideService,
80
- :AdGroupAdService,
81
- :AdGroupCriterionService,
82
- :AdGroupService,
83
- :AdParamService,
84
- :AlertService,
85
- :BudgetOrderService,
86
- :BulkMutateJobService,
87
- :CampaignAdExtensionService,
88
- :CampaignCriterionService,
89
- :CampaignService,
90
- :CampaignTargetService,
91
- :ConstantDataService,
92
- :ConversionTrackerService,
93
- :CreateAccountService,
94
- :CustomerService,
95
- :CustomerSyncService,
96
- :DataService,
97
- :ExperimentService,
98
- :GeoLocationService,
99
- :InfoService,
100
- :LocationCriterionService,
101
- :ManagedCustomerService,
102
- :MediaService,
103
- :MutateJobService,
104
- :ReportDefinitionService,
105
- :ServicedAccountService,
106
- :TargetingIdeaService,
107
- :TrafficEstimatorService,
108
- :UserListService
109
- ],
110
48
  :v201206 => [
111
49
  :AdExtensionOverrideService,
112
50
  :AdGroupAdService,
@@ -172,84 +110,14 @@ module AdwordsApi
172
110
  :PRODUCTION => {
173
111
  :oauth_scope => 'https://adwords.google.com/api/adwords/',
174
112
  :header_ns => 'https://adwords.google.com/api/adwords/cm/',
175
- :v201109 => 'https://adwords.google.com/api/adwords/',
176
- :v201109_1 => 'https://adwords.google.com/api/adwords/',
177
113
  :v201206 => 'https://adwords.google.com/api/adwords/',
178
114
  :v201209 => 'https://adwords.google.com/api/adwords/'
179
- },
180
- :SANDBOX => {
181
- :oauth_scope => 'https://adwords-sandbox.google.com/api/adwords/',
182
- :header_ns => 'https://adwords.google.com/api/adwords/cm/',
183
- :v201109 => 'https://adwords-sandbox.google.com/api/adwords/',
184
- :v201109_1 => 'https://adwords-sandbox.google.com/api/adwords/',
185
- :v201206 => 'https://adwords-sandbox.google.com/api/adwords/',
186
- :v201209 => 'https://adwords-sandbox.google.com/api/adwords/'
187
115
  }
188
116
  }
189
117
 
190
118
  # Configure the subdirectories for each version / service pair.
191
119
  # A missing pair means that only the base URL is used.
192
120
  @@subdir_config = {
193
- # v201109
194
- [:v201109, :AdExtensionOverrideService] => 'cm/',
195
- [:v201109, :AdGroupAdService] => 'cm/',
196
- [:v201109, :AdGroupCriterionService] => 'cm/',
197
- [:v201109, :AdGroupService] => 'cm/',
198
- [:v201109, :AdParamService] => 'cm/',
199
- [:v201109, :AlertService] => 'mcm/',
200
- [:v201109, :BudgetOrderService] => 'billing/',
201
- [:v201109, :BulkMutateJobService] => 'job/',
202
- [:v201109, :CampaignAdExtensionService] => 'cm/',
203
- [:v201109, :CampaignCriterionService] => 'cm/',
204
- [:v201109, :CampaignService] => 'cm/',
205
- [:v201109, :CampaignTargetService] => 'cm/',
206
- [:v201109, :ConstantDataService] => 'cm/',
207
- [:v201109, :ConversionTrackerService] => 'cm/',
208
- [:v201109, :CreateAccountService] => 'mcm/',
209
- [:v201109, :CustomerSyncService] => 'ch/',
210
- [:v201109, :DataService] => 'cm/',
211
- [:v201109, :ExperimentService] => 'cm/',
212
- [:v201109, :GeoLocationService] => 'cm/',
213
- [:v201109, :InfoService] => 'info/',
214
- [:v201109, :LocationCriterionService] => 'cm/',
215
- [:v201109, :MediaService] => 'cm/',
216
- [:v201109, :MutateJobService] => 'cm/',
217
- [:v201109, :ReportDefinitionService] => 'cm/',
218
- [:v201109, :ServicedAccountService] => 'mcm/',
219
- [:v201109, :TargetingIdeaService] => 'o/',
220
- [:v201109, :TrafficEstimatorService] => 'o/',
221
- [:v201109, :UserListService] => 'cm/',
222
- # v201109_1
223
- [:v201109_1, :AdExtensionOverrideService] => 'cm/',
224
- [:v201109_1, :AdGroupAdService] => 'cm/',
225
- [:v201109_1, :AdGroupCriterionService] => 'cm/',
226
- [:v201109_1, :AdGroupService] => 'cm/',
227
- [:v201109_1, :AdParamService] => 'cm/',
228
- [:v201109_1, :AlertService] => 'mcm/',
229
- [:v201109_1, :BudgetOrderService] => 'billing/',
230
- [:v201109_1, :BulkMutateJobService] => 'job/',
231
- [:v201109_1, :CampaignAdExtensionService] => 'cm/',
232
- [:v201109_1, :CampaignCriterionService] => 'cm/',
233
- [:v201109_1, :CampaignService] => 'cm/',
234
- [:v201109_1, :CampaignTargetService] => 'cm/',
235
- [:v201109_1, :ConstantDataService] => 'cm/',
236
- [:v201109_1, :ConversionTrackerService] => 'cm/',
237
- [:v201109_1, :CreateAccountService] => 'mcm/',
238
- [:v201109_1, :CustomerSyncService] => 'ch/',
239
- [:v201109_1, :DataService] => 'cm/',
240
- [:v201109_1, :ExperimentService] => 'cm/',
241
- [:v201109_1, :GeoLocationService] => 'cm/',
242
- [:v201109_1, :InfoService] => 'info/',
243
- [:v201109_1, :LocationCriterionService] => 'cm/',
244
- [:v201109_1, :MediaService] => 'cm/',
245
- [:v201109_1, :MutateJobService] => 'cm/',
246
- [:v201109_1, :ReportDefinitionService] => 'cm/',
247
- [:v201109_1, :ServicedAccountService] => 'mcm/',
248
- [:v201109_1, :TargetingIdeaService] => 'o/',
249
- [:v201109_1, :TrafficEstimatorService] => 'o/',
250
- [:v201109_1, :UserListService] => 'cm/',
251
- [:v201109_1, :ManagedCustomerService] => 'mcm/',
252
- [:v201109_1, :CustomerService] => 'mcm/',
253
121
  # v201206
254
122
  [:v201206, :AdExtensionOverrideService] => 'cm/',
255
123
  [:v201206, :AdGroupAdService] => 'cm/',