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.
- data/ChangeLog +6 -0
- data/README +11 -5
- data/Rakefile +1 -1
- data/examples/{v201101 → v201108}/common/error_handling.rb +1 -1
- data/examples/{v201101 → v201108}/common/oauth_handling.rb +1 -1
- data/examples/{v201101 → v201108}/company_service/create_companies.rb +1 -1
- data/examples/{v201101 → v201108}/company_service/get_all_companies.rb +1 -1
- data/examples/{v201101 → v201108}/company_service/get_companies_by_statement.rb +1 -1
- data/examples/{v201101 → v201108}/company_service/get_company.rb +1 -1
- data/examples/{v201101 → v201108}/company_service/update_companies.rb +1 -1
- data/examples/{v201101 → v201108}/creative_service/copy_image_creatives.rb +1 -1
- data/examples/{v201101 → v201108}/creative_service/create_creatives.rb +1 -1
- data/examples/{v201101 → v201108}/creative_service/get_all_creatives.rb +1 -1
- data/examples/{v201101 → v201108}/creative_service/get_creative.rb +1 -1
- data/examples/{v201101 → v201108}/creative_service/get_creatives_by_statement.rb +1 -1
- data/examples/{v201101 → v201108}/creative_service/update_creatives.rb +1 -1
- data/examples/{v201101 → v201108}/custom_targeting_service/create_custom_targeting_keys_and_values.rb +1 -1
- data/examples/{v201101 → v201108}/custom_targeting_service/delete_custom_targeting_keys.rb +1 -1
- data/examples/{v201101 → v201108}/custom_targeting_service/delete_custom_targeting_values.rb +1 -1
- data/examples/{v201101 → v201108}/custom_targeting_service/get_all_custom_targeting_keys_and_values.rb +1 -1
- data/examples/{v201101 → v201108}/custom_targeting_service/get_custom_targeting_keys_by_statement.rb +1 -1
- data/examples/{v201101 → v201108}/custom_targeting_service/get_custom_targeting_values_by_statement.rb +1 -1
- data/examples/{v201101 → v201108}/custom_targeting_service/update_custom_targeting_keys.rb +1 -1
- data/examples/{v201101 → v201108}/custom_targeting_service/update_custom_targeting_values.rb +1 -1
- data/examples/{v201101 → v201108}/forecast_service/get_forecast.rb +8 -4
- data/examples/{v201101 → v201108}/forecast_service/get_forecast_by_id.rb +1 -1
- data/examples/{v201101 → v201108}/inventory_service/create_ad_units.rb +8 -2
- data/examples/{v201101 → v201108}/inventory_service/deactivate_ad_units.rb +1 -1
- data/examples/{v201101 → v201108}/inventory_service/get_ad_unit.rb +1 -1
- data/examples/v201108/inventory_service/get_ad_unit_sizes.rb +73 -0
- data/examples/{v201101 → v201108}/inventory_service/get_ad_units_by_statement.rb +1 -1
- data/examples/{v201101 → v201108}/inventory_service/get_all_ad_units.rb +1 -1
- data/examples/{v201101 → v201108}/inventory_service/update_ad_units.rb +1 -1
- data/examples/v201108/label_service/create_labels.rb +83 -0
- data/examples/v201108/label_service/deactivate_labels.rb +118 -0
- data/examples/v201108/label_service/get_all_labels.rb +94 -0
- data/examples/v201108/label_service/get_label.rb +76 -0
- data/examples/v201108/label_service/get_labels_by_statement.rb +91 -0
- data/examples/v201108/label_service/update_labels.rb +104 -0
- data/examples/{v201101 → v201108}/line_item_creative_association_service/create_licas.rb +1 -1
- data/examples/{v201101 → v201108}/line_item_creative_association_service/deactivate_licas.rb +1 -1
- data/examples/{v201101 → v201108}/line_item_creative_association_service/get_all_licas.rb +1 -1
- data/examples/{v201101 → v201108}/line_item_creative_association_service/get_lica.rb +1 -1
- data/examples/{v201101 → v201108}/line_item_creative_association_service/get_licas_by_statement.rb +1 -1
- data/examples/{v201101 → v201108}/line_item_creative_association_service/update_licas.rb +1 -1
- data/examples/{v201101 → v201108}/line_item_service/activate_line_items.rb +1 -1
- data/examples/{v201101 → v201108}/line_item_service/create_line_items.rb +49 -19
- data/examples/{v201101 → v201108}/line_item_service/get_all_line_items.rb +1 -1
- data/examples/{v201101 → v201108}/line_item_service/get_line_item.rb +1 -1
- data/examples/{v201101 → v201108}/line_item_service/get_line_items_by_statement.rb +1 -1
- data/examples/{v201101 → v201108}/line_item_service/target_custom_criteria.rb +30 -36
- data/examples/{v201101 → v201108}/line_item_service/update_line_items.rb +1 -1
- data/examples/{v201101 → v201108}/network_service/get_all_networks.rb +1 -1
- data/examples/{v201101 → v201108}/network_service/get_current_network.rb +1 -1
- data/examples/{v201101 → v201108}/order_service/approve_orders.rb +1 -1
- data/examples/{v201101 → v201108}/order_service/create_orders.rb +1 -1
- data/examples/{v201101 → v201108}/order_service/get_all_orders.rb +1 -1
- data/examples/{v201101 → v201108}/order_service/get_order.rb +1 -1
- data/examples/{v201101 → v201108}/order_service/get_orders_by_statement.rb +1 -1
- data/examples/{v201101 → v201108}/order_service/update_orders.rb +1 -1
- data/examples/{v201101 → v201108}/placement_service/create_placements.rb +3 -2
- data/examples/{v201101 → v201108}/placement_service/deactivate_placements.rb +1 -1
- data/examples/{v201101 → v201108}/placement_service/get_all_placements.rb +1 -1
- data/examples/{v201101 → v201108}/placement_service/get_placement.rb +1 -1
- data/examples/{v201101 → v201108}/placement_service/get_placements_by_statement.rb +1 -1
- data/examples/{v201101 → v201108}/placement_service/update_placements.rb +1 -1
- data/examples/v201108/publisher_query_language_service/get_all_bandwidth_groups.rb +85 -0
- data/examples/v201108/publisher_query_language_service/get_all_browser_languages.rb +85 -0
- data/examples/v201108/publisher_query_language_service/get_all_browsers.rb +85 -0
- data/examples/{v201101 → v201108}/publisher_query_language_service/get_all_cities.rb +1 -1
- data/examples/{v201101 → v201108}/publisher_query_language_service/get_all_countries.rb +1 -1
- data/examples/{v201101 → v201108}/publisher_query_language_service/get_all_metros.rb +1 -1
- data/examples/v201108/publisher_query_language_service/get_all_operating_systems.rb +85 -0
- data/examples/{v201101 → v201108}/publisher_query_language_service/get_all_regions.rb +1 -1
- data/examples/{v201101 → v201108}/report_service/download_report.rb +1 -1
- data/examples/{v201101 → v201108}/report_service/run_delivery_report.rb +1 -1
- data/examples/{v201101 → v201108}/report_service/run_inventory_report.rb +1 -1
- data/examples/{v201101 → v201108}/report_service/run_sales_report.rb +1 -1
- data/examples/{v201101 → v201108}/user_service/create_users.rb +1 -1
- data/examples/{v201101 → v201108}/user_service/deactivate_users.rb +1 -1
- data/examples/{v201101 → v201108}/user_service/get_all_roles.rb +1 -1
- data/examples/{v201101 → v201108}/user_service/get_all_users.rb +1 -1
- data/examples/v201108/user_service/get_current_user.rb +66 -0
- data/examples/{v201101 → v201108}/user_service/get_user.rb +1 -1
- data/examples/{v201101 → v201108}/user_service/get_users_by_statement.rb +1 -1
- data/examples/{v201101 → v201108}/user_service/update_users.rb +1 -1
- data/lib/dfp_api.rb +5 -12
- data/lib/dfp_api/api_config.rb +14 -13
- data/lib/dfp_api/credential_handler.rb +5 -5
- data/lib/dfp_api/v201104/company_service.rb +5 -5
- data/lib/dfp_api/v201104/company_service_registry.rb +5 -3
- data/lib/dfp_api/v201104/creative_service.rb +5 -5
- data/lib/dfp_api/v201104/creative_service_registry.rb +5 -3
- data/lib/dfp_api/v201104/custom_targeting_service.rb +9 -9
- data/lib/dfp_api/v201104/custom_targeting_service_registry.rb +5 -3
- data/lib/dfp_api/v201104/forecast_service.rb +5 -5
- data/lib/dfp_api/v201104/forecast_service_registry.rb +5 -3
- data/lib/dfp_api/v201104/inventory_service.rb +9 -9
- data/lib/dfp_api/v201104/inventory_service_registry.rb +5 -3
- data/lib/dfp_api/v201104/line_item_creative_association_service.rb +1 -1
- data/lib/dfp_api/v201104/line_item_creative_association_service_registry.rb +5 -3
- data/lib/dfp_api/v201104/line_item_service.rb +13 -13
- data/lib/dfp_api/v201104/line_item_service_registry.rb +5 -3
- data/lib/dfp_api/v201104/network_service.rb +5 -5
- data/lib/dfp_api/v201104/network_service_registry.rb +5 -3
- data/lib/dfp_api/v201104/order_service.rb +1 -1
- data/lib/dfp_api/v201104/order_service_registry.rb +5 -3
- data/lib/dfp_api/v201104/placement_service.rb +5 -5
- data/lib/dfp_api/v201104/placement_service_registry.rb +5 -3
- data/lib/dfp_api/v201104/publisher_query_language_service.rb +1 -1
- data/lib/dfp_api/v201104/publisher_query_language_service_registry.rb +5 -3
- data/lib/dfp_api/v201104/report_service.rb +5 -5
- data/lib/dfp_api/v201104/report_service_registry.rb +5 -3
- data/lib/dfp_api/v201104/user_service.rb +9 -9
- data/lib/dfp_api/v201104/user_service_registry.rb +5 -3
- data/lib/dfp_api/v201107/company_service.rb +9 -9
- data/lib/dfp_api/v201107/company_service_registry.rb +5 -3
- data/lib/dfp_api/v201107/custom_targeting_service.rb +9 -9
- data/lib/dfp_api/v201107/custom_targeting_service_registry.rb +5 -3
- data/lib/dfp_api/v201107/label_service.rb +5 -5
- data/lib/dfp_api/v201107/label_service_registry.rb +5 -3
- data/lib/dfp_api/v201107/order_service.rb +13 -13
- data/lib/dfp_api/v201107/order_service_registry.rb +5 -3
- data/lib/dfp_api/v201107/report_service.rb +5 -5
- data/lib/dfp_api/v201107/report_service_registry.rb +5 -3
- data/lib/dfp_api/v201107/user_service.rb +19 -19
- data/lib/dfp_api/v201107/user_service_registry.rb +5 -3
- data/lib/dfp_api/{v201101 → v201108}/company_service.rb +10 -10
- data/lib/dfp_api/v201108/company_service_registry.rb +44 -0
- data/lib/dfp_api/{v201101 → v201108}/creative_service.rb +10 -10
- data/lib/dfp_api/v201108/creative_service_registry.rb +44 -0
- data/lib/dfp_api/{v201101 → v201108}/custom_targeting_service.rb +14 -14
- data/lib/dfp_api/v201108/custom_targeting_service_registry.rb +44 -0
- data/lib/dfp_api/{v201101 → v201108}/forecast_service.rb +10 -10
- data/lib/dfp_api/v201108/forecast_service_registry.rb +44 -0
- data/lib/dfp_api/{v201101 → v201108}/inventory_service.rb +18 -14
- data/lib/dfp_api/v201108/inventory_service_registry.rb +44 -0
- data/lib/dfp_api/v201108/label_service.rb +56 -0
- data/lib/dfp_api/v201108/label_service_registry.rb +44 -0
- data/lib/dfp_api/{v201101 → v201108}/line_item_creative_association_service.rb +6 -6
- data/lib/dfp_api/v201108/line_item_creative_association_service_registry.rb +44 -0
- data/lib/dfp_api/{v201101 → v201108}/line_item_service.rb +18 -18
- data/lib/dfp_api/v201108/line_item_service_registry.rb +44 -0
- data/lib/dfp_api/{v201101 → v201108}/network_service.rb +10 -10
- data/lib/dfp_api/v201108/network_service_registry.rb +44 -0
- data/lib/dfp_api/{v201101 → v201108}/order_service.rb +6 -6
- data/lib/dfp_api/v201108/order_service_registry.rb +44 -0
- data/lib/dfp_api/{v201101 → v201108}/placement_service.rb +10 -10
- data/lib/dfp_api/v201108/placement_service_registry.rb +44 -0
- data/lib/dfp_api/{v201101 → v201108}/publisher_query_language_service.rb +6 -6
- data/lib/dfp_api/v201108/publisher_query_language_service_registry.rb +44 -0
- data/lib/dfp_api/{v201101 → v201108}/report_service.rb +10 -10
- data/lib/dfp_api/v201108/report_service_registry.rb +44 -0
- data/lib/dfp_api/v201108/third_party_slot_service.rb +44 -0
- data/lib/dfp_api/v201108/third_party_slot_service_registry.rb +44 -0
- data/lib/dfp_api/{v201101 → v201108}/user_service.rb +18 -14
- data/lib/dfp_api/v201108/user_service_registry.rb +44 -0
- metadata +120 -104
- data/lib/dfp_api/v201101/company_service_registry.rb +0 -42
- data/lib/dfp_api/v201101/creative_service_registry.rb +0 -42
- data/lib/dfp_api/v201101/custom_targeting_service_registry.rb +0 -42
- data/lib/dfp_api/v201101/forecast_service_registry.rb +0 -42
- data/lib/dfp_api/v201101/inventory_service_registry.rb +0 -42
- data/lib/dfp_api/v201101/line_item_creative_association_service_registry.rb +0 -42
- data/lib/dfp_api/v201101/line_item_service_registry.rb +0 -42
- data/lib/dfp_api/v201101/network_service_registry.rb +0 -42
- data/lib/dfp_api/v201101/order_service_registry.rb +0 -42
- data/lib/dfp_api/v201101/placement_service_registry.rb +0 -42
- data/lib/dfp_api/v201101/publisher_query_language_service_registry.rb +0 -42
- data/lib/dfp_api/v201101/report_service_registry.rb +0 -42
- data/lib/dfp_api/v201101/user_service_registry.rb +0 -42
data/ChangeLog
CHANGED
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. :
|
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/
|
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
|
-
|
178
|
-
|
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.
|
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.
|
50
|
+
s.add_dependency('google-ads-common', '~> 0.5.1')
|
51
51
|
s.add_dependency('savon', '= 0.9.6')
|
52
52
|
end
|
53
53
|
|
@@ -25,7 +25,7 @@
|
|
25
25
|
require 'rubygems'
|
26
26
|
require 'dfp_api'
|
27
27
|
|
28
|
-
API_VERSION = :
|
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 = [
|
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
|
-
:
|
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),
|
@@ -26,7 +26,7 @@
|
|
26
26
|
require 'rubygems'
|
27
27
|
require 'dfp_api'
|
28
28
|
|
29
|
-
API_VERSION = :
|
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
|
-
:
|
66
|
+
:ad_unit_sizes => [creative_placeholder]}
|
61
67
|
end
|
62
68
|
|
63
69
|
# Create the ad units on the server.
|
@@ -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
|