google-dfp-api 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (370) hide show
  1. checksums.yaml +15 -0
  2. data/ChangeLog +6 -0
  3. data/examples/{v201311 → v201411}/activity_group_service/create_activity_groups.rb +1 -1
  4. data/examples/{v201311 → v201411}/activity_group_service/get_active_activity_groups.rb +18 -27
  5. data/examples/{v201311 → v201411}/activity_group_service/get_all_activity_groups.rb +13 -23
  6. data/examples/{v201311 → v201411}/activity_group_service/update_activity_groups.rb +25 -14
  7. data/examples/{v201311 → v201411}/activity_service/create_activities.rb +1 -1
  8. data/examples/{v201311 → v201411}/activity_service/get_active_activities.rb +15 -27
  9. data/examples/{v201311 → v201411}/activity_service/get_all_activities.rb +10 -21
  10. data/examples/{v201311 → v201411}/activity_service/update_activities.rb +32 -16
  11. data/examples/{v201311 → v201411}/audience_segment_service/create_audience_segments.rb +1 -1
  12. data/examples/{v201311 → v201411}/audience_segment_service/get_all_audience_segments.rb +10 -19
  13. data/examples/{v201311 → v201411}/audience_segment_service/get_first_party_audience_segments.rb +14 -21
  14. data/examples/{v201311 → v201411}/audience_segment_service/populate_first_party_audience_segments.rb +16 -13
  15. data/examples/{v201311 → v201411}/audience_segment_service/update_audience_segments.rb +12 -11
  16. data/examples/{v201311 → v201411}/common/error_handling.rb +1 -1
  17. data/examples/{v201311 → v201411}/common/oauth2_jwt_handling.rb +9 -17
  18. data/examples/{v201311 → v201411}/common/setup_oauth2.rb +1 -1
  19. data/examples/{v201311 → v201411}/company_service/create_companies.rb +1 -1
  20. data/examples/{v201311 → v201411}/company_service/get_all_companies.rb +10 -18
  21. data/examples/{v201311 → v201411}/company_service/get_companies_by_statement.rb +21 -16
  22. data/examples/{v201311 → v201411}/company_service/update_companies.rb +17 -11
  23. data/examples/{v201311 → v201411}/contact_service/create_contacts.rb +1 -1
  24. data/examples/{v201311 → v201411}/contact_service/get_all_contacts.rb +11 -19
  25. data/examples/{v201311 → v201411}/contact_service/get_uninvited_contacts.rb +18 -22
  26. data/examples/{v201311 → v201411}/contact_service/update_contacts.rb +33 -17
  27. data/examples/v201411/content_metadata_key_hierarchy_service/create_content_metadata_key_hierarchies.rb +96 -0
  28. data/examples/v201411/content_metadata_key_hierarchy_service/delete_content_metadata_key_hierarchies.rb +106 -0
  29. data/examples/v201411/content_metadata_key_hierarchy_service/get_all_content_metadata_key_hierarchies.rb +89 -0
  30. data/examples/v201411/content_metadata_key_hierarchy_service/update_content_metadata_key_hierarchies.rb +115 -0
  31. data/examples/{v201311 → v201411}/content_service/get_all_content.rb +9 -18
  32. data/examples/{v201311 → v201411}/content_service/get_content_by_category.rb +18 -28
  33. data/examples/{v201311 → v201411}/creative_service/copy_image_creatives.rb +7 -7
  34. data/examples/{v201311 → v201411}/creative_service/create_creative_from_template.rb +1 -1
  35. data/examples/{v201311 → v201411}/creative_service/create_creatives.rb +1 -1
  36. data/examples/{v201311 → v201411}/creative_service/create_custom_creative.rb +1 -1
  37. data/examples/{v201311 → v201411}/creative_service/get_all_creatives.rb +8 -17
  38. data/examples/{v201311 → v201411}/creative_service/get_creatives_by_statement.rb +18 -13
  39. data/examples/{v201311 → v201411}/creative_service/update_creatives.rb +16 -11
  40. data/examples/{v201311 → v201411}/creative_set_service/associate_creative_set_to_line_item.rb +1 -1
  41. data/examples/{v201311 → v201411}/creative_set_service/create_creative_set.rb +1 -1
  42. data/examples/{v201311 → v201411}/creative_set_service/get_all_creative_sets.rb +9 -17
  43. data/examples/{v201311 → v201411}/creative_set_service/get_creative_sets_by_statement.rb +20 -14
  44. data/examples/{v201311 → v201411}/creative_set_service/update_creative_sets.rb +33 -15
  45. data/examples/{v201311 → v201411}/creative_template_service/get_all_creative_templates.rb +9 -17
  46. data/examples/{v201311/creative_template_service/get_creative_templates_by_statement.rb → v201411/creative_template_service/get_system_defined_creative_templates.rb} +24 -13
  47. data/examples/{v201311 → v201411}/creative_wrapper_service/create_creative_wrappers.rb +1 -1
  48. data/examples/{v201311 → v201411}/creative_wrapper_service/deactivate_creative_wrapper.rb +9 -7
  49. data/examples/{v201311 → v201411}/creative_wrapper_service/get_all_creative_wrappers.rb +10 -18
  50. data/examples/{v201311 → v201411}/creative_wrapper_service/get_creative_wrappers_by_statement.rb +17 -12
  51. data/examples/{v201311 → v201411}/creative_wrapper_service/update_creative_wrappers.rb +34 -16
  52. data/examples/{v201311 → v201411}/custom_field_service/create_custom_field_options.rb +1 -1
  53. data/examples/{v201311 → v201411}/custom_field_service/create_custom_fields.rb +1 -1
  54. data/examples/{v201311 → v201411}/custom_field_service/deactivate_all_line_item_custom_fields.rb +13 -23
  55. data/examples/{v201311 → v201411}/custom_field_service/get_all_custom_fields.rb +11 -19
  56. data/examples/{v201311 → v201411}/custom_field_service/get_all_line_item_custom_fields.rb +19 -14
  57. data/examples/{v201311 → v201411}/custom_field_service/set_line_item_custom_field_value.rb +59 -11
  58. data/examples/{v201311 → v201411}/custom_field_service/update_custom_fields.rb +33 -15
  59. data/examples/{v201311 → v201411}/custom_targeting_service/create_custom_targeting_keys_and_values.rb +1 -1
  60. data/examples/{v201311 → v201411}/custom_targeting_service/delete_custom_targeting_keys.rb +16 -20
  61. data/examples/{v201311 → v201411}/custom_targeting_service/delete_custom_targeting_values.rb +23 -21
  62. data/examples/{v201311 → v201411}/custom_targeting_service/get_all_custom_targeting_keys_and_values.rb +15 -36
  63. data/examples/{v201311 → v201411}/custom_targeting_service/get_custom_targeting_keys_by_statement.rb +20 -16
  64. data/examples/{v201311 → v201411}/custom_targeting_service/get_custom_targeting_values_by_statement.rb +19 -15
  65. data/examples/{v201311 → v201411}/custom_targeting_service/update_custom_targeting_keys.rb +4 -3
  66. data/examples/{v201311 → v201411}/custom_targeting_service/update_custom_targeting_values.rb +34 -30
  67. data/examples/{v201311 → v201411}/forecast_service/get_forecast.rb +6 -3
  68. data/examples/{v201311 → v201411}/forecast_service/get_forecast_by_id.rb +1 -1
  69. data/examples/{v201311 → v201411}/inventory_service/create_ad_units.rb +1 -1
  70. data/examples/{v201311 → v201411}/inventory_service/create_mobile_ad_unit.rb +1 -1
  71. data/examples/{v201311 → v201411}/inventory_service/create_video_ad_unit.rb +1 -1
  72. data/examples/{v201311 → v201411}/inventory_service/deactivate_ad_units.rb +19 -23
  73. data/examples/{v201311 → v201411}/inventory_service/get_ad_unit_sizes.rb +7 -14
  74. data/examples/{v201311 → v201411}/inventory_service/get_ad_units_by_statement.rb +18 -13
  75. data/examples/{v201311 → v201411}/inventory_service/get_all_ad_units.rb +8 -17
  76. data/examples/{v201311 → v201411}/inventory_service/update_ad_units.rb +23 -11
  77. data/examples/{v201311 → v201411}/label_service/create_labels.rb +1 -1
  78. data/examples/{v201311 → v201411}/label_service/deactivate_labels.rb +15 -22
  79. data/examples/{v201311 → v201411}/label_service/get_all_labels.rb +9 -18
  80. data/examples/{v201311 → v201411}/label_service/get_labels_by_statement.rb +16 -11
  81. data/examples/{v201311 → v201411}/label_service/update_labels.rb +24 -26
  82. data/examples/{v201311 → v201411}/line_item_creative_association_service/create_licas.rb +1 -1
  83. data/examples/{v201311 → v201411}/line_item_creative_association_service/deactivate_licas.rb +15 -24
  84. data/examples/{v201311 → v201411}/line_item_creative_association_service/get_all_licas.rb +8 -17
  85. data/examples/{v201311 → v201411}/line_item_creative_association_service/get_licas_by_statement.rb +10 -8
  86. data/examples/{v201311 → v201411}/line_item_creative_association_service/update_licas.rb +16 -7
  87. data/examples/{v201311 → v201411}/line_item_service/activate_line_items.rb +13 -21
  88. data/examples/{v201311 → v201411}/line_item_service/create_line_items.rb +6 -3
  89. data/examples/{v201311 → v201411}/line_item_service/create_video_line_item.rb +8 -2
  90. data/examples/{v201311 → v201411}/line_item_service/get_all_line_items.rb +9 -17
  91. data/examples/{v201311 → v201411}/line_item_service/get_line_items_by_statement.rb +19 -17
  92. data/examples/{v201311 → v201411}/line_item_service/get_recently_updated_line_items.rb +19 -13
  93. data/examples/{v201311 → v201411}/line_item_service/target_custom_criteria.rb +31 -15
  94. data/examples/{v201311 → v201411}/line_item_service/update_line_items.rb +9 -9
  95. data/examples/{v201311 → v201411}/network_service/get_all_networks.rb +1 -1
  96. data/examples/{v201311 → v201411}/network_service/get_current_network.rb +1 -1
  97. data/examples/{v201311 → v201411}/network_service/make_test_network.rb +1 -1
  98. data/examples/{v201311 → v201411}/order_service/approve_orders.rb +16 -24
  99. data/examples/{v201311 → v201411}/order_service/create_orders.rb +1 -1
  100. data/examples/{v201311 → v201411}/order_service/get_all_orders.rb +8 -17
  101. data/examples/{v201311 → v201411}/order_service/get_orders_by_statement.rb +18 -14
  102. data/examples/{v201311 → v201411}/order_service/update_orders.rb +15 -7
  103. data/examples/{v201311 → v201411}/placement_service/create_placements.rb +4 -2
  104. data/examples/{v201311 → v201411}/placement_service/deactivate_placements.rb +14 -22
  105. data/examples/{v201311 → v201411}/placement_service/get_all_placements.rb +9 -17
  106. data/examples/{v201311 → v201411}/placement_service/get_placements_by_statement.rb +18 -13
  107. data/examples/{v201311 → v201411}/placement_service/update_placements.rb +16 -6
  108. data/examples/{v201311 → v201411}/publisher_query_language_service/fetch_match_tables.rb +9 -11
  109. data/examples/{v201311 → v201411}/publisher_query_language_service/get_all_line_items.rb +8 -9
  110. data/examples/{v201311 → v201411}/publisher_query_language_service/get_geo_targets.rb +10 -10
  111. data/examples/{v201311 → v201411}/publisher_query_language_service/get_line_items_named_like.rb +10 -10
  112. data/examples/{v201311 → v201411}/report_service/display_report.rb +1 -1
  113. data/examples/{v201311 → v201411}/report_service/download_report.rb +1 -1
  114. data/examples/{v201311 → v201411}/report_service/run_delivery_report.rb +1 -1
  115. data/examples/{v201311 → v201411}/report_service/run_inventory_report.rb +4 -4
  116. data/examples/{v201311 → v201411}/report_service/run_reach_report.rb +1 -1
  117. data/examples/{v201311/report_service/run_merged_delivery_report.rb → v201411/report_service/run_report_with_custom_fields.rb} +12 -14
  118. data/examples/{v201311 → v201411}/report_service/run_sales_report.rb +1 -1
  119. data/examples/{v201311 → v201411}/suggested_ad_unit_service/approve_all_suggested_ad_units.rb +25 -21
  120. data/examples/{v201311 → v201411}/suggested_ad_unit_service/get_all_suggested_ad_units.rb +9 -18
  121. data/examples/{v201311 → v201411}/suggested_ad_unit_service/get_suggested_ad_units_by_statement.rb +24 -21
  122. data/examples/{v201311 → v201411}/team_service/create_teams.rb +1 -1
  123. data/examples/{v201311 → v201411}/team_service/get_all_teams.rb +8 -17
  124. data/examples/{v201311 → v201411}/team_service/get_teams_by_statement.rb +15 -11
  125. data/examples/{v201311 → v201411}/team_service/update_teams.rb +4 -3
  126. data/examples/{v201311 → v201411}/user_service/create_users.rb +1 -1
  127. data/examples/{v201311 → v201411}/user_service/deactivate_users.rb +7 -7
  128. data/examples/{v201311 → v201411}/user_service/get_all_roles.rb +1 -1
  129. data/examples/{v201311 → v201411}/user_service/get_all_users.rb +8 -18
  130. data/examples/{v201311 → v201411}/user_service/get_current_user.rb +1 -1
  131. data/examples/{v201311 → v201411}/user_service/get_users_by_statement.rb +17 -12
  132. data/examples/{v201311 → v201411}/user_service/update_users.rb +15 -6
  133. data/examples/{v201311 → v201411}/user_team_association_service/create_user_team_associations.rb +1 -1
  134. data/examples/{v201311 → v201411}/user_team_association_service/delete_user_team_associations.rb +13 -21
  135. data/examples/{v201311 → v201411}/user_team_association_service/get_all_user_team_associations.rb +10 -17
  136. data/examples/{v201311 → v201411}/user_team_association_service/get_user_team_associations_by_statement.rb +20 -16
  137. data/examples/{v201311 → v201411}/user_team_association_service/update_user_team_associations.rb +8 -7
  138. data/lib/dfp_api/api_config.rb +26 -3
  139. data/lib/dfp_api/{v201302 → v201411}/activity_group_service.rb +6 -18
  140. data/lib/dfp_api/v201411/activity_group_service_registry.rb +46 -0
  141. data/lib/dfp_api/{v201302 → v201411}/activity_service.rb +6 -18
  142. data/lib/dfp_api/v201411/activity_service_registry.rb +46 -0
  143. data/lib/dfp_api/v201411/ad_exclusion_rule_service.rb +46 -0
  144. data/lib/dfp_api/v201411/ad_exclusion_rule_service_registry.rb +46 -0
  145. data/lib/dfp_api/{v201302 → v201411}/ad_rule_service.rb +6 -18
  146. data/lib/dfp_api/v201411/ad_rule_service_registry.rb +46 -0
  147. data/lib/dfp_api/{v201208 → v201411}/audience_segment_service.rb +18 -6
  148. data/lib/dfp_api/v201411/audience_segment_service_registry.rb +46 -0
  149. data/lib/dfp_api/v201411/base_rate_service.rb +46 -0
  150. data/lib/dfp_api/v201411/base_rate_service_registry.rb +46 -0
  151. data/lib/dfp_api/{v201208 → v201411}/company_service.rb +6 -18
  152. data/lib/dfp_api/v201411/company_service_registry.rb +46 -0
  153. data/lib/dfp_api/{v201302 → v201411}/contact_service.rb +6 -18
  154. data/lib/dfp_api/v201411/contact_service_registry.rb +46 -0
  155. data/lib/dfp_api/{v201302 → v201411}/content_bundle_service.rb +6 -18
  156. data/lib/dfp_api/v201411/content_bundle_service_registry.rb +46 -0
  157. data/lib/dfp_api/v201411/content_metadata_key_hierarchy_service.rb +46 -0
  158. data/lib/dfp_api/v201411/content_metadata_key_hierarchy_service_registry.rb +46 -0
  159. data/lib/dfp_api/{v201302 → v201411}/content_service.rb +6 -6
  160. data/lib/dfp_api/v201411/content_service_registry.rb +46 -0
  161. data/lib/dfp_api/{v201208 → v201411}/creative_service.rb +6 -18
  162. data/lib/dfp_api/v201411/creative_service_registry.rb +46 -0
  163. data/lib/dfp_api/{v201208 → v201411}/creative_set_service.rb +6 -10
  164. data/lib/dfp_api/v201411/creative_set_service_registry.rb +46 -0
  165. data/lib/dfp_api/{v201211 → v201411}/creative_template_service.rb +6 -10
  166. data/lib/dfp_api/v201411/creative_template_service_registry.rb +46 -0
  167. data/lib/dfp_api/{v201211 → v201411}/creative_wrapper_service.rb +6 -18
  168. data/lib/dfp_api/v201411/creative_wrapper_service_registry.rb +46 -0
  169. data/lib/dfp_api/{v201302 → v201411}/custom_field_service.rb +6 -26
  170. data/lib/dfp_api/v201411/custom_field_service_registry.rb +46 -0
  171. data/lib/dfp_api/{v201208 → v201411}/custom_targeting_service.rb +6 -6
  172. data/lib/dfp_api/v201411/custom_targeting_service_registry.rb +46 -0
  173. data/lib/dfp_api/v201411/exchange_rate_service.rb +46 -0
  174. data/lib/dfp_api/v201411/exchange_rate_service_registry.rb +46 -0
  175. data/lib/dfp_api/{v201211 → v201411}/forecast_service.rb +6 -6
  176. data/lib/dfp_api/v201411/forecast_service_registry.rb +46 -0
  177. data/lib/dfp_api/{v201211 → v201411}/inventory_service.rb +6 -18
  178. data/lib/dfp_api/v201411/inventory_service_registry.rb +46 -0
  179. data/lib/dfp_api/{v201211 → v201411}/label_service.rb +6 -18
  180. data/lib/dfp_api/v201411/label_service_registry.rb +46 -0
  181. data/lib/dfp_api/{v201211 → v201411}/line_item_creative_association_service.rb +6 -18
  182. data/lib/dfp_api/v201411/line_item_creative_association_service_registry.rb +46 -0
  183. data/lib/dfp_api/{v201211 → v201411}/line_item_service.rb +6 -18
  184. data/lib/dfp_api/v201411/line_item_service_registry.rb +46 -0
  185. data/lib/dfp_api/v201411/line_item_template_service.rb +34 -0
  186. data/lib/dfp_api/v201411/line_item_template_service_registry.rb +46 -0
  187. data/lib/dfp_api/v201411/live_stream_event_service.rb +46 -0
  188. data/lib/dfp_api/v201411/live_stream_event_service_registry.rb +46 -0
  189. data/lib/dfp_api/{v201211 → v201411}/network_service.rb +6 -6
  190. data/lib/dfp_api/v201411/network_service_registry.rb +46 -0
  191. data/lib/dfp_api/{v201302 → v201411}/order_service.rb +6 -18
  192. data/lib/dfp_api/v201411/order_service_registry.rb +46 -0
  193. data/lib/dfp_api/{v201211 → v201411}/placement_service.rb +6 -18
  194. data/lib/dfp_api/v201411/placement_service_registry.rb +46 -0
  195. data/lib/dfp_api/v201411/premium_rate_service.rb +42 -0
  196. data/lib/dfp_api/v201411/premium_rate_service_registry.rb +46 -0
  197. data/lib/dfp_api/v201411/product_service.rb +42 -0
  198. data/lib/dfp_api/v201411/product_service_registry.rb +46 -0
  199. data/lib/dfp_api/v201411/product_template_service.rb +46 -0
  200. data/lib/dfp_api/v201411/product_template_service_registry.rb +46 -0
  201. data/lib/dfp_api/v201411/proposal_line_item_service.rb +46 -0
  202. data/lib/dfp_api/v201411/proposal_line_item_service_registry.rb +46 -0
  203. data/lib/dfp_api/v201411/proposal_service.rb +46 -0
  204. data/lib/dfp_api/v201411/proposal_service_registry.rb +46 -0
  205. data/lib/dfp_api/{v201211 → v201411}/publisher_query_language_service.rb +6 -6
  206. data/lib/dfp_api/v201411/publisher_query_language_service_registry.rb +46 -0
  207. data/lib/dfp_api/v201411/rate_card_service.rb +46 -0
  208. data/lib/dfp_api/v201411/rate_card_service_registry.rb +46 -0
  209. data/lib/dfp_api/v201411/reconciliation_order_report_service.rb +38 -0
  210. data/lib/dfp_api/v201411/reconciliation_order_report_service_registry.rb +46 -0
  211. data/lib/dfp_api/v201411/reconciliation_report_row_service.rb +38 -0
  212. data/lib/dfp_api/v201411/reconciliation_report_row_service_registry.rb +46 -0
  213. data/lib/dfp_api/v201411/reconciliation_report_service.rb +38 -0
  214. data/lib/dfp_api/v201411/reconciliation_report_service_registry.rb +46 -0
  215. data/lib/dfp_api/{v201302 → v201411}/report_service.rb +6 -6
  216. data/lib/dfp_api/v201411/report_service_registry.rb +46 -0
  217. data/lib/dfp_api/v201411/shared_ad_unit_service.rb +38 -0
  218. data/lib/dfp_api/v201411/shared_ad_unit_service_registry.rb +46 -0
  219. data/lib/dfp_api/{v201211 → v201411}/suggested_ad_unit_service.rb +6 -10
  220. data/lib/dfp_api/v201411/suggested_ad_unit_service_registry.rb +46 -0
  221. data/lib/dfp_api/{v201302 → v201411}/team_service.rb +6 -18
  222. data/lib/dfp_api/v201411/team_service_registry.rb +46 -0
  223. data/lib/dfp_api/{v201208 → v201411}/user_service.rb +6 -18
  224. data/lib/dfp_api/v201411/user_service_registry.rb +46 -0
  225. data/lib/dfp_api/{v201211 → v201411}/user_team_association_service.rb +6 -18
  226. data/lib/dfp_api/v201411/user_team_association_service_registry.rb +46 -0
  227. data/lib/dfp_api/v201411/workflow_request_service.rb +38 -0
  228. data/lib/dfp_api/v201411/workflow_request_service_registry.rb +46 -0
  229. data/lib/dfp_api/version.rb +1 -1
  230. data/lib/dfp_api_statement.rb +5 -1
  231. metadata +1118 -1190
  232. data/examples/v201311/company_service/get_company.rb +0 -72
  233. data/examples/v201311/creative_service/get_creative.rb +0 -72
  234. data/examples/v201311/creative_template_service/get_creative_template.rb +0 -74
  235. data/examples/v201311/inventory_service/get_ad_unit.rb +0 -72
  236. data/examples/v201311/label_service/get_label.rb +0 -76
  237. data/examples/v201311/line_item_creative_association_service/get_lica.rb +0 -77
  238. data/examples/v201311/line_item_service/create_mobile_line_item.rb +0 -135
  239. data/examples/v201311/line_item_service/get_line_item.rb +0 -74
  240. data/examples/v201311/order_service/get_order.rb +0 -74
  241. data/examples/v201311/placement_service/get_placement.rb +0 -74
  242. data/examples/v201311/report_service/run_report_with_custom_fields.rb +0 -135
  243. data/examples/v201311/suggested_ad_unit_service/get_suggested_ad_unit.rb +0 -75
  244. data/examples/v201311/team_service/get_team.rb +0 -74
  245. data/examples/v201311/user_service/get_user.rb +0 -73
  246. data/examples/v201311/user_team_association_service/get_user_team_association.rb +0 -76
  247. data/lib/dfp_api/v201208/audience_segment_service_registry.rb +0 -46
  248. data/lib/dfp_api/v201208/company_service_registry.rb +0 -46
  249. data/lib/dfp_api/v201208/content_service.rb +0 -42
  250. data/lib/dfp_api/v201208/content_service_registry.rb +0 -46
  251. data/lib/dfp_api/v201208/creative_service_registry.rb +0 -46
  252. data/lib/dfp_api/v201208/creative_set_service_registry.rb +0 -46
  253. data/lib/dfp_api/v201208/creative_template_service.rb +0 -38
  254. data/lib/dfp_api/v201208/creative_template_service_registry.rb +0 -46
  255. data/lib/dfp_api/v201208/custom_field_service.rb +0 -78
  256. data/lib/dfp_api/v201208/custom_field_service_registry.rb +0 -46
  257. data/lib/dfp_api/v201208/custom_targeting_service_registry.rb +0 -46
  258. data/lib/dfp_api/v201208/forecast_service.rb +0 -38
  259. data/lib/dfp_api/v201208/forecast_service_registry.rb +0 -46
  260. data/lib/dfp_api/v201208/inventory_service.rb +0 -62
  261. data/lib/dfp_api/v201208/inventory_service_registry.rb +0 -46
  262. data/lib/dfp_api/v201208/label_service.rb +0 -58
  263. data/lib/dfp_api/v201208/label_service_registry.rb +0 -46
  264. data/lib/dfp_api/v201208/line_item_creative_association_service.rb +0 -62
  265. data/lib/dfp_api/v201208/line_item_creative_association_service_registry.rb +0 -46
  266. data/lib/dfp_api/v201208/line_item_service.rb +0 -58
  267. data/lib/dfp_api/v201208/line_item_service_registry.rb +0 -46
  268. data/lib/dfp_api/v201208/network_service.rb +0 -46
  269. data/lib/dfp_api/v201208/network_service_registry.rb +0 -46
  270. data/lib/dfp_api/v201208/order_service.rb +0 -58
  271. data/lib/dfp_api/v201208/order_service_registry.rb +0 -46
  272. data/lib/dfp_api/v201208/placement_service.rb +0 -58
  273. data/lib/dfp_api/v201208/placement_service_registry.rb +0 -46
  274. data/lib/dfp_api/v201208/publisher_query_language_service.rb +0 -34
  275. data/lib/dfp_api/v201208/publisher_query_language_service_registry.rb +0 -46
  276. data/lib/dfp_api/v201208/report_service.rb +0 -46
  277. data/lib/dfp_api/v201208/report_service_registry.rb +0 -46
  278. data/lib/dfp_api/v201208/suggested_ad_unit_service.rb +0 -42
  279. data/lib/dfp_api/v201208/suggested_ad_unit_service_registry.rb +0 -46
  280. data/lib/dfp_api/v201208/team_service.rb +0 -54
  281. data/lib/dfp_api/v201208/team_service_registry.rb +0 -46
  282. data/lib/dfp_api/v201208/third_party_slot_service.rb +0 -46
  283. data/lib/dfp_api/v201208/third_party_slot_service_registry.rb +0 -46
  284. data/lib/dfp_api/v201208/user_service_registry.rb +0 -46
  285. data/lib/dfp_api/v201208/user_team_association_service.rb +0 -58
  286. data/lib/dfp_api/v201208/user_team_association_service_registry.rb +0 -46
  287. data/lib/dfp_api/v201211/audience_segment_service.rb +0 -34
  288. data/lib/dfp_api/v201211/audience_segment_service_registry.rb +0 -46
  289. data/lib/dfp_api/v201211/company_service.rb +0 -54
  290. data/lib/dfp_api/v201211/company_service_registry.rb +0 -46
  291. data/lib/dfp_api/v201211/content_service.rb +0 -42
  292. data/lib/dfp_api/v201211/content_service_registry.rb +0 -46
  293. data/lib/dfp_api/v201211/creative_service.rb +0 -54
  294. data/lib/dfp_api/v201211/creative_service_registry.rb +0 -46
  295. data/lib/dfp_api/v201211/creative_set_service.rb +0 -46
  296. data/lib/dfp_api/v201211/creative_set_service_registry.rb +0 -46
  297. data/lib/dfp_api/v201211/creative_template_service_registry.rb +0 -46
  298. data/lib/dfp_api/v201211/creative_wrapper_service_registry.rb +0 -46
  299. data/lib/dfp_api/v201211/custom_field_service.rb +0 -78
  300. data/lib/dfp_api/v201211/custom_field_service_registry.rb +0 -46
  301. data/lib/dfp_api/v201211/custom_targeting_service.rb +0 -62
  302. data/lib/dfp_api/v201211/custom_targeting_service_registry.rb +0 -46
  303. data/lib/dfp_api/v201211/forecast_service_registry.rb +0 -46
  304. data/lib/dfp_api/v201211/inventory_service_registry.rb +0 -46
  305. data/lib/dfp_api/v201211/label_service_registry.rb +0 -46
  306. data/lib/dfp_api/v201211/line_item_creative_association_service_registry.rb +0 -46
  307. data/lib/dfp_api/v201211/line_item_service_registry.rb +0 -46
  308. data/lib/dfp_api/v201211/network_service_registry.rb +0 -46
  309. data/lib/dfp_api/v201211/order_service.rb +0 -58
  310. data/lib/dfp_api/v201211/order_service_registry.rb +0 -46
  311. data/lib/dfp_api/v201211/placement_service_registry.rb +0 -46
  312. data/lib/dfp_api/v201211/publisher_query_language_service_registry.rb +0 -46
  313. data/lib/dfp_api/v201211/report_service.rb +0 -46
  314. data/lib/dfp_api/v201211/report_service_registry.rb +0 -46
  315. data/lib/dfp_api/v201211/suggested_ad_unit_service_registry.rb +0 -46
  316. data/lib/dfp_api/v201211/team_service.rb +0 -54
  317. data/lib/dfp_api/v201211/team_service_registry.rb +0 -46
  318. data/lib/dfp_api/v201211/third_party_slot_service.rb +0 -46
  319. data/lib/dfp_api/v201211/third_party_slot_service_registry.rb +0 -46
  320. data/lib/dfp_api/v201211/user_service.rb +0 -66
  321. data/lib/dfp_api/v201211/user_service_registry.rb +0 -46
  322. data/lib/dfp_api/v201211/user_team_association_service_registry.rb +0 -46
  323. data/lib/dfp_api/v201302/activity_group_service_registry.rb +0 -46
  324. data/lib/dfp_api/v201302/activity_service_registry.rb +0 -46
  325. data/lib/dfp_api/v201302/ad_rule_service_registry.rb +0 -46
  326. data/lib/dfp_api/v201302/audience_segment_service.rb +0 -34
  327. data/lib/dfp_api/v201302/audience_segment_service_registry.rb +0 -46
  328. data/lib/dfp_api/v201302/company_service.rb +0 -54
  329. data/lib/dfp_api/v201302/company_service_registry.rb +0 -46
  330. data/lib/dfp_api/v201302/contact_service_registry.rb +0 -46
  331. data/lib/dfp_api/v201302/content_bundle_service_registry.rb +0 -46
  332. data/lib/dfp_api/v201302/content_service_registry.rb +0 -46
  333. data/lib/dfp_api/v201302/creative_service.rb +0 -54
  334. data/lib/dfp_api/v201302/creative_service_registry.rb +0 -46
  335. data/lib/dfp_api/v201302/creative_set_service.rb +0 -46
  336. data/lib/dfp_api/v201302/creative_set_service_registry.rb +0 -46
  337. data/lib/dfp_api/v201302/creative_template_service.rb +0 -38
  338. data/lib/dfp_api/v201302/creative_template_service_registry.rb +0 -46
  339. data/lib/dfp_api/v201302/creative_wrapper_service.rb +0 -58
  340. data/lib/dfp_api/v201302/creative_wrapper_service_registry.rb +0 -46
  341. data/lib/dfp_api/v201302/custom_field_service_registry.rb +0 -46
  342. data/lib/dfp_api/v201302/custom_targeting_service.rb +0 -62
  343. data/lib/dfp_api/v201302/custom_targeting_service_registry.rb +0 -46
  344. data/lib/dfp_api/v201302/forecast_service.rb +0 -38
  345. data/lib/dfp_api/v201302/forecast_service_registry.rb +0 -46
  346. data/lib/dfp_api/v201302/inventory_service.rb +0 -62
  347. data/lib/dfp_api/v201302/inventory_service_registry.rb +0 -46
  348. data/lib/dfp_api/v201302/label_service.rb +0 -58
  349. data/lib/dfp_api/v201302/label_service_registry.rb +0 -46
  350. data/lib/dfp_api/v201302/line_item_creative_association_service.rb +0 -62
  351. data/lib/dfp_api/v201302/line_item_creative_association_service_registry.rb +0 -46
  352. data/lib/dfp_api/v201302/line_item_service.rb +0 -58
  353. data/lib/dfp_api/v201302/line_item_service_registry.rb +0 -46
  354. data/lib/dfp_api/v201302/network_service.rb +0 -46
  355. data/lib/dfp_api/v201302/network_service_registry.rb +0 -46
  356. data/lib/dfp_api/v201302/order_service_registry.rb +0 -46
  357. data/lib/dfp_api/v201302/placement_service.rb +0 -58
  358. data/lib/dfp_api/v201302/placement_service_registry.rb +0 -46
  359. data/lib/dfp_api/v201302/publisher_query_language_service.rb +0 -34
  360. data/lib/dfp_api/v201302/publisher_query_language_service_registry.rb +0 -46
  361. data/lib/dfp_api/v201302/report_service_registry.rb +0 -46
  362. data/lib/dfp_api/v201302/suggested_ad_unit_service.rb +0 -42
  363. data/lib/dfp_api/v201302/suggested_ad_unit_service_registry.rb +0 -46
  364. data/lib/dfp_api/v201302/team_service_registry.rb +0 -46
  365. data/lib/dfp_api/v201302/third_party_slot_service.rb +0 -46
  366. data/lib/dfp_api/v201302/third_party_slot_service_registry.rb +0 -46
  367. data/lib/dfp_api/v201302/user_service.rb +0 -66
  368. data/lib/dfp_api/v201302/user_service_registry.rb +0 -46
  369. data/lib/dfp_api/v201302/user_team_association_service.rb +0 -58
  370. data/lib/dfp_api/v201302/user_team_association_service_registry.rb +0 -46
@@ -25,7 +25,7 @@
25
25
 
26
26
  require 'dfp_api'
27
27
 
28
- API_VERSION = :v201311
28
+ API_VERSION = :v201411
29
29
 
30
30
  def create_contacts()
31
31
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -23,9 +23,9 @@
23
23
  # Tags: ContactService.getContactsByStatement.
24
24
 
25
25
  require 'dfp_api'
26
+ require 'dfp_api_statement'
26
27
 
27
- API_VERSION = :v201311
28
- PAGE_SIZE = 500
28
+ API_VERSION = :v201411
29
29
 
30
30
  def get_all_contacts()
31
31
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -38,31 +38,23 @@ def get_all_contacts()
38
38
  # Get the ContactService.
39
39
  contact_service = dfp.service(:ContactService, API_VERSION)
40
40
 
41
- # Define initial values.
42
- offset = 0
43
- page = {}
41
+ # Create statement for one page with current offset.
42
+ statement = DfpApiStatement::FilterStatement.new('ORDER BY id ASC')
44
43
 
45
44
  begin
46
- # Create statement for one page with current offset.
47
- statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]}
48
-
49
45
  # Get contacts by statement.
50
- page = contact_service.get_contacts_by_statement(statement)
46
+ page = contact_service.get_contacts_by_statement(
47
+ statement.toStatement())
51
48
 
52
49
  if page[:results]
53
- # Increase query offset by page size.
54
- offset += PAGE_SIZE
55
-
56
- # Get the start index for printout.
57
- start_index = page[:start_index]
58
-
59
- # Print details about each content object in results page.
60
50
  page[:results].each_with_index do |contact, index|
61
- puts "%d) Contact ID: %d, name: %s." % [index + start_index,
62
- contact[:id], contact[:name]]
51
+ puts "%d) Contact ID: %d, name: '%s'" %
52
+ [index + statement.offset,
53
+ contact[:id], contact[:name]]
63
54
  end
64
55
  end
65
- end while offset < page[:total_result_set_size]
56
+ statement.offset += DfpApiStatement::SUGGESTED_PAGE_LIMIT
57
+ end while statement.offset < page[:total_result_set_size]
66
58
 
67
59
  # Print a footer
68
60
  if page.include?(:total_result_set_size)
@@ -24,8 +24,9 @@
24
24
  # Tags: ContactService.getContactsByStatement.
25
25
 
26
26
  require 'dfp_api'
27
+ require 'dfp_api_statement'
27
28
 
28
- API_VERSION = :v201311
29
+ API_VERSION = :v201411
29
30
  PAGE_SIZE = 500
30
31
 
31
32
  def get_uninvited_contacts()
@@ -42,37 +43,32 @@ def get_uninvited_contacts()
42
43
  # Define initial values.
43
44
  offset = 0
44
45
  page = {}
45
- query_base = 'WHERE status = :status ORDER BY id LIMIT %d OFFSET %d'
46
+ query_base = 'WHERE status = :status ORDER BY id ASC LIMIT %d OFFSET %d'
46
47
 
47
48
  # Create statement.
48
- statement = {
49
- :values => [
50
- {:key => 'status',
51
- :value => {:value => 'UNINVITED', :xsi_type => 'TextValue'}}
52
- ]
53
- }
54
49
 
55
- begin
56
- # Update statement for one page with current offset.
57
- statement[:query] = query_base % [PAGE_SIZE, offset]
50
+ statement = DfpApiStatement::FilterStatement.new(
51
+ 'WHERE status = :status ORDER BY id ASC',
52
+ [
53
+ {:key => 'status',
54
+ :value => {:value => 'UNINVITED', :xsi_type => 'TextValue'}}
55
+ ]
56
+ )
58
57
 
58
+ begin
59
59
  # Get contacts by statement.
60
- page = contact_service.get_contacts_by_statement(statement)
60
+ page = contact_service.get_contacts_by_statement(
61
+ statement.toStatement())
61
62
 
62
63
  if page[:results]
63
- # Increase query offset by page size.
64
- offset += PAGE_SIZE
65
-
66
- # Get the start index for printout.
67
- start_index = page[:start_index]
68
-
69
- # Print details about each content object in results page.
70
64
  page[:results].each_with_index do |contact, index|
71
- puts "%d) Contact ID: %d, name: %s." % [index + start_index,
72
- contact[:id], contact[:name]]
65
+ puts "%d) Contact ID: %d, name: '%s'" %
66
+ [index + statement.offset,
67
+ contact[:id], contact[:name]]
73
68
  end
74
69
  end
75
- end while offset < page[:total_result_set_size]
70
+ statement.offset += DfpApiStatement::SUGGESTED_PAGE_LIMIT
71
+ end while statement.offset < page[:total_result_set_size]
76
72
 
77
73
  # Print a footer
78
74
  if page.include?(:total_result_set_size)
@@ -24,8 +24,9 @@
24
24
  # Tags: ContactService.updateContacts
25
25
 
26
26
  require 'dfp_api'
27
+ require 'dfp_api_statement'
27
28
 
28
- API_VERSION = :v201311
29
+ API_VERSION = :v201411
29
30
 
30
31
  def update_contacts()
31
32
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -38,28 +39,43 @@ def update_contacts()
38
39
  # Get the ContactService.
39
40
  contact_service = dfp.service(:ContactService, API_VERSION)
40
41
 
41
- contact_id = 'INSERT_CONTACT_ID_HERE'
42
+ contact_id = 'INSERT_CONTACT_ID_HERE'.to_i
42
43
 
43
- # Get contact.
44
- contact = contact_service.get_contact(contact_id)
44
+ # Create a statement to only select a single contact.
45
+ statement = DfpApiStatement::FilterStatement.new(
46
+ 'WHERE id = :id',
47
+ [
48
+ {:key => 'id',
49
+ :value => {:value => contact_id, :xsi_type => 'NumberValue'}}
50
+ ],
51
+ 1
52
+ }
45
53
 
46
- # Update the comment of the contact.
47
- contact[:address] = '123 New Street, New York, NY, 10011'
54
+ # Get contacts by statement.
55
+ page = contact_service.get_contacts_by_statement(statement.toStatement())
48
56
 
49
- # Update the contact on the server.
50
- return_contacts = contact_service.update_contacts([contact])
57
+ if page[:results]
58
+ contacts = page[:results]
51
59
 
52
- # Display results.
53
- if return_contacts
54
- return_contacts.each do |updated_contact|
55
- puts "Contact with ID: %d, name: %s and comment: '%s' was updated." %
56
- [updated_contact[:id], updated_contact[:name],
57
- updated_contact[:comment]]
60
+ contacts.each do |contact|
61
+ # Update the comment of the contact.
62
+ contact[:address] = '123 New Street, New York, NY, 10011'
58
63
  end
59
- else
60
- raise 'No contacts were updated.'
61
- end
62
64
 
65
+ # Update the contact on the server.
66
+ return_contacts = contact_service.update_contacts([contact])
67
+
68
+ # Display results.
69
+ if return_contacts
70
+ return_contacts.each do |updated_contact|
71
+ puts "Contact with ID: %d, name: %s and comment: '%s' was updated." %
72
+ [updated_contact[:id], updated_contact[:name],
73
+ updated_contact[:comment]]
74
+ end
75
+ else
76
+ raise 'No contacts were updated.'
77
+ end
78
+ end
63
79
  end
64
80
 
65
81
  if __FILE__ == $0
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env ruby
2
+ # Encoding: utf-8
3
+ #
4
+ # Author:: api.nicholaschen@gmail.com (Nicholas Chen)
5
+ #
6
+ # Copyright:: Copyright 2014, 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
+ # This example creates a content metadata key hierarchy.
22
+ #
23
+ # This feature is only available to DFP video publishers.
24
+ #
25
+ # Tags: ContentMetadataKeyHierarchyService.createContentMetadataKeyHierarchies
26
+
27
+ require 'dfp_api'
28
+
29
+ API_VERSION = :v201411
30
+
31
+ def create_content_metadata_key_hierarchies()
32
+ # Get DfpApi instance and load configuration from ~/dfp_api.yml.
33
+ dfp = DfpApi::Api.new
34
+
35
+ # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
36
+ # the configuration file or provide your own logger:
37
+ # dfp.logger = Logger.new('dfp_xml.log')
38
+
39
+ # Get the ContentMetadataKeyHierarchyService.
40
+ cmkh_service = dfp.service(:ContentMetadataKeyHierarchyService, API_VERSION)
41
+
42
+ # Set the IDs of the custom targeting keys for the hierarchy.
43
+ hierarchy_level_one_key_id = 'INSERT_LEVEL_ONE_CUSTOM_TARGETING_KEY_ID_HERE'
44
+ hierarchy_level_two_key_id = 'INSERT_LEVEL_TWO_CUSTOM_TARGETING_KEY_ID_HERE'
45
+
46
+ hierarchy_level_1 = {
47
+ :custom_targeting_key_id => hierarchy_level_own_key_id,
48
+ :hierarchy_level => 1
49
+ }
50
+
51
+ hierarchy_level_2 = {
52
+ :custom_targeting_key_id => hierarchy_level_two_key_id,
53
+ :hierarchy_level => 2
54
+ }
55
+
56
+ hierarchy_levels = [hierarchy_level_1, hierarchy_level_2]
57
+
58
+ content_metadata_key_hierarchy = {
59
+ :name => 'Content Metadata Key Hierarchy #%d' % (Time.new.to_f * 1000),
60
+ :hierarchy_levels => hierarchy_levels
61
+ }
62
+
63
+ # Create the content metadata key hierarchy on the server.
64
+ content_metadata_key_hierarchies =
65
+ cmkh_service.create_content_metadata_key_hierarchies(
66
+ [content_metadata_key_hierarchy])
67
+
68
+ content_metadata_key_hierarchies.each do |content_metadata_key_hierarchy|
69
+ puts 'A content metadata key hierarchy with ID %d, name "%s", and %d ' +
70
+ 'levels was created.' % [
71
+ content_metadata_key_hierarchy[:id],
72
+ content_metadata_key_hierarchy[:name],
73
+ content_metadata_key_hierarchy[:hierarchy_levels].length]
74
+ end
75
+ end
76
+
77
+ if __FILE__ == $0
78
+ begin
79
+ create_content_metadata_key_hierarchies()
80
+
81
+ # HTTP errors.
82
+ rescue AdsCommon::Errors::HttpError => e
83
+ puts "HTTP Error: %s" % e
84
+
85
+ # API errors.
86
+ rescue DfpApi::Errors::ApiException => e
87
+ puts "Message: %s" % e.message
88
+ puts 'Errors:'
89
+ e.errors.each_with_index do |error, index|
90
+ puts "\tError [%d]:" % (index + 1)
91
+ error.each do |field, value|
92
+ puts "\t\t%s: %s" % [field, value]
93
+ end
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env ruby
2
+ # Encoding: utf-8
3
+ #
4
+ # Author:: api.nicholaschen@gmail.com (Nicholas Chen)
5
+ #
6
+ # Copyright:: Copyright 2014, 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
+ # This example deletes a single content metadata key hierarchy.
22
+ #
23
+ # This feature is only available to DFP video publishers.
24
+ #
25
+ # Tags: ContentMetadataKeyHierarchyService.getContentMetadataKeyHierarchiesByStatement
26
+ # Tags: ContentMetadataKeyHierarchyService.performContentMetadataKeyHierarchyAction
27
+
28
+ require 'dfp_api'
29
+ require 'dfp_api_statement'
30
+
31
+ API_VERSION = :v201411
32
+
33
+ def delete_content_metadata_key_hierarchies()
34
+ # Get DfpApi instance and load configuration from ~/dfp_api.yml.
35
+ dfp = DfpApi::Api.new
36
+
37
+ # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
38
+ # the configuration file or provide your own logger:
39
+ # dfp.logger = Logger.new('dfp_xml.log')
40
+
41
+ # Get the ContentMetadataKeyHierarchyService.
42
+ cmkh_service = dfp.service(:ContentMetadataKeyHierarchyService, API_VERSION)
43
+
44
+ # Set the ID of the content metadata key hierarchy.
45
+ content_metadata_key_hierarchy_id = 'CONTENT_METADATA_KEY_HIERARCHY_ID'
46
+
47
+ # Create a statement to only select a single content metadata key hierarchy.
48
+ statement = DfpApiStatement::FilterStatement.new(
49
+ 'WHERE id = :id ORDER BY id ASC',
50
+ [
51
+ {:key => 'id',
52
+ :value => {:value => content_metadata_key_hierarchy_id,
53
+ :xsi_type => 'NumberValue'}},
54
+ ],
55
+ 1
56
+ )
57
+
58
+ # Get content metadata key hierarchies by statement.
59
+ page = cmkh_service.get_content_metadata_key_hierarchies_by_statement(
60
+ statement.toStatement())
61
+
62
+ if page[:results]
63
+ content_metadata_key_hierarchy = page[:results].first
64
+ end
65
+
66
+ if content_metadata_key_hierarchy
67
+ puts 'Content metadata key hierarchy with ID ' +
68
+ '"%d" will be deleted.' % content_metadata_key_hierarchy[:id]
69
+
70
+ # Perform action.
71
+ result = cmkh_service.perform_content_metadata_key_hierarchy_action(
72
+ {:xsi_type => 'DeleteContentMetadataKeyHierarchy'},
73
+ statement.toStatement())
74
+
75
+ # Display results.
76
+ if result and result[:num_changes] > 0
77
+ puts 'Number of content metadata key hierarchies deleted: %d' %
78
+ result[:num_changes]
79
+ else
80
+ puts 'No content metadata key hierarchies were deleted.'
81
+ end
82
+ else
83
+ puts 'No content metadata key hierarchy found to delete.'
84
+ end
85
+ end
86
+
87
+ if __FILE__ == $0
88
+ begin
89
+ delete_content_metadata_key_hierarchies()
90
+
91
+ # HTTP errors.
92
+ rescue AdsCommon::Errors::HttpError => e
93
+ puts "HTTP Error: %s" % e
94
+
95
+ # API errors.
96
+ rescue DfpApi::Errors::ApiException => e
97
+ puts "Message: %s" % e.message
98
+ puts 'Errors:'
99
+ e.errors.each_with_index do |error, index|
100
+ puts "\tError [%d]:" % (index + 1)
101
+ error.each do |field, value|
102
+ puts "\t\t%s: %s" % [field, value]
103
+ end
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env ruby
2
+ # Encoding: utf-8
3
+ #
4
+ # Author:: api.nicholaschen@gmail.com (Nicholas Chen)
5
+ #
6
+ # Copyright:: Copyright 2014, 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
+ # This example gets all content metadata key hierarchies.
22
+ #
23
+ # This feature is only available to DFP video publishers.
24
+ #
25
+ # Tags: ContentMetadataKeyHierarchyService.getContentMetadataKeyHierarchiesByStatement
26
+
27
+ require 'dfp_api'
28
+ require 'dfp_api_statement'
29
+
30
+ API_VERSION = :v201411
31
+
32
+ def get_all_content_metadata_key_hierarchies()
33
+ # Get DfpApi instance and load configuration from ~/dfp_api.yml.
34
+ dfp = DfpApi::Api.new
35
+
36
+ # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
37
+ # the configuration file or provide your own logger:
38
+ # dfp.logger = Logger.new('dfp_xml.log')
39
+
40
+ # Get the ContentMetadataKeyHierarchyService.
41
+ cmkh_service = dfp.service(:ContentMetadataKeyHierarchyService, API_VERSION)
42
+
43
+ # Create statement for one page with current offset.
44
+ statement = DfpApiStatement::FilterStatement.new('ORDER BY id ASC')
45
+
46
+ begin
47
+
48
+ # Get content metadata key hierarchies by statement.
49
+ page = cmkh_service.get_content_metadata_key_hierarchies_by_statement(
50
+ statement.toStatement())
51
+
52
+ if page[:results]
53
+ page[:results].each_with_index do |content_metadata_key_hierarchy, index|
54
+ puts ("%d) Content Metadata Key Hierarchy ID: " +
55
+ "%d and name: %s was found.") % [
56
+ index + statement.offset,
57
+ content_metadata_key_hierarchy[:id],
58
+ content_metadata_key_hierarchy[:name]]
59
+ end
60
+ end
61
+ statement.offset += DfpApiStatement::SUGGESTED_PAGE_LIMIT
62
+ end while statement.offset < page[:total_result_set_size]
63
+
64
+ # Print a footer
65
+ if page.include?(:total_result_set_size)
66
+ puts "Total number of results: %d" % page[:total_result_set_size]
67
+ end
68
+ end
69
+
70
+ if __FILE__ == $0
71
+ begin
72
+ get_all_content_metadata_key_hierarchies()
73
+
74
+ # HTTP errors.
75
+ rescue AdsCommon::Errors::HttpError => e
76
+ puts "HTTP Error: %s" % e
77
+
78
+ # API errors.
79
+ rescue DfpApi::Errors::ApiException => e
80
+ puts "Message: %s" % e.message
81
+ puts 'Errors:'
82
+ e.errors.each_with_index do |error, index|
83
+ puts "\tError [%d]:" % (index + 1)
84
+ error.each do |field, value|
85
+ puts "\t\t%s: %s" % [field, value]
86
+ end
87
+ end
88
+ end
89
+ end