google-dfp-api 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
data/ChangeLog CHANGED
@@ -1,3 +1,9 @@
1
+ 0.2.4:
2
+ - Support for proxies.
3
+ - Require google-ads-common 0.5.1 or later from now on.
4
+ - Support for v201108.
5
+ - v201101 is now deprecated.
6
+
1
7
  0.2.3:
2
8
  - Support for v201107.
3
9
 
data/README CHANGED
@@ -106,7 +106,7 @@ Once the library object is created you can request services with a 'service'
106
106
  method:
107
107
  user_service = dfp.service(:UserService, <API_VERSION>)
108
108
 
109
- where <API_VERSION> is required version of DFP API as symbol, e.g. :v201104.
109
+ where <API_VERSION> is required version of DFP API as symbol, e.g. :v201108.
110
110
 
111
111
  Then you should be able to execute service methods:
112
112
 
@@ -139,7 +139,7 @@ Examples can be run by executing by running:
139
139
 
140
140
  from the "examples/<version>/<service_name>" directory i.e.
141
141
 
142
- $ cd examples/v201104/user_service
142
+ $ cd examples/v201108/user_service
143
143
  $ ruby get_all_users.rb
144
144
 
145
145
  Some examples require modification to be functional, like create_order example
@@ -174,8 +174,14 @@ to the Ruby Logger documentation.
174
174
 
175
175
  == What if I am behind an HTTP Proxy server?
176
176
 
177
- The Ruby Client Libraries does not support proxy servers in this version but it
178
- is planned for next releases.
177
+ You can specify a proxy server to be used for all requests as part of
178
+ configuration hash:
179
+
180
+ config[:connection] = {
181
+ :proxy => 'http://user:password@proxy_hostname:8080'
182
+ }
183
+
184
+ or via configuration file (see example).
179
185
 
180
186
 
181
187
  = External dependencies:
@@ -183,7 +189,7 @@ is planned for next releases.
183
189
  External dependencies should be pulled automatically on gem install. Here is the
184
190
  list though:
185
191
 
186
- - Google Ads Common library (google-ads-common-0.5.0);
192
+ - Google Ads Common library (google-ads-common-0.5.1);
187
193
  - Savon 'the heavy metal Ruby SOAP client' (savon-0.9.6).
188
194
 
189
195
 
data/Rakefile CHANGED
@@ -47,7 +47,7 @@ spec = Gem::Specification.new do |s|
47
47
  s.test_files = tests
48
48
  s.has_rdoc = true
49
49
  s.extra_rdoc_files = docs
50
- s.add_dependency('google-ads-common', '~> 0.5.0')
50
+ s.add_dependency('google-ads-common', '~> 0.5.1')
51
51
  s.add_dependency('savon', '= 0.9.6')
52
52
  end
53
53
 
@@ -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 produce_api_error()
30
30
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -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
  MAX_RETRIES = 3
31
31
 
@@ -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
  # Number of companies to create.
30
30
  ITEM_COUNT = 5
31
31
 
@@ -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_companies()
@@ -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_companies_by_statement()
32
32
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -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_company()
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 update_companies()
32
32
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -28,7 +28,7 @@ require 'dfp_api'
28
28
 
29
29
  require 'base64'
30
30
 
31
- API_VERSION = :v201101
31
+ API_VERSION = :v201108
32
32
 
33
33
  def copy_image_creatives()
34
34
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -27,7 +27,7 @@ require 'rubygems'
27
27
  require 'base64'
28
28
  require 'dfp_api'
29
29
 
30
- API_VERSION = :v201101
30
+ API_VERSION = :v201108
31
31
  # Number of creatives 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_creatives()
@@ -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_creative()
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_creatives_by_statement()
32
32
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -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 update_creatives()
31
31
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -28,7 +28,7 @@
28
28
  require 'rubygems'
29
29
  require 'dfp_api'
30
30
 
31
- API_VERSION = :v201101
31
+ API_VERSION = :v201108
32
32
 
33
33
  def create_custom_targeting_keys_and_values()
34
34
  # 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 delete_custom_targeting_keys()
@@ -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 delete_custom_targeting_values()
@@ -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 get_all_custom_targeting_keys_and_values()
@@ -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_custom_targeting_keys_by_statement()
32
32
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -28,7 +28,7 @@
28
28
  require 'rubygems'
29
29
  require 'dfp_api'
30
30
 
31
- API_VERSION = :v201101
31
+ API_VERSION = :v201108
32
32
 
33
33
  def get_custom_targeting_values_by_statement()
34
34
  # 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_custom_targeting_keys()
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_custom_targeting_values()
33
33
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -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_forecast()
31
31
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -39,7 +39,7 @@ def get_forecast()
39
39
  forecast_service = dfp.service(:ForecastService, API_VERSION)
40
40
 
41
41
  # Set the placement that the prospective line item will target.
42
- targeted_placement_ids = ["INSERT_PLACEMENT_ID_HERE".to_i]
42
+ targeted_placement_ids = ['INSERT_PLACEMENT_ID_HERE'.to_i]
43
43
 
44
44
  # Create targeting.
45
45
  targeting = {
@@ -47,13 +47,17 @@ def get_forecast()
47
47
  {:targeted_placement_ids => targeted_placement_ids}
48
48
  }
49
49
 
50
+ # Create the creative placeholder.
51
+ creative_placeholder = {
52
+ :size => {:width => 300, :height => 250, :is_aspect_ratio => false}
53
+ }
54
+
50
55
  # Create prospective line item.
51
56
  line_item = {
52
57
  :line_item_type => 'SPONSORSHIP',
53
58
  :targeting => targeting,
54
59
  # Set the size of creatives that can be associated with this line item.
55
- :creative_sizes =>
56
- {:width => 300, :height => 250, :is_aspect_ratio => false},
60
+ :creative_placeholders => [creative_placeholder],
57
61
  # Set the line item's time to be now until the projected end date time.
58
62
  :start_date_time_type => 'IMMEDIATELY',
59
63
  :end_date_time => Time.utc(2012, 01, 01),
@@ -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_forecast_by_id()
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
  # Number of ad units to create.
31
31
  ITEM_COUNT = 5
32
32
 
@@ -50,6 +50,12 @@ def create_ad_units()
50
50
 
51
51
  puts "Using effective root ad unit: %d" % effective_root_ad_unit_id
52
52
 
53
+ # Create the creative placeholder.
54
+ creative_placeholder = {
55
+ :size => {:width => 300, :height => 250, :is_aspect_ratio => false},
56
+ :environment_type => 'BROWSER'
57
+ }
58
+
53
59
  # Create an array to store local ad unit objects.
54
60
  ad_units = (1..ITEM_COUNT).map do |index|
55
61
  {:name => "Ad_Unit_%d" % index,
@@ -57,7 +63,7 @@ def create_ad_units()
57
63
  :description => 'Ad unit description.',
58
64
  :target_window => 'BLANK',
59
65
  # Set the size of possible creatives that can match this ad unit.
60
- :sizes => [{:width => 300, :height => 250, :is_aspect_ratio => false}]}
66
+ :ad_unit_sizes => [creative_placeholder]}
61
67
  end
62
68
 
63
69
  # Create the ad units on the server.
@@ -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 deactivate_ad_units()
@@ -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_ad_unit()
31
31
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.
@@ -0,0 +1,73 @@
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 gets all ad unit sizes in the network.
21
+ #
22
+ # Tags: InventoryService.getAdUnitSizes
23
+
24
+ require 'rubygems'
25
+ require 'dfp_api'
26
+
27
+ API_VERSION = :v201108
28
+
29
+ def get_all_ad_unit_sizes()
30
+ # Get DfpApi instance and load configuration from ~/dfp_api.yml.
31
+ dfp = DfpApi::Api.new
32
+
33
+ # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
34
+ # the configuration file or provide your own logger:
35
+ # dfp.logger = Logger.new('dfp_xml.log')
36
+
37
+ # Get the InventoryService.
38
+ inventory_service = dfp.service(:InventoryService, API_VERSION)
39
+
40
+ # Get all ad unit sizes.
41
+ ad_unit_sizes = inventory_service.get_ad_unit_sizes()
42
+
43
+ if ad_unit_sizes
44
+ # Print details about each ad unit in results.
45
+ ad_unit_sizes.each_with_index do |ad_unit_size, index|
46
+ puts "%d) Ad unit size %dx%d was found." % [index,
47
+ ad_unit_size[:size][:width], ad_unit_size[:size][:height]]
48
+ end
49
+ else
50
+ puts 'No ad unit sizes found.'
51
+ end
52
+ end
53
+
54
+ if __FILE__ == $0
55
+ begin
56
+ get_all_ad_unit_sizes()
57
+
58
+ # HTTP errors.
59
+ rescue AdsCommon::Errors::HttpError => e
60
+ puts "HTTP Error: %s" % e
61
+
62
+ # API errors.
63
+ rescue DfpApi::Errors::ApiException => e
64
+ puts "Message: %s" % e.message
65
+ puts 'Errors:'
66
+ e.errors.each_with_index do |error, index|
67
+ puts "\tError [%d]:" % (index + 1)
68
+ error.each do |field, value|
69
+ puts "\t\t%s: %s" % [field, value]
70
+ end
71
+ end
72
+ end
73
+ end
@@ -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_ad_units_by_statement()
31
31
  # Get DfpApi instance and load configuration from ~/dfp_api.yml.