google-dfp-api 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. data/ChangeLog +6 -0
  2. data/README +11 -5
  3. data/Rakefile +1 -1
  4. data/examples/{v201101 → v201108}/common/error_handling.rb +1 -1
  5. data/examples/{v201101 → v201108}/common/oauth_handling.rb +1 -1
  6. data/examples/{v201101 → v201108}/company_service/create_companies.rb +1 -1
  7. data/examples/{v201101 → v201108}/company_service/get_all_companies.rb +1 -1
  8. data/examples/{v201101 → v201108}/company_service/get_companies_by_statement.rb +1 -1
  9. data/examples/{v201101 → v201108}/company_service/get_company.rb +1 -1
  10. data/examples/{v201101 → v201108}/company_service/update_companies.rb +1 -1
  11. data/examples/{v201101 → v201108}/creative_service/copy_image_creatives.rb +1 -1
  12. data/examples/{v201101 → v201108}/creative_service/create_creatives.rb +1 -1
  13. data/examples/{v201101 → v201108}/creative_service/get_all_creatives.rb +1 -1
  14. data/examples/{v201101 → v201108}/creative_service/get_creative.rb +1 -1
  15. data/examples/{v201101 → v201108}/creative_service/get_creatives_by_statement.rb +1 -1
  16. data/examples/{v201101 → v201108}/creative_service/update_creatives.rb +1 -1
  17. data/examples/{v201101 → v201108}/custom_targeting_service/create_custom_targeting_keys_and_values.rb +1 -1
  18. data/examples/{v201101 → v201108}/custom_targeting_service/delete_custom_targeting_keys.rb +1 -1
  19. data/examples/{v201101 → v201108}/custom_targeting_service/delete_custom_targeting_values.rb +1 -1
  20. data/examples/{v201101 → v201108}/custom_targeting_service/get_all_custom_targeting_keys_and_values.rb +1 -1
  21. data/examples/{v201101 → v201108}/custom_targeting_service/get_custom_targeting_keys_by_statement.rb +1 -1
  22. data/examples/{v201101 → v201108}/custom_targeting_service/get_custom_targeting_values_by_statement.rb +1 -1
  23. data/examples/{v201101 → v201108}/custom_targeting_service/update_custom_targeting_keys.rb +1 -1
  24. data/examples/{v201101 → v201108}/custom_targeting_service/update_custom_targeting_values.rb +1 -1
  25. data/examples/{v201101 → v201108}/forecast_service/get_forecast.rb +8 -4
  26. data/examples/{v201101 → v201108}/forecast_service/get_forecast_by_id.rb +1 -1
  27. data/examples/{v201101 → v201108}/inventory_service/create_ad_units.rb +8 -2
  28. data/examples/{v201101 → v201108}/inventory_service/deactivate_ad_units.rb +1 -1
  29. data/examples/{v201101 → v201108}/inventory_service/get_ad_unit.rb +1 -1
  30. data/examples/v201108/inventory_service/get_ad_unit_sizes.rb +73 -0
  31. data/examples/{v201101 → v201108}/inventory_service/get_ad_units_by_statement.rb +1 -1
  32. data/examples/{v201101 → v201108}/inventory_service/get_all_ad_units.rb +1 -1
  33. data/examples/{v201101 → v201108}/inventory_service/update_ad_units.rb +1 -1
  34. data/examples/v201108/label_service/create_labels.rb +83 -0
  35. data/examples/v201108/label_service/deactivate_labels.rb +118 -0
  36. data/examples/v201108/label_service/get_all_labels.rb +94 -0
  37. data/examples/v201108/label_service/get_label.rb +76 -0
  38. data/examples/v201108/label_service/get_labels_by_statement.rb +91 -0
  39. data/examples/v201108/label_service/update_labels.rb +104 -0
  40. data/examples/{v201101 → v201108}/line_item_creative_association_service/create_licas.rb +1 -1
  41. data/examples/{v201101 → v201108}/line_item_creative_association_service/deactivate_licas.rb +1 -1
  42. data/examples/{v201101 → v201108}/line_item_creative_association_service/get_all_licas.rb +1 -1
  43. data/examples/{v201101 → v201108}/line_item_creative_association_service/get_lica.rb +1 -1
  44. data/examples/{v201101 → v201108}/line_item_creative_association_service/get_licas_by_statement.rb +1 -1
  45. data/examples/{v201101 → v201108}/line_item_creative_association_service/update_licas.rb +1 -1
  46. data/examples/{v201101 → v201108}/line_item_service/activate_line_items.rb +1 -1
  47. data/examples/{v201101 → v201108}/line_item_service/create_line_items.rb +49 -19
  48. data/examples/{v201101 → v201108}/line_item_service/get_all_line_items.rb +1 -1
  49. data/examples/{v201101 → v201108}/line_item_service/get_line_item.rb +1 -1
  50. data/examples/{v201101 → v201108}/line_item_service/get_line_items_by_statement.rb +1 -1
  51. data/examples/{v201101 → v201108}/line_item_service/target_custom_criteria.rb +30 -36
  52. data/examples/{v201101 → v201108}/line_item_service/update_line_items.rb +1 -1
  53. data/examples/{v201101 → v201108}/network_service/get_all_networks.rb +1 -1
  54. data/examples/{v201101 → v201108}/network_service/get_current_network.rb +1 -1
  55. data/examples/{v201101 → v201108}/order_service/approve_orders.rb +1 -1
  56. data/examples/{v201101 → v201108}/order_service/create_orders.rb +1 -1
  57. data/examples/{v201101 → v201108}/order_service/get_all_orders.rb +1 -1
  58. data/examples/{v201101 → v201108}/order_service/get_order.rb +1 -1
  59. data/examples/{v201101 → v201108}/order_service/get_orders_by_statement.rb +1 -1
  60. data/examples/{v201101 → v201108}/order_service/update_orders.rb +1 -1
  61. data/examples/{v201101 → v201108}/placement_service/create_placements.rb +3 -2
  62. data/examples/{v201101 → v201108}/placement_service/deactivate_placements.rb +1 -1
  63. data/examples/{v201101 → v201108}/placement_service/get_all_placements.rb +1 -1
  64. data/examples/{v201101 → v201108}/placement_service/get_placement.rb +1 -1
  65. data/examples/{v201101 → v201108}/placement_service/get_placements_by_statement.rb +1 -1
  66. data/examples/{v201101 → v201108}/placement_service/update_placements.rb +1 -1
  67. data/examples/v201108/publisher_query_language_service/get_all_bandwidth_groups.rb +85 -0
  68. data/examples/v201108/publisher_query_language_service/get_all_browser_languages.rb +85 -0
  69. data/examples/v201108/publisher_query_language_service/get_all_browsers.rb +85 -0
  70. data/examples/{v201101 → v201108}/publisher_query_language_service/get_all_cities.rb +1 -1
  71. data/examples/{v201101 → v201108}/publisher_query_language_service/get_all_countries.rb +1 -1
  72. data/examples/{v201101 → v201108}/publisher_query_language_service/get_all_metros.rb +1 -1
  73. data/examples/v201108/publisher_query_language_service/get_all_operating_systems.rb +85 -0
  74. data/examples/{v201101 → v201108}/publisher_query_language_service/get_all_regions.rb +1 -1
  75. data/examples/{v201101 → v201108}/report_service/download_report.rb +1 -1
  76. data/examples/{v201101 → v201108}/report_service/run_delivery_report.rb +1 -1
  77. data/examples/{v201101 → v201108}/report_service/run_inventory_report.rb +1 -1
  78. data/examples/{v201101 → v201108}/report_service/run_sales_report.rb +1 -1
  79. data/examples/{v201101 → v201108}/user_service/create_users.rb +1 -1
  80. data/examples/{v201101 → v201108}/user_service/deactivate_users.rb +1 -1
  81. data/examples/{v201101 → v201108}/user_service/get_all_roles.rb +1 -1
  82. data/examples/{v201101 → v201108}/user_service/get_all_users.rb +1 -1
  83. data/examples/v201108/user_service/get_current_user.rb +66 -0
  84. data/examples/{v201101 → v201108}/user_service/get_user.rb +1 -1
  85. data/examples/{v201101 → v201108}/user_service/get_users_by_statement.rb +1 -1
  86. data/examples/{v201101 → v201108}/user_service/update_users.rb +1 -1
  87. data/lib/dfp_api.rb +5 -12
  88. data/lib/dfp_api/api_config.rb +14 -13
  89. data/lib/dfp_api/credential_handler.rb +5 -5
  90. data/lib/dfp_api/v201104/company_service.rb +5 -5
  91. data/lib/dfp_api/v201104/company_service_registry.rb +5 -3
  92. data/lib/dfp_api/v201104/creative_service.rb +5 -5
  93. data/lib/dfp_api/v201104/creative_service_registry.rb +5 -3
  94. data/lib/dfp_api/v201104/custom_targeting_service.rb +9 -9
  95. data/lib/dfp_api/v201104/custom_targeting_service_registry.rb +5 -3
  96. data/lib/dfp_api/v201104/forecast_service.rb +5 -5
  97. data/lib/dfp_api/v201104/forecast_service_registry.rb +5 -3
  98. data/lib/dfp_api/v201104/inventory_service.rb +9 -9
  99. data/lib/dfp_api/v201104/inventory_service_registry.rb +5 -3
  100. data/lib/dfp_api/v201104/line_item_creative_association_service.rb +1 -1
  101. data/lib/dfp_api/v201104/line_item_creative_association_service_registry.rb +5 -3
  102. data/lib/dfp_api/v201104/line_item_service.rb +13 -13
  103. data/lib/dfp_api/v201104/line_item_service_registry.rb +5 -3
  104. data/lib/dfp_api/v201104/network_service.rb +5 -5
  105. data/lib/dfp_api/v201104/network_service_registry.rb +5 -3
  106. data/lib/dfp_api/v201104/order_service.rb +1 -1
  107. data/lib/dfp_api/v201104/order_service_registry.rb +5 -3
  108. data/lib/dfp_api/v201104/placement_service.rb +5 -5
  109. data/lib/dfp_api/v201104/placement_service_registry.rb +5 -3
  110. data/lib/dfp_api/v201104/publisher_query_language_service.rb +1 -1
  111. data/lib/dfp_api/v201104/publisher_query_language_service_registry.rb +5 -3
  112. data/lib/dfp_api/v201104/report_service.rb +5 -5
  113. data/lib/dfp_api/v201104/report_service_registry.rb +5 -3
  114. data/lib/dfp_api/v201104/user_service.rb +9 -9
  115. data/lib/dfp_api/v201104/user_service_registry.rb +5 -3
  116. data/lib/dfp_api/v201107/company_service.rb +9 -9
  117. data/lib/dfp_api/v201107/company_service_registry.rb +5 -3
  118. data/lib/dfp_api/v201107/custom_targeting_service.rb +9 -9
  119. data/lib/dfp_api/v201107/custom_targeting_service_registry.rb +5 -3
  120. data/lib/dfp_api/v201107/label_service.rb +5 -5
  121. data/lib/dfp_api/v201107/label_service_registry.rb +5 -3
  122. data/lib/dfp_api/v201107/order_service.rb +13 -13
  123. data/lib/dfp_api/v201107/order_service_registry.rb +5 -3
  124. data/lib/dfp_api/v201107/report_service.rb +5 -5
  125. data/lib/dfp_api/v201107/report_service_registry.rb +5 -3
  126. data/lib/dfp_api/v201107/user_service.rb +19 -19
  127. data/lib/dfp_api/v201107/user_service_registry.rb +5 -3
  128. data/lib/dfp_api/{v201101 → v201108}/company_service.rb +10 -10
  129. data/lib/dfp_api/v201108/company_service_registry.rb +44 -0
  130. data/lib/dfp_api/{v201101 → v201108}/creative_service.rb +10 -10
  131. data/lib/dfp_api/v201108/creative_service_registry.rb +44 -0
  132. data/lib/dfp_api/{v201101 → v201108}/custom_targeting_service.rb +14 -14
  133. data/lib/dfp_api/v201108/custom_targeting_service_registry.rb +44 -0
  134. data/lib/dfp_api/{v201101 → v201108}/forecast_service.rb +10 -10
  135. data/lib/dfp_api/v201108/forecast_service_registry.rb +44 -0
  136. data/lib/dfp_api/{v201101 → v201108}/inventory_service.rb +18 -14
  137. data/lib/dfp_api/v201108/inventory_service_registry.rb +44 -0
  138. data/lib/dfp_api/v201108/label_service.rb +56 -0
  139. data/lib/dfp_api/v201108/label_service_registry.rb +44 -0
  140. data/lib/dfp_api/{v201101 → v201108}/line_item_creative_association_service.rb +6 -6
  141. data/lib/dfp_api/v201108/line_item_creative_association_service_registry.rb +44 -0
  142. data/lib/dfp_api/{v201101 → v201108}/line_item_service.rb +18 -18
  143. data/lib/dfp_api/v201108/line_item_service_registry.rb +44 -0
  144. data/lib/dfp_api/{v201101 → v201108}/network_service.rb +10 -10
  145. data/lib/dfp_api/v201108/network_service_registry.rb +44 -0
  146. data/lib/dfp_api/{v201101 → v201108}/order_service.rb +6 -6
  147. data/lib/dfp_api/v201108/order_service_registry.rb +44 -0
  148. data/lib/dfp_api/{v201101 → v201108}/placement_service.rb +10 -10
  149. data/lib/dfp_api/v201108/placement_service_registry.rb +44 -0
  150. data/lib/dfp_api/{v201101 → v201108}/publisher_query_language_service.rb +6 -6
  151. data/lib/dfp_api/v201108/publisher_query_language_service_registry.rb +44 -0
  152. data/lib/dfp_api/{v201101 → v201108}/report_service.rb +10 -10
  153. data/lib/dfp_api/v201108/report_service_registry.rb +44 -0
  154. data/lib/dfp_api/v201108/third_party_slot_service.rb +44 -0
  155. data/lib/dfp_api/v201108/third_party_slot_service_registry.rb +44 -0
  156. data/lib/dfp_api/{v201101 → v201108}/user_service.rb +18 -14
  157. data/lib/dfp_api/v201108/user_service_registry.rb +44 -0
  158. metadata +120 -104
  159. data/lib/dfp_api/v201101/company_service_registry.rb +0 -42
  160. data/lib/dfp_api/v201101/creative_service_registry.rb +0 -42
  161. data/lib/dfp_api/v201101/custom_targeting_service_registry.rb +0 -42
  162. data/lib/dfp_api/v201101/forecast_service_registry.rb +0 -42
  163. data/lib/dfp_api/v201101/inventory_service_registry.rb +0 -42
  164. data/lib/dfp_api/v201101/line_item_creative_association_service_registry.rb +0 -42
  165. data/lib/dfp_api/v201101/line_item_service_registry.rb +0 -42
  166. data/lib/dfp_api/v201101/network_service_registry.rb +0 -42
  167. data/lib/dfp_api/v201101/order_service_registry.rb +0 -42
  168. data/lib/dfp_api/v201101/placement_service_registry.rb +0 -42
  169. data/lib/dfp_api/v201101/publisher_query_language_service_registry.rb +0 -42
  170. data/lib/dfp_api/v201101/report_service_registry.rb +0 -42
  171. data/lib/dfp_api/v201101/user_service_registry.rb +0 -42
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/ruby
2
+ #
3
+ # Author:: api.dklimkin@gmail.com (Danial Klimkin)
4
+ #
5
+ # Copyright:: Copyright 2011, 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
+ # This example updates the descriptions of all labels that are competitive
21
+ # exclusion by updating its description up to the first 500. To determine which
22
+ # labels exist, run get_all_labels.rb.
23
+ #
24
+ # This feature is only available to DFP premium solution networks.
25
+ #
26
+ # Tags: LabelService.getLabelsByStatement, LabelService.updateLabels
27
+
28
+ require 'rubygems'
29
+ require 'dfp_api'
30
+
31
+ API_VERSION = :v201108
32
+
33
+ def update_labels()
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 LabelService.
42
+ label_service = dfp.service(:LabelService, API_VERSION)
43
+
44
+ # Create a statement to only select labels that are competitive exclusion and
45
+ # active.
46
+ statement = {
47
+ :query => 'WHERE type = :type and isActive = true LIMIT 500',
48
+ :values => [
49
+ {:key => 'type',
50
+ :value => {
51
+ :value => 'COMPETITIVE_EXCLUSION',
52
+ :xsi_type => 'TextValue'}
53
+ }
54
+ ]
55
+ }
56
+
57
+ # Get labels by statement.
58
+ page = label_service.get_labels_by_statement(statement)
59
+
60
+ if page[:results]
61
+ labels = page[:results]
62
+
63
+ # Update each local label object by changing its description.
64
+ labels.each do |label|
65
+ label[:description] =
66
+ 'These labels are still competiting with each other'
67
+ end
68
+
69
+ # Update the labels on the server.
70
+ return_labels = label_service.update_labels(labels)
71
+
72
+ if return_labels
73
+ return_labels.each do |label|
74
+ puts ("Label ID: %d, name: %s was updated with description: %s.") %
75
+ [label[:id], label[:name], label[:description]]
76
+ end
77
+ else
78
+ raise 'No labels were updated.'
79
+ end
80
+ else
81
+ puts 'No labels found to update.'
82
+ end
83
+ end
84
+
85
+ if __FILE__ == $0
86
+ begin
87
+ update_labels()
88
+
89
+ # HTTP errors.
90
+ rescue AdsCommon::Errors::HttpError => e
91
+ puts "HTTP Error: %s" % e
92
+
93
+ # API errors.
94
+ rescue DfpApi::Errors::ApiException => e
95
+ puts "Message: %s" % e.message
96
+ puts 'Errors:'
97
+ e.errors.each_with_index do |error, index|
98
+ puts "\tError [%d]:" % (index + 1)
99
+ error.each do |field, value|
100
+ puts "\t\t%s: %s" % [field, value]
101
+ end
102
+ end
103
+ end
104
+ end
@@ -29,7 +29,7 @@
29
29
  require 'rubygems'
30
30
  require 'dfp_api'
31
31
 
32
- API_VERSION = :v201101
32
+ API_VERSION = :v201108
33
33
 
34
34
  def create_licas()
35
35
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -27,7 +27,7 @@
27
27
  require 'rubygems'
28
28
  require 'dfp_api'
29
29
 
30
- API_VERSION = :v201101
30
+ API_VERSION = :v201108
31
31
  PAGE_SIZE = 500
32
32
 
33
33
  def deactivate_licas()
@@ -25,7 +25,7 @@
25
25
  require 'rubygems'
26
26
  require 'dfp_api'
27
27
 
28
- API_VERSION = :v201101
28
+ API_VERSION = :v201108
29
29
  PAGE_SIZE = 500
30
30
 
31
31
  def get_all_licas()
@@ -26,7 +26,7 @@
26
26
  require 'rubygems'
27
27
  require 'dfp_api'
28
28
 
29
- API_VERSION = :v201101
29
+ API_VERSION = :v201108
30
30
 
31
31
  def get_lica()
32
32
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -27,7 +27,7 @@
27
27
  require 'rubygems'
28
28
  require 'dfp_api'
29
29
 
30
- API_VERSION = :v201101
30
+ API_VERSION = :v201108
31
31
 
32
32
  def get_licas_by_statement()
33
33
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -27,7 +27,7 @@
27
27
  require 'rubygems'
28
28
  require 'dfp_api'
29
29
 
30
- API_VERSION = :v201101
30
+ API_VERSION = :v201108
31
31
 
32
32
  def update_licas()
33
33
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -30,7 +30,7 @@
30
30
  require 'rubygems'
31
31
  require 'dfp_api'
32
32
 
33
- API_VERSION = :v201101
33
+ API_VERSION = :v201108
34
34
  PAGE_SIZE = 500
35
35
 
36
36
  def activate_line_items()
@@ -20,14 +20,16 @@
20
20
  # This example creates new line items. To determine which line items exist, run
21
21
  # get_all_line_items.rb. To determine which orders exist, run
22
22
  # get_all_orders.rb. To determine which placements exist, run
23
- # get_all_placements.rb.
23
+ # get_all_placements.rb. To determine the IDs for locations, run
24
+ # get_all_cities.rb, get_all_countries.rb, get_all_metros.rb and
25
+ # get_all_regions.rb.
24
26
  #
25
27
  # Tags: LineItemService.createLineItems
26
28
 
27
29
  require 'rubygems'
28
30
  require 'dfp_api'
29
31
 
30
- API_VERSION = :v201101
32
+ API_VERSION = :v201108
31
33
  # Number of line items to create.
32
34
  ITEM_COUNT = 5
33
35
 
@@ -53,23 +55,48 @@ def create_line_items()
53
55
  inventory_targeting = {:targeted_placement_ids => targeted_placement_ids}
54
56
 
55
57
  # Create geographical targeting.
56
- geo_targeting = {}
57
- # Include the US and Quebec, Canada.
58
- geo_targeting[:targeted_locations] = [
59
- {:xsi_type => 'CountryLocation', :country_code => 'US'},
60
- {:xsi_type => 'RegionLocation', :region_code => 'CA-QC'}
61
- ]
62
-
63
- # Exclude Chicago and the New York metro area.
64
- geo_targeting[:excluded_locations] = [
65
- {:xsi_type => 'CityLocation',
66
- :city_name => 'Chicago', :country_code => 'US'},
67
- {:xsi_type => 'MetroLocation', :metro_code => '501'}
68
- ]
58
+ geo_targeting = {
59
+ # Include the US and Quebec, Canada.
60
+ :targeted_locations => [{:id => 2840}, {:id => 20123}],
61
+ # Exclude Chicago and the New York metro area.
62
+ :excluded_locations => [{:id => 1016367}, {:id => 200501}]
63
+ }
64
+
65
+ # Create user domain targeting. Exclude domains that are not under the
66
+ # network's control.
67
+ user_domain_targeting = {:domains => ['usa.gov'], :targeted => false}
68
+
69
+ # Create day-part targeting.
70
+ day_part_targeting = {
71
+ # Target only the weekend in the browser's timezone.
72
+ :time_zone => 'BROWSER',
73
+ :day_parts => [
74
+ {:day_of_week => 'SATURDAY',
75
+ :start_time => {:hour => 0, :minute => 'ZERO'},
76
+ :end_time => {:hour => 24, :minute => 'ZERO'}},
77
+ {:day_of_week => 'SUNDAY',
78
+ :start_time => {:hour => 0, :minute => 'ZERO'},
79
+ :end_time => {:hour => 24, :minute => 'ZERO'}}
80
+ ]
81
+ }
82
+
83
+ # Create technology targeting.
84
+ technology_targeting = {
85
+ # Create browser targeting.
86
+ :browser_targeting => {
87
+ :is_targeted => true,
88
+ # Target just the Chrome browser.
89
+ :browsers => [{:id => 500072}]
90
+ }
91
+ }
69
92
 
70
93
  # Create targeting.
71
94
  targeting = {:geo_targeting => geo_targeting,
72
- :inventory_targeting => inventory_targeting}
95
+ :inventory_targeting => inventory_targeting,
96
+ :user_domain_targeting => user_domain_targeting,
97
+ :day_part_targeting => day_part_targeting,
98
+ :technology_targeting => technology_targeting
99
+ }
73
100
 
74
101
  # Create an array to store local line item objects.
75
102
  line_items = (1..ITEM_COUNT).map do |index|
@@ -81,10 +108,13 @@ def create_line_items()
81
108
  # Set the creative rotation type to even.
82
109
  line_item[:creative_rotation_type] = 'EVEN'
83
110
 
111
+ # Create the creative placeholder.
112
+ creative_placeholder = {
113
+ :size => {:width => 300, :height => 250, :is_aspect_ratio => false}
114
+ }
115
+
84
116
  # Set the size of creatives that can be associated with this line item.
85
- line_item[:creative_sizes] = [
86
- {:width => 300, :height => 250, :is_aspect_ratio => false}
87
- ]
117
+ line_item[:creative_placeholders] = [creative_placeholder]
88
118
 
89
119
  # Set the length of the line item to run.
90
120
  line_item[:start_date_time_type] = 'IMMEDIATELY'
@@ -25,7 +25,7 @@
25
25
  require 'rubygems'
26
26
  require 'dfp_api'
27
27
 
28
- API_VERSION = :v201101
28
+ API_VERSION = :v201108
29
29
  PAGE_SIZE = 500
30
30
 
31
31
  def get_all_line_items()
@@ -25,7 +25,7 @@
25
25
  require 'rubygems'
26
26
  require 'dfp_api'
27
27
 
28
- API_VERSION = :v201101
28
+ API_VERSION = :v201108
29
29
 
30
30
  def get_line_item()
31
31
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -26,7 +26,7 @@
26
26
  require 'rubygems'
27
27
  require 'dfp_api'
28
28
 
29
- API_VERSION = :v201101
29
+ API_VERSION = :v201108
30
30
 
31
31
  def get_line_items_by_statement()
32
32
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -29,7 +29,7 @@ require 'dfp_api'
29
29
 
30
30
  require 'pp'
31
31
 
32
- API_VERSION = :v201101
32
+ API_VERSION = :v201108
33
33
  PAGE_SIZE = 500
34
34
 
35
35
  def target_custom_criteria()
@@ -47,51 +47,45 @@ def target_custom_criteria()
47
47
  line_item_id = 'INSERT_LINE_ITEM_ID_HERE'.to_i
48
48
 
49
49
  # Set the IDs of the custom targeting keys.
50
- free_form_custom_targeting_key_id1 =
51
- 'INSERT_FREE_FORM_CUSTOM_TARGETING_KEY_ID_HERE'.to_i
52
- free_form_custom_targeting_key_id2 =
53
- 'INSERT_FREE_FORM_CUSTOM_TARGETING_KEY_ID_HERE'.to_i
54
-
55
- # Create the free-form custom criteria for targeting "toyota".
56
- toyota_free_form_custom_criteria = {
57
- :xsi_type => 'FreeFormCustomCriteria',
58
- :operator => 'IS',
59
- :key_id => free_form_custom_targeting_key_id1,
60
- :values => [{:name => 'toyota', :match_type => 'EXACT'}]
61
- }
62
-
63
- # Create the free-form custom criteria for targeting "honda".
64
- honda_free_form_custom_criteria = {
65
- :xsi_type => 'FreeFormCustomCriteria',
66
- :operator => 'IS_NOT',
67
- :key_id => free_form_custom_targeting_key_id1,
68
- :values => [{:name => 'honda', :match_type => 'EXACT'}]
69
- }
70
-
71
- # Create the free-form custom criteria for targeting "ford".
72
- ford_free_form_custom_criteria = {
73
- :xsi_type => 'FreeFormCustomCriteria',
74
- :operator => 'IS',
75
- :key_id => free_form_custom_targeting_key_id2,
76
- :values => [{:name => 'ford', :match_type => 'EXACT'}]
77
- }
50
+ custom_criteria_ids = [
51
+ {:key => 'INSERT_CUSTOM_TARGETING_KEY_ID_HERE'.to_i,
52
+ :values => ['INSERT_CUSTOM_TARGETING_VALUE_IDS_HERE'.to_i]},
53
+ {:key => 'INSERT_CUSTOM_TARGETING_KEY_ID_HERE'.to_i,
54
+ :values => ['INSERT_CUSTOM_TARGETING_VALUE_IDS_HERE'.to_i]},
55
+ {:key => 'INSERT_CUSTOM_TARGETING_KEY_ID_HERE'.to_i,
56
+ :values => ['INSERT_CUSTOM_TARGETING_VALUE_IDS_HERE'.to_i]}
57
+ ]
58
+
59
+ # Create custom criteria.
60
+ custom_criteria = [
61
+ {:xsi_type => 'CustomCriteria',
62
+ :key_id => custom_criteria_ids[0][:key],
63
+ :value_ids => custom_criteria_ids[0][:values],
64
+ :operator => 'IS'},
65
+ {:xsi_type => 'CustomCriteria',
66
+ :key_id => custom_criteria_ids[1][:key],
67
+ :value_ids => custom_criteria_ids[1][:values],
68
+ :operator => 'IS_NOT'},
69
+ {:xsi_type => 'CustomCriteria',
70
+ :key_id => custom_criteria_ids[2][:key],
71
+ :value_ids => custom_criteria_ids[2][:values],
72
+ :operator => 'IS'}
73
+ ]
78
74
 
79
75
  # Create the custom criteria set that will resemble:
80
76
  #
81
- # (freeFormCustomTargetingKeyId1 == toyota OR
82
- # (freeFormCustomTargetingKeyId1 != honda AND
83
- # freeFormCustomTargetingKeyId2 == ford))
77
+ # (custom_criteria[0].key == custom_criteria[0].values OR
78
+ # (custom_criteria[1].key != custom_criteria[1].values AND
79
+ # custom_criteria[2].key == custom_criteria[2].values))
84
80
  sub_custom_criteria_set = {
85
81
  :xsi_type => 'CustomCriteriaSet',
86
82
  :logical_operator => 'AND',
87
- :children => [honda_free_form_custom_criteria,
88
- ford_free_form_custom_criteria]
83
+ :children => [custom_criteria[1], custom_criteria[2]]
89
84
  }
90
85
  top_custom_criteria_set = {
91
86
  :xsi_type => 'CustomCriteriaSet',
92
87
  :logical_operator => 'OR',
93
- :children => [toyota_free_form_custom_criteria,
94
- sub_custom_criteria_set]
88
+ :children => [custom_criteria[0], sub_custom_criteria_set]
95
89
  }
96
90
 
97
91
  # Get the line item.
@@ -26,7 +26,7 @@
26
26
  require 'rubygems'
27
27
  require 'dfp_api'
28
28
 
29
- API_VERSION = :v201101
29
+ API_VERSION = :v201108
30
30
 
31
31
  def update_line_items()
32
32
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -24,7 +24,7 @@
24
24
  require 'rubygems'
25
25
  require 'dfp_api'
26
26
 
27
- API_VERSION = :v201101
27
+ API_VERSION = :v201108
28
28
 
29
29
  def get_all_networks()
30
30
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -24,7 +24,7 @@
24
24
  require 'rubygems'
25
25
  require 'dfp_api'
26
26
 
27
- API_VERSION = :v201101
27
+ API_VERSION = :v201108
28
28
 
29
29
  def get_current_network()
30
30
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -26,7 +26,7 @@
26
26
  require 'rubygems'
27
27
  require 'dfp_api'
28
28
 
29
- API_VERSION = :v201101
29
+ API_VERSION = :v201108
30
30
  PAGE_SIZE = 500
31
31
 
32
32
  def approve_orders()
@@ -27,7 +27,7 @@
27
27
  require 'rubygems'
28
28
  require 'dfp_api'
29
29
 
30
- API_VERSION = :v201101
30
+ API_VERSION = :v201108
31
31
  # Number of orders to create.
32
32
  ITEM_COUNT = 5
33
33
 
@@ -24,7 +24,7 @@
24
24
  require 'rubygems'
25
25
  require 'dfp_api'
26
26
 
27
- API_VERSION = :v201101
27
+ API_VERSION = :v201108
28
28
  PAGE_SIZE = 500
29
29
 
30
30
  def get_all_orders()