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
@@ -1,39 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Encoding: utf-8
3
- #
4
- # Author:: api.dklimkin@gmail.com (Danial Klimkin)
5
- #
6
- # Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
7
- #
8
- # License:: Licensed under the Apache License, Version 2.0 (the "License");
9
- # you may not use this file except in compliance with the License.
10
- # You may obtain a copy of the License at
11
- #
12
- # http://www.apache.org/licenses/LICENSE-2.0
13
- #
14
- # Unless required by applicable law or agreed to in writing, software
15
- # distributed under the License is distributed on an "AS IS" BASIS,
16
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17
- # implied.
18
- # See the License for the specific language governing permissions and
19
- # limitations under the License.
20
- #
21
- # Tests the remarketing examples.
22
-
23
- require 'test/unit'
24
-
25
- require 'remarketing/add_audience'
26
- require 'remarketing/add_conversion_tracker'
27
-
28
- class TestRemarketingV201109_1 < Test::Unit::TestCase
29
- def setup
30
- end
31
-
32
- def test_add_audience
33
- add_audience()
34
- end
35
-
36
- def test_add_conversion_tracker
37
- add_conversion_tracker()
38
- end
39
- end
@@ -1,72 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Encoding: utf-8
3
- #
4
- # Author:: api.dklimkin@gmail.com (Danial Klimkin)
5
- #
6
- # Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
7
- #
8
- # License:: Licensed under the Apache License, Version 2.0 (the "License");
9
- # you may not use this file except in compliance with the License.
10
- # You may obtain a copy of the License at
11
- #
12
- # http://www.apache.org/licenses/LICENSE-2.0
13
- #
14
- # Unless required by applicable law or agreed to in writing, software
15
- # distributed under the License is distributed on an "AS IS" BASIS,
16
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17
- # implied.
18
- # See the License for the specific language governing permissions and
19
- # limitations under the License.
20
- #
21
- # Tests the reporting examples.
22
-
23
- require 'test/unit'
24
- require 'tempfile'
25
-
26
- require 'reporting/download_criteria_report'
27
- require 'reporting/get_campaign_stats'
28
- require 'reporting/get_report_fields'
29
- require 'reporting/parallel_report_download'
30
-
31
- THREADS = 3
32
- MAX_RETRIES = 3
33
- BACKOFF_FACTOR = 3
34
-
35
- class TestReportingV201109_1 < Test::Unit::TestCase
36
- def setup
37
- @logger = Logger.new(STDOUT)
38
- @logger.level = Logger::ERROR
39
- @adwords = AdwordsApi::Api.new
40
- @adwords.logger = @logger
41
- @utils = UtilsV201109_1.new(@adwords)
42
- end
43
-
44
- def test_download_criteria_report
45
- file = Tempfile.new('ruby-examples')
46
- begin
47
- file.close()
48
- download_criteria_report(file.path)
49
- ensure
50
- file.unlink()
51
- end
52
- end
53
-
54
- def test_get_campaign_stats
55
- get_campaign_stats()
56
- end
57
-
58
- def test_get_report_fields
59
- report_type = 'ACCOUNT_PERFORMANCE_REPORT'
60
- get_report_fields(report_type)
61
- end
62
-
63
- def test_parallel_report_download
64
- old_dir = Dir.pwd
65
- Dir.chdir('/tmp')
66
- begin
67
- parallel_report_download()
68
- ensure
69
- Dir.chdir(old_dir)
70
- end
71
- end
72
- end
@@ -1,60 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Encoding: utf-8
3
- #
4
- # Author:: api.dklimkin@gmail.com (Danial Klimkin)
5
- #
6
- # Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
7
- #
8
- # License:: Licensed under the Apache License, Version 2.0 (the "License");
9
- # you may not use this file except in compliance with the License.
10
- # You may obtain a copy of the License at
11
- #
12
- # http://www.apache.org/licenses/LICENSE-2.0
13
- #
14
- # Unless required by applicable law or agreed to in writing, software
15
- # distributed under the License is distributed on an "AS IS" BASIS,
16
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17
- # implied.
18
- # See the License for the specific language governing permissions and
19
- # limitations under the License.
20
- #
21
- # Tests the targeting examples.
22
-
23
- require 'test/unit'
24
-
25
- require 'targeting/add_campaign_targeting_criteria'
26
- require 'targeting/get_campaign_targeting_criteria'
27
- require 'targeting/get_targetable_languages_and_carriers'
28
- require 'targeting/lookup_location'
29
-
30
- class TestTargetingV201109_1 < Test::Unit::TestCase
31
- def setup
32
- @logger = Logger.new(STDOUT)
33
- @logger.level = Logger::ERROR
34
- @adwords = AdwordsApi::Api.new
35
- @adwords.logger = @logger
36
- @utils = UtilsV201109_1.new(@adwords)
37
- end
38
-
39
- def test_add_campaign_targeting_criteria
40
- campaign = @utils.get_campaign()
41
- assert_not_nil(campaign)
42
- assert_not_nil(campaign[:id])
43
- add_campaign_targeting_criteria(campaign[:id])
44
- end
45
-
46
- def test_get_campaign_targeting_criteria
47
- campaign = @utils.get_campaign()
48
- assert_not_nil(campaign)
49
- assert_not_nil(campaign[:id])
50
- get_campaign_targeting_criteria(campaign[:id])
51
- end
52
-
53
- def test_get_targetable_languages_and_carriers
54
- get_targetable_languages_and_carriers()
55
- end
56
-
57
- def test_lookup_location
58
- lookup_location()
59
- end
60
- end
@@ -1,238 +0,0 @@
1
- # Encoding: utf-8
2
- #
3
- # Author:: api.dklimkin@gmail.com (Danial Klimkin)
4
- #
5
- # Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
6
- #
7
- # License:: Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
16
- # implied.
17
- # See the License for the specific language governing permissions and
18
- # limitations under the License.
19
- #
20
- # Utilities and constants for example tests.
21
-
22
- API_VERSION = :v201109_1
23
- PAGE_SIZE = 500
24
-
25
- class UtilsV201109_1
26
- def initialize(adwords)
27
- @adwords = adwords
28
- end
29
-
30
- def get_campaign
31
- @campaign ||= create_campaign()
32
- return @campaign
33
- end
34
-
35
- def get_ad_group
36
- @ad_group ||= create_ad_group()
37
- return @ad_group
38
- end
39
-
40
- def get_ad
41
- @ad ||= create_ad(get_ad_group()[:id])
42
- return @ad
43
- end
44
-
45
- def get_keyword
46
- @keyword ||= create_keyword(get_ad_group()[:id])
47
- return @keyword
48
- end
49
-
50
- def get_location_extension
51
- @location_extension ||= create_location_extension(get_campaign()[:id])
52
- return @location_extension
53
- end
54
-
55
- def get_experiment
56
- @experiment ||= create_experiment(
57
- get_campaign()[:id], get_ad_group()[:id], get_keyword[:criterion][:id])
58
- return @experiment
59
- end
60
-
61
- private
62
-
63
- def create_campaign
64
- campaign_srv = @adwords.service(:CampaignService, API_VERSION)
65
- campaign = {
66
- :name => "Example tests campaign #%d" % (Time.new.to_f * 1000).to_i,
67
- :status => 'PAUSED',
68
- :bidding_strategy => {:xsi_type => 'ManualCPC'},
69
- :budget => {
70
- :period => 'DAILY',
71
- :amount => {:micro_amount => 50000000},
72
- :delivery_method => 'STANDARD'
73
- },
74
- :network_setting => {
75
- :target_google_search => true,
76
- :target_search_network => true,
77
- :target_content_network => true
78
- }
79
- }
80
- operation = {:operator => 'ADD', :operand => campaign}
81
- response = campaign_srv.mutate([operation])
82
- return response[:value].first
83
- end
84
-
85
- def create_ad_group
86
- campaign = get_campaign()
87
- ad_group_srv = @adwords.service(:AdGroupService, API_VERSION)
88
- ad_group = {
89
- :name => "Example tests ad group #%d" % (Time.new.to_f * 1000).to_i,
90
- :status => 'ENABLED',
91
- :campaign_id => campaign[:id],
92
- :bids => {
93
- :xsi_type => 'ManualCPCAdGroupBids',
94
- :keyword_max_cpc => {:amount => {:micro_amount => 10000000}},
95
- }
96
- }
97
- operation = {:operator => 'ADD', :operand => ad_group}
98
- response = ad_group_srv.mutate([operation])
99
- return response[:value].first
100
- end
101
-
102
- def create_ad(ad_group_id)
103
- ad_group_ad_srv = @adwords.service(:AdGroupAdService, API_VERSION)
104
- text_ad = {
105
- :xsi_type => 'TextAd',
106
- :headline => 'Examples test ad %d' % (Time.new.to_f * 1000).to_i,
107
- :description1 => 'testing ruby examples',
108
- :description2 => 'all your base are belong to us',
109
- :url => 'http://www.example.com',
110
- :display_url => 'www.example.com'
111
- }
112
- operation = {:operator => 'ADD',
113
- :operand => {:ad_group_id => ad_group_id, :ad => text_ad}}
114
- response = ad_group_ad_srv.mutate([operation])
115
- return response[:value].first
116
- end
117
-
118
- def create_keyword(ad_group_id)
119
- ad_group_criterion_srv =
120
- @adwords.service(:AdGroupCriterionService, API_VERSION)
121
- keyword = {
122
- :xsi_type => 'BiddableAdGroupCriterion',
123
- :ad_group_id => ad_group_id,
124
- :criterion => {
125
- :xsi_type => 'Keyword',
126
- :text => 'mars cruise',
127
- :match_type => 'BROAD'
128
- }
129
- }
130
- operation = {:operator => 'ADD', :operand => keyword}
131
- response = ad_group_criterion_srv.mutate([operation])
132
- return response[:value].first
133
- end
134
-
135
- def create_location_extension(campaign_id)
136
- campaign_ad_ext_srv =
137
- @adwords.service(:CampaignAdExtensionService, API_VERSION)
138
- geo_location_srv = @adwords.service(:GeoLocationService, API_VERSION)
139
-
140
- selector = {
141
- :addresses => [
142
- {
143
- :street_address => '1600 Amphitheatre Parkway',
144
- :city_name => 'Mountain View',
145
- :province_code => 'CA',
146
- :postal_code => '94043',
147
- :country_code => 'US'
148
- }
149
- ]
150
- }
151
-
152
- locations = geo_location_srv.get(selector)
153
- raise StandardError, 'Unable to retrieve geo locations.' if locations.nil?
154
-
155
- operations = locations.map do |location|
156
- {
157
- :operator => 'ADD',
158
- :operand => {
159
- :campaign_id => campaign_id,
160
- :status => 'ACTIVE',
161
- :ad_extension => {
162
- :xsi_type => 'LocationExtension',
163
- :address => location[:address],
164
- :geo_point => location[:geo_point],
165
- :encoded_location => location[:encoded_location],
166
- :source => 'ADWORDS_FRONTEND'
167
- }
168
- }
169
- }
170
- end
171
-
172
- response = campaign_ad_ext_srv.mutate(operations)
173
- extension = response[:value].first
174
- return extension
175
- end
176
-
177
- def create_experiment(campaign_id, ad_group_id, criterion_id)
178
- experiment_srv = @adwords.service(:ExperimentService, API_VERSION)
179
- ad_group_srv = @adwords.service(:AdGroupService, API_VERSION)
180
- ad_group_criterion_srv =
181
- @adwords.service(:AdGroupCriterionService, API_VERSION)
182
-
183
- operation = {
184
- :operator => 'ADD',
185
- :operand => {
186
- :campaign_id => campaign_id,
187
- :name => "Examples test experiment #%d" % (Time.new.to_f * 1000).to_i,
188
- :query_percentage => 10,
189
- :start_date_time => Time.now.strftime('%Y%m%d %H%M%S'),
190
- }
191
- }
192
- response = experiment_srv.mutate([operation])
193
- experiment = response[:value].first
194
-
195
- raise StandardError, 'Failed to create experiment' if experiment.nil?
196
-
197
- ad_group = {
198
- :id => ad_group_id,
199
- :experiment_data => {
200
- :experiment_id => experiment[:id],
201
- :experiment_delta_status => 'MODIFIED',
202
- :experiment_bid_multipliers => {
203
- :xsi_type => 'ManualCPCAdGroupExperimentBidMultipliers',
204
- :max_cpc_multiplier => {:multiplier => 1.5}
205
- }
206
- }
207
- }
208
-
209
- operation = {:operator => 'SET', :operand => ad_group}
210
- response = ad_group_srv.mutate([operation])
211
- ad_group = response[:value].first
212
-
213
- raise StandardError, 'Failed to assign experiment' if ad_group.nil?
214
-
215
- ad_group_criterion = {
216
- :xsi_type => 'BiddableAdGroupCriterion',
217
- :ad_group_id => ad_group_id,
218
- :criterion => {:id => criterion_id},
219
- :experiment_data => {
220
- :xsi_type => 'BiddableAdGroupCriterionExperimentData',
221
- :experiment_id => experiment[:id],
222
- :experiment_delta_status => 'MODIFIED',
223
- :experiment_bid_multiplier => {
224
- :xsi_type => 'ManualCPCAdGroupCriterionExperimentBidMultiplier',
225
- :max_cpc_multiplier => {:multiplier => 1.5}
226
- }
227
- }
228
- }
229
-
230
- operation = {:operator => 'SET', :operand => ad_group_criterion}
231
- response = ad_group_criterion_srv.mutate([operation])
232
- criterion = response[:value].first
233
-
234
- raise StandardError, 'Failed to assign criterion' if criterion.nil?
235
-
236
- return experiment
237
- end
238
- end
@@ -1,37 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Encoding: utf-8
3
- #
4
- # Author:: api.dklimkin@gmail.com (Danial Klimkin)
5
- #
6
- # Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
7
- #
8
- # License:: Licensed under the Apache License, Version 2.0 (the "License");
9
- # you may not use this file except in compliance with the License.
10
- # You may obtain a copy of the License at
11
- #
12
- # http://www.apache.org/licenses/LICENSE-2.0
13
- #
14
- # Unless required by applicable law or agreed to in writing, software
15
- # distributed under the License is distributed on an "AS IS" BASIS,
16
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17
- # implied.
18
- # See the License for the specific language governing permissions and
19
- # limitations under the License.
20
- #
21
- # Test suite for v201109_1 example tests.
22
-
23
- require 'test/unit'
24
-
25
- $:.unshift File.expand_path('../../lib/', __FILE__)
26
- $:.unshift File.expand_path('../../', __FILE__)
27
-
28
- version = 'v201109_1'
29
-
30
- examples_path =
31
- File.expand_path(File.join('..', '..', 'examples', version), __FILE__)
32
- $:.unshift(examples_path)
33
-
34
- tests_path = File.join(File.dirname(__FILE__), 'examples', version)
35
- require File.join(tests_path, 'utils.rb')
36
- tests_mask = File.join(tests_path, 'test_*.rb')
37
- Dir.glob(tests_mask).each {|file| require file}