google-dfp-api 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +201 -0
- data/ChangeLog +10 -0
- data/README +210 -0
- data/Rakefile +83 -0
- data/examples/v201101/common/error_handling.rb +76 -0
- data/examples/v201101/company_service/create_companies.rb +82 -0
- data/examples/v201101/company_service/get_all_companies.rb +92 -0
- data/examples/v201101/company_service/get_companies_by_statement.rb +88 -0
- data/examples/v201101/company_service/get_company.rb +72 -0
- data/examples/v201101/company_service/update_companies.rb +95 -0
- data/examples/v201101/creative_service/copy_image_creatives.rb +117 -0
- data/examples/v201101/creative_service/create_creatives.rb +109 -0
- data/examples/v201101/creative_service/get_all_creatives.rb +93 -0
- data/examples/v201101/creative_service/get_creative.rb +72 -0
- data/examples/v201101/creative_service/get_creatives_by_statement.rb +87 -0
- data/examples/v201101/creative_service/update_creatives.rb +98 -0
- data/examples/v201101/custom_targeting_service/create_custom_targeting_keys_and_values.rb +118 -0
- data/examples/v201101/custom_targeting_service/delete_custom_targeting_keys.rb +121 -0
- data/examples/v201101/custom_targeting_service/delete_custom_targeting_values.rb +125 -0
- data/examples/v201101/custom_targeting_service/get_all_custom_targeting_keys_and_values.rb +148 -0
- data/examples/v201101/custom_targeting_service/get_custom_targeting_keys_by_statement.rb +92 -0
- data/examples/v201101/custom_targeting_service/get_custom_targeting_values_by_statement.rb +98 -0
- data/examples/v201101/custom_targeting_service/update_custom_targeting_keys.rb +94 -0
- data/examples/v201101/custom_targeting_service/update_custom_targeting_values.rb +106 -0
- data/examples/v201101/forecast_service/get_forecast.rb +103 -0
- data/examples/v201101/forecast_service/get_forecast_by_id.rb +80 -0
- data/examples/v201101/inventory_service/create_ad_units.rb +98 -0
- data/examples/v201101/inventory_service/deactivate_ad_units.rb +119 -0
- data/examples/v201101/inventory_service/get_ad_unit.rb +72 -0
- data/examples/v201101/inventory_service/get_ad_units_by_statement.rb +96 -0
- data/examples/v201101/inventory_service/get_all_ad_units.rb +93 -0
- data/examples/v201101/inventory_service/update_ad_units.rb +94 -0
- data/examples/v201101/line_item_creative_association_service/create_licas.rb +94 -0
- data/examples/v201101/line_item_creative_association_service/deactivate_licas.rb +127 -0
- data/examples/v201101/line_item_creative_association_service/get_all_licas.rb +95 -0
- data/examples/v201101/line_item_creative_association_service/get_lica.rb +77 -0
- data/examples/v201101/line_item_creative_association_service/get_licas_by_statement.rb +91 -0
- data/examples/v201101/line_item_creative_association_service/update_licas.rb +92 -0
- data/examples/v201101/line_item_service/activate_line_items.rb +131 -0
- data/examples/v201101/line_item_service/create_line_items.rb +141 -0
- data/examples/v201101/line_item_service/get_all_line_items.rb +94 -0
- data/examples/v201101/line_item_service/get_line_item.rb +74 -0
- data/examples/v201101/line_item_service/get_line_items_by_statement.rb +89 -0
- data/examples/v201101/line_item_service/target_custom_criteria.rb +135 -0
- data/examples/v201101/line_item_service/update_line_items.rb +110 -0
- data/examples/v201101/network_service/get_all_networks.rb +74 -0
- data/examples/v201101/network_service/get_current_network.rb +66 -0
- data/examples/v201101/order_service/approve_orders.rb +116 -0
- data/examples/v201101/order_service/create_orders.rb +93 -0
- data/examples/v201101/order_service/get_all_orders.rb +93 -0
- data/examples/v201101/order_service/get_order.rb +74 -0
- data/examples/v201101/order_service/get_orders_by_statement.rb +90 -0
- data/examples/v201101/order_service/update_orders.rb +95 -0
- data/examples/v201101/placement_service/create_placements.rb +128 -0
- data/examples/v201101/placement_service/deactivate_placements.rb +118 -0
- data/examples/v201101/placement_service/get_all_placements.rb +93 -0
- data/examples/v201101/placement_service/get_placement.rb +74 -0
- data/examples/v201101/placement_service/get_placements_by_statement.rb +86 -0
- data/examples/v201101/placement_service/update_placements.rb +96 -0
- data/examples/v201101/publisher_query_language_service/get_all_cities.rb +85 -0
- data/examples/v201101/publisher_query_language_service/get_all_countries.rb +85 -0
- data/examples/v201101/publisher_query_language_service/get_all_metros.rb +85 -0
- data/examples/v201101/publisher_query_language_service/get_all_regions.rb +85 -0
- data/examples/v201101/report_service/download_report.rb +81 -0
- data/examples/v201101/report_service/run_delivery_report.rb +89 -0
- data/examples/v201101/report_service/run_inventory_report.rb +90 -0
- data/examples/v201101/report_service/run_sales_report.rb +89 -0
- data/examples/v201101/user_service/create_users.rb +89 -0
- data/examples/v201101/user_service/deactivate_users.rb +99 -0
- data/examples/v201101/user_service/get_all_roles.rb +73 -0
- data/examples/v201101/user_service/get_all_users.rb +92 -0
- data/examples/v201101/user_service/get_user.rb +73 -0
- data/examples/v201101/user_service/get_users_by_statement.rb +79 -0
- data/examples/v201101/user_service/update_users.rb +89 -0
- data/lib/dfp_api.rb +142 -0
- data/lib/dfp_api/api_config.rb +126 -0
- data/lib/dfp_api/credential_handler.rb +60 -0
- data/lib/dfp_api/errors.rb +59 -0
- data/lib/dfp_api/extensions.rb +54 -0
- data/lib/dfp_api/v201101/company_service.rb +52 -0
- data/lib/dfp_api/v201101/company_service_registry.rb +37 -0
- data/lib/dfp_api/v201101/creative_service.rb +52 -0
- data/lib/dfp_api/v201101/creative_service_registry.rb +37 -0
- data/lib/dfp_api/v201101/custom_targeting_service.rb +60 -0
- data/lib/dfp_api/v201101/custom_targeting_service_registry.rb +37 -0
- data/lib/dfp_api/v201101/forecast_service.rb +36 -0
- data/lib/dfp_api/v201101/forecast_service_registry.rb +37 -0
- data/lib/dfp_api/v201101/inventory_service.rb +56 -0
- data/lib/dfp_api/v201101/inventory_service_registry.rb +37 -0
- data/lib/dfp_api/v201101/line_item_creative_association_service.rb +56 -0
- data/lib/dfp_api/v201101/line_item_creative_association_service_registry.rb +37 -0
- data/lib/dfp_api/v201101/line_item_service.rb +56 -0
- data/lib/dfp_api/v201101/line_item_service_registry.rb +37 -0
- data/lib/dfp_api/v201101/network_service.rb +40 -0
- data/lib/dfp_api/v201101/network_service_registry.rb +37 -0
- data/lib/dfp_api/v201101/order_service.rb +56 -0
- data/lib/dfp_api/v201101/order_service_registry.rb +37 -0
- data/lib/dfp_api/v201101/placement_service.rb +56 -0
- data/lib/dfp_api/v201101/placement_service_registry.rb +37 -0
- data/lib/dfp_api/v201101/publisher_query_language_service.rb +32 -0
- data/lib/dfp_api/v201101/publisher_query_language_service_registry.rb +37 -0
- data/lib/dfp_api/v201101/report_service.rb +40 -0
- data/lib/dfp_api/v201101/report_service_registry.rb +37 -0
- data/lib/dfp_api/v201101/user_service.rb +60 -0
- data/lib/dfp_api/v201101/user_service_registry.rb +37 -0
- metadata +204 -0
@@ -0,0 +1,60 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#
|
3
|
+
# Authors:: 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
|
+
# DFP-specific credential handler.
|
21
|
+
|
22
|
+
require 'ads_common/credential_handler'
|
23
|
+
require 'dfp_api/api_config'
|
24
|
+
|
25
|
+
module DfpApi
|
26
|
+
class CredentialHandler < AdsCommon::CredentialHandler
|
27
|
+
# Create the list of credentials to be used by the auth handler for header
|
28
|
+
# generation.
|
29
|
+
def credentials(version = nil)
|
30
|
+
validate_headers_for_server()
|
31
|
+
client_lib = "Ruby-DfpApi-%s" % DfpApi::ApiConfig::CLIENT_LIB_VERSION
|
32
|
+
application_name = @credentials[:application_name] || $0
|
33
|
+
result = {
|
34
|
+
:email => @credentials[:email],
|
35
|
+
:password => @credentials[:password],
|
36
|
+
:applicationName => "%s|%s" % [client_lib, application_name]
|
37
|
+
}
|
38
|
+
network_code = @credentials[:network_code]
|
39
|
+
result[:networkCode] = network_code if !network_code.nil?
|
40
|
+
return result
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
# Validates that the right credentials are being used for the chosen
|
46
|
+
# environment.
|
47
|
+
def validate_headers_for_server()
|
48
|
+
if @credentials[:email].nil?
|
49
|
+
raise AdsCommon::Errors::AuthError, "Login email is not specified"
|
50
|
+
end
|
51
|
+
if @credentials[:password].nil?
|
52
|
+
raise AdsCommon::Errors::AuthError, "Password is not specified"
|
53
|
+
end
|
54
|
+
if @credentials[:application_name].nil?
|
55
|
+
raise AdsCommon::Errors::AuthError, "Application name is not specified"
|
56
|
+
end
|
57
|
+
return nil
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#
|
3
|
+
# Authors:: api.dklimkin@gmail.com (Danial Klimkin)
|
4
|
+
#
|
5
|
+
# Copyright:: Copyright 2010, 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
|
+
# Specific error handling for the DFP API.
|
21
|
+
|
22
|
+
require 'ads_common/errors'
|
23
|
+
|
24
|
+
module DfpApi
|
25
|
+
module Errors
|
26
|
+
|
27
|
+
# This class encapsulates base class for API exceptions. More specific
|
28
|
+
# exceptions are generated based on Service WSDL.
|
29
|
+
class ApiException < AdsCommon::Errors::ApiException
|
30
|
+
attr_reader :array_fields
|
31
|
+
|
32
|
+
def initialize(exception_fault)
|
33
|
+
@array_fields = [] if !defined?(@array_fields)
|
34
|
+
exception_fault.each {|key, value| set_field(key, value)}
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
# Sets instance's property to a value if it is defined
|
40
|
+
def set_field(field, value)
|
41
|
+
if respond_to?(field)
|
42
|
+
value = arrayize(value) if is_array_field(field)
|
43
|
+
instance_variable_set("@#{field}", value)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Makes sure object is an array
|
48
|
+
def arrayize(object)
|
49
|
+
return Array.new if object.nil?
|
50
|
+
return object.is_a?(Array) ? object : [object]
|
51
|
+
end
|
52
|
+
|
53
|
+
# Should a field be forced to be an array
|
54
|
+
def is_array_field(field)
|
55
|
+
return @array_fields.include?(field.to_s)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#
|
3
|
+
# Author:: api.dklimkin@gmail.com (Danial Klimkin)
|
4
|
+
#
|
5
|
+
# Copyright:: Copyright 2010, 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
|
+
# Contains extensions to the API, that is, service helper methods provided in
|
21
|
+
# client-side by the client library.
|
22
|
+
|
23
|
+
module DfpApi
|
24
|
+
|
25
|
+
module Extensions
|
26
|
+
|
27
|
+
# Maintains a list of all extension methods, indexed by version and service.
|
28
|
+
# Using camelCase to match API method names.
|
29
|
+
@@extensions = {
|
30
|
+
}
|
31
|
+
|
32
|
+
# Defines the parameter list for every extension method
|
33
|
+
@@methods = {
|
34
|
+
}
|
35
|
+
|
36
|
+
# Return list of all extension methods, indexed by version and service.
|
37
|
+
def self.extensions
|
38
|
+
return @@extensions
|
39
|
+
end
|
40
|
+
|
41
|
+
# Return the parameter list for every extension method.
|
42
|
+
def self.methods
|
43
|
+
return @@methods
|
44
|
+
end
|
45
|
+
|
46
|
+
#########################################################################
|
47
|
+
# NOTE: The following extension methods shouldn't be used directly; they
|
48
|
+
# should instead be used from the services wrappers they get mapped to.
|
49
|
+
# For example, you should use ReportService::downloadXmlReport instead of
|
50
|
+
# Extensions::downloadXmlReport.
|
51
|
+
#########################################################################
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# This is auto-generated code, changes will be overwritten.
|
3
|
+
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
|
4
|
+
# License:: Licensed under the Apache License,Version 2.0 (the "License").
|
5
|
+
#
|
6
|
+
# Code generated by AdsCommon library 0.3.0 on 2011-06-09 13:32:18.
|
7
|
+
|
8
|
+
require 'ads_common/savon_service'
|
9
|
+
require 'dfp_api/v201101/company_service_registry'
|
10
|
+
|
11
|
+
module DfpApi; module V201101; module CompanyService
|
12
|
+
class CompanyService < AdsCommon::SavonService
|
13
|
+
def initialize(endpoint)
|
14
|
+
namespace = 'https://www.google.com/apis/ads/publisher/v201101'
|
15
|
+
super(endpoint, namespace)
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_companies_by_statement(*args)
|
19
|
+
return execute_action('get_companies_by_statement', args)
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_company(*args)
|
23
|
+
return execute_action('get_company', args)
|
24
|
+
end
|
25
|
+
|
26
|
+
def update_companies(*args)
|
27
|
+
return execute_action('update_companies', args)
|
28
|
+
end
|
29
|
+
|
30
|
+
def update_company(*args)
|
31
|
+
return execute_action('update_company', args)
|
32
|
+
end
|
33
|
+
|
34
|
+
def create_companies(*args)
|
35
|
+
return execute_action('create_companies', args)
|
36
|
+
end
|
37
|
+
|
38
|
+
def create_company(*args)
|
39
|
+
return execute_action('create_company', args)
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def get_service_registry()
|
45
|
+
return CompanyServiceRegistry
|
46
|
+
end
|
47
|
+
|
48
|
+
def get_module()
|
49
|
+
return DfpApi::V201101::CompanyService
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end; end; end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# This is auto-generated code, changes will be overwritten.
|
3
|
+
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
|
4
|
+
# License:: Licensed under the Apache License,Version 2.0 (the "License").
|
5
|
+
#
|
6
|
+
# Code generated by AdsCommon library 0.3.0 on 2011-06-09 13:32:18.
|
7
|
+
|
8
|
+
module DfpApi; module V201101; module CompanyService
|
9
|
+
class CompanyServiceRegistry
|
10
|
+
COMPANYSERVICE_METHODS = {:get_companies_by_statement=>{:output=>{:fields=>[{:type=>"CompanyPage", :min_occurs=>0, :name=>:rval, :max_occurs=>1}], :name=>"get_companies_by_statement_response"}, :input=>[{:type=>"Statement", :min_occurs=>0, :name=>:filter_statement, :max_occurs=>1}]}, :get_company=>{:output=>{:fields=>[{:type=>"Company", :min_occurs=>0, :name=>:rval, :max_occurs=>1}], :name=>"get_company_response"}, :input=>[{:type=>"long", :min_occurs=>0, :name=>:company_id, :max_occurs=>1}]}, :update_companies=>{:output=>{:fields=>[{:type=>"Company", :min_occurs=>0, :name=>:rval, :max_occurs=>nil}], :name=>"update_companies_response"}, :input=>[{:type=>"Company", :min_occurs=>0, :name=>:companies, :max_occurs=>nil}]}, :update_company=>{:output=>{:fields=>[{:type=>"Company", :min_occurs=>0, :name=>:rval, :max_occurs=>1}], :name=>"update_company_response"}, :input=>[{:type=>"Company", :min_occurs=>0, :name=>:company, :max_occurs=>1}]}, :create_companies=>{:output=>{:fields=>[{:type=>"Company", :min_occurs=>0, :name=>:rval, :max_occurs=>nil}], :name=>"create_companies_response"}, :input=>[{:type=>"Company", :min_occurs=>0, :name=>:companies, :max_occurs=>nil}]}, :create_company=>{:output=>{:fields=>[{:type=>"Company", :min_occurs=>0, :name=>:rval, :max_occurs=>1}], :name=>"create_company_response"}, :input=>[{:type=>"Company", :min_occurs=>0, :name=>:company, :max_occurs=>1}]}}
|
11
|
+
COMPANYSERVICE_TYPES = {:SoapRequestHeader=>{:fields=>[{:type=>"string", :min_occurs=>0, :name=>:auth_token, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:network_code, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:application_name, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:o_auth_token, :max_occurs=>1}]}, :BooleanValue=>{:base=>"Value", :fields=>[{:type=>"boolean", :min_occurs=>0, :name=>:value, :max_occurs=>1}]}, :TextValue=>{:base=>"Value", :fields=>[{:type=>"string", :min_occurs=>0, :name=>:value, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:type=>"string", :min_occurs=>0, :name=>:request_id, :max_occurs=>1}, {:type=>"long", :min_occurs=>0, :name=>:response_time, :max_occurs=>1}]}, :Value=>{:fields=>[{:type=>"string", :min_occurs=>0, :name=>:value_type, :max_occurs=>1}], :abstract=>true}, :Statement=>{:fields=>[{:type=>"string", :min_occurs=>0, :name=>:query, :max_occurs=>1}, {:type=>"String_ValueMapEntry", :min_occurs=>0, :name=>:values, :max_occurs=>nil}]}, :Company=>{:fields=>[{:type=>"long", :min_occurs=>0, :name=>:id, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:name, :max_occurs=>1}, {:type=>"Company.Type", :min_occurs=>0, :name=>:type, :max_occurs=>1}]}, :String_ValueMapEntry=>{:fields=>[{:type=>"string", :min_occurs=>0, :name=>:key, :max_occurs=>1}, {:type=>"Value", :min_occurs=>0, :name=>:value, :max_occurs=>1}]}, :CompanyPage=>{:fields=>[{:type=>"int", :min_occurs=>0, :name=>:total_result_set_size, :max_occurs=>1}, {:type=>"int", :min_occurs=>0, :name=>:start_index, :max_occurs=>1}, {:type=>"Company", :min_occurs=>0, :name=>:results, :max_occurs=>nil}]}, :NumberValue=>{:base=>"Value", :fields=>[{:type=>"string", :min_occurs=>0, :name=>:value, :max_occurs=>1}]}}
|
12
|
+
|
13
|
+
def self.get_method_signature(method_name)
|
14
|
+
return COMPANYSERVICE_METHODS[method_name.to_sym]
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.get_type_signature(type_name)
|
18
|
+
return COMPANYSERVICE_TYPES[type_name.to_sym]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Base class for exceptions.
|
23
|
+
class ApplicationException < DfpApi::Errors::ApiException
|
24
|
+
attr_reader :message # string
|
25
|
+
attr_reader :application_exception_type # string
|
26
|
+
end
|
27
|
+
|
28
|
+
# Exception class for holding a list of service errors.
|
29
|
+
class ApiException < ApplicationException
|
30
|
+
attr_reader :errors # ApiError
|
31
|
+
def initialize(exception_fault)
|
32
|
+
@array_fields = [] if !defined?(@array_fields)
|
33
|
+
@array_fields << 'errors'
|
34
|
+
super(exception_fault)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end; end; end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# This is auto-generated code, changes will be overwritten.
|
3
|
+
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
|
4
|
+
# License:: Licensed under the Apache License,Version 2.0 (the "License").
|
5
|
+
#
|
6
|
+
# Code generated by AdsCommon library 0.3.0 on 2011-06-09 13:32:44.
|
7
|
+
|
8
|
+
require 'ads_common/savon_service'
|
9
|
+
require 'dfp_api/v201101/creative_service_registry'
|
10
|
+
|
11
|
+
module DfpApi; module V201101; module CreativeService
|
12
|
+
class CreativeService < AdsCommon::SavonService
|
13
|
+
def initialize(endpoint)
|
14
|
+
namespace = 'https://www.google.com/apis/ads/publisher/v201101'
|
15
|
+
super(endpoint, namespace)
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_creatives_by_statement(*args)
|
19
|
+
return execute_action('get_creatives_by_statement', args)
|
20
|
+
end
|
21
|
+
|
22
|
+
def update_creative(*args)
|
23
|
+
return execute_action('update_creative', args)
|
24
|
+
end
|
25
|
+
|
26
|
+
def update_creatives(*args)
|
27
|
+
return execute_action('update_creatives', args)
|
28
|
+
end
|
29
|
+
|
30
|
+
def create_creative(*args)
|
31
|
+
return execute_action('create_creative', args)
|
32
|
+
end
|
33
|
+
|
34
|
+
def create_creatives(*args)
|
35
|
+
return execute_action('create_creatives', args)
|
36
|
+
end
|
37
|
+
|
38
|
+
def get_creative(*args)
|
39
|
+
return execute_action('get_creative', args)
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def get_service_registry()
|
45
|
+
return CreativeServiceRegistry
|
46
|
+
end
|
47
|
+
|
48
|
+
def get_module()
|
49
|
+
return DfpApi::V201101::CreativeService
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end; end; end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# This is auto-generated code, changes will be overwritten.
|
3
|
+
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
|
4
|
+
# License:: Licensed under the Apache License,Version 2.0 (the "License").
|
5
|
+
#
|
6
|
+
# Code generated by AdsCommon library 0.3.0 on 2011-06-09 13:32:44.
|
7
|
+
|
8
|
+
module DfpApi; module V201101; module CreativeService
|
9
|
+
class CreativeServiceRegistry
|
10
|
+
CREATIVESERVICE_METHODS = {:get_creatives_by_statement=>{:output=>{:fields=>[{:type=>"CreativePage", :min_occurs=>0, :name=>:rval, :max_occurs=>1}], :name=>"get_creatives_by_statement_response"}, :input=>[{:type=>"Statement", :min_occurs=>0, :name=>:filter_statement, :max_occurs=>1}]}, :update_creative=>{:output=>{:fields=>[{:type=>"Creative", :min_occurs=>0, :name=>:rval, :max_occurs=>1}], :name=>"update_creative_response"}, :input=>[{:type=>"Creative", :min_occurs=>0, :name=>:creative, :max_occurs=>1}]}, :update_creatives=>{:output=>{:fields=>[{:type=>"Creative", :min_occurs=>0, :name=>:rval, :max_occurs=>nil}], :name=>"update_creatives_response"}, :input=>[{:type=>"Creative", :min_occurs=>0, :name=>:creatives, :max_occurs=>nil}]}, :create_creative=>{:output=>{:fields=>[{:type=>"Creative", :min_occurs=>0, :name=>:rval, :max_occurs=>1}], :name=>"create_creative_response"}, :input=>[{:type=>"Creative", :min_occurs=>0, :name=>:creative, :max_occurs=>1}]}, :create_creatives=>{:output=>{:fields=>[{:type=>"Creative", :min_occurs=>0, :name=>:rval, :max_occurs=>nil}], :name=>"create_creatives_response"}, :input=>[{:type=>"Creative", :min_occurs=>0, :name=>:creatives, :max_occurs=>nil}]}, :get_creative=>{:output=>{:fields=>[{:type=>"Creative", :min_occurs=>0, :name=>:rval, :max_occurs=>1}], :name=>"get_creative_response"}, :input=>[{:type=>"long", :min_occurs=>0, :name=>:creative_id, :max_occurs=>1}]}}
|
11
|
+
CREATIVESERVICE_TYPES = {:SoapRequestHeader=>{:fields=>[{:type=>"string", :min_occurs=>0, :name=>:auth_token, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:network_code, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:application_name, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:o_auth_token, :max_occurs=>1}]}, :BooleanValue=>{:base=>"Value", :fields=>[{:type=>"boolean", :min_occurs=>0, :name=>:value, :max_occurs=>1}]}, :BaseFlashRedirectCreative=>{:base=>"HasDestinationUrlCreative", :fields=>[{:type=>"string", :min_occurs=>0, :name=>:flash_url, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:fallback_url, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:fallback_preview_url, :max_occurs=>1}], :abstract=>true}, :TextValue=>{:base=>"Value", :fields=>[{:type=>"string", :min_occurs=>0, :name=>:value, :max_occurs=>1}]}, :ImageCreative=>{:base=>"HasDestinationUrlCreative", :fields=>[{:type=>"string", :min_occurs=>0, :name=>:image_name, :max_occurs=>1}, {:type=>"base64Binary", :min_occurs=>0, :name=>:image_byte_array, :max_occurs=>1}, {:type=>"boolean", :min_occurs=>0, :name=>:override_size, :max_occurs=>1}, {:type=>"Size", :min_occurs=>0, :name=>:asset_size, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:image_url, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:type=>"string", :min_occurs=>0, :name=>:request_id, :max_occurs=>1}, {:type=>"long", :min_occurs=>0, :name=>:response_time, :max_occurs=>1}]}, :Creative=>{:fields=>[{:type=>"long", :min_occurs=>0, :name=>:advertiser_id, :max_occurs=>1}, {:type=>"long", :min_occurs=>0, :name=>:id, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:name, :max_occurs=>1}, {:type=>"Size", :min_occurs=>0, :name=>:size, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:preview_url, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:creative_type, :max_occurs=>1}], :abstract=>true}, :Value=>{:fields=>[{:type=>"string", :min_occurs=>0, :name=>:value_type, :max_occurs=>1}], :abstract=>true}, :Size=>{:fields=>[{:type=>"int", :min_occurs=>0, :name=>:width, :max_occurs=>1}, {:type=>"int", :min_occurs=>0, :name=>:height, :max_occurs=>1}, {:type=>"boolean", :min_occurs=>0, :name=>:is_aspect_ratio, :max_occurs=>1}]}, :ImageRedirectCreative=>{:base=>"HasDestinationUrlCreative", :fields=>[{:type=>"string", :min_occurs=>0, :name=>:image_url, :max_occurs=>1}]}, :Statement=>{:fields=>[{:type=>"string", :min_occurs=>0, :name=>:query, :max_occurs=>1}, {:type=>"String_ValueMapEntry", :min_occurs=>0, :name=>:values, :max_occurs=>nil}]}, :CreativePage=>{:fields=>[{:type=>"int", :min_occurs=>0, :name=>:total_result_set_size, :max_occurs=>1}, {:type=>"int", :min_occurs=>0, :name=>:start_index, :max_occurs=>1}, {:type=>"Creative", :min_occurs=>0, :name=>:results, :max_occurs=>nil}]}, :ThirdPartyCreative=>{:base=>"Creative", :fields=>[{:type=>"string", :min_occurs=>0, :name=>:snippet, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:expanded_snippet, :max_occurs=>1}, {:type=>"ThirdPartyCreative.FormatStatus", :min_occurs=>0, :name=>:format_status, :max_occurs=>1}]}, :String_ValueMapEntry=>{:fields=>[{:type=>"string", :min_occurs=>0, :name=>:key, :max_occurs=>1}, {:type=>"Value", :min_occurs=>0, :name=>:value, :max_occurs=>1}]}, :NumberValue=>{:base=>"Value", :fields=>[{:type=>"string", :min_occurs=>0, :name=>:value, :max_occurs=>1}]}, :FlashCreative=>{:base=>"HasDestinationUrlCreative", :fields=>[{:type=>"string", :min_occurs=>0, :name=>:flash_name, :max_occurs=>1}, {:type=>"base64Binary", :min_occurs=>0, :name=>:flash_byte_array, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:fallback_image_name, :max_occurs=>1}, {:type=>"base64Binary", :min_occurs=>0, :name=>:fallback_image_byte_array, :max_occurs=>1}, {:type=>"boolean", :min_occurs=>0, :name=>:override_size, :max_occurs=>1}, {:type=>"boolean", :min_occurs=>0, :name=>:click_tag_required, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:fallback_preview_url, :max_occurs=>1}, {:type=>"Size", :min_occurs=>0, :name=>:flash_asset_size, :max_occurs=>1}, {:type=>"Size", :min_occurs=>0, :name=>:fallback_asset_size, :max_occurs=>1}]}, :FlashRedirectCreative=>{:base=>"BaseFlashRedirectCreative", :fields=>[]}, :HasDestinationUrlCreative=>{:base=>"Creative", :fields=>[{:type=>"string", :min_occurs=>0, :name=>:destination_url, :max_occurs=>1}], :abstract=>true}}
|
12
|
+
|
13
|
+
def self.get_method_signature(method_name)
|
14
|
+
return CREATIVESERVICE_METHODS[method_name.to_sym]
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.get_type_signature(type_name)
|
18
|
+
return CREATIVESERVICE_TYPES[type_name.to_sym]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Base class for exceptions.
|
23
|
+
class ApplicationException < DfpApi::Errors::ApiException
|
24
|
+
attr_reader :message # string
|
25
|
+
attr_reader :application_exception_type # string
|
26
|
+
end
|
27
|
+
|
28
|
+
# Exception class for holding a list of service errors.
|
29
|
+
class ApiException < ApplicationException
|
30
|
+
attr_reader :errors # ApiError
|
31
|
+
def initialize(exception_fault)
|
32
|
+
@array_fields = [] if !defined?(@array_fields)
|
33
|
+
@array_fields << 'errors'
|
34
|
+
super(exception_fault)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end; end; end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# This is auto-generated code, changes will be overwritten.
|
3
|
+
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
|
4
|
+
# License:: Licensed under the Apache License,Version 2.0 (the "License").
|
5
|
+
#
|
6
|
+
# Code generated by AdsCommon library 0.3.0 on 2011-06-09 13:32:09.
|
7
|
+
|
8
|
+
require 'ads_common/savon_service'
|
9
|
+
require 'dfp_api/v201101/custom_targeting_service_registry'
|
10
|
+
|
11
|
+
module DfpApi; module V201101; module CustomTargetingService
|
12
|
+
class CustomTargetingService < AdsCommon::SavonService
|
13
|
+
def initialize(endpoint)
|
14
|
+
namespace = 'https://www.google.com/apis/ads/publisher/v201101'
|
15
|
+
super(endpoint, namespace)
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_custom_targeting_values_by_statement(*args)
|
19
|
+
return execute_action('get_custom_targeting_values_by_statement', args)
|
20
|
+
end
|
21
|
+
|
22
|
+
def perform_custom_targeting_key_action(*args)
|
23
|
+
return execute_action('perform_custom_targeting_key_action', args)
|
24
|
+
end
|
25
|
+
|
26
|
+
def perform_custom_targeting_value_action(*args)
|
27
|
+
return execute_action('perform_custom_targeting_value_action', args)
|
28
|
+
end
|
29
|
+
|
30
|
+
def create_custom_targeting_keys(*args)
|
31
|
+
return execute_action('create_custom_targeting_keys', args)
|
32
|
+
end
|
33
|
+
|
34
|
+
def update_custom_targeting_keys(*args)
|
35
|
+
return execute_action('update_custom_targeting_keys', args)
|
36
|
+
end
|
37
|
+
|
38
|
+
def create_custom_targeting_values(*args)
|
39
|
+
return execute_action('create_custom_targeting_values', args)
|
40
|
+
end
|
41
|
+
|
42
|
+
def update_custom_targeting_values(*args)
|
43
|
+
return execute_action('update_custom_targeting_values', args)
|
44
|
+
end
|
45
|
+
|
46
|
+
def get_custom_targeting_keys_by_statement(*args)
|
47
|
+
return execute_action('get_custom_targeting_keys_by_statement', args)
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def get_service_registry()
|
53
|
+
return CustomTargetingServiceRegistry
|
54
|
+
end
|
55
|
+
|
56
|
+
def get_module()
|
57
|
+
return DfpApi::V201101::CustomTargetingService
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end; end; end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# This is auto-generated code, changes will be overwritten.
|
3
|
+
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
|
4
|
+
# License:: Licensed under the Apache License,Version 2.0 (the "License").
|
5
|
+
#
|
6
|
+
# Code generated by AdsCommon library 0.3.0 on 2011-06-09 13:32:09.
|
7
|
+
|
8
|
+
module DfpApi; module V201101; module CustomTargetingService
|
9
|
+
class CustomTargetingServiceRegistry
|
10
|
+
CUSTOMTARGETINGSERVICE_METHODS = {:get_custom_targeting_values_by_statement=>{:output=>{:fields=>[{:type=>"CustomTargetingValuePage", :min_occurs=>0, :name=>:rval, :max_occurs=>1}], :name=>"get_custom_targeting_values_by_statement_response"}, :input=>[{:type=>"Statement", :min_occurs=>0, :name=>:filter_statement, :max_occurs=>1}]}, :perform_custom_targeting_key_action=>{:output=>{:fields=>[{:type=>"UpdateResult", :min_occurs=>0, :name=>:rval, :max_occurs=>1}], :name=>"perform_custom_targeting_key_action_response"}, :input=>[{:type=>"CustomTargetingKeyAction", :min_occurs=>0, :name=>:custom_targeting_key_action, :max_occurs=>1}, {:type=>"Statement", :min_occurs=>0, :name=>:filter_statement, :max_occurs=>1}]}, :perform_custom_targeting_value_action=>{:output=>{:fields=>[{:type=>"UpdateResult", :min_occurs=>0, :name=>:rval, :max_occurs=>1}], :name=>"perform_custom_targeting_value_action_response"}, :input=>[{:type=>"CustomTargetingValueAction", :min_occurs=>0, :name=>:custom_targeting_value_action, :max_occurs=>1}, {:type=>"Statement", :min_occurs=>0, :name=>:filter_statement, :max_occurs=>1}]}, :create_custom_targeting_keys=>{:output=>{:fields=>[{:type=>"CustomTargetingKey", :min_occurs=>0, :name=>:rval, :max_occurs=>nil}], :name=>"create_custom_targeting_keys_response"}, :input=>[{:type=>"CustomTargetingKey", :min_occurs=>0, :name=>:keys, :max_occurs=>nil}]}, :update_custom_targeting_keys=>{:output=>{:fields=>[{:type=>"CustomTargetingKey", :min_occurs=>0, :name=>:rval, :max_occurs=>nil}], :name=>"update_custom_targeting_keys_response"}, :input=>[{:type=>"CustomTargetingKey", :min_occurs=>0, :name=>:keys, :max_occurs=>nil}]}, :create_custom_targeting_values=>{:output=>{:fields=>[{:type=>"CustomTargetingValue", :min_occurs=>0, :name=>:rval, :max_occurs=>nil}], :name=>"create_custom_targeting_values_response"}, :input=>[{:type=>"CustomTargetingValue", :min_occurs=>0, :name=>:values, :max_occurs=>nil}]}, :update_custom_targeting_values=>{:output=>{:fields=>[{:type=>"CustomTargetingValue", :min_occurs=>0, :name=>:rval, :max_occurs=>nil}], :name=>"update_custom_targeting_values_response"}, :input=>[{:type=>"CustomTargetingValue", :min_occurs=>0, :name=>:values, :max_occurs=>nil}]}, :get_custom_targeting_keys_by_statement=>{:output=>{:fields=>[{:type=>"CustomTargetingKeyPage", :min_occurs=>0, :name=>:rval, :max_occurs=>1}], :name=>"get_custom_targeting_keys_by_statement_response"}, :input=>[{:type=>"Statement", :min_occurs=>0, :name=>:filter_statement, :max_occurs=>1}]}}
|
11
|
+
CUSTOMTARGETINGSERVICE_TYPES = {:SoapRequestHeader=>{:fields=>[{:type=>"string", :min_occurs=>0, :name=>:auth_token, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:network_code, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:application_name, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:o_auth_token, :max_occurs=>1}]}, :CustomTargetingValueAction=>{:fields=>[{:type=>"string", :min_occurs=>0, :name=>:custom_targeting_value_action_type, :max_occurs=>1}], :abstract=>true}, :BooleanValue=>{:base=>"Value", :fields=>[{:type=>"boolean", :min_occurs=>0, :name=>:value, :max_occurs=>1}]}, :TextValue=>{:base=>"Value", :fields=>[{:type=>"string", :min_occurs=>0, :name=>:value, :max_occurs=>1}]}, :DeleteCustomTargetingKeyAction=>{:base=>"DeleteCustomTargetingKeys", :fields=>[]}, :SoapResponseHeader=>{:fields=>[{:type=>"string", :min_occurs=>0, :name=>:request_id, :max_occurs=>1}, {:type=>"long", :min_occurs=>0, :name=>:response_time, :max_occurs=>1}]}, :Value=>{:fields=>[{:type=>"string", :min_occurs=>0, :name=>:value_type, :max_occurs=>1}], :abstract=>true}, :DeleteCustomTargetingKeys=>{:base=>"CustomTargetingKeyAction", :fields=>[]}, :Statement=>{:fields=>[{:type=>"string", :min_occurs=>0, :name=>:query, :max_occurs=>1}, {:type=>"String_ValueMapEntry", :min_occurs=>0, :name=>:values, :max_occurs=>nil}]}, :CustomTargetingKey=>{:fields=>[{:type=>"long", :min_occurs=>0, :name=>:id, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:name, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:display_name, :max_occurs=>1}, {:type=>"CustomTargetingKey.Type", :min_occurs=>0, :name=>:type, :max_occurs=>1}]}, :UpdateResult=>{:fields=>[{:type=>"int", :min_occurs=>0, :name=>:num_changes, :max_occurs=>1}]}, :DeleteCustomTargetingValueAction=>{:base=>"DeleteCustomTargetingValues", :fields=>[]}, :String_ValueMapEntry=>{:fields=>[{:type=>"string", :min_occurs=>0, :name=>:key, :max_occurs=>1}, {:type=>"Value", :min_occurs=>0, :name=>:value, :max_occurs=>1}]}, :NumberValue=>{:base=>"Value", :fields=>[{:type=>"string", :min_occurs=>0, :name=>:value, :max_occurs=>1}]}, :CustomTargetingKeyPage=>{:fields=>[{:type=>"int", :min_occurs=>0, :name=>:total_result_set_size, :max_occurs=>1}, {:type=>"int", :min_occurs=>0, :name=>:start_index, :max_occurs=>1}, {:type=>"CustomTargetingKey", :min_occurs=>0, :name=>:results, :max_occurs=>nil}]}, :DeleteCustomTargetingValues=>{:base=>"CustomTargetingValueAction", :fields=>[]}, :CustomTargetingValue=>{:fields=>[{:type=>"long", :min_occurs=>0, :name=>:custom_targeting_key_id, :max_occurs=>1}, {:type=>"long", :min_occurs=>0, :name=>:id, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:name, :max_occurs=>1}, {:type=>"string", :min_occurs=>0, :name=>:display_name, :max_occurs=>1}, {:type=>"CustomTargetingValue.MatchType", :min_occurs=>0, :name=>:match_type, :max_occurs=>1}]}, :CustomTargetingKeyAction=>{:fields=>[{:type=>"string", :min_occurs=>0, :name=>:custom_targeting_key_action_type, :max_occurs=>1}], :abstract=>true}, :CustomTargetingValuePage=>{:fields=>[{:type=>"int", :min_occurs=>0, :name=>:total_result_set_size, :max_occurs=>1}, {:type=>"int", :min_occurs=>0, :name=>:start_index, :max_occurs=>1}, {:type=>"CustomTargetingValue", :min_occurs=>0, :name=>:results, :max_occurs=>nil}]}}
|
12
|
+
|
13
|
+
def self.get_method_signature(method_name)
|
14
|
+
return CUSTOMTARGETINGSERVICE_METHODS[method_name.to_sym]
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.get_type_signature(type_name)
|
18
|
+
return CUSTOMTARGETINGSERVICE_TYPES[type_name.to_sym]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Base class for exceptions.
|
23
|
+
class ApplicationException < DfpApi::Errors::ApiException
|
24
|
+
attr_reader :message # string
|
25
|
+
attr_reader :application_exception_type # string
|
26
|
+
end
|
27
|
+
|
28
|
+
# Exception class for holding a list of service errors.
|
29
|
+
class ApiException < ApplicationException
|
30
|
+
attr_reader :errors # ApiError
|
31
|
+
def initialize(exception_fault)
|
32
|
+
@array_fields = [] if !defined?(@array_fields)
|
33
|
+
@array_fields << 'errors'
|
34
|
+
super(exception_fault)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end; end; end
|