google-adwords-api 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (400) hide show
  1. checksums.yaml +4 -4
  2. data/COPYING +0 -0
  3. data/ChangeLog +5 -0
  4. data/README.md +0 -0
  5. data/adwords_api.yml +0 -0
  6. data/lib/adwords_api.rb +14 -0
  7. data/lib/adwords_api/api_config.rb +0 -92
  8. data/lib/adwords_api/batch_job_utils.rb +0 -0
  9. data/lib/adwords_api/credential_handler.rb +0 -0
  10. data/lib/adwords_api/errors.rb +0 -0
  11. data/lib/adwords_api/incremental_upload_helper.rb +0 -0
  12. data/lib/adwords_api/query_utils/query_builder.rb +41 -0
  13. data/lib/adwords_api/query_utils/report_query.rb +30 -0
  14. data/lib/adwords_api/query_utils/report_query_builder.rb +82 -0
  15. data/lib/adwords_api/query_utils/service_query.rb +61 -0
  16. data/lib/adwords_api/query_utils/service_query_builder.rb +83 -0
  17. data/lib/adwords_api/query_utils/where_builder.rb +97 -0
  18. data/lib/adwords_api/report_header_handler.rb +0 -0
  19. data/lib/adwords_api/report_stream.rb +0 -0
  20. data/lib/adwords_api/report_utils.rb +0 -0
  21. data/lib/adwords_api/utils.rb +0 -0
  22. data/lib/adwords_api/utils_reporter.rb +12 -0
  23. data/lib/adwords_api/v201705/account_label_service.rb +0 -0
  24. data/lib/adwords_api/v201705/account_label_service_registry.rb +0 -0
  25. data/lib/adwords_api/v201705/ad_customizer_feed_service.rb +0 -0
  26. data/lib/adwords_api/v201705/ad_customizer_feed_service_registry.rb +0 -0
  27. data/lib/adwords_api/v201705/ad_group_ad_service.rb +0 -0
  28. data/lib/adwords_api/v201705/ad_group_ad_service_registry.rb +0 -0
  29. data/lib/adwords_api/v201705/ad_group_bid_modifier_service.rb +0 -0
  30. data/lib/adwords_api/v201705/ad_group_bid_modifier_service_registry.rb +0 -0
  31. data/lib/adwords_api/v201705/ad_group_criterion_service.rb +0 -0
  32. data/lib/adwords_api/v201705/ad_group_criterion_service_registry.rb +0 -0
  33. data/lib/adwords_api/v201705/ad_group_extension_setting_service.rb +0 -0
  34. data/lib/adwords_api/v201705/ad_group_extension_setting_service_registry.rb +0 -0
  35. data/lib/adwords_api/v201705/ad_group_feed_service.rb +0 -0
  36. data/lib/adwords_api/v201705/ad_group_feed_service_registry.rb +0 -0
  37. data/lib/adwords_api/v201705/ad_group_service.rb +0 -0
  38. data/lib/adwords_api/v201705/ad_group_service_registry.rb +0 -0
  39. data/lib/adwords_api/v201705/ad_param_service.rb +0 -0
  40. data/lib/adwords_api/v201705/ad_param_service_registry.rb +0 -0
  41. data/lib/adwords_api/v201705/adwords_user_list_service.rb +0 -0
  42. data/lib/adwords_api/v201705/adwords_user_list_service_registry.rb +0 -0
  43. data/lib/adwords_api/v201705/batch_job_service.rb +0 -0
  44. data/lib/adwords_api/v201705/batch_job_service_registry.rb +0 -0
  45. data/lib/adwords_api/v201705/bidding_strategy_service.rb +0 -0
  46. data/lib/adwords_api/v201705/bidding_strategy_service_registry.rb +0 -0
  47. data/lib/adwords_api/v201705/budget_order_service.rb +0 -0
  48. data/lib/adwords_api/v201705/budget_order_service_registry.rb +0 -0
  49. data/lib/adwords_api/v201705/budget_service.rb +0 -0
  50. data/lib/adwords_api/v201705/budget_service_registry.rb +0 -0
  51. data/lib/adwords_api/v201705/campaign_bid_modifier_service.rb +0 -0
  52. data/lib/adwords_api/v201705/campaign_bid_modifier_service_registry.rb +0 -0
  53. data/lib/adwords_api/v201705/campaign_criterion_service.rb +0 -0
  54. data/lib/adwords_api/v201705/campaign_criterion_service_registry.rb +0 -0
  55. data/lib/adwords_api/v201705/campaign_extension_setting_service.rb +0 -0
  56. data/lib/adwords_api/v201705/campaign_extension_setting_service_registry.rb +0 -0
  57. data/lib/adwords_api/v201705/campaign_feed_service.rb +0 -0
  58. data/lib/adwords_api/v201705/campaign_feed_service_registry.rb +0 -0
  59. data/lib/adwords_api/v201705/campaign_group_performance_target_service.rb +0 -0
  60. data/lib/adwords_api/v201705/campaign_group_performance_target_service_registry.rb +0 -0
  61. data/lib/adwords_api/v201705/campaign_group_service.rb +0 -0
  62. data/lib/adwords_api/v201705/campaign_group_service_registry.rb +0 -0
  63. data/lib/adwords_api/v201705/campaign_service.rb +0 -0
  64. data/lib/adwords_api/v201705/campaign_service_registry.rb +0 -0
  65. data/lib/adwords_api/v201705/campaign_shared_set_service.rb +0 -0
  66. data/lib/adwords_api/v201705/campaign_shared_set_service_registry.rb +0 -0
  67. data/lib/adwords_api/v201705/constant_data_service.rb +0 -0
  68. data/lib/adwords_api/v201705/constant_data_service_registry.rb +0 -0
  69. data/lib/adwords_api/v201705/conversion_tracker_service.rb +0 -0
  70. data/lib/adwords_api/v201705/conversion_tracker_service_registry.rb +0 -0
  71. data/lib/adwords_api/v201705/customer_extension_setting_service.rb +0 -0
  72. data/lib/adwords_api/v201705/customer_extension_setting_service_registry.rb +0 -0
  73. data/lib/adwords_api/v201705/customer_feed_service.rb +0 -0
  74. data/lib/adwords_api/v201705/customer_feed_service_registry.rb +0 -0
  75. data/lib/adwords_api/v201705/customer_service.rb +0 -0
  76. data/lib/adwords_api/v201705/customer_service_registry.rb +0 -0
  77. data/lib/adwords_api/v201705/customer_sync_service.rb +0 -0
  78. data/lib/adwords_api/v201705/customer_sync_service_registry.rb +0 -0
  79. data/lib/adwords_api/v201705/data_service.rb +0 -0
  80. data/lib/adwords_api/v201705/data_service_registry.rb +0 -0
  81. data/lib/adwords_api/v201705/draft_async_error_service.rb +0 -0
  82. data/lib/adwords_api/v201705/draft_async_error_service_registry.rb +0 -0
  83. data/lib/adwords_api/v201705/draft_service.rb +0 -0
  84. data/lib/adwords_api/v201705/draft_service_registry.rb +0 -0
  85. data/lib/adwords_api/v201705/feed_item_service.rb +0 -0
  86. data/lib/adwords_api/v201705/feed_item_service_registry.rb +0 -0
  87. data/lib/adwords_api/v201705/feed_mapping_service.rb +0 -0
  88. data/lib/adwords_api/v201705/feed_mapping_service_registry.rb +0 -0
  89. data/lib/adwords_api/v201705/feed_service.rb +0 -0
  90. data/lib/adwords_api/v201705/feed_service_registry.rb +0 -0
  91. data/lib/adwords_api/v201705/label_service.rb +0 -0
  92. data/lib/adwords_api/v201705/label_service_registry.rb +0 -0
  93. data/lib/adwords_api/v201705/location_criterion_service.rb +0 -0
  94. data/lib/adwords_api/v201705/location_criterion_service_registry.rb +0 -0
  95. data/lib/adwords_api/v201705/managed_customer_service.rb +0 -0
  96. data/lib/adwords_api/v201705/managed_customer_service_registry.rb +0 -0
  97. data/lib/adwords_api/v201705/media_service.rb +0 -0
  98. data/lib/adwords_api/v201705/media_service_registry.rb +0 -0
  99. data/lib/adwords_api/v201705/offline_call_conversion_feed_service.rb +0 -0
  100. data/lib/adwords_api/v201705/offline_call_conversion_feed_service_registry.rb +0 -0
  101. data/lib/adwords_api/v201705/offline_conversion_feed_service.rb +0 -0
  102. data/lib/adwords_api/v201705/offline_conversion_feed_service_registry.rb +0 -0
  103. data/lib/adwords_api/v201705/report_definition_service.rb +0 -0
  104. data/lib/adwords_api/v201705/report_definition_service_registry.rb +0 -0
  105. data/lib/adwords_api/v201705/shared_criterion_service.rb +0 -0
  106. data/lib/adwords_api/v201705/shared_criterion_service_registry.rb +0 -0
  107. data/lib/adwords_api/v201705/shared_set_service.rb +0 -0
  108. data/lib/adwords_api/v201705/shared_set_service_registry.rb +0 -0
  109. data/lib/adwords_api/v201705/targeting_idea_service.rb +0 -0
  110. data/lib/adwords_api/v201705/targeting_idea_service_registry.rb +0 -0
  111. data/lib/adwords_api/v201705/traffic_estimator_service.rb +0 -0
  112. data/lib/adwords_api/v201705/traffic_estimator_service_registry.rb +0 -0
  113. data/lib/adwords_api/v201705/trial_async_error_service.rb +0 -0
  114. data/lib/adwords_api/v201705/trial_async_error_service_registry.rb +0 -0
  115. data/lib/adwords_api/v201705/trial_service.rb +0 -0
  116. data/lib/adwords_api/v201705/trial_service_registry.rb +0 -0
  117. data/lib/adwords_api/v201708/account_label_service.rb +0 -0
  118. data/lib/adwords_api/v201708/account_label_service_registry.rb +0 -0
  119. data/lib/adwords_api/v201708/ad_customizer_feed_service.rb +0 -0
  120. data/lib/adwords_api/v201708/ad_customizer_feed_service_registry.rb +0 -0
  121. data/lib/adwords_api/v201708/ad_group_ad_service.rb +0 -0
  122. data/lib/adwords_api/v201708/ad_group_ad_service_registry.rb +0 -0
  123. data/lib/adwords_api/v201708/ad_group_bid_modifier_service.rb +0 -0
  124. data/lib/adwords_api/v201708/ad_group_bid_modifier_service_registry.rb +0 -0
  125. data/lib/adwords_api/v201708/ad_group_criterion_service.rb +0 -0
  126. data/lib/adwords_api/v201708/ad_group_criterion_service_registry.rb +0 -0
  127. data/lib/adwords_api/v201708/ad_group_extension_setting_service.rb +0 -0
  128. data/lib/adwords_api/v201708/ad_group_extension_setting_service_registry.rb +0 -0
  129. data/lib/adwords_api/v201708/ad_group_feed_service.rb +0 -0
  130. data/lib/adwords_api/v201708/ad_group_feed_service_registry.rb +0 -0
  131. data/lib/adwords_api/v201708/ad_group_service.rb +0 -0
  132. data/lib/adwords_api/v201708/ad_group_service_registry.rb +0 -0
  133. data/lib/adwords_api/v201708/ad_param_service.rb +0 -0
  134. data/lib/adwords_api/v201708/ad_param_service_registry.rb +0 -0
  135. data/lib/adwords_api/v201708/adwords_user_list_service.rb +0 -0
  136. data/lib/adwords_api/v201708/adwords_user_list_service_registry.rb +0 -0
  137. data/lib/adwords_api/v201708/batch_job_service.rb +0 -0
  138. data/lib/adwords_api/v201708/batch_job_service_registry.rb +0 -0
  139. data/lib/adwords_api/v201708/bidding_strategy_service.rb +0 -0
  140. data/lib/adwords_api/v201708/bidding_strategy_service_registry.rb +0 -0
  141. data/lib/adwords_api/v201708/budget_order_service.rb +0 -0
  142. data/lib/adwords_api/v201708/budget_order_service_registry.rb +0 -0
  143. data/lib/adwords_api/v201708/budget_service.rb +0 -0
  144. data/lib/adwords_api/v201708/budget_service_registry.rb +0 -0
  145. data/lib/adwords_api/v201708/campaign_bid_modifier_service.rb +0 -0
  146. data/lib/adwords_api/v201708/campaign_bid_modifier_service_registry.rb +0 -0
  147. data/lib/adwords_api/v201708/campaign_criterion_service.rb +0 -0
  148. data/lib/adwords_api/v201708/campaign_criterion_service_registry.rb +0 -0
  149. data/lib/adwords_api/v201708/campaign_extension_setting_service.rb +0 -0
  150. data/lib/adwords_api/v201708/campaign_extension_setting_service_registry.rb +0 -0
  151. data/lib/adwords_api/v201708/campaign_feed_service.rb +0 -0
  152. data/lib/adwords_api/v201708/campaign_feed_service_registry.rb +0 -0
  153. data/lib/adwords_api/v201708/campaign_group_performance_target_service.rb +0 -0
  154. data/lib/adwords_api/v201708/campaign_group_performance_target_service_registry.rb +0 -0
  155. data/lib/adwords_api/v201708/campaign_group_service.rb +0 -0
  156. data/lib/adwords_api/v201708/campaign_group_service_registry.rb +0 -0
  157. data/lib/adwords_api/v201708/campaign_service.rb +0 -0
  158. data/lib/adwords_api/v201708/campaign_service_registry.rb +0 -0
  159. data/lib/adwords_api/v201708/campaign_shared_set_service.rb +0 -0
  160. data/lib/adwords_api/v201708/campaign_shared_set_service_registry.rb +0 -0
  161. data/lib/adwords_api/v201708/constant_data_service.rb +0 -0
  162. data/lib/adwords_api/v201708/constant_data_service_registry.rb +0 -0
  163. data/lib/adwords_api/v201708/conversion_tracker_service.rb +0 -0
  164. data/lib/adwords_api/v201708/conversion_tracker_service_registry.rb +0 -0
  165. data/lib/adwords_api/v201708/customer_extension_setting_service.rb +0 -0
  166. data/lib/adwords_api/v201708/customer_extension_setting_service_registry.rb +0 -0
  167. data/lib/adwords_api/v201708/customer_feed_service.rb +0 -0
  168. data/lib/adwords_api/v201708/customer_feed_service_registry.rb +0 -0
  169. data/lib/adwords_api/v201708/customer_service.rb +0 -0
  170. data/lib/adwords_api/v201708/customer_service_registry.rb +0 -0
  171. data/lib/adwords_api/v201708/customer_sync_service.rb +0 -0
  172. data/lib/adwords_api/v201708/customer_sync_service_registry.rb +0 -0
  173. data/lib/adwords_api/v201708/data_service.rb +0 -0
  174. data/lib/adwords_api/v201708/data_service_registry.rb +0 -0
  175. data/lib/adwords_api/v201708/draft_async_error_service.rb +0 -0
  176. data/lib/adwords_api/v201708/draft_async_error_service_registry.rb +0 -0
  177. data/lib/adwords_api/v201708/draft_service.rb +0 -0
  178. data/lib/adwords_api/v201708/draft_service_registry.rb +0 -0
  179. data/lib/adwords_api/v201708/feed_item_service.rb +0 -0
  180. data/lib/adwords_api/v201708/feed_item_service_registry.rb +0 -0
  181. data/lib/adwords_api/v201708/feed_mapping_service.rb +0 -0
  182. data/lib/adwords_api/v201708/feed_mapping_service_registry.rb +0 -0
  183. data/lib/adwords_api/v201708/feed_service.rb +0 -0
  184. data/lib/adwords_api/v201708/feed_service_registry.rb +0 -0
  185. data/lib/adwords_api/v201708/label_service.rb +0 -0
  186. data/lib/adwords_api/v201708/label_service_registry.rb +0 -0
  187. data/lib/adwords_api/v201708/location_criterion_service.rb +0 -0
  188. data/lib/adwords_api/v201708/location_criterion_service_registry.rb +0 -0
  189. data/lib/adwords_api/v201708/managed_customer_service.rb +0 -0
  190. data/lib/adwords_api/v201708/managed_customer_service_registry.rb +0 -0
  191. data/lib/adwords_api/v201708/media_service.rb +0 -0
  192. data/lib/adwords_api/v201708/media_service_registry.rb +0 -0
  193. data/lib/adwords_api/v201708/offline_call_conversion_feed_service.rb +0 -0
  194. data/lib/adwords_api/v201708/offline_call_conversion_feed_service_registry.rb +0 -0
  195. data/lib/adwords_api/v201708/offline_conversion_feed_service.rb +0 -0
  196. data/lib/adwords_api/v201708/offline_conversion_feed_service_registry.rb +0 -0
  197. data/lib/adwords_api/v201708/offline_data_upload_service.rb +0 -0
  198. data/lib/adwords_api/v201708/offline_data_upload_service_registry.rb +0 -0
  199. data/lib/adwords_api/v201708/report_definition_service.rb +0 -0
  200. data/lib/adwords_api/v201708/report_definition_service_registry.rb +0 -0
  201. data/lib/adwords_api/v201708/shared_criterion_service.rb +0 -0
  202. data/lib/adwords_api/v201708/shared_criterion_service_registry.rb +0 -0
  203. data/lib/adwords_api/v201708/shared_set_service.rb +0 -0
  204. data/lib/adwords_api/v201708/shared_set_service_registry.rb +0 -0
  205. data/lib/adwords_api/v201708/targeting_idea_service.rb +0 -0
  206. data/lib/adwords_api/v201708/targeting_idea_service_registry.rb +0 -0
  207. data/lib/adwords_api/v201708/traffic_estimator_service.rb +0 -0
  208. data/lib/adwords_api/v201708/traffic_estimator_service_registry.rb +0 -0
  209. data/lib/adwords_api/v201708/trial_async_error_service.rb +0 -0
  210. data/lib/adwords_api/v201708/trial_async_error_service_registry.rb +0 -0
  211. data/lib/adwords_api/v201708/trial_service.rb +0 -0
  212. data/lib/adwords_api/v201708/trial_service_registry.rb +0 -0
  213. data/lib/adwords_api/v201710/account_label_service.rb +0 -0
  214. data/lib/adwords_api/v201710/account_label_service_registry.rb +0 -0
  215. data/lib/adwords_api/v201710/ad_customizer_feed_service.rb +0 -0
  216. data/lib/adwords_api/v201710/ad_customizer_feed_service_registry.rb +0 -0
  217. data/lib/adwords_api/v201710/ad_group_ad_service.rb +0 -0
  218. data/lib/adwords_api/v201710/ad_group_ad_service_registry.rb +0 -0
  219. data/lib/adwords_api/v201710/ad_group_bid_modifier_service.rb +0 -0
  220. data/lib/adwords_api/v201710/ad_group_bid_modifier_service_registry.rb +0 -0
  221. data/lib/adwords_api/v201710/ad_group_criterion_service.rb +0 -0
  222. data/lib/adwords_api/v201710/ad_group_criterion_service_registry.rb +0 -0
  223. data/lib/adwords_api/v201710/ad_group_extension_setting_service.rb +0 -0
  224. data/lib/adwords_api/v201710/ad_group_extension_setting_service_registry.rb +0 -0
  225. data/lib/adwords_api/v201710/ad_group_feed_service.rb +0 -0
  226. data/lib/adwords_api/v201710/ad_group_feed_service_registry.rb +0 -0
  227. data/lib/adwords_api/v201710/ad_group_service.rb +0 -0
  228. data/lib/adwords_api/v201710/ad_group_service_registry.rb +0 -0
  229. data/lib/adwords_api/v201710/ad_param_service.rb +0 -0
  230. data/lib/adwords_api/v201710/ad_param_service_registry.rb +0 -0
  231. data/lib/adwords_api/v201710/adwords_user_list_service.rb +0 -0
  232. data/lib/adwords_api/v201710/adwords_user_list_service_registry.rb +0 -0
  233. data/lib/adwords_api/v201710/batch_job_service.rb +0 -0
  234. data/lib/adwords_api/v201710/batch_job_service_registry.rb +0 -0
  235. data/lib/adwords_api/v201710/bidding_strategy_service.rb +0 -0
  236. data/lib/adwords_api/v201710/bidding_strategy_service_registry.rb +0 -0
  237. data/lib/adwords_api/v201710/budget_order_service.rb +0 -0
  238. data/lib/adwords_api/v201710/budget_order_service_registry.rb +0 -0
  239. data/lib/adwords_api/v201710/budget_service.rb +0 -0
  240. data/lib/adwords_api/v201710/budget_service_registry.rb +0 -0
  241. data/lib/adwords_api/v201710/campaign_bid_modifier_service.rb +0 -0
  242. data/lib/adwords_api/v201710/campaign_bid_modifier_service_registry.rb +0 -0
  243. data/lib/adwords_api/v201710/campaign_criterion_service.rb +0 -0
  244. data/lib/adwords_api/v201710/campaign_criterion_service_registry.rb +0 -0
  245. data/lib/adwords_api/v201710/campaign_extension_setting_service.rb +0 -0
  246. data/lib/adwords_api/v201710/campaign_extension_setting_service_registry.rb +0 -0
  247. data/lib/adwords_api/v201710/campaign_feed_service.rb +0 -0
  248. data/lib/adwords_api/v201710/campaign_feed_service_registry.rb +0 -0
  249. data/lib/adwords_api/v201710/campaign_group_performance_target_service.rb +0 -0
  250. data/lib/adwords_api/v201710/campaign_group_performance_target_service_registry.rb +0 -0
  251. data/lib/adwords_api/v201710/campaign_group_service.rb +0 -0
  252. data/lib/adwords_api/v201710/campaign_group_service_registry.rb +0 -0
  253. data/lib/adwords_api/v201710/campaign_service.rb +0 -0
  254. data/lib/adwords_api/v201710/campaign_service_registry.rb +0 -0
  255. data/lib/adwords_api/v201710/campaign_shared_set_service.rb +0 -0
  256. data/lib/adwords_api/v201710/campaign_shared_set_service_registry.rb +0 -0
  257. data/lib/adwords_api/v201710/constant_data_service.rb +0 -0
  258. data/lib/adwords_api/v201710/constant_data_service_registry.rb +0 -0
  259. data/lib/adwords_api/v201710/conversion_tracker_service.rb +0 -0
  260. data/lib/adwords_api/v201710/conversion_tracker_service_registry.rb +0 -0
  261. data/lib/adwords_api/v201710/customer_extension_setting_service.rb +0 -0
  262. data/lib/adwords_api/v201710/customer_extension_setting_service_registry.rb +0 -0
  263. data/lib/adwords_api/v201710/customer_feed_service.rb +0 -0
  264. data/lib/adwords_api/v201710/customer_feed_service_registry.rb +0 -0
  265. data/lib/adwords_api/v201710/customer_negative_criterion_service.rb +0 -0
  266. data/lib/adwords_api/v201710/customer_negative_criterion_service_registry.rb +0 -0
  267. data/lib/adwords_api/v201710/customer_service.rb +0 -0
  268. data/lib/adwords_api/v201710/customer_service_registry.rb +0 -0
  269. data/lib/adwords_api/v201710/customer_sync_service.rb +0 -0
  270. data/lib/adwords_api/v201710/customer_sync_service_registry.rb +0 -0
  271. data/lib/adwords_api/v201710/data_service.rb +0 -0
  272. data/lib/adwords_api/v201710/data_service_registry.rb +0 -0
  273. data/lib/adwords_api/v201710/draft_async_error_service.rb +0 -0
  274. data/lib/adwords_api/v201710/draft_async_error_service_registry.rb +0 -0
  275. data/lib/adwords_api/v201710/draft_service.rb +0 -0
  276. data/lib/adwords_api/v201710/draft_service_registry.rb +0 -0
  277. data/lib/adwords_api/v201710/feed_item_service.rb +0 -0
  278. data/lib/adwords_api/v201710/feed_item_service_registry.rb +0 -0
  279. data/lib/adwords_api/v201710/feed_mapping_service.rb +0 -0
  280. data/lib/adwords_api/v201710/feed_mapping_service_registry.rb +0 -0
  281. data/lib/adwords_api/v201710/feed_service.rb +0 -0
  282. data/lib/adwords_api/v201710/feed_service_registry.rb +0 -0
  283. data/lib/adwords_api/v201710/label_service.rb +0 -0
  284. data/lib/adwords_api/v201710/label_service_registry.rb +0 -0
  285. data/lib/adwords_api/v201710/location_criterion_service.rb +0 -0
  286. data/lib/adwords_api/v201710/location_criterion_service_registry.rb +0 -0
  287. data/lib/adwords_api/v201710/managed_customer_service.rb +0 -0
  288. data/lib/adwords_api/v201710/managed_customer_service_registry.rb +0 -0
  289. data/lib/adwords_api/v201710/media_service.rb +0 -0
  290. data/lib/adwords_api/v201710/media_service_registry.rb +0 -0
  291. data/lib/adwords_api/v201710/offline_call_conversion_feed_service.rb +0 -0
  292. data/lib/adwords_api/v201710/offline_call_conversion_feed_service_registry.rb +0 -0
  293. data/lib/adwords_api/v201710/offline_conversion_feed_service.rb +0 -0
  294. data/lib/adwords_api/v201710/offline_conversion_feed_service_registry.rb +0 -0
  295. data/lib/adwords_api/v201710/offline_data_upload_service.rb +0 -0
  296. data/lib/adwords_api/v201710/offline_data_upload_service_registry.rb +0 -0
  297. data/lib/adwords_api/v201710/report_definition_service.rb +0 -0
  298. data/lib/adwords_api/v201710/report_definition_service_registry.rb +0 -0
  299. data/lib/adwords_api/v201710/shared_criterion_service.rb +0 -0
  300. data/lib/adwords_api/v201710/shared_criterion_service_registry.rb +0 -0
  301. data/lib/adwords_api/v201710/shared_set_service.rb +0 -0
  302. data/lib/adwords_api/v201710/shared_set_service_registry.rb +0 -0
  303. data/lib/adwords_api/v201710/targeting_idea_service.rb +0 -0
  304. data/lib/adwords_api/v201710/targeting_idea_service_registry.rb +0 -0
  305. data/lib/adwords_api/v201710/traffic_estimator_service.rb +0 -0
  306. data/lib/adwords_api/v201710/traffic_estimator_service_registry.rb +0 -0
  307. data/lib/adwords_api/v201710/trial_async_error_service.rb +0 -0
  308. data/lib/adwords_api/v201710/trial_async_error_service_registry.rb +0 -0
  309. data/lib/adwords_api/v201710/trial_service.rb +0 -0
  310. data/lib/adwords_api/v201710/trial_service_registry.rb +0 -0
  311. data/lib/adwords_api/version.rb +1 -1
  312. metadata +8 -96
  313. data/lib/adwords_api/v201702/account_label_service.rb +0 -46
  314. data/lib/adwords_api/v201702/account_label_service_registry.rb +0 -46
  315. data/lib/adwords_api/v201702/ad_customizer_feed_service.rb +0 -46
  316. data/lib/adwords_api/v201702/ad_customizer_feed_service_registry.rb +0 -46
  317. data/lib/adwords_api/v201702/ad_group_ad_service.rb +0 -70
  318. data/lib/adwords_api/v201702/ad_group_ad_service_registry.rb +0 -46
  319. data/lib/adwords_api/v201702/ad_group_bid_modifier_service.rb +0 -54
  320. data/lib/adwords_api/v201702/ad_group_bid_modifier_service_registry.rb +0 -46
  321. data/lib/adwords_api/v201702/ad_group_criterion_service.rb +0 -62
  322. data/lib/adwords_api/v201702/ad_group_criterion_service_registry.rb +0 -46
  323. data/lib/adwords_api/v201702/ad_group_extension_setting_service.rb +0 -54
  324. data/lib/adwords_api/v201702/ad_group_extension_setting_service_registry.rb +0 -46
  325. data/lib/adwords_api/v201702/ad_group_feed_service.rb +0 -54
  326. data/lib/adwords_api/v201702/ad_group_feed_service_registry.rb +0 -46
  327. data/lib/adwords_api/v201702/ad_group_service.rb +0 -62
  328. data/lib/adwords_api/v201702/ad_group_service_registry.rb +0 -46
  329. data/lib/adwords_api/v201702/ad_param_service.rb +0 -46
  330. data/lib/adwords_api/v201702/ad_param_service_registry.rb +0 -46
  331. data/lib/adwords_api/v201702/adwords_user_list_service.rb +0 -62
  332. data/lib/adwords_api/v201702/adwords_user_list_service_registry.rb +0 -46
  333. data/lib/adwords_api/v201702/batch_job_service.rb +0 -54
  334. data/lib/adwords_api/v201702/batch_job_service_registry.rb +0 -46
  335. data/lib/adwords_api/v201702/bidding_strategy_service.rb +0 -54
  336. data/lib/adwords_api/v201702/bidding_strategy_service_registry.rb +0 -46
  337. data/lib/adwords_api/v201702/budget_order_service.rb +0 -54
  338. data/lib/adwords_api/v201702/budget_order_service_registry.rb +0 -46
  339. data/lib/adwords_api/v201702/budget_service.rb +0 -54
  340. data/lib/adwords_api/v201702/budget_service_registry.rb +0 -46
  341. data/lib/adwords_api/v201702/campaign_criterion_service.rb +0 -54
  342. data/lib/adwords_api/v201702/campaign_criterion_service_registry.rb +0 -46
  343. data/lib/adwords_api/v201702/campaign_extension_setting_service.rb +0 -54
  344. data/lib/adwords_api/v201702/campaign_extension_setting_service_registry.rb +0 -46
  345. data/lib/adwords_api/v201702/campaign_feed_service.rb +0 -54
  346. data/lib/adwords_api/v201702/campaign_feed_service_registry.rb +0 -46
  347. data/lib/adwords_api/v201702/campaign_service.rb +0 -62
  348. data/lib/adwords_api/v201702/campaign_service_registry.rb +0 -46
  349. data/lib/adwords_api/v201702/campaign_shared_set_service.rb +0 -54
  350. data/lib/adwords_api/v201702/campaign_shared_set_service_registry.rb +0 -46
  351. data/lib/adwords_api/v201702/constant_data_service.rb +0 -110
  352. data/lib/adwords_api/v201702/constant_data_service_registry.rb +0 -46
  353. data/lib/adwords_api/v201702/conversion_tracker_service.rb +0 -54
  354. data/lib/adwords_api/v201702/conversion_tracker_service_registry.rb +0 -46
  355. data/lib/adwords_api/v201702/customer_extension_setting_service.rb +0 -54
  356. data/lib/adwords_api/v201702/customer_extension_setting_service_registry.rb +0 -46
  357. data/lib/adwords_api/v201702/customer_feed_service.rb +0 -54
  358. data/lib/adwords_api/v201702/customer_feed_service_registry.rb +0 -46
  359. data/lib/adwords_api/v201702/customer_service.rb +0 -62
  360. data/lib/adwords_api/v201702/customer_service_registry.rb +0 -46
  361. data/lib/adwords_api/v201702/customer_sync_service.rb +0 -38
  362. data/lib/adwords_api/v201702/customer_sync_service_registry.rb +0 -47
  363. data/lib/adwords_api/v201702/data_service.rb +0 -94
  364. data/lib/adwords_api/v201702/data_service_registry.rb +0 -46
  365. data/lib/adwords_api/v201702/draft_async_error_service.rb +0 -46
  366. data/lib/adwords_api/v201702/draft_async_error_service_registry.rb +0 -46
  367. data/lib/adwords_api/v201702/draft_service.rb +0 -54
  368. data/lib/adwords_api/v201702/draft_service_registry.rb +0 -46
  369. data/lib/adwords_api/v201702/feed_item_service.rb +0 -54
  370. data/lib/adwords_api/v201702/feed_item_service_registry.rb +0 -46
  371. data/lib/adwords_api/v201702/feed_mapping_service.rb +0 -54
  372. data/lib/adwords_api/v201702/feed_mapping_service_registry.rb +0 -46
  373. data/lib/adwords_api/v201702/feed_service.rb +0 -54
  374. data/lib/adwords_api/v201702/feed_service_registry.rb +0 -46
  375. data/lib/adwords_api/v201702/label_service.rb +0 -54
  376. data/lib/adwords_api/v201702/label_service_registry.rb +0 -46
  377. data/lib/adwords_api/v201702/location_criterion_service.rb +0 -46
  378. data/lib/adwords_api/v201702/location_criterion_service_registry.rb +0 -46
  379. data/lib/adwords_api/v201702/managed_customer_service.rb +0 -78
  380. data/lib/adwords_api/v201702/managed_customer_service_registry.rb +0 -46
  381. data/lib/adwords_api/v201702/media_service.rb +0 -54
  382. data/lib/adwords_api/v201702/media_service_registry.rb +0 -46
  383. data/lib/adwords_api/v201702/offline_call_conversion_feed_service.rb +0 -38
  384. data/lib/adwords_api/v201702/offline_call_conversion_feed_service_registry.rb +0 -46
  385. data/lib/adwords_api/v201702/offline_conversion_feed_service.rb +0 -38
  386. data/lib/adwords_api/v201702/offline_conversion_feed_service_registry.rb +0 -46
  387. data/lib/adwords_api/v201702/report_definition_service.rb +0 -38
  388. data/lib/adwords_api/v201702/report_definition_service_registry.rb +0 -46
  389. data/lib/adwords_api/v201702/shared_criterion_service.rb +0 -54
  390. data/lib/adwords_api/v201702/shared_criterion_service_registry.rb +0 -46
  391. data/lib/adwords_api/v201702/shared_set_service.rb +0 -54
  392. data/lib/adwords_api/v201702/shared_set_service_registry.rb +0 -46
  393. data/lib/adwords_api/v201702/targeting_idea_service.rb +0 -38
  394. data/lib/adwords_api/v201702/targeting_idea_service_registry.rb +0 -46
  395. data/lib/adwords_api/v201702/traffic_estimator_service.rb +0 -38
  396. data/lib/adwords_api/v201702/traffic_estimator_service_registry.rb +0 -46
  397. data/lib/adwords_api/v201702/trial_async_error_service.rb +0 -46
  398. data/lib/adwords_api/v201702/trial_async_error_service_registry.rb +0 -46
  399. data/lib/adwords_api/v201702/trial_service.rb +0 -54
  400. data/lib/adwords_api/v201702/trial_service_registry.rb +0 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7918e647f6e65a7e6dc263b1ace9efaa64374594
4
- data.tar.gz: ecba28d77d77bbe7cf7cd60262bcecb5d292f5ca
3
+ metadata.gz: 8d7cb94ca2d32367dc495517785a534f443f2571
4
+ data.tar.gz: 3ace7373eeb42580acb914556cb6479a3a93b9ba
5
5
  SHA512:
6
- metadata.gz: 28d2ad3aedb29c6be059e4f93c31f662fe89b4f01e450fd3ee3f93aab18ae4e1065cecf0dc7c6c1bd109bb89fbce2f99b6371d388df04e0b0d7bea08db46f2f8
7
- data.tar.gz: c4130ea29ee7620e73c0a1aeaf8e25ffeabd905cb077a296ce2bd43f7084d1004ed185ac1aca2f91a7b8d412170c37fa6ba848da9a994dfaacbd4507e9e8ef45
6
+ metadata.gz: d3058ad324f73b0db96ec1e0839fd3bb30db34d15e6472c6bb2b3f8c27c0dbdaf663da97674e9a5711db6578033b92f9bb2358bbe6d86c73faf4e0e8e4ebd211
7
+ data.tar.gz: 67d37401dd0c7d560167332aa39a7955608cc45eeffa4e8ac9bc4eadf0ae054fc314a9dcc47b2d76d6e07e19e7b49f3c785111a0b99482de700e6501dc730350
data/COPYING CHANGED
File without changes
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ 1.1.0:
2
+ - Added ReportQueryBuilder and ServiceQueryBuilder to aid in constructing
3
+ AWQL for both contexts.
4
+ - Remove deprecated API version v201702.
5
+
1
6
  1.0.1:
2
7
  - Support and examples for v201710.
3
8
 
data/README.md CHANGED
File without changes
File without changes
@@ -25,6 +25,8 @@ require 'adwords_api/errors'
25
25
  require 'adwords_api/report_utils'
26
26
  require 'adwords_api/batch_job_utils'
27
27
  require 'adwords_api/utils_reporter'
28
+ require 'adwords_api/query_utils/report_query_builder'
29
+ require 'adwords_api/query_utils/service_query_builder'
28
30
 
29
31
  # Main namespace for all the client library's modules and classes.
30
32
  module AdwordsApi
@@ -206,6 +208,18 @@ module AdwordsApi
206
208
  return AdwordsApi::BatchJobUtils.new(self, version)
207
209
  end
208
210
 
211
+ # Returns an instance of ReportQueryBuilder to aid in generating AWQL for
212
+ # reports.
213
+ def report_query_builder(&block)
214
+ return AdwordsApi::ReportQueryBuilder.new(self, &block)
215
+ end
216
+
217
+ # Returns an instance of ServiceQueryBuilder to aid in generating AWQL for
218
+ # service queries.
219
+ def service_query_builder(&block)
220
+ return AdwordsApi::ServiceQueryBuilder.new(self, &block)
221
+ end
222
+
209
223
  private
210
224
 
211
225
  # Executes block with a temporary flag set to a given value. Returns block
@@ -42,52 +42,6 @@ module AdwordsApi
42
42
 
43
43
  # Configure the services available to each version
44
44
  @@service_config = {
45
- :v201702 => [
46
- :AccountLabelService,
47
- :AdCustomizerFeedService,
48
- :AdGroupAdService,
49
- :AdGroupBidModifierService,
50
- :AdGroupCriterionService,
51
- :AdGroupExtensionSettingService,
52
- :AdGroupFeedService,
53
- :AdGroupService,
54
- :AdParamService,
55
- :AdwordsUserListService,
56
- :BatchJobService,
57
- :BiddingStrategyService,
58
- :BudgetOrderService,
59
- :BudgetService,
60
- :CampaignCriterionService,
61
- :CampaignExtensionSettingService,
62
- :CampaignFeedService,
63
- :CampaignService,
64
- :CampaignSharedSetService,
65
- :ConstantDataService,
66
- :ConversionTrackerService,
67
- :CustomerExtensionSettingService,
68
- :CustomerFeedService,
69
- :CustomerService,
70
- :CustomerSyncService,
71
- :DataService,
72
- :DraftService,
73
- :DraftAsyncErrorService,
74
- :FeedItemService,
75
- :FeedMappingService,
76
- :FeedService,
77
- :LabelService,
78
- :LocationCriterionService,
79
- :ManagedCustomerService,
80
- :MediaService,
81
- :OfflineCallConversionFeedService,
82
- :OfflineConversionFeedService,
83
- :ReportDefinitionService,
84
- :SharedCriterionService,
85
- :SharedSetService,
86
- :TargetingIdeaService,
87
- :TrafficEstimatorService,
88
- :TrialService,
89
- :TrialAsyncErrorService
90
- ],
91
45
  :v201705 => [
92
46
  :AccountLabelService,
93
47
  :AdCustomizerFeedService,
@@ -244,7 +198,6 @@ module AdwordsApi
244
198
  @@config = {
245
199
  :oauth_scope => 'https://www.googleapis.com/auth/adwords',
246
200
  :header_ns => 'https://adwords.google.com/api/adwords/cm/',
247
- :v201702 => 'https://adwords.google.com/api/adwords/',
248
201
  :v201705 => 'https://adwords.google.com/api/adwords/',
249
202
  :v201708 => 'https://adwords.google.com/api/adwords/',
250
203
  :v201710 => 'https://adwords.google.com/api/adwords/'
@@ -253,51 +206,6 @@ module AdwordsApi
253
206
  # Configure the subdirectories for each version / service pair.
254
207
  # A missing pair means that only the base URL is used.
255
208
  @@subdir_config = {
256
- # v201702
257
- [:v201702, :AccountLabelService] => 'mcm/',
258
- [:v201702, :AdCustomizerFeedService] => 'cm/',
259
- [:v201702, :AdGroupAdService] => 'cm/',
260
- [:v201702, :AdGroupBidModifierService] => 'cm/',
261
- [:v201702, :AdGroupCriterionService] => 'cm/',
262
- [:v201702, :AdGroupExtensionSettingService] => 'cm/',
263
- [:v201702, :AdGroupFeedService] => 'cm/',
264
- [:v201702, :AdGroupService] => 'cm/',
265
- [:v201702, :AdParamService] => 'cm/',
266
- [:v201702, :BatchJobService] => 'cm/',
267
- [:v201702, :BudgetOrderService] => 'billing/',
268
- [:v201702, :CampaignCriterionService] => 'cm/',
269
- [:v201702, :CampaignExtensionSettingService] => 'cm/',
270
- [:v201702, :CampaignFeedService] => 'cm/',
271
- [:v201702, :CampaignService] => 'cm/',
272
- [:v201702, :CampaignSharedSetService] => 'cm/',
273
- [:v201702, :ConstantDataService] => 'cm/',
274
- [:v201702, :ConversionTrackerService] => 'cm/',
275
- [:v201702, :CustomerExtensionSettingService] => 'cm/',
276
- [:v201702, :CustomerSyncService] => 'ch/',
277
- [:v201702, :DataService] => 'cm/',
278
- [:v201702, :FeedItemService] => 'cm/',
279
- [:v201702, :FeedMappingService] => 'cm/',
280
- [:v201702, :FeedService] => 'cm/',
281
- [:v201702, :LocationCriterionService] => 'cm/',
282
- [:v201702, :MediaService] => 'cm/',
283
- [:v201702, :OfflineCallConversionFeedService] => 'cm/',
284
- [:v201702, :OfflineConversionFeedService] => 'cm/',
285
- [:v201702, :ReportDefinitionService] => 'cm/',
286
- [:v201702, :SharedCriterionService] => 'cm/',
287
- [:v201702, :SharedSetService] => 'cm/',
288
- [:v201702, :TargetingIdeaService] => 'o/',
289
- [:v201702, :TrafficEstimatorService] => 'o/',
290
- [:v201702, :ManagedCustomerService] => 'mcm/',
291
- [:v201702, :CustomerService] => 'mcm/',
292
- [:v201702, :CustomerFeedService] => 'cm/',
293
- [:v201702, :BudgetService] => 'cm/',
294
- [:v201702, :BiddingStrategyService] => 'cm/',
295
- [:v201702, :AdwordsUserListService] => 'rm/',
296
- [:v201702, :LabelService] => 'cm/',
297
- [:v201702, :DraftService] => 'cm/',
298
- [:v201702, :DraftAsyncErrorService] => 'cm/',
299
- [:v201702, :TrialService] => 'cm/',
300
- [:v201702, :TrialAsyncErrorService] => 'cm/',
301
209
  # v201705
302
210
  [:v201705, :AccountLabelService] => 'mcm/',
303
211
  [:v201705, :AdCustomizerFeedService] => 'cm/',
File without changes
File without changes
File without changes
@@ -0,0 +1,41 @@
1
+ # Encoding: utf-8
2
+ #
3
+ # Copyright:: Copyright 2018, Google Inc. All Rights Reserved.
4
+ #
5
+ # License:: Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14
+ # implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ # Base class with common methods used across both report and service queries.
19
+
20
+ require 'adwords_api/query_utils/where_builder'
21
+
22
+ module AdwordsApi
23
+ class QueryBuilder
24
+ def initialize(api)
25
+ @api = api
26
+ @where = []
27
+ end
28
+
29
+ def where(field)
30
+ clause = WhereBuilder.new(field)
31
+ @where << clause
32
+ return clause
33
+ end
34
+
35
+ def build_where()
36
+ return '' if @where.empty?
37
+ wheres = @where.map {|w| w.awql}
38
+ return sprintf(' WHERE %s', wheres.join(' AND '))
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,30 @@
1
+ # Encoding: utf-8
2
+ #
3
+ # Copyright:: Copyright 2018, Google Inc. All Rights Reserved.
4
+ #
5
+ # License:: Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14
+ # implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ # Class to hold a generated AWQL query for reports.
19
+
20
+ module AdwordsApi
21
+ class ReportQuery
22
+ def initialize(query)
23
+ @query = query
24
+ end
25
+
26
+ def to_s()
27
+ return @query
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,82 @@
1
+ # Encoding: utf-8
2
+ #
3
+ # Copyright:: Copyright 2018, Google Inc. All Rights Reserved.
4
+ #
5
+ # License:: Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14
+ # implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ # Class with methods to aid in building AWQL for reports.
19
+
20
+ require 'adwords_api/query_utils/query_builder'
21
+ require 'adwords_api/query_utils/report_query'
22
+
23
+ module AdwordsApi
24
+ class ReportQueryBuilder < QueryBuilder
25
+ def initialize(api)
26
+ super(api)
27
+ @select = nil
28
+ @from = nil
29
+ @during_range = nil
30
+ @during_start = nil
31
+ @during_end = nil
32
+ yield self if block_given?
33
+ end
34
+
35
+ def configure()
36
+ yield self
37
+ end
38
+
39
+ def select(*fields)
40
+ @select = fields
41
+ end
42
+
43
+ def from(report_name)
44
+ @from = report_name
45
+ end
46
+
47
+ def during_date_range(date_range)
48
+ @during_range = date_range
49
+ end
50
+
51
+ def during(start_date, end_date)
52
+ @during_start = start_date
53
+ @during_end = end_date
54
+ end
55
+
56
+ def build()
57
+ raise ArgumentError,
58
+ 'Must specify SELECT clause for valid AWQL' if @select.nil?
59
+ raise ArgumentError,
60
+ 'Must specify FROM clause for valid AWQL' if @from.nil?
61
+ if !@during_range.nil? && (!@during_start.nil? || !@during_end.nil?)
62
+ raise ArgumentError,
63
+ 'Cannot specify both date range and start/end dates.'
64
+ end
65
+ result = sprintf('SELECT %s', @select.join(', '))
66
+ result += sprintf(' FROM %s', @from)
67
+ result += build_where()
68
+ if !@during_range.nil?
69
+ result += sprintf(' DURING %s', @during_range)
70
+ elsif !@during_start.nil? || !@during_end.nil?
71
+ if @during_start.nil?
72
+ raise ArgumentError, 'Cannot specify end date without start date.'
73
+ elsif @during_end.nil?
74
+ raise ArgumentError, 'Cannot specify start date without end date.'
75
+ end
76
+ result += sprintf(' DURING %s,%s', @during_start, @during_end)
77
+ end
78
+ @api.utils_reporter.report_query_builder_used()
79
+ return ReportQuery.new(result)
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,61 @@
1
+ # Encoding: utf-8
2
+ #
3
+ # Copyright:: Copyright 2018, Google Inc. All Rights Reserved.
4
+ #
5
+ # License:: Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14
+ # implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ # Class to hold a generated AWQL query and aid in paging for services.
19
+
20
+ module AdwordsApi
21
+ class ServiceQuery
22
+ def initialize(query, start_index, page_size)
23
+ @query = query
24
+ @start_index = start_index
25
+ @page_size = page_size
26
+ end
27
+
28
+ def has_next(page)
29
+ raise ArgumentError,
30
+ 'Cannot page through query with no LIMIT clause.' if @start_index.nil?
31
+ return @start_index + @page_size < page[:total_num_entries]
32
+ end
33
+
34
+ # Determining whether another page exists when dealing with bid landscapes
35
+ # is different from other types of queries. Use this method for those cases.
36
+ def has_next_landscape_page(page)
37
+ raise ArgumentError,
38
+ 'Cannot page through query with no LIMIT clause.' if @start_index.nil?
39
+ total_landscape_points_in_page = 0
40
+ page[:entries].each do |landscape|
41
+ total_landscape_points_in_page += landscape[:landscape_points].size
42
+ end
43
+ return total_landscape_points_in_page >= @page_size
44
+ end
45
+
46
+ def next_page()
47
+ raise ArgumentError,
48
+ 'Cannot page through query with no LIMIT clause.' if @start_index.nil?
49
+ @start_index += @page_size
50
+ return self
51
+ end
52
+
53
+ def to_s()
54
+ query = @query
55
+ unless @start_index.nil?
56
+ query += sprintf(' LIMIT %s,%s', @start_index, @page_size)
57
+ end
58
+ return query
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,83 @@
1
+ # Encoding: utf-8
2
+ #
3
+ # Copyright:: Copyright 2018, Google Inc. All Rights Reserved.
4
+ #
5
+ # License:: Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14
+ # implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ # Class with methods to aid in building AWQL for services.
19
+
20
+ require 'adwords_api/query_utils/query_builder'
21
+ require 'adwords_api/query_utils/service_query'
22
+ require 'set'
23
+
24
+ module AdwordsApi
25
+ class ServiceQueryBuilder < QueryBuilder
26
+ def initialize(api)
27
+ super(api)
28
+ @select = nil
29
+ @order = []
30
+ @start_index = nil
31
+ @page_size = nil
32
+ yield self if block_given?
33
+ end
34
+
35
+ def configure()
36
+ yield self
37
+ end
38
+
39
+ def select(*fields)
40
+ @select = Set[*fields]
41
+ end
42
+
43
+ def order_by_asc(field)
44
+ @order << {
45
+ :field => field,
46
+ :direction => 'ASC'
47
+ }
48
+ end
49
+
50
+ def order_by_desc(field)
51
+ @order << {
52
+ :field => field,
53
+ :direction => 'DESC'
54
+ }
55
+ end
56
+
57
+ def limit(start_index, page_size)
58
+ @start_index = start_index
59
+ @page_size = page_size
60
+ end
61
+
62
+ def build()
63
+ raise ArgumentError,
64
+ 'Must specify SELECT clause for valid AWQL' if @select.nil?
65
+ if !@start_index.nil? && @page_size.nil?
66
+ raise ArgumentError, 'Cannot specify start index without page size.'
67
+ end
68
+ if !@page_size.nil? && @start_index.nil?
69
+ raise ArgumentError, 'Cannot specify page size without start index.'
70
+ end
71
+ result = sprintf('SELECT %s', @select.to_a.join(', '))
72
+ result += build_where()
73
+ unless @order.empty?
74
+ orders = @order.map do |o|
75
+ sprintf('%s %s', o[:field], o[:direction])
76
+ end
77
+ result += sprintf(' ORDER BY %s', orders.join(', '))
78
+ end
79
+ @api.utils_reporter.service_query_builder_used()
80
+ return ServiceQuery.new(result, @start_index, @page_size)
81
+ end
82
+ end
83
+ end