diff --git a/dfp_api/ChangeLog b/dfp_api/ChangeLog index 3737b2db3..82cd577b4 100644 --- a/dfp_api/ChangeLog +++ b/dfp_api/ChangeLog @@ -1,4 +1,6 @@ 0.7.1: + - Added support and examples for v201311. + - Require google-ads-common 0.9.4 or later from now on. 0.7.0: - Added support and examples for v201308. diff --git a/dfp_api/README b/dfp_api/README index 5752f0dab..606594be0 100644 --- a/dfp_api/README +++ b/dfp_api/README @@ -116,7 +116,7 @@ Once the library object is created you can request services with a 'service' method: user_service = dfp.service(:UserService, ) -where is required version of DFP API as symbol, e.g. :v201308. +where is required version of DFP API as symbol, e.g. :v201311. Then you should be able to execute service methods: @@ -150,7 +150,7 @@ Examples can be run by executing by running: from the "examples//" directory i.e. - $ cd examples/v201308/user_service + $ cd examples/v201311/user_service $ ruby get_all_users.rb Some examples require modification to be functional, like create_order example diff --git a/dfp_api/examples/v201311/activity_group_service/create_activity_groups.rb b/dfp_api/examples/v201311/activity_group_service/create_activity_groups.rb new file mode 100755 index 000000000..dfe7a1888 --- /dev/null +++ b/dfp_api/examples/v201311/activity_group_service/create_activity_groups.rb @@ -0,0 +1,94 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.davidtorres@gmail.com (David Torres) +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates new activity groups. To determine which activity groups +# exist, run get_all_activity_groups.rb. +# +# Tags: ActivityGroupService.createActivityGroups + +require 'dfp_api' + +API_VERSION = :v201311 + +def create_activity_groups() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the ActivityGroupService. + activity_group_service = dfp.service(:ActivityGroupService, API_VERSION) + + # Set the ID of the advertiser company this activity group is associated + # with. + advertiser_company_id = 'INSERT_ADVERTISER_COMPANY_ID_HERE'; + + # Create a short-term activity group. + short_term_activity_group = { + :name => 'Short-term activity group', + :company_ids => [advertiser_company_id], + :clicks_lookback => 1, + :impressions_lookback => 1 + } + + # Create a long-term activity group. + long_term_activity_group = { + :name => 'Long-term activity group', + :company_ids => [advertiser_company_id], + :clicks_lookback => 30, + :impressions_lookback => 30 + } + + # Create the activity groups on the server. + return_activity_groups = activity_group_service.create_activity_groups([ + short_term_activity_group, long_term_activity_group]) + + if return_activity_groups + return_activity_groups.each do |activity_group| + puts "An activity group with ID: %d and name: %s was created." % + [activity_group[:id], activity_group[:name]] + end + else + raise 'No activity groups were created.' + end +end + +if __FILE__ == $0 + begin + create_activity_groups() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/activity_group_service/get_active_activity_groups.rb b/dfp_api/examples/v201311/activity_group_service/get_active_activity_groups.rb new file mode 100755 index 000000000..0b5630425 --- /dev/null +++ b/dfp_api/examples/v201311/activity_group_service/get_active_activity_groups.rb @@ -0,0 +1,100 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.davidtorres@gmail.com (David Torres) +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all active activity groups. To create activity groups, +# run create_activity_groups.rb. +# +# Tags: ActivityGroupService.getActivityGroupsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_active_activity_groups() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the ActivityGroupService. + activity_group_service = dfp.service(:ActivityGroupService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create statement for one page with current offset. + statement = { + :query => 'WHERE status = :status ORDER BY id LIMIT %d OFFSET %d' % + [PAGE_SIZE, offset], + :values => [ + {:key => 'status', + :value => {:value => 'ACTIVE', :xsi_type => 'TextValue'}} + ] + } + + # Get activity groups by statement. + page = activity_group_service.get_activity_groups_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each content object in results page. + page[:results].each_with_index do |activity_group, index| + puts "%d) Activity group with ID: %d, name: %s." % [index + start_index, + activity_group[:id], activity_group[:name]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer + if page.include?(:total_result_set_size) + puts "Total number of results: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_active_activity_groups() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/activity_group_service/get_all_activity_groups.rb b/dfp_api/examples/v201311/activity_group_service/get_all_activity_groups.rb new file mode 100755 index 000000000..63ab1206b --- /dev/null +++ b/dfp_api/examples/v201311/activity_group_service/get_all_activity_groups.rb @@ -0,0 +1,95 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.davidtorres@gmail.com (David Torres) +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all activity groups. To create activity groups, +# run create_activity_groups.rb. +# +# Tags: ActivityGroupService.getActivityGroupsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_activity_groups() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the ActivityGroupService. + activity_group_service = dfp.service(:ActivityGroupService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create statement for one page with current offset. + statement = { + :query => 'ORDER BY id LIMIT %d OFFSET %d' % [PAGE_SIZE, offset], + } + + # Get activity groups by statement. + page = activity_group_service.get_activity_groups_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each content object in results page. + page[:results].each_with_index do |activity_group, index| + puts "%d) Activity group with ID: %d, name: %s." % [index + start_index, + activity_group[:id], activity_group[:name]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer + if page.include?(:total_result_set_size) + puts "Total number of results: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_activity_groups() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/activity_group_service/update_activity_groups.rb b/dfp_api/examples/v201311/activity_group_service/update_activity_groups.rb new file mode 100755 index 000000000..541f42d7b --- /dev/null +++ b/dfp_api/examples/v201311/activity_group_service/update_activity_groups.rb @@ -0,0 +1,87 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.davidtorres@gmail.com (David Torres) +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example updates activity groups by adding a company. To determine which +# activity groups exist, run get_all_activity_groups.rb. +# +# Tags: ActivityGroupService.getActivityGroup +# Tags: ActivityGroupService.updateActivityGroups + +require 'dfp_api' + +API_VERSION = :v201311 + +def update_activity_groups() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the ActivityGroupService. + activity_group_service = dfp.service(:ActivityGroupService, API_VERSION) + + # Set the ID of the activity group and the company to update it with. + activity_group_id = 'INSERT_ACTIVITY_GROUP_ID_HERE' + advertiser_company_id = 'INSERT_ADVERTISER_COMPANY_ID_HERE' + + # Get the activity group. + activity_group = activity_group_service.get_activity_group(activity_group_id) + + # Update the companies. + activity_group[:company_ids] << advertiser_company_id + + # Update the activity groups on the server. + return_activity_groups = activity_group_service.update_activity_groups([ + activity_group]) + + # Display results. + if return_activity_groups + return_activity_groups.each do |updates_activity_group| + puts "Activity group with ID: %d and name: %s was updated." % + [updates_activity_group[:id], updates_activity_group[:name]] + end + else + raise 'No activity groups were updated.' + end + +end + +if __FILE__ == $0 + begin + update_activity_groups() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/activity_service/create_activities.rb b/dfp_api/examples/v201311/activity_service/create_activities.rb new file mode 100755 index 000000000..c644bc549 --- /dev/null +++ b/dfp_api/examples/v201311/activity_service/create_activities.rb @@ -0,0 +1,91 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.davidtorres@gmail.com (David Torres) +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates new activities. To determine which activities exist, run +# get_all_activities.php. +# +# Tags: ActivityService.createActivities + +require 'dfp_api' + +API_VERSION = :v201311 + +def create_activities() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the ActivityService. + activity_service = dfp.service(:ActivityService, API_VERSION) + + # Set the ID of the activity group this activity is associated with. + activity_group_id = 'INSERT_ACTIVITY_GROUP_ID_HERE'; + + # Create a daily visits activity. + daily_visits_activity = { + :name => 'Activity', + :activity_group_id => activity_group_id, + :type => 'DAILY_VISITS' + } + + # Create a custom activity. + custom_activity = { + :name => 'Activity', + :activity_group_id => activity_group_id, + :type => 'CUSTOM' + } + + # Create the activities on the server. + return_activities = activity_service.create_activities([ + daily_visits_activity, custom_activity]) + + if return_activities + return_activities.each do |activity| + puts "An activity with ID: %d, name: %s and type: %s was created." % + [activity[:id], activity[:name], activity[:type]] + end + else + raise 'No activities were created.' + end +end + +if __FILE__ == $0 + begin + create_activities() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/activity_service/get_active_activities.rb b/dfp_api/examples/v201311/activity_service/get_active_activities.rb new file mode 100755 index 000000000..385e9519f --- /dev/null +++ b/dfp_api/examples/v201311/activity_service/get_active_activities.rb @@ -0,0 +1,103 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.davidtorres@gmail.com (David Torres) +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all active activities. To create activities, +# run create_activities.rb. +# +# Tags: ActivityService.getActivitiesByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_active_activities() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the ActivityService. + activity_service = dfp.service(:ActivityService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create statement for one page with current offset. + statement = { + :query => 'WHERE status = :status ORDER BY id LIMIT %d OFFSET %d' % + [PAGE_SIZE, offset], + :values => [ + { + :key => 'status', + :value => {:value => 'ACTIVE', :xsi_type => 'TextValue'} + } + ] + } + + # Get activities by statement. + page = activity_service.get_activities_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each content object in results page. + page[:results].each_with_index do |activity, index| + puts "%d) Activity with ID: %d, name: %s, type: %s." % + [index + start_index, activity[:id], activity[:name], + activity[:type]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer + if page.include?(:total_result_set_size) + puts "Total number of results: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_active_activities() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/activity_service/get_all_activities.rb b/dfp_api/examples/v201311/activity_service/get_all_activities.rb new file mode 100755 index 000000000..c4055512b --- /dev/null +++ b/dfp_api/examples/v201311/activity_service/get_all_activities.rb @@ -0,0 +1,96 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.davidtorres@gmail.com (David Torres) +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all activities. To create activities, +# run create_activities.rb. +# +# Tags: ActivityService.getActivitiesByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_activities() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the ActivityService. + activity_service = dfp.service(:ActivityService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Update statement for one page with current offset. + statement = { + :query => 'ORDER BY id LIMIT %d OFFSET %d' % [PAGE_SIZE, offset] + } + + # Get activities by statement. + page = activity_service.get_activities_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each content object in results page. + page[:results].each_with_index do |activity, index| + puts "%d) Activity with ID: %d, name: %s, type: %s." % + [index + start_index, activity[:id], activity[:name], + activity[:type]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Total number of results: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_activities() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/activity_service/update_activities.rb b/dfp_api/examples/v201311/activity_service/update_activities.rb new file mode 100755 index 000000000..3c132a6c8 --- /dev/null +++ b/dfp_api/examples/v201311/activity_service/update_activities.rb @@ -0,0 +1,85 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.davidtorres@gmail.com (David Torres) +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example updates activity expected URLs. To determine which activities +# exist, run get_all_activities.rb. +# +# Tags: ActivityService.getActivity +# Tags: ActivityService.updateActivities + +require 'dfp_api' + +API_VERSION = :v201311 + +def update_activities() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the ActivityService. + activity_service = dfp.service(:ActivityService, API_VERSION) + + # Set the ID of the activity to update. + activity_id = 'INSERT_ACTIVITY_ID_HERE' + + # Get the activity. + activity = activity_service.get_activity(activity_id) + + # Update the expected URL. + activity[:expected_url] = 'https://www.google.com' + + # Update the activity on the server. + return_activities = activity_service.update_activities([activity]) + + # Display results. + if return_activities + return_activities.each do |updated_activity| + puts "Activity with ID: %d and name: %s was updated." % + [updated_activity[:id], updated_activity[:name]] + end + else + raise 'No activities were updated.' + end + +end + +if __FILE__ == $0 + begin + update_activities() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/audience_segment_service/create_audience_segments.rb b/dfp_api/examples/v201311/audience_segment_service/create_audience_segments.rb new file mode 100755 index 000000000..dd926c737 --- /dev/null +++ b/dfp_api/examples/v201311/audience_segment_service/create_audience_segments.rb @@ -0,0 +1,118 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates new rule based first party audience segments. To +# determine which audience segments exist, run get_all_audience_segments.rb. +# +# Tags: AudienceSegmentService.createAudienceSegments + +require 'dfp_api' + +API_VERSION = :v201311 + +def create_audience_segments(custom_targeting_key_id, custom_targeting_value_id) + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the AudienceSegmentService. + audience_segment_service = dfp.service(:AudienceSegmentService, API_VERSION) + + # Get the NetworkService. + network_service = dfp.service(:NetworkService, API_VERSION) + + # Get the root ad unit ID used to target the whole site. + effective_root_ad_unit_id = + network_service.get_current_network()[:effective_root_ad_unit_id] + + # Create custom criteria. + custom_criteria = { + :xsi_type => 'CustomCriteria', + :operator => 'IS', + :key_id => custom_targeting_key_id, + :value_ids => [custom_targeting_value_id] + } + + # Create the audience segment rule. + rule = { + :xsi_type => 'FirstPartyAudienceSegmentRule', + # Inventory targeting. + :inventory_rule => { + :targeted_ad_units => [{:ad_unit_id => effective_root_ad_unit_id}] + }, + # Create the custom criteria set that will resemble: + # custom_criteria.key == custom_criteria.value + :custom_criteria_rule => { + :logical_operator => 'AND', + :children => [custom_criteria] + } + } + + # Create an audience segment. + segment = { + :xsi_type => 'RuleBasedFirstPartyAudienceSegment', + :name => 'Audience segment #%d' % Time.new.to_i, + :description => 'Sports enthusiasts between the ages of 20 and 30', + :page_views => 6, + :recency_days => 6, + :membership_expiration_days => 88, + :rule => rule + } + + # Create the audience segment on the server. + return_segments = audience_segment_service.create_audience_segments([segment]) + + if return_segments + return_segments.each do |segment| + puts ("An audience segment with ID: %d, name: '%s' and type: '%s' was " + + "created.") % [segment[:id], segment[:name], segment[:type]] + end + else + raise 'No audience segments were created.' + end +end + +if __FILE__ == $0 + begin + # Set the IDs of the custom criteria to target. + custom_targeting_key_id = 'INSERT_CUSTOM_TARGETING_KEY_ID_HERE' + custom_targeting_value_id = 'INSERT_CUSTOM_TARGETING_VALUE_ID_HERE' + + create_audience_segments(custom_targeting_key_id, custom_targeting_value_id) + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/audience_segment_service/get_all_audience_segments.rb b/dfp_api/examples/v201311/audience_segment_service/get_all_audience_segments.rb new file mode 100755 index 000000000..7918b517b --- /dev/null +++ b/dfp_api/examples/v201311/audience_segment_service/get_all_audience_segments.rb @@ -0,0 +1,94 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This code example gets all audience segments. To create audience segments, run +# create_audience_segments.rb. +# +# Tags: AudienceSegmentService.getAudienceSegmentsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_audience_segments() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the AudienceSegmentService. + audience_segment_service = dfp.service(:AudienceSegmentService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create statement for one page with current offset. + statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]} + + # Get audience segments by statement. + page = + audience_segment_service.get_audience_segments_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each audience segment in results page. + page[:results].each_with_index do |segment, index| + puts "%d) Audience segment ID: %d, name: '%s' of size %d" % + [index + start_index, segment[:id], segment[:name], segment[:size]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer + if page.include?(:total_result_set_size) + puts "Total number of audience segments: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_audience_segments() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/audience_segment_service/get_first_party_audience_segments.rb b/dfp_api/examples/v201311/audience_segment_service/get_first_party_audience_segments.rb new file mode 100755 index 000000000..b8cc1c094 --- /dev/null +++ b/dfp_api/examples/v201311/audience_segment_service/get_first_party_audience_segments.rb @@ -0,0 +1,99 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This code example gets all first party audience segments. To create audience +# segments, run create_audience_segments.rb. +# +# Tags: AudienceSegmentService.getAudienceSegmentsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_first_party_audience_segments() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the AudienceSegmentService. + audience_segment_service = dfp.service(:AudienceSegmentService, API_VERSION) + + # Statement parts to help build a statement to select all first party audience + # segments. + statement_text = "WHERE type = 'FIRST_PARTY' ORDER BY id LIMIT %d OFFSET %d" + + # Define initial values. + offset = 0 + page = {} + + begin + # Create statement for one page with current offset. + statement = {:query => statement_text % [PAGE_SIZE, offset]} + + # Get audience segments by statement. + page = + audience_segment_service.get_audience_segments_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each audience segment in results page. + page[:results].each_with_index do |segment, index| + puts "%d) First party audience segment ID: %d, name: '%s', size %d" % + [index + start_index, segment[:id], segment[:name], segment[:size]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer + if page.include?(:total_result_set_size) + puts 'Total number of first party audience segments: %d' % + page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_first_party_audience_segments() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/audience_segment_service/populate_first_party_audience_segments.rb b/dfp_api/examples/v201311/audience_segment_service/populate_first_party_audience_segments.rb new file mode 100755 index 000000000..71a4ceacd --- /dev/null +++ b/dfp_api/examples/v201311/audience_segment_service/populate_first_party_audience_segments.rb @@ -0,0 +1,101 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This code example populates specific rule based first party audience segment. +# To determine which audience segments exist, run get_audience_segments.rb. +# +# Tags: AudienceSegmentService.getAudienceSegmentsByStatement +# Tags: AudienceSegmentService.performAudienceSegmentAction + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def populate_first_party_audience_segments(audience_segment_id) + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the AudienceSegmentService. + audience_segment_service = dfp.service(:AudienceSegmentService, API_VERSION) + + # Statement parts to help build a statement to select first party audience + # segment for an ID. + statement = { + :query => 'WHERE type = :type AND Id = :audience_segment_id LIMIT 1', + :values => [ + {:key => 'type', + :value => {:value => 'FIRST_PARTY', :xsi_type => 'TextValue'}}, + {:key => 'audience_segment_id', + :value => {:value => audience_segment_id, :xsi_type => 'TextValue'}}, + ] + } + + # Get audience segments by statement. + page = audience_segment_service.get_audience_segments_by_statement(statement) + + if page[:results] + page[:results].each do |segment| + puts "First party audience segment ID: %d, name: '%s' will be populated" % + [segment[:id], segment[:name]] + + # Perform action. + result = audience_segment_service.perform_audience_segment_action( + {:xsi_type => 'PopulateAudienceSegments'}, {:query => statement}) + + # Display results. + if result and result[:num_changes] > 0 + puts 'Number of audience segments populated: %d.' % result[:num_changes] + else + puts 'No audience segments were populated.' + end + end + else + puts 'No first party audience segments found to populate.' + end +end + +if __FILE__ == $0 + begin + # Audience segment ID to populate. + audience_segment_id = 'INSERT_AUDIENCE_SEGMENT_ID_HERE' + + populate_first_party_audience_segments(audience_segment_id) + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/audience_segment_service/update_audience_segments.rb b/dfp_api/examples/v201311/audience_segment_service/update_audience_segments.rb new file mode 100755 index 000000000..c078c2f91 --- /dev/null +++ b/dfp_api/examples/v201311/audience_segment_service/update_audience_segments.rb @@ -0,0 +1,98 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example updates rule based first party audience segments. To determine +# which first party audience segments exist, run +# get_all_first_party_audience_segments.rb. +# +# Tags: AudienceSegmentService.getAudienceSegmentsByStatement +# Tags: AudienceSegmentService.updateAudienceSegments + +require 'dfp_api' + +API_VERSION = :v201311 + +def update_audience_segments() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Set the ID of the first party audience segment to update. + audience_segment_id = 'INSERT_AUDIENCE_SEGMENT_ID_HERE' + + # Get the AudienceSegmentService. + audience_segment_service = dfp.service(:AudienceSegmentService, API_VERSION) + + # Create statement text to select the audience segment to update. + statement = { + :query => 'WHERE id = :segment_id', + :values => [ + { + :key => 'segment_id', + :value => {:value => audience_segment_id, :xsi_type => 'NumberValue'} + } + ] + } + + # Get audience segments by statement. + page = audience_segment_service.get_audience_segments_by_statement(statement) + + if page[:results] + audience_segments = page[:results] + + # Create a local set of audience segments than need to be updated. + audience_segments.each do |audience_segment| + audience_segment[:membership_expiration_days] = 180 + end + + # Update the audience segments on the server. + return_audience_segments = + audience_segment_service.update_audience_segments(audience_segments) + return_audience_segments.each do |audience_segment| + puts 'Audience segment ID: %d was updated' % audience_segment[:id] + end + else + puts 'No audience segments found to update.' + end +end + +if __FILE__ == $0 + begin + update_audience_segments() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/common/error_handling.rb b/dfp_api/examples/v201311/common/error_handling.rb new file mode 100755 index 000000000..a7b014878 --- /dev/null +++ b/dfp_api/examples/v201311/common/error_handling.rb @@ -0,0 +1,76 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example runs incorrect query and demonstrates how to handle errors. +# +# Tags: UserService.updateUser + +require 'dfp_api' + +API_VERSION = :v201311 + +def produce_api_error() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the UserService. + user_service = dfp.service(:UserService, API_VERSION) + + # Omitting "id" field here to produce an error. + user = {:preferred_locale => 'en_UK', :name => 'foo_bar'} + + # Execute request and get the response, this should raise an exception. + user = user_service.update_user(user) + + # Output retrieved data. + puts "User ID: %d, name: %s, email: %s" % + [user[:id], user[:name], user[:email]] +end + +if __FILE__ == $0 + begin + # This function should produce an exception for demo. + produce_api_error() + + # One of two kinds of exception might occur, general HTTP error like 403 or + # 404 and DFP API error defined in WSDL and described in documentation. + + # Handling HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # Handling API errors. + rescue DfpApi::Errors::ApiException => e + # Standard DFP API error includes message and array of errors occured. + puts "Message: %s" % e.message + puts 'Errors:' + # Print out each of the errors. + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/common/oauth2_jwt_handling.rb b/dfp_api/examples/v201311/common/oauth2_jwt_handling.rb new file mode 100755 index 000000000..e85af0fa0 --- /dev/null +++ b/dfp_api/examples/v201311/common/oauth2_jwt_handling.rb @@ -0,0 +1,107 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example shows how to use OAuth2.0 authorization method with JWT (Service +# Account). +# +# Tags: UserService.getUsersByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def oauth2_jwt_handling() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Option 1: provide key filename as authentication -> oauth2_keyfile in the + # configuration file. No additional code is necessary. + # To provide a file name at runtime, use authorize: + # dfp.authorize({:oauth2_keyfile => key_filename}) + + # Option 2: retrieve key manually and create OpenSSL::PKCS12 object. + # key_filename = 'INSERT_FILENAME_HERE' + # key_secret = 'INSERT_SECRET_HERE' + # key_file_data = File.read(key_filename) + # key = OpenSSL::PKCS12.new(key_file_data, key_secret).key + # dfp.authorize({:oauth2_key => key}) + + # Now you can make API calls. + + # Get the UserService. + user_service = dfp.service(:UserService, API_VERSION) + + # Define initial values. + offset = 0 + page = Hash.new + + begin + # Create statement for one page with current offset. + statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]} + + # Get users by statement. + page = user_service.get_users_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each user in results page. + page[:results].each_with_index do |user, index| + puts "%d) User ID: %d, name: %s, email: %s" % + [index + start_index, user[:id], user[:name], user[:email]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer + if page.include?(:total_result_set_size) + puts "Total number of users: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + oauth2_jwt_handling() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/common/setup_oauth2.rb b/dfp_api/examples/v201311/common/setup_oauth2.rb new file mode 100755 index 000000000..f19522723 --- /dev/null +++ b/dfp_api/examples/v201311/common/setup_oauth2.rb @@ -0,0 +1,89 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example shows how to use OAuth2.0 authorization method. It is designed to +# be run from console and requires user input. +# +# Tags: UserService.getUsersByStatement + +require 'dfp_api' + +API_VERSION = :v201311 + +def setup_oauth2() + # DfpApi::Api will read a config file from ENV['HOME']/dfp_api.yml + # when called without parameters. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # You can call authorize explicitly to obtain the access token. Otherwise, it + # will be invoked automatically on the first API call. + # There are two ways to provide verification code, first one is via the block: + token = dfp.authorize() do |auth_url| + puts "Hit Auth error, please navigate to URL:\n\t%s" % auth_url + print 'log in and type the verification code: ' + verification_code = gets.chomp + verification_code + end + if token + print "\nWould you like to update your dfp_api.yml to save " + + "OAuth2 credentials? (y/N): " + response = gets.chomp + if ('y'.casecmp(response) == 0) or ('yes'.casecmp(response) == 0) + dfp.save_oauth2_token(token) + puts 'OAuth2 token is now saved to ~/dfp_api.yml and will be ' + + 'automatically used by the library.' + end + end + + # Alternatively, you can provide one within the parameters: + # token = dfp.authorize({:oauth2_verification_code => verification_code}) + + # Note, 'token' is a Hash. Its value is not used in this example. If you need + # to be able to access the API in offline mode, with no user present, you + # should persist it to be used in subsequent invocations like this: + # dfp.authorize({:oauth2_token => token}) + + # No exception thrown - we are good to make a request. +end + +if __FILE__ == $0 + begin + setup_oauth2() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/company_service/create_companies.rb b/dfp_api/examples/v201311/company_service/create_companies.rb new file mode 100755 index 000000000..052451316 --- /dev/null +++ b/dfp_api/examples/v201311/company_service/create_companies.rb @@ -0,0 +1,81 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates new companies. To determine which companies exist, run +# get_all_companies.rb. +# +# Tags: CompanyService.createCompanies + +require 'dfp_api' + +API_VERSION = :v201311 +# Number of companies to create. +ITEM_COUNT = 5 + +def create_companies() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CompanyService. + company_service = dfp.service(:CompanyService, API_VERSION) + + # Create an array to store local company objects. + companies = (1..ITEM_COUNT).map do |index| + {:name => "Advertiser #%d" % index, :type => 'ADVERTISER'} + end + + # Create the companies on the server. + return_companies = company_service.create_companies(companies) + + if return_companies + return_companies.each do |company| + puts "Company with ID: %d, name: %s and type: %s was created." % + [company[:id], company[:name], company[:type]] + end + else + raise 'No companies were created.' + end + +end + +if __FILE__ == $0 + begin + create_companies() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/company_service/get_all_companies.rb b/dfp_api/examples/v201311/company_service/get_all_companies.rb new file mode 100755 index 000000000..88132bdf5 --- /dev/null +++ b/dfp_api/examples/v201311/company_service/get_all_companies.rb @@ -0,0 +1,92 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all companies. To create companies, run create_companies.rb. +# +# Tags: CompanyService.getCompaniesByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_companies() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CompanyService. + company_service = dfp.service(:CompanyService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create a statement to get one page with current offset. + statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]} + + # Get companies by statement. + page = company_service.get_companies_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each company in results. + page[:results].each_with_index do |company, index| + puts "%d) Company ID: %d, name: '%s', type: '%s'" % + [index + start_index, company[:id], company[:name], company[:type]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Total number of companies: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_companies() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/company_service/get_companies_by_statement.rb b/dfp_api/examples/v201311/company_service/get_companies_by_statement.rb new file mode 100755 index 000000000..847299836 --- /dev/null +++ b/dfp_api/examples/v201311/company_service/get_companies_by_statement.rb @@ -0,0 +1,88 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all companies that are advertisers. The statement retrieves +# up to the maximum page size limit of 500. To create companies, run +# create_companies.rb. +# +# Tags: CompanyService.getCompaniesByStatement + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_companies_by_statement() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CompanyService. + company_service = dfp.service(:CompanyService, API_VERSION) + + # Create a statement to only select companies that are advertisers, sorted by + # name. + statement = { + :query => 'WHERE type = :type ORDER BY name LIMIT 500', + :values => [ + {:key => 'type', + :value => {:value => 'ADVERTISER', :xsi_type => 'TextValue'}} + ] + } + + # Get companies by statement. + page = company_service.get_companies_by_statement(statement) + + if page[:results] + # Print details about each company in results. + page[:results].each_with_index do |company, index| + puts "%d) [%d] name: %s, type: %s" % + [index, company[:id], company[:name], company[:type]] + end + end + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Total number of companies: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_companies_by_statement() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/company_service/get_company.rb b/dfp_api/examples/v201311/company_service/get_company.rb new file mode 100755 index 000000000..e04eebda3 --- /dev/null +++ b/dfp_api/examples/v201311/company_service/get_company.rb @@ -0,0 +1,72 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets a company by its ID. To determine which companies exist, run +# get_all_companies.rb. +# +# Tags: CompanyService.getCompany + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_company() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CompanyService. + company_service = dfp.service(:CompanyService, API_VERSION) + + # Set the ID of the company to get. + company_id = 'INSERT_COMPANY_ID_HERE'.to_i + + # Get the company. + company = company_service.get_company(company_id) + + if company + puts "Company with ID: %d, name: %s and type: %s was found." % + [company[:id], company[:name], company[:type]] + end +end + +if __FILE__ == $0 + begin + get_company() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/company_service/update_companies.rb b/dfp_api/examples/v201311/company_service/update_companies.rb new file mode 100755 index 000000000..95d3f591d --- /dev/null +++ b/dfp_api/examples/v201311/company_service/update_companies.rb @@ -0,0 +1,102 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example updates the names of all companies that are advertisers by +# appending "LLC." up to the first 500. To determine which companies exist, run +# get_all_companies.rb. +# +# Tags: CompanyService.getCompaniesByStatement, CompanyService.updateCompanies + +require 'dfp_api' + +API_VERSION = :v201311 + +def update_companies() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CompanyService. + company_service = dfp.service(:CompanyService, API_VERSION) + + # Create a statement to only select companies that are advertisers. + statement = { + :query => "WHERE type = :type LIMIT 500", + :values => [ + {:key => 'type', + :value => {:value => 'ADVERTISER', :xsi_type => 'TextValue'}} + ] + } + + # Get companies by statement. + page = company_service.get_companies_by_statement(statement) + + if page[:results] + companies = page[:results] + + # Update each local company object by appending ' LLC.' to its name. + companies.each do |company| + company[:name] += ' LLC.' + # Workaround for issue #94. + [:address, :email, :fax_phone, :primary_phone, + :external_id, :comment].each do |item| + company[item] = "" if company[item].nil? + end + end + + # Update the companies on the server. + return_companies = company_service.update_companies(companies) + + if return_companies + return_companies.each do |company| + puts "A company with ID [%d], name: %s and type %s was updated." % + [company[:id], company[:name], company[:type]] + end + else + raise 'No companies were updated.' + end + else + puts 'No companies found to update.' + end +end + +if __FILE__ == $0 + begin + update_companies() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/contact_service/create_contacts.rb b/dfp_api/examples/v201311/contact_service/create_contacts.rb new file mode 100755 index 000000000..c0d797da9 --- /dev/null +++ b/dfp_api/examples/v201311/contact_service/create_contacts.rb @@ -0,0 +1,95 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.davidtorres@gmail.com (David Torres) +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates new contacts. To determine which contacts exist, run +# get_all_contacts.rb. +# +# Tags: ContactService.createContacts + +require 'dfp_api' + +API_VERSION = :v201311 + +def create_contacts() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the ContactService. + contact_service = dfp.service(:ContactService, API_VERSION) + + # Set the ID of the advertiser company this contact is associated with. + advertiser_company_id = 'INSERT_ADVERTISER_COMPANY_ID_HERE' + + # Set the ID of the agency company this contact is associated with. + agency_company_id = 'INSERT_AGENCY_COMPANY_ID_HERE' + + # Create an advertiser contact. + advertiser_contact = { + :name => 'Mr. Advertiser', + :email => 'advertiser@advertising.com', + :company_id => advertiser_company_id + } + + # Create an agency contact. + agency_contact = { + :name => 'Ms. Agency', + :email => 'agency@agencies.com', + :company_id => agency_company_id + } + + # Create the contacts on the server. + return_contacts = contact_service.create_contacts([advertiser_contact, + agency_contact]) + + # Display results. + if return_contacts + return_contacts.each do |contact| + puts 'A contact with ID %d and name %s was created.' % [contact[:id], + contact[:name]] + end + else + raise 'No contacts were created.' + end +end + +if __FILE__ == $0 + begin + create_contacts() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/contact_service/get_all_contacts.rb b/dfp_api/examples/v201311/contact_service/get_all_contacts.rb new file mode 100755 index 000000000..13a30769e --- /dev/null +++ b/dfp_api/examples/v201311/contact_service/get_all_contacts.rb @@ -0,0 +1,92 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.davidtorres@gmail.com (David Torres) +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all contacts. To create contacts, run create_contacts.rb. +# +# Tags: ContactService.getContactsByStatement. + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_contacts() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the ContactService. + contact_service = dfp.service(:ContactService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create statement for one page with current offset. + statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]} + + # Get contacts by statement. + page = contact_service.get_contacts_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each content object in results page. + page[:results].each_with_index do |contact, index| + puts "%d) Contact ID: %d, name: %s." % [index + start_index, + contact[:id], contact[:name]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer + if page.include?(:total_result_set_size) + puts "Total number of results: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_contacts() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/contact_service/get_uninvited_contacts.rb b/dfp_api/examples/v201311/contact_service/get_uninvited_contacts.rb new file mode 100755 index 000000000..ea2a36282 --- /dev/null +++ b/dfp_api/examples/v201311/contact_service/get_uninvited_contacts.rb @@ -0,0 +1,102 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.davidtorres@gmail.com (David Torres) +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets uninvited contacts. To create contacts, run +# create_contacts.rb. +# +# Tags: ContactService.getContactsByStatement. + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_uninvited_contacts() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the ContactService. + contact_service = dfp.service(:ContactService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + query_base = 'WHERE status = :status ORDER BY id LIMIT %d OFFSET %d' + + # Create statement. + statement = { + :values => [ + {:key => 'status', + :value => {:value => 'UNINVITED', :xsi_type => 'TextValue'}} + ] + } + + begin + # Update statement for one page with current offset. + statement[:query] = query_base % [PAGE_SIZE, offset] + + # Get contacts by statement. + page = contact_service.get_contacts_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each content object in results page. + page[:results].each_with_index do |contact, index| + puts "%d) Contact ID: %d, name: %s." % [index + start_index, + contact[:id], contact[:name]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer + if page.include?(:total_result_set_size) + puts "Total number of results: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_uninvited_contacts() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/contact_service/update_contacts.rb b/dfp_api/examples/v201311/contact_service/update_contacts.rb new file mode 100755 index 000000000..7f22385ae --- /dev/null +++ b/dfp_api/examples/v201311/contact_service/update_contacts.rb @@ -0,0 +1,84 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.davidtorres@gmail.com (David Torres) +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example updates contact comments. To determine which contacts exist, +# run get_all_contacts.rb. +# +# Tags: ContactService.updateContacts + +require 'dfp_api' + +API_VERSION = :v201311 + +def update_contacts() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the ContactService. + contact_service = dfp.service(:ContactService, API_VERSION) + + contact_id = 'INSERT_CONTACT_ID_HERE' + + # Get contact. + contact = contact_service.get_contact(contact_id) + + # Update the comment of the contact. + contact[:address] = '123 New Street, New York, NY, 10011' + + # Update the contact on the server. + return_contacts = contact_service.update_contacts([contact]) + + # Display results. + if return_contacts + return_contacts.each do |updated_contact| + puts "Contact with ID: %d, name: %s and comment: '%s' was updated." % + [updated_contact[:id], updated_contact[:name], + updated_contact[:comment]] + end + else + raise 'No contacts were updated.' + end + +end + +if __FILE__ == $0 + begin + update_contacts() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/content_service/get_all_content.rb b/dfp_api/examples/v201311/content_service/get_all_content.rb new file mode 100755 index 000000000..a851a6ce7 --- /dev/null +++ b/dfp_api/examples/v201311/content_service/get_all_content.rb @@ -0,0 +1,94 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all content. +# +# This feature is only available to DFP video publishers. +# +# Tags: ContentService.getContentByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_content() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the ContentService. + content_service = dfp.service(:ContentService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create statement for one page with current offset. + statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]} + + # Get content by statement. + page = content_service.get_content_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each content object in results page. + page[:results].each_with_index do |content, index| + puts "%d) Content ID: %d, name: %s, status: %s." % [index + start_index, + content[:id], content[:name], content[:status]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer + if page.include?(:total_result_set_size) + puts "Total number of results: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_content() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/content_service/get_content_by_category.rb b/dfp_api/examples/v201311/content_service/get_content_by_category.rb new file mode 100755 index 000000000..fef081a3e --- /dev/null +++ b/dfp_api/examples/v201311/content_service/get_content_by_category.rb @@ -0,0 +1,143 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all active content categorized as "comedy" using the +# network's content browse custom targeting key. +# +# This feature is only available to DFP video publishers. +# +# Tags: NetworkService.getCurrentNetwork +# Tags: ContentService.getContentByStatementAndCustomTargetingValue +# Tags: CustomTargetingService.getCustomTargetingValuesByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_content_by_statement() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the NetworkService. + network_service = dfp.service(:NetworkService, API_VERSION) + + # Get content browse custom targeting key ID. + current_network = network_service.get_current_network + content_browse_custom_targeting_key_id = + current_network[:content_browse_custom_targeting_key_id] + + # Get the CustomTargetingService. + custom_targeting_service = dfp.service(:CustomTargetingService, API_VERSION) + + # Create a statement to select the categories matching the name comedy. + statement = { + :query => 'WHERE customTargetingKeyId = :targeting_key_id' + + ' and name = :category LIMIT 1', + :values => [ + {:key => 'targeting_key_id', + :value => {:value => content_browse_custom_targeting_key_id, + :xsi_type => 'NumberValue'}}, + {:key => 'category', + :value => {:value => 'comedy', + :xsi_type => 'TextValue'}}, + ] + } + + # Get categories matching the filter statement. + page = custom_targeting_service.get_custom_targeting_values_by_statement( + statement) + + # Get the custom targeting value ID for the comedy category. + if page[:results] + category_custom_targeting_value_id = page[:results].first()[:id] + + # Get the ContentService. + content_service = dfp.service(:ContentService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + statement_text = 'WHERE status = :status' + statement = { + :query => statement_text, + :values => [ + {:key => 'status', + :value => {:value => 'ACTIVE', :xsi_type => 'TextValue'}} + ] + } + + begin + # Create a statement to get one page with current offset. + statement[:query] = statement_text + + " LIMIT %d OFFSET %d" % [PAGE_SIZE, offset] + + # Get content by statement. + page = + content_service.get_content_by_statement_and_custom_targeting_value( + statement, category_custom_targeting_value_id) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + page[:results].each_with_index do |content, index| + puts "%d) Content ID: %d, name: %s, status: %s." % + [index + start_index, content[:id], content[:name], + content[:status]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Number of results found: %d" % page[:total_result_set_size] + end + else + puts "Category was not found for targeting key ID %d." % + content_browse_custom_targeting_key_id + end +end + +if __FILE__ == $0 + begin + get_content_by_statement() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/creative_service/copy_image_creatives.rb b/dfp_api/examples/v201311/creative_service/copy_image_creatives.rb new file mode 100755 index 000000000..c6c4ff5a4 --- /dev/null +++ b/dfp_api/examples/v201311/creative_service/copy_image_creatives.rb @@ -0,0 +1,115 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example copies a given set of image creatives. This would typically be +# done to reuse creatives in a small business network. To determine which +# creatives exist, run get_all_creatives.rb. +# +# Tags: CreativeService.getCreativesByStatement, CreativeService.createCreatives + +require 'dfp_api' + +require 'base64' + +API_VERSION = :v201311 + +def copy_image_creatives() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CreativeService. + creative_service = dfp.service(:CreativeService, API_VERSION) + + # Create a list of creative ids to copy. + image_creative_ids = [ + 'INSERT_IMAGE_CREATIVE_ID_HERE'.to_i, + 'INSERT_IMAGE_CREATIVE_ID_HERE'.to_i, + 'INSERT_IMAGE_CREATIVE_ID_HERE'.to_i, + 'INSERT_IMAGE_CREATIVE_ID_HERE'.to_i + ] + + # Create the statement to filter image creatives by ID. + statement = { + :query => "WHERE id IN (%s) AND creativeType = :creative_type" % + image_creative_ids.join(', '), + :values => [ + {:key => 'creative_type', + :value => {:value => 'ImageCreative', :xsi_type => 'TextValue'}} + ] + } + + # Get creatives by statement. + page = creative_service.get_creatives_by_statement(statement) + + if page[:results] + creatives = page[:results] + + # Copy each local creative object and change its name. + new_creatives = creatives.map do |creative| + new_creative = creative.dup() + old_id = new_creative.delete(:id) + new_creative[:name] += " (Copy of %d)" % old_id + image_url = new_creative.delete(:image_url) + new_creative[:image_byte_array] = + Base64.encode64(AdsCommon::Http.get(image_url, dfp.config)) + new_creative + end + + # Create the creatives on the server. + return_creatives = creative_service.create_creatives(new_creatives) + + # Display copied creatives. + if return_creatives + return_creatives.each_with_index do |creative, index| + puts "A creative with ID [%d] was copied to ID [%d], name: %s" % + [creatives[index][:id], creative[:id], creative[:name]] + end + else + raise 'No creatives were copied.' + end + else + puts 'No creatives found to copy.' + end +end + +if __FILE__ == $0 + begin + copy_image_creatives() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/creative_service/create_creative_from_template.rb b/dfp_api/examples/v201311/creative_service/create_creative_from_template.rb new file mode 100755 index 000000000..9469e33ed --- /dev/null +++ b/dfp_api/examples/v201311/creative_service/create_creative_from_template.rb @@ -0,0 +1,139 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates a new template creative for a given advertiser. To +# determine which companies are advertisers, run get_companies_by_statement.rb. +# To determine which creatives already exist, run get_all_creatives.rb. To +# determine which creative templates run get_all_creative_templates.rb. +# +# Tags: CreativeService.createCreative + +require 'base64' +require 'dfp_api' + +API_VERSION = :v201311 + +def create_creative_from_template() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CreativeService. + creative_service = dfp.service(:CreativeService, API_VERSION) + + # Set the ID of the advertiser (company) that all creatives will be assigned + # to. + advertiser_id = 'INSERT_ADVERTISER_COMPANY_ID_HERE'.to_i + + # Use the image banner with optional third party tracking template. + creative_template_id = 10000680 + + # Create the local custom creative object. + creative = { + :xsi_type => 'TemplateCreative', + :name => 'Template creative', + :advertiser_id => advertiser_id, + :creative_template_id => creative_template_id, + :size => {:width => 300, :height => 250, :is_aspect_ratio => false} + } + + # Prepare image data for asset value. + image_url = + 'http://www.google.com/intl/en/adwords/select/images/samples/inline.jpg' + image_data = AdsCommon::Http.get(image_url, dfp.config) + image_data_base64 = Base64.encode64(image_data) + + # Create the asset variable value. + asset_variable_value = { + :xsi_type => 'AssetCreativeTemplateVariableValue', + :unique_name => 'Imagefile', + :asset_byte_array => image_data_base64, + # Filenames must be unique. + :file_name => "image%d.jpg" % Time.new.to_i + } + + # Create the image width variable value. + image_width_variable_value = { + :xsi_type => 'LongCreativeTemplateVariableValue', + :unique_name => 'Imagewidth', + :value => 300 + } + + # Create the image height variable value. + image_height_variable_value = { + :xsi_type => 'LongCreativeTemplateVariableValue', + :unique_name => 'Imageheight', + :value => 250 + } + + # Create the URL variable value. + url_variable_value = { + :xsi_type => 'UrlCreativeTemplateVariableValue', + :unique_name => 'ClickthroughURL', + :value => 'www.google.com' + } + + # Create the target window variable value. + target_window_variable_value = { + :xsi_type => 'StringCreativeTemplateVariableValue', + :unique_name => 'Targetwindow', + :value => '__blank' + } + + creative[:creative_template_variable_values] = [asset_variable_value, + image_width_variable_value, image_height_variable_value, + url_variable_value, target_window_variable_value] + + # Create the creatives on the server. + return_creative = creative_service.create_creative(creative) + + if return_creative + puts(("Template creative with ID: %d, name: %s and type '%s' was " + + "created and can be previewed at: '%s'") % + [return_creative[:id], return_creative[:name], + return_creative[:creative_type], return_creative[:preview_url]]) + else + raise 'No creatives were created.' + end +end + +if __FILE__ == $0 + begin + create_creative_from_template() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/creative_service/create_creatives.rb b/dfp_api/examples/v201311/creative_service/create_creatives.rb new file mode 100755 index 000000000..37c52109a --- /dev/null +++ b/dfp_api/examples/v201311/creative_service/create_creatives.rb @@ -0,0 +1,112 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates new image creatives for a given advertiser. To determine +# which companies are advertisers, run get_companies_by_statement.rb. To +# determine which creatives already exist, run get_all_creatives.rb. +# +# Tags: CreativeService.createCreatives + +require 'base64' +require 'dfp_api' + +API_VERSION = :v201311 +# Number of creatives to create. +ITEM_COUNT = 5 + +def create_creatives() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CreativeService. + creative_service = dfp.service(:CreativeService, API_VERSION) + + # Set the ID of the advertiser (company) that all creatives will be assigned + # to. + advertiser_id = 'INSERT_ADVERTISER_COMPANY_ID_HERE'.to_i + + # Prepare image data for creative. + image_url = + 'http://www.google.com/intl/en/adwords/select/images/samples/inline.jpg' + image_data = AdsCommon::Http.get(image_url, dfp.config) + image_data_base64 = Base64.encode64(image_data) + size = {:width => 300, :height => 250} + + # Create an array to store local creative objects. + creatives = (1..ITEM_COUNT).map do |index| + { + :xsi_type => 'ImageCreative', + :name => "Image creative #%d-%d" % [index, (Time.new.to_f * 1000).to_i], + :advertiser_id => advertiser_id, + :destination_url => 'http://www.google.com', + :size => size, + :primary_image_asset => { + :file_name => 'image.jpg', + :asset_byte_array => image_data_base64, + :size => size + } + } + end + + # Create the creatives on the server. + return_creatives = creative_service.create_creatives(creatives) + + if return_creatives + return_creatives.each do |creative| + if creative[:creative_type] == 'ImageCreative' + puts ("Image creative with ID: %d, name: %s, size: %dx%d was " + + "created and can be previewed at: [%s]") % + [creative[:id], creative[:name], + creative[:size][:width], creative[:size][:height], + creative[:preview_url]] + else + puts "Creative with ID: %d, name: %s and type: %s was created." % + [creative[:id], creative[:name], creative[:creative_type]] + end + end + else + raise 'No creatives were created.' + end +end + +if __FILE__ == $0 + begin + create_creatives() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/creative_service/create_custom_creative.rb b/dfp_api/examples/v201311/creative_service/create_custom_creative.rb new file mode 100755 index 000000000..09f19236c --- /dev/null +++ b/dfp_api/examples/v201311/creative_service/create_custom_creative.rb @@ -0,0 +1,104 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates a custom creative for a given advertiser. To determine +# which companies are advertisers, run get_companies_by_statement.rb. To +# determine which creatives already exist, run get_all_creatives.rb. +# +# This feature is only available to DFP premium solution networks. +# +# Tags: CreativeService.createCreative + +require 'base64' +require 'dfp_api' + +API_VERSION = :v201311 + +def create_custom_creative() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CreativeService. + creative_service = dfp.service(:CreativeService, API_VERSION) + + # Set the ID of the advertiser (company) that all creatives will be assigned + # to. + advertiser_id = 'INSERT_ADVERTISER_COMPANY_ID_HERE'.to_i + + # Prepare image data for creative. + image_url = + 'http://www.google.com/intl/en/adwords/select/images/samples/inline.jpg' + image_data = AdsCommon::Http.get(image_url, dfp.config) + image_data_base64 = Base64.encode64(image_data) + + # Create an array to store local creative objects. + custom_creative = { + :xsi_type => 'CustomCreative', + :name => 'Custom creative', + :advertiser_id => advertiser_id, + :destination_url => 'http://www.google.com', + :custom_creative_assets => [ + {:macro_name => 'IMAGE_ASSET', + :file_name => "image%d.jpg" % Time.new.to_i, + :asset_byte_array => image_data_base64} + ], + # Set the HTML snippet using the custom creative asset macro. + :html_snippet => "" + + "
Click above for great deals!", + # Set the creative size. + :size => {:width => 300, :height => 250, :is_aspect_ratio => false} + } + + # Create the creatives on the server. + return_creative = creative_service.create_creative(custom_creative) + + if return_creative + puts "Custom creative with ID: %d, name: '%s' and type: '%s' was created." % + [return_creative[:id], return_creative[:name], + return_creative[:creative_type]] + else + raise 'No creatives were created.' + end +end + +if __FILE__ == $0 + begin + create_custom_creative() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/creative_service/get_all_creatives.rb b/dfp_api/examples/v201311/creative_service/get_all_creatives.rb new file mode 100755 index 000000000..66448bc72 --- /dev/null +++ b/dfp_api/examples/v201311/creative_service/get_all_creatives.rb @@ -0,0 +1,93 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all creatives. To create creatives, run create_creatives.rb. +# +# Tags: CreativeService.getCreativesByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_creatives() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CreativeService. + creative_service = dfp.service(:CreativeService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create a statement to get one page with current offset. + statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]} + + # Get creatives by statement. + page = creative_service.get_creatives_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each creative in results. + page[:results].each_with_index do |creative, index| + puts "%d) Creative ID: %d, name: %s, type: %s" % + [index + start_index, creative[:id], + creative[:name], creative[:creative_type]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Total number of creatives: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_creatives() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/creative_service/get_creative.rb b/dfp_api/examples/v201311/creative_service/get_creative.rb new file mode 100755 index 000000000..e5ef2e30c --- /dev/null +++ b/dfp_api/examples/v201311/creative_service/get_creative.rb @@ -0,0 +1,72 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets a creative by its ID. To determine which creatives exist, +# run get_all_creatives.rb. +# +# Tags: CreativeService.getCreative + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_creative() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CreativeService. + creative_service = dfp.service(:CreativeService, API_VERSION) + + # Set the ID of the creative to get. + creative_id = 'INSERT_CREATIVE_ID_HERE'.to_i + + # Get the creative. + creative = creative_service.get_creative(creative_id) + + if creative + puts "Creative with ID: %d, name: %s and type: %s was found." % + [creative[:id], creative[:name], creative[:creative_type]] + end +end + +if __FILE__ == $0 + begin + get_creative() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/creative_service/get_creatives_by_statement.rb b/dfp_api/examples/v201311/creative_service/get_creatives_by_statement.rb new file mode 100755 index 000000000..8f575381d --- /dev/null +++ b/dfp_api/examples/v201311/creative_service/get_creatives_by_statement.rb @@ -0,0 +1,87 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all image creatives. The statement retrieves up to the +# maximum page size limit of 500. To create an image creative, run +# create_creatives.rb. +# +# Tags: CreativeService.getCreativesByStatement + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_creatives_by_statement() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CreativeService. + creative_service = dfp.service(:CreativeService, API_VERSION) + + # Create a statement to only select image creatives. + statement = { + :query => 'WHERE creativeType = :creative_type LIMIT 500', + :values => [ + {:key => 'creative_type', + :value => {:value => 'ImageCreative', :xsi_type => 'TextValue'}} + ] + } + + # Get creatives by statement. + page = creative_service.get_creatives_by_statement(statement) + + if page[:results] + # Print details about each creative in results. + page[:results].each_with_index do |creative, index| + puts "%d) Creative ID: %d, name: %s, type: %s" % + [index, creative[:id], creative[:name], creative[:creative_type]] + end + end + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Total number of creatives: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_creatives_by_statement() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/creative_service/update_creatives.rb b/dfp_api/examples/v201311/creative_service/update_creatives.rb new file mode 100755 index 000000000..716270229 --- /dev/null +++ b/dfp_api/examples/v201311/creative_service/update_creatives.rb @@ -0,0 +1,96 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example updates the destination URL of all image creatives up to the +# first 500. To determine which image creatives exist, run get_all_creatives.rb. +# +# Tags: CreativeService.getCreativesByStatement, CreativeService.updateCreatives + +require 'dfp_api' + +API_VERSION = :v201311 + +def update_creatives() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CreativeService. + creative_service = dfp.service(:CreativeService, API_VERSION) + + # Create a statement to get first 500 image creatives. + statement = { + :query => "WHERE creativeType = :creative_type LIMIT 500", + :values => [ + {:key => 'creative_type', + :value => {:value => 'ImageCreative', :xsi_type => 'TextValue'}} + ] + } + + # Get creatives by statement. + page = creative_service.get_creatives_by_statement(statement) + + if page[:results] + creatives = page[:results] + + # Update each local creative object by changing its destination URL. + creatives.each do |creative| + creative[:destination_url] = 'http://news.google.com' + end + + # Update the creatives on the server. + return_creatives = creative_service.update_creatives(creatives) + + if return_creatives + return_creatives.each do |creative| + puts "Creative with ID: %d, name: %s and url: [%s] was updated." % + [creative[:id], creative[:name], creative[:destination_url]] + end + else + raise 'No creatives were updated.' + end + else + puts 'No creatives found to update.' + end +end + +if __FILE__ == $0 + begin + update_creatives() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/creative_set_service/associate_creative_set_to_line_item.rb b/dfp_api/examples/v201311/creative_set_service/associate_creative_set_to_line_item.rb new file mode 100755 index 000000000..51d1d435d --- /dev/null +++ b/dfp_api/examples/v201311/creative_set_service/associate_creative_set_to_line_item.rb @@ -0,0 +1,77 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This code example creates a line item creative association for a creative +# set. To create creative sets, run create_creative_set.rb. To create creatives, +# run create_creatives.rb. To determine which LICAs exist, run get_all_licas.rb. +# +# Tags: LineItemCreativeAssociationService.createLineItemCreativeAssociations + +require 'dfp_api' + +API_VERSION = :v201311 + +def associate_creative_set_to_line_item() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Set the line item ID and creative set ID to associate. + line_item_id = 'INSERT_LINE_ITEM_ID_HERE'.to_i + creative_set_id = 'INSERT_CREATIVE_SET_ID_HERE'.to_i + + # Get the LineItemCreativeAssociationService. + lica_service = dfp.service(:LineItemCreativeAssociationService, API_VERSION) + + lica = { + :creative_set_id => creative_set_id, + :line_item_id => line_item_id + } + + # Create the LICAs on the server. + return_lica = lica_service.create_line_item_creative_associations([lica]) + + puts 'A LICA with line item ID %d and creative set ID %d was created.' % + [return_lica[:line_item_id], return_lica[:creative_set_id]] +end + +if __FILE__ == $0 + begin + associate_creative_set_to_line_item() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts 'HTTP Error: %s' % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts 'Message: %s' % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/creative_set_service/create_creative_set.rb b/dfp_api/examples/v201311/creative_set_service/create_creative_set.rb new file mode 100755 index 000000000..303b293f9 --- /dev/null +++ b/dfp_api/examples/v201311/creative_set_service/create_creative_set.rb @@ -0,0 +1,83 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This code example creates a new creative set. +# +# Tags: CreativeSetService.createCreativeSet + +require 'dfp_api' + +API_VERSION = :v201311 + +def create_creative_set() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + master_creative_id = 'INSERT_MASTER_CREATIVE_ID_HERE'.to_i + companion_creative_id = 'INSERT_COMPANION_CREATIVE_ID_HERE'.to_i + + # Get the CreativeSetService. + creative_set_service = dfp.service(:CreativeSetService, API_VERSION) + + # Create an array to store local creative set object. + creative_set = { + :name => 'Creative set #%d' % (Time.new.to_f * 1000), + :master_creative_id => master_creative_id, + :companion_creative_ids => [companion_creative_id] + } + + # Create the creative set on the server. + return_set = creative_set_service.create_creative_set(creative_set) + + if return_set + puts ('Creative set with ID: %d, master creative ID: %d and companion ' + + 'creative IDs: [%s] was created') % + [return_set[:id], return_set[:master_creative_id], + return_set[:companion_creative_ids].join(', ')] + else + raise 'No creative set was created.' + end + +end + +if __FILE__ == $0 + begin + create_creative_set() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/creative_set_service/get_all_creative_sets.rb b/dfp_api/examples/v201311/creative_set_service/get_all_creative_sets.rb new file mode 100755 index 000000000..cb6f74784 --- /dev/null +++ b/dfp_api/examples/v201311/creative_set_service/get_all_creative_sets.rb @@ -0,0 +1,94 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This code example gets all creative sets. To create creative sets run +# create_creative_set.rb. +# +# Tags: CreativeSetService.getCreativeSetsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_creative_sets() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CreativeSetService. + creative_set_service = dfp.service(:CreativeSetService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create statement for one page with current offset. + statement = {:query => 'LIMIT %d OFFSET %d' % [PAGE_SIZE, offset]} + + # Get creative sets by statement. + page = creative_set_service.get_creative_sets_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each creative set in results page. + page[:results].each_with_index do |set, index| + puts ('%d) Creative set ID: %d, master creative ID: %d and companion ' + + 'creative IDs: [%s]') % [index + start_index, set[:id], + set[:master_creative_id], set[:companion_creative_ids].join(', ')] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer + if page.include?(:total_result_set_size) + puts "Total number of creative sets: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_creative_sets() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/creative_set_service/get_creative_sets_by_statement.rb b/dfp_api/examples/v201311/creative_set_service/get_creative_sets_by_statement.rb new file mode 100755 index 000000000..7250e3b24 --- /dev/null +++ b/dfp_api/examples/v201311/creative_set_service/get_creative_sets_by_statement.rb @@ -0,0 +1,90 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This code example gets all creative sets for a master creative. To create +# creative sets, run create_creative_sets.rb. +# +# Tags: CreativeSetService.getCreativeSetsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_creative_sets_by_statement() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + master_creative_id = 'INSERT_MASTER_CREATIVE_ID_HERE'.to_i + + # Get the CreativeSetService. + creative_set_service = dfp.service(:CreativeSetService, API_VERSION) + + # Create a statement to get all creative sets that have the given master + # creative. + statement = { + :query => 'WHERE masterCreativeId = :master_creative_id', + :values => [ + {:key => 'master_creative_id', + :value => {:value => master_creative_id, :xsi_type => 'NumberValue'}} + ] + } + + # Get creative sets by statement. + page = creative_set_service.get_creative_sets_by_statement(statement) + + if page and page[:results] + page[:results].each_with_index do |creative_set, index| + puts ('%d) Creative set ID: %d, master creative ID: %d and companion ' + + 'creative IDs: [%s]') % + [index, creative_set[:id], creative_set[:master_creative_id], + creative_set[:companion_creative_ids].join(', ')] + end + end + + # Print a footer. + if page.include?(:total_result_set_size) + puts 'Number of results found: %d' % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_creative_sets_by_statement() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/creative_set_service/update_creative_sets.rb b/dfp_api/examples/v201311/creative_set_service/update_creative_sets.rb new file mode 100755 index 000000000..18ebb0ad1 --- /dev/null +++ b/dfp_api/examples/v201311/creative_set_service/update_creative_sets.rb @@ -0,0 +1,85 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This code example updates a creative set by adding a companion creative. To +# determine which creative sets exist, run get_all_creative_sets.rb. +# +# Tags: CreativeSetService.getCreativeSet +# Tags: CreativeSetService.updateCreativeSet + +require 'dfp_api' + +API_VERSION = :v201311 + +def update_creative_sets() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Set the IDs of the creative set to get and companion creative ID to add. + creative_set_id = 'INSERT_CREATIVE_SET_ID_HERE'.to_i + companion_creative_id = 'INSERT_COMPANION_CREATIVE_ID_HERE'.to_i + + # Get the CreativeSetService. + creative_set_service = dfp.service(:CreativeSetService, API_VERSION) + + # Get creative set. + creative_set = creative_set_service.get_creative_set(creative_set_id) + + # Update the creative set locally. + creative_set[:companion_creative_ids] << companion_creative_id + + # Update the creative set on the server. + return_creative_set = creative_set_service.update_creative_set(creative_set) + + if return_creative_set + puts ('Creative set ID: %d, master creative ID: %d was updated with ' + + 'companion creative IDs: [%s]') % + [creative_set[:id], + creative_set[:master_creative_id], + creative_set[:companion_creative_ids].join(', ')] + else + raise 'No creative sets were updated.' + end +end + +if __FILE__ == $0 + begin + update_creative_sets() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/creative_template_service/get_all_creative_templates.rb b/dfp_api/examples/v201311/creative_template_service/get_all_creative_templates.rb new file mode 100755 index 000000000..4a9c9cdde --- /dev/null +++ b/dfp_api/examples/v201311/creative_template_service/get_all_creative_templates.rb @@ -0,0 +1,94 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all creative templates. +# +# Tags: CreativeTemplateService.getCreativeTemplatesByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_creative_templates() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CreativeTemplateService. + creative_template_service = dfp.service(:CreativeTemplateService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create a statement to get one page with current offset. + statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]} + + # Get creative templates by statement. + page = + creative_template_service.get_creative_templates_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each creative template in results. + page[:results].each_with_index do |template, index| + puts "%d) Creative template ID: %d, name: %s, type: %s" % + [index + start_index, template[:id], + template[:name], template[:type]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Total number of creative templates: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_creative_templates() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/creative_template_service/get_creative_template.rb b/dfp_api/examples/v201311/creative_template_service/get_creative_template.rb new file mode 100755 index 000000000..0b4031b66 --- /dev/null +++ b/dfp_api/examples/v201311/creative_template_service/get_creative_template.rb @@ -0,0 +1,74 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets a creative template by its ID. To determine which creative +# templates exist, run get_all_creative_templates.rb. +# +# Tags: CreativeTemplateService.getCreativeTemplate + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_creative_template() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CreativeTemplateService. + creative_template_service = dfp.service(:CreativeTemplateService, API_VERSION) + + # Set the ID of the creative_template to get. + creative_template_id = 'INSERT_CREATIVE_ID_HERE'.to_i + + # Get the creative_template. + creative_template = + creative_template_service.get_creative_template(creative_template_id) + + if creative_template + puts "Creative template with ID: %d, name: '%s' and type: '%s' was found." % + [creative_template[:id], creative_template[:name], + creative_template[:type]] + end +end + +if __FILE__ == $0 + begin + get_creative_template() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/creative_template_service/get_creative_templates_by_statement.rb b/dfp_api/examples/v201311/creative_template_service/get_creative_templates_by_statement.rb new file mode 100755 index 000000000..a8504d99a --- /dev/null +++ b/dfp_api/examples/v201311/creative_template_service/get_creative_templates_by_statement.rb @@ -0,0 +1,80 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets up to 500 system defined creative templates. +# +# Tags: CreativeTemplateService.getCreativeTemplatesByStatement + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_creative_templates_by_statement() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CreativeTemplateService. + creative_template_service = dfp.service(:CreativeTemplateService, API_VERSION) + + # Create a statement to only select image creative_templates. + statement = {:query => 'LIMIT 500'} + + # Get creative templates by statement. + page = + creative_template_service.get_creative_templates_by_statement(statement) + + if page[:results] + # Print details about each creative template in results. + page[:results].each_with_index do |template, index| + puts "%d) Creative template ID: %d, name: %s, type: %s" % + [index, template[:id], template[:name], template[:type]] + end + end + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Total number of creative templates: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_creative_templates_by_statement() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/creative_wrapper_service/create_creative_wrappers.rb b/dfp_api/examples/v201311/creative_wrapper_service/create_creative_wrappers.rb new file mode 100755 index 000000000..d2c913140 --- /dev/null +++ b/dfp_api/examples/v201311/creative_wrapper_service/create_creative_wrappers.rb @@ -0,0 +1,89 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This code example creates a new creative wrapper. +# +# Creative wrappers must be associated with a LabelType.CREATIVE_WRAPPER label +# and applied to ad units by AdUnit.appliedLabels. To determine which creative +# wrappers exist, run get_all_creative_wrappers.rb. +# +# Tags: CreativeWrapperService.createCreativeWrappers + +require 'dfp_api' + +API_VERSION = :v201311 + +def create_creative_wrappers() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CreativeWrapperService. + creative_wrapper_service = dfp.service(:CreativeWrapperService, API_VERSION) + + # Set the creative wrapper label ID. + label_id = 'INSERT_CREATIVE_WRAPPER_LABEL_ID_HERE'.to_i + + # Create creative wrapper objects. + creative_wrapper = { + # A label can only be associated with one creative wrapper. + :label_id => label_id, + :ordering => 'INNER', + :header => {:html_snippet => 'My creative wrapper header'}, + :footer => {:html_snippet => 'My creative wrapper footer'} + } + + # Create the creative wrapper on the server. + return_creative_wrappers = + creative_wrapper_service.create_creative_wrappers([creative_wrapper]) + + if return_creative_wrappers + return_creative_wrappers.each do |creative_wrapper| + puts "Creative wrapper with ID: %d applying to label: %d was created." % + [creative_wrapper[:id], creative_wrapper[:label_id]] + end + else + raise 'No creative wrappers were created.' + end +end + +if __FILE__ == $0 + begin + create_creative_wrappers() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/creative_wrapper_service/deactivate_creative_wrapper.rb b/dfp_api/examples/v201311/creative_wrapper_service/deactivate_creative_wrapper.rb new file mode 100755 index 000000000..14513936c --- /dev/null +++ b/dfp_api/examples/v201311/creative_wrapper_service/deactivate_creative_wrapper.rb @@ -0,0 +1,102 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example deactivates a creative wrapper belonging to a label. +# +# Tags: CreativeWrapperService.getCreativeWrappersByStatement +# Tags: CreativeWrapperService.performCreativeWrapperAction + +require 'dfp_api' + +API_VERSION = :v201311 + +def deactivate_creative_wrappers() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CreativeWrapperService. + creative_wrapper_service = dfp.service(:CreativeWrapperService, API_VERSION) + + # Set the ID of the label for the creative wrapper to deactivate. + label_id = 'INSERT_CREATIVE_WRAPPER_LABEL_ID_HERE'.to_i + + # Create statement to select creative wrappers by label id and status. + statement = { + :query => 'WHERE labelId = :label_id AND status = :status', + :values => [ + { + :key => 'label_id', + :value => {:value => label_id, :xsi_type => 'NumberValue'} + }, + { + :key => 'status', + :value => {:value => 'ACTIVE', :xsi_type => 'TextValue'} + } + ] + } + + # Get creative wrappers by statement. + page = creative_wrapper_service.get_creative_wrappers_by_statement(statement) + + if page[:results] + page[:results].each do |creative_wrapper| + puts 'Creative wrapper ID: %d, label: %d will be deactivated.' % + [creative_wrapper[:id], creative_wrapper[:label_id]] + end + + # Perform action. + result = creative_wrapper_service.perform_creative_wrapper_action( + {:xsi_type => 'DeactivateCreativeWrappers'}, statement) + + # Display results. + if result and result[:num_changes] > 0 + puts 'Number of creative wrappers deactivated: %d' % result[:num_changes] + else + puts 'No creative wrappers were deactivated.' + end + else + puts 'No creative wrapper found to deactivate.' + end +end + +if __FILE__ == $0 + begin + deactivate_creative_wrappers() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/creative_wrapper_service/get_all_creative_wrappers.rb b/dfp_api/examples/v201311/creative_wrapper_service/get_all_creative_wrappers.rb new file mode 100755 index 000000000..a709395de --- /dev/null +++ b/dfp_api/examples/v201311/creative_wrapper_service/get_all_creative_wrappers.rb @@ -0,0 +1,94 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all creative wrappers for an account. To create creative +# wrappers, run create_creative_wrappers.rb. +# +# Tags: CreativeWrapperService.getCreativeWrappersByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_creative_wrappers() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CreativeWrapperService. + creative_wrapper_service = dfp.service(:CreativeWrapperService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create statement for one page with current offset. + statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]} + + # Get creative wrappers by statement. + page = + creative_wrapper_service.get_creative_wrappers_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each creative wrapper in results page. + page[:results].each_with_index do |creative_wrapper, index| + puts "%d) Creative wrapper ID: %d, label ID: %d" % [index + start_index, + creative_wrapper[:id], creative_wrapper[:label_id]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer + if page.include?(:total_result_set_size) + puts "Total number of creative wrappers: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_creative_wrappers() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/creative_wrapper_service/get_creative_wrappers_by_statement.rb b/dfp_api/examples/v201311/creative_wrapper_service/get_creative_wrappers_by_statement.rb new file mode 100755 index 000000000..b37b17175 --- /dev/null +++ b/dfp_api/examples/v201311/creative_wrapper_service/get_creative_wrappers_by_statement.rb @@ -0,0 +1,88 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This code example gets all active creative wrappers. To create creative +# wrappers, run create_creative_wrappers.rb. +# +# Tags: CreativeWrapperService.getCreativeWrappersByStatement + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_creative_wrappers_by_statement() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CreativeWrapperService. + creative_wrapper_service = dfp.service(:CreativeWrapperService, API_VERSION) + + # Create filter text to select active creative wrappers. + statement = { + :query => 'WHERE status = :status', + :values => [ + { + :key => 'status', + :value => {:value => 'ACTIVE', :xsi_type => 'TextValue'} + } + ] + } + + # Get creative wrappers by statement. + page = creative_wrapper_service.get_creative_wrappers_by_statement(statement) + + if page and page[:results] + page[:results].each_with_index do |creative_wrapper, index| + puts "%d) Creative wrapper ID: %d, label ID: %d, status: '%s'." % + [index, creative_wrapper[:id], creative_wrapper[:label_id], + creative_wrapper[:status]] + end + end + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Number of results found: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_creative_wrappers_by_statement() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/creative_wrapper_service/update_creative_wrappers.rb b/dfp_api/examples/v201311/creative_wrapper_service/update_creative_wrappers.rb new file mode 100755 index 000000000..a4540cff0 --- /dev/null +++ b/dfp_api/examples/v201311/creative_wrapper_service/update_creative_wrappers.rb @@ -0,0 +1,86 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This code example updates a creative wrapper to the 'OUTER' wrapping order. To +# determine which creative wrappers exist, run get_all_creative_wrappers.rb. +# +# Tags: CreativeWrapperService.getCreativeWrappersByStatement +# Tags: CreativeWrapperService.updateCreativeWrappers + +require 'dfp_api' + +API_VERSION = :v201311 + +def update_creative_wrappers() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CreativeWrapperService. + creative_wrapper_service = dfp.service(:CreativeWrapperService, API_VERSION) + + # Set the ID of the creative wrapper to get. + creative_wrapper_id = 'INSERT_CREATIVE_WRAPPER_ID_HERE'.to_i + + # Get creative wrapper by ID. + creative_wrapper = + creative_wrapper_service.get_creative_wrapper(creative_wrapper_id) + + # Update local creative wrapper object by changing its ordering. + creative_wrapper[:ordering] = 'OUTER' + + # Update the creative wrapper on the server. + return_creative_wrappers = + creative_wrapper_service.update_creative_wrappers([creative_wrapper]) + + if return_creative_wrappers + return_creative_wrappers.each do |creative_wrapper| + puts ("Creative wrapper ID: %d, label ID: %d was updated with ordering" + + " '%s'") % [creative_wrapper[:id], creative_wrapper[:label_id], + creative_wrapper[:ordering]] + end + else + puts 'No creative wrappers found to update.' + end +end + +if __FILE__ == $0 + begin + update_creative_wrappers() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/custom_field_service/create_custom_field_options.rb b/dfp_api/examples/v201311/custom_field_service/create_custom_field_options.rb new file mode 100755 index 000000000..c07000222 --- /dev/null +++ b/dfp_api/examples/v201311/custom_field_service/create_custom_field_options.rb @@ -0,0 +1,87 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates custom field options for a drop-down custom field. Once +# created, custom field options can be found under the options fields of the +# drop-down custom field and they cannot be deleted. To determine which custom +# fields exist, run get_all_custom_fields.rb. +# +# Tags: CustomFieldService.createCustomFieldOptions + +require 'dfp_api' + +API_VERSION = :v201311 + +def create_custom_field_options() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CustomFieldService. + custom_field_service = dfp.service(:CustomFieldService, API_VERSION) + + # Set the ID of the drop-down custom field to create options for. + custom_field_id = 'INSERT_DROP_DOWN_CUSTOM_FIELD_ID_HERE'.to_i + + # Create local custom field options. + custom_field_options = [ + { + :display_name => 'Approved', + :custom_field_id => custom_field_id + }, + { + :display_name => 'Unapproved', + :custom_field_id => custom_field_id + } + ] + + # Create the custom field options on the server. + return_custom_field_options = + custom_field_service.create_custom_field_options(custom_field_options) + + return_custom_field_options.each do |option| + puts "Custom field option with ID: %d and name: '%s' was created." % + [option[:id], option[:display_name]] + end +end + +if __FILE__ == $0 + begin + create_custom_field_options() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/custom_field_service/create_custom_fields.rb b/dfp_api/examples/v201311/custom_field_service/create_custom_fields.rb new file mode 100755 index 000000000..3558f7508 --- /dev/null +++ b/dfp_api/examples/v201311/custom_field_service/create_custom_fields.rb @@ -0,0 +1,86 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates custom fields. To determine which custom fields exist, +# run get_all_custom_fields.rb. +# +# Tags: CustomFieldService.createCustomFields + +require 'dfp_api' + +API_VERSION = :v201311 + +def create_custom_fields() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CustomFieldService. + custom_field_service = dfp.service(:CustomFieldService, API_VERSION) + + # Create local custom field objects. + custom_fields = [ + { + :name => 'Customer comments', + :entity_type => 'LINE_ITEM', + :data_type => 'STRING', + :visibility => 'FULL' + }, + { + :name => 'Internal approval status', + :entity_type => 'LINE_ITEM', + :data_type => 'DROP_DOWN', + :visibility => 'FULL' + } + ] + + # Create the custom fields on the server. + return_custom_fields = + custom_field_service.create_custom_fields(custom_fields) + + return_custom_fields.each do |custom_field| + puts "Custom field with ID: %d and name: %s was created." % + [custom_field[:id], custom_field[:name]] + end +end + +if __FILE__ == $0 + begin + create_custom_fields() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/custom_field_service/deactivate_all_line_item_custom_fields.rb b/dfp_api/examples/v201311/custom_field_service/deactivate_all_line_item_custom_fields.rb new file mode 100755 index 000000000..a469d4c40 --- /dev/null +++ b/dfp_api/examples/v201311/custom_field_service/deactivate_all_line_item_custom_fields.rb @@ -0,0 +1,112 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example deactivates all active line item custom fields. To determine +# which custom fields exist, run get_all_custom_fields.rb. +# +# Tags: CustomFieldService.getCustomFieldsByStatement +# Tags: CustomFieldService.performCustomFieldAction + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def deactivate_all_line_item_custom_fields() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CustomFieldService. + custom_field_service = dfp.service(:CustomFieldService, API_VERSION) + + # Create statement text to select active ad units. + statement_text = 'WHERE entityType = :entity_type AND isActive = :is_active' + statement = { + :values => [ + {:key => 'entity_type', + :value => {:value => 'LINE_ITEM', :xsi_type => 'TextValue'}}, + {:key => 'is_active', + :value => {:value => true, :xsi_type => 'BooleanValue'}} + ] + } + + # Define initial values. + offset = 0 + page = {} + + begin + # Create a statement to get one page with the current offset. + statement[:query] = statement_text + + " LIMIT %d OFFSET %d" % [PAGE_SIZE, offset] + + # Get custom fields by statement. + page = custom_field_service.get_custom_fields_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + start_index = page[:start_index] + + page[:results].each_with_index do |custom_field, index| + puts "%d) Custom field with ID: %d and name: '%s' will be deactivated" % + [index + start_index, custom_field[:id], custom_field[:name]] + end + end + end while offset < page[:total_result_set_size] + + # Update statement for action. + statement[:query] = statement_text + + # Perform action. + result = custom_field_service.perform_custom_field_action( + {:xsi_type => 'DeactivateCustomFields'}, statement) + + # Display results. + if result and result[:num_changes] > 0 + puts "Number of custom fields deactivated: %d" % result[:num_changes] + else + puts 'No custom fields were deactivated.' + end +end + +if __FILE__ == $0 + begin + deactivate_all_line_item_custom_fields() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/custom_field_service/get_all_custom_fields.rb b/dfp_api/examples/v201311/custom_field_service/get_all_custom_fields.rb new file mode 100755 index 000000000..e1dae06ff --- /dev/null +++ b/dfp_api/examples/v201311/custom_field_service/get_all_custom_fields.rb @@ -0,0 +1,102 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all custom fields. To create custom fields, run +# create_custom_fields.rb. +# +# Tags: CustomFieldService.getCustomFieldsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_custom_fields() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CustomFieldService. + custom_field_service = dfp.service(:CustomFieldService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create a statement to get one page with current offset. + statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]} + + # Get custom fields by statement. + page = custom_field_service.get_custom_fields_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each custom field in results. + page[:results].each_with_index do |custom_field, index| + if custom_field[:custom_field_type].eql?('DropDownCustomField') + drop_down_custom_field_strings = custom_field.include?(:options) ? + custom_field[:options].map {|option| option[:display_name]} : [] + print ("%d) Drop-down custom field with ID %d, name '%s', and " + + "options [%s] was found.") % + [index + start_index, custom_field[:id], custom_field[:name], + drop_down_custom_field_strings.join(', ')] + else + puts "%d) Custom field ID: %d and name: '%s' was found" % + [index + start_index, custom_field[:id], custom_field[:name]] + end + end + end + end while offset < page[:total_result_set_size] + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Total number of custom fields: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_custom_fields() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/custom_field_service/get_all_line_item_custom_fields.rb b/dfp_api/examples/v201311/custom_field_service/get_all_line_item_custom_fields.rb new file mode 100755 index 000000000..27828e60a --- /dev/null +++ b/dfp_api/examples/v201311/custom_field_service/get_all_line_item_custom_fields.rb @@ -0,0 +1,86 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all custom fields that apply to line items. To create custom +# fields, run create_custom_fields.rb. +# +# Tags: CustomFieldService.getCustomFieldsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_all_line_item_custom_fields() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CustomFieldService. + custom_field_service = dfp.service(:CustomFieldService, API_VERSION) + + # Create statement to select only custom fields that apply to line items. + statement = { + :query => 'WHERE entityType = :entity_type', + :values => [ + {:key => 'entity_type', + :value => {:value => 'LINE_ITEM', :xsi_type => 'TextValue'}} + ] + } + + # Get custom fields by statement. + page = custom_field_service.get_custom_fields_by_statement(statement) + + if page[:results] + # Print details about each custom field in results. + page[:results].each_with_index do |custom_field, index| + puts "%d) Custom field with ID %d and name: '%s' was found." % + [index, custom_field[:id], custom_field[:name]] + end + end + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Total number of custom fields: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_line_item_custom_fields() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/custom_field_service/set_line_item_custom_field_value.rb b/dfp_api/examples/v201311/custom_field_service/set_line_item_custom_field_value.rb new file mode 100755 index 000000000..731efa79c --- /dev/null +++ b/dfp_api/examples/v201311/custom_field_service/set_line_item_custom_field_value.rb @@ -0,0 +1,135 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example sets custom field values on a line item. To determine which +# custom fields exist, run get_all_custom_fields.rb. To determine which line +# items exist, run get_all_line_items.rb. To create custom field options, run +# create_custom_field_options.rb. +# +# Tags: CustomFieldService.getCustomField, LineItemService.getLineItem + +require 'dfp_api' + +API_VERSION = :v201311 + +def set_line_item_custom_field_value() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CustomFieldService. + custom_field_service = dfp.service(:CustomFieldService, API_VERSION) + + # Get the LineItemService. + line_item_service = dfp.service(:LineItemService, API_VERSION) + + # Set the ID of the custom fields, custom field option, and line item. + custom_field_id = 'INSERT_CUSTOM_FIELD_ID_HERE'.to_i + drop_down_custom_field_id = 'INSERT_DROP_DOWN_CUSTOM_FIELD_ID_HERE'.to_i + custom_field_option_id = 'INSERT_CUSTOM_FIELD_OPTION_ID_HERE'.to_i + line_item_id = 'INSERT_LINE_ITEM_ID_HERE'.to_i + + # Get custom field. + custom_field = custom_field_service.get_custom_field(custom_field_id) + + # Get drop-down custom field. + drop_down_custom_field = custom_field_service.get_custom_field( + drop_down_custom_field_id) + + # Get line item. + line_item = line_item_service.get_line_item(line_item_id) + + if custom_field and drop_down_custom_field and line_item + # Create custom field values. + custom_field_value = { + :custom_field_id => custom_field[:id], + :type => 'CustomFieldValue', + :value => {:type => 'TextValue', :value => 'Custom field value'} + } + + drop_down_custom_field_value = { + :custom_field_id => drop_down_custom_field[:id], + :type => 'DropDownCustomFieldValue', + :custom_field_option_id => custom_field_option_id + } + + custom_field_values = [custom_field_value, drop_down_custom_field_value] + old_custom_field_values = line_item.include?(:custom_field_values) ? + line_item[:custom_field_values] : [] + + # Only add existing custom field values for different custom fields than the + # ones you are setting. + old_custom_field_values.each do |old_custom_field_value| + unless custom_field_values.map {|value| value[:id]}.include?( + old_custom_field_value[:custom_field_id]) + custom_field_values << old_custom_field_value + end + end + + line_item[:custom_field_values] = custom_field_values + + # Update the line item on the server. + return_line_items = line_item_service.update_line_items([line_item]) + + return_line_items.each do |return_line_item| + custom_field_value_strings = [] + if return_line_item.include?(:custom_field_values) + return_line_item[:custom_field_values].each do |value| + if value[:base_custom_field_value_type].eql?('CustomFieldValue') + custom_field_value_strings << "{ID: %d, value: '%s'}" % + [value[:custom_field_id], value[:value][:value]] + end + if value[:base_custom_field_value_type].eql?( + 'DropDownCustomFieldValue') + custom_field_value_strings << + "{ID: %d, custom field option ID: %d}" % + [value[:custom_field_id], value[:custom_field_option_id]] + end + end + end + puts "Line item ID %d set with custom field values: [%s]" % + [return_line_item[:id], custom_field_value_strings.join(', ')] + end + end +end + +if __FILE__ == $0 + begin + set_line_item_custom_field_value() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/custom_field_service/update_custom_fields.rb b/dfp_api/examples/v201311/custom_field_service/update_custom_fields.rb new file mode 100755 index 000000000..af73f268a --- /dev/null +++ b/dfp_api/examples/v201311/custom_field_service/update_custom_fields.rb @@ -0,0 +1,84 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example updates custom field descriptions. To determine which custom +# fields exist, run get_all_custom_fields.rb. +# +# Tags: CustomFieldService.updateCustomFields + +require 'dfp_api' + +API_VERSION = :v201311 + +def update_custom_fields() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CustomFieldService. + custom_field_service = dfp.service(:CustomFieldService, API_VERSION) + + # Set the ID of the custom field to update. + custom_field_id = 'INSERT_CUSTOM_FIELD_ID_HERE'.to_i + + # Get custom field. + custom_field = custom_field_service.get_custom_field(custom_field_id) + + if custom_field + # Update local custom field object. + custom_field[:description] = '' if custom_field[:description].nil? + custom_field[:description] +=' Updated.' + + # Update the custom field on the server. + return_custom_fields = + custom_field_service.update_custom_fields([custom_field]) + + return_custom_fields.each do |custom_field| + puts "Custom field ID: %d, name: '%s' and description '%s' was updated." % + [custom_field[:id], custom_field[:name], custom_field[:description]] + end + else + puts 'No custom fields were found to update.' + end +end + +if __FILE__ == $0 + begin + update_custom_fields() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/custom_targeting_service/create_custom_targeting_keys_and_values.rb b/dfp_api/examples/v201311/custom_targeting_service/create_custom_targeting_keys_and_values.rb new file mode 100755 index 000000000..dd5abf39d --- /dev/null +++ b/dfp_api/examples/v201311/custom_targeting_service/create_custom_targeting_keys_and_values.rb @@ -0,0 +1,140 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates new custom targeting keys and values. To determine which +# custom targeting keys and values exist, run +# get_all_custom_targeting_keys_and_values.rb. To target these custom targeting +# keys and values, run target_custom_criteria.rb. +# +# Tags: CustomTargetingService.createCustomTargetingKeys +# Tags: CustomTargetingService.createCustomTargetingValues + +require 'dfp_api' + +API_VERSION = :v201311 + +def create_custom_targeting_keys_and_values() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CustomTargetingService. + custom_targeting_service = dfp.service(:CustomTargetingService, API_VERSION) + + # Create predefined key. + gender_key = {:display_name => 'gender', :name => 'g', :type => 'PREDEFINED'} + + # Create free-form key. + car_model_key = {:display_name => 'car model', :name => 'c', + :type => 'FREEFORM'} + + # Create predefined key that may be used for content targeting. + genre_key = {:display_name => 'genre', :name => 'genre', + :type => 'PREDEFINED'} + + # Create the custom targeting keys on the server. + return_keys = custom_targeting_service.create_custom_targeting_keys( + [gender_key, car_model_key, genre_key]) + + if return_keys + return_keys.each do |key| + puts ("Custom targeting key ID: %d, name: %s and display name: %s" + + " was created.") % [key[:id], key[:name], key[:display_name]] + end + else + raise 'No keys were created.' + end + + # Create custom targeting value for the predefined gender key. + gender_male_value = {:custom_targeting_key_id => return_keys[0][:id], + :display_name => 'male', :match_type => 'EXACT'} + # Name is set to 1 so that the actual name can be hidden from website users. + gender_male_value[:name] = '1' + + # Create another custom targeting value for the same key. + gender_female_value = {:custom_targeting_key_id => return_keys[0][:id], + :display_name => 'female', :name => '2', :match_type => 'EXACT'} + + # Create custom targeting value for the free-form age key. These are values + # that would be suggested in the UI or can be used when targeting + # with a free-form custom criterion. + car_model_honda_civic_value = { + :custom_targeting_key_id => return_keys[1][:id], + :display_name => 'honda civic', + :name => 'honda civic', + # Setting match type to exact will match exactly "honda civic". + :match_type => 'EXACT' + } + + # Create custom targeting values for the predefined genre key. + genre_comedy_value = { + :custom_targeting_key_id => return_keys[2][:id], + :display_name => 'comedy', + :name => 'comedy', + :match_type => 'EXACT' + } + + genre_drama_value = { + :custom_targeting_key_id => return_keys[2][:id], + :display_name => 'drama', + :name => 'drama', + :match_type => 'EXACT' + } + + # Create the custom targeting values on the server. + return_values = custom_targeting_service.create_custom_targeting_values( + [gender_male_value, gender_female_value, car_model_honda_civic_value, + genre_comedy_value, genre_drama_value]) + + if return_values + return_values.each do |value| + puts ("A custom targeting value ID: %d, name: %s and display name: %s" + + " was created for key ID: %d.") % [value[:id], value[:name], + value[:display_name], value[:custom_targeting_key_id]] + end + else + raise 'No values were created.' + end + +end + +if __FILE__ == $0 + begin + create_custom_targeting_keys_and_values() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/custom_targeting_service/delete_custom_targeting_keys.rb b/dfp_api/examples/v201311/custom_targeting_service/delete_custom_targeting_keys.rb new file mode 100755 index 000000000..eaab2f125 --- /dev/null +++ b/dfp_api/examples/v201311/custom_targeting_service/delete_custom_targeting_keys.rb @@ -0,0 +1,121 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example deletes custom targeting key by its name. To determine which +# custom targeting keys exist, run get_all_custom_targeting_keys_and_values.rb. +# +# Tags: CustomTargetingService.getCustomTargetingKeysByStatement +# Tags: CustomTargetingService.performCustomTargetingKeyAction + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def delete_custom_targeting_keys() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CustomTargetingService. + custom_targeting_service = dfp.service(:CustomTargetingService, API_VERSION) + + # Set the name of the custom targeting key to delete. + custom_targeting_key_name = 'INSERT_CUSTOM_TARGETING_KEY_NAME_HERE' + + # Create statement to only select custom targeting key by the given name. + statement_text = 'WHERE name = :name' + + # Define initial values. + offset = 0 + page = {} + custom_target_key_ids = [] + statement = { + :values => [ + {:key => 'name', + :value => {:value => custom_targeting_key_name, + :xsi_type => 'TextValue'} + } + ] + } + + begin + # Create a statement to page through custom targeting keys. + statement[:query] = statement_text + " LIMIT %d OFFSET %d" % + [PAGE_SIZE, offset] + + page = custom_targeting_service.get_custom_targeting_keys_by_statement( + statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + page[:results].each do |key| + # Add key ID to the list for deletion. + custom_target_key_ids << key[:id] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer. + puts "Number of custom targeting keys to be deleted: %d" % + custom_target_key_ids.size + + if !(custom_target_key_ids.empty?) + # Modify statement for action. + statement = {:query => "WHERE id IN (%s)" % + [custom_target_key_ids.join(', ')]} + + # Perform action. + result = custom_targeting_service.perform_custom_targeting_key_action( + {:xsi_type => 'DeleteCustomTargetingKeys'}, statement) + + # Display results. + if result and result[:num_changes] > 0 + puts "Number of custom targeting keys deleted: %d" % result[:num_changes] + else + puts 'No custom targeting keys were deleted.' + end + end +end + +if __FILE__ == $0 + begin + delete_custom_targeting_keys() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/custom_targeting_service/delete_custom_targeting_values.rb b/dfp_api/examples/v201311/custom_targeting_service/delete_custom_targeting_values.rb new file mode 100755 index 000000000..2075e997f --- /dev/null +++ b/dfp_api/examples/v201311/custom_targeting_service/delete_custom_targeting_values.rb @@ -0,0 +1,125 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example deletes custom targeting values for a given custom targeting key. +# To determine which custom targeting keys and values exist, run +# get_all_custom_targeting_keys_and_values.rb. +# +# Tags: CustomTargetingService.getCustomTargetingValuesByStatement +# Tags: CustomTargetingService.performCustomTargetingValueAction + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def delete_custom_targeting_values() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CustomTargetingService. + custom_targeting_service = dfp.service(:CustomTargetingService, API_VERSION) + + # Set ID of the custom targeting key to delete values from. + custom_targeting_key_id = 'INSERT_CUSTOM_TARGETING_KEY_ID_HERE'.to_i + + # Create statement to only select custom values by the given custom targeting + # key ID. + statement_text = 'WHERE customTargetingKeyId = :key_id' + + # Define initial values. + offset = 0 + page = {} + custom_target_value_ids = [] + statement = { + :values => [ + {:key => 'key_id', + :value => {:value => custom_targeting_key_id, + :xsi_type => 'NumberValue'} + } + ] + } + + begin + # Create a statement to page through custom targeting values. + statement[:query] = statement_text + " LIMIT %d OFFSET %d" % + [PAGE_SIZE, offset] + + # Get custom targeting values by statement. + page = custom_targeting_service.get_custom_targeting_values_by_statement( + statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + page[:results].each do |value| + # Add value ID to the list for deletion. + custom_target_value_ids << value[:id] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer. + puts "Number of custom targeting value to be deleted: %d" % + custom_target_value_ids.size + + if !(custom_target_value_ids.empty?) + # Modify statement for action, note, values are still present. + statement[:query] = statement_text + " AND id IN (%s)" % + [custom_target_value_ids.join(', ')] + + # Perform action. + result = custom_targeting_service.perform_custom_targeting_value_action( + {:xsi_type => 'DeleteCustomTargetingValues'}, statement) + + # Display results. + if result and result[:num_changes] > 0 + puts "Number of custom targeting values deleted: %d" % + result[:num_changes] + else + puts 'No custom targeting values were deleted.' + end + end +end + +if __FILE__ == $0 + begin + delete_custom_targeting_values() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/custom_targeting_service/get_all_custom_targeting_keys_and_values.rb b/dfp_api/examples/v201311/custom_targeting_service/get_all_custom_targeting_keys_and_values.rb new file mode 100755 index 000000000..33c8e3c88 --- /dev/null +++ b/dfp_api/examples/v201311/custom_targeting_service/get_all_custom_targeting_keys_and_values.rb @@ -0,0 +1,148 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all custom targeting keys and the values. To create custom +# targeting keys and values, run create_custom_targeting_keys_and_values.rb. +# +# Tags: CustomTargetingService.getCustomTargetingKeysByStatement +# Tags: CustomTargetingService.getCustomTargetingValuesByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_custom_targeting_keys_and_values() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CustomTargetingService. + custom_targeting_service = dfp.service(:CustomTargetingService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create a statement to get one page with current offset. + statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]} + + # Get custom targeting keys by statement. + page = custom_targeting_service.get_custom_targeting_keys_by_statement( + statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each key in results. + page[:results].each_with_index do |custom_targeting_key, index| + puts ("%d) Custom targeting key ID: %d, name: %s, displayName: %s, " + + "type: %s") % [index + start_index, + custom_targeting_key[:id], + custom_targeting_key[:name], + custom_targeting_key[:display_name], + custom_targeting_key[:type]] + print_all_values_for_key(custom_targeting_service, custom_targeting_key) + end + end + end while offset < page[:total_result_set_size] + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Total number of targeting keys: %d" % + page[:total_result_set_size] + end +end + +def print_all_values_for_key(custom_targeting_service, custom_targeting_key) + # Define initial values. + offset = 0 + page = {} + + # Create a statement to get values for given key. + statement_text = "WHERE customTargetingKeyId = :key_id LIMIT %d" % PAGE_SIZE + statement = { + :values => [ + {:key => 'key_id', + :value => {:value => custom_targeting_key[:id], + :xsi_type => 'NumberValue'}} + ] + } + + begin + # Modify statement to get the next page. + statement[:query] = statement_text + " OFFSET %d" % offset + + # Get custom targeting values by statement. + page = custom_targeting_service.get_custom_targeting_values_by_statement( + statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each value in results. + page[:results].each_with_index do |custom_targeting_value, index| + puts ("\t%d) Custom targeting value ID: %d, name: %s, displayName: %s") % + [index + start_index, + custom_targeting_value[:id], + custom_targeting_value[:name], + custom_targeting_value[:display_name]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer. + if page.include?(:total_result_set_size) + puts "\tTotal number of targeting values: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_custom_targeting_keys_and_values() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/custom_targeting_service/get_custom_targeting_keys_by_statement.rb b/dfp_api/examples/v201311/custom_targeting_service/get_custom_targeting_keys_by_statement.rb new file mode 100755 index 000000000..23a56bdc6 --- /dev/null +++ b/dfp_api/examples/v201311/custom_targeting_service/get_custom_targeting_keys_by_statement.rb @@ -0,0 +1,92 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all predefined custom targeting keys. The statement +# retrieves up to the maximum page size limit of 500. To create custom +# targeting keys, run create_custom_targeting_keys_and_values.rb. +# +# Tags: CustomTargetingService.getCustomTargetingKeysByStatement + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_custom_targeting_keys_by_statement() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CustomTargetingService. + custom_targeting_service = dfp.service(:CustomTargetingService, API_VERSION) + + # Create a statement to only select predefined custom targeting keys. + statement = { + :query => 'WHERE type = :type LIMIT 500', + :values => [ + {:key => 'type', + :value => {:value => 'PREDEFINED', :xsi_type => 'TextValue'}} + ] + } + + # Get custom targeting keys by statement. + page = custom_targeting_service.get_custom_targeting_keys_by_statement( + statement) + + if page[:results] + # Print details about each key in results. + page[:results].each_with_index do |custom_targeting_key, index| + puts ("%d) Custom targeting key with ID [%d], name: %s," + + " displayName: %s type: %s") % [index, + custom_targeting_key[:id], + custom_targeting_key[:name], + custom_targeting_key[:display_name], + custom_targeting_key[:type]] + end + end + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Number of results found: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_custom_targeting_keys_by_statement() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/custom_targeting_service/get_custom_targeting_values_by_statement.rb b/dfp_api/examples/v201311/custom_targeting_service/get_custom_targeting_values_by_statement.rb new file mode 100755 index 000000000..2151751e0 --- /dev/null +++ b/dfp_api/examples/v201311/custom_targeting_service/get_custom_targeting_values_by_statement.rb @@ -0,0 +1,98 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets custom targeting values for the given predefined custom +# targeting key. The statement retrieves up to the maximum page size limit of +# 500. To create custom targeting values, run +# create_custom_targeting_keys_and_values.rb. To determine which custom +# targeting keys exist, run get_all_custom_targeting_keys_and_values.rb. +# +# Tags: CustomTargetingService.getCustomTargetingValuesByStatement + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_custom_targeting_values_by_statement() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CustomTargetingService. + custom_targeting_service = dfp.service(:CustomTargetingService, API_VERSION) + + # Set the ID of the custom targeting key to get custom targeting values for. + custom_targeting_key_id = 'INSERT_CUSTOM_TARGETING_KEY_ID_HERE'.to_i + + # Create a statement to only select custom targeting values for a given key. + statement = { + :query => 'WHERE customTargetingKeyId = :key_id LIMIT 500', + :values => [ + {:key => 'key_id', + :value => {:value => custom_targeting_key_id, + :xsi_type => 'NumberValue'} + } + ] + } + + # Get custom targeting values by statement. + page = custom_targeting_service.get_custom_targeting_values_by_statement( + statement) + + if page[:results] + # Print details about each value in results. + page[:results].each_with_index do |custom_targeting_value, index| + puts ("%d) Custom targeting value with ID [%d], name: %s," + + " displayName: %s") % [index, + custom_targeting_value[:id], + custom_targeting_value[:name], + custom_targeting_value[:display_name]] + end + end + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Number of results found: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_custom_targeting_values_by_statement() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/custom_targeting_service/update_custom_targeting_keys.rb b/dfp_api/examples/v201311/custom_targeting_service/update_custom_targeting_keys.rb new file mode 100755 index 000000000..b5adc4a67 --- /dev/null +++ b/dfp_api/examples/v201311/custom_targeting_service/update_custom_targeting_keys.rb @@ -0,0 +1,94 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example updates the display name of each custom targeting key up to the +# first 500. To determine which custom targeting keys exist, run +# get_all_custom_targeting_keys_and_values.rb. +# +# Tags: CustomTargetingService.getCustomTargetingKeysByStatement +# Tags: CustomTargetingService.updateCustomTargetingKeys + +require 'dfp_api' + +API_VERSION = :v201311 + +def update_custom_targeting_keys() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CustomTargetingService. + custom_targeting_service = dfp.service(:CustomTargetingService, API_VERSION) + + # Create a statement to get first 500 custom targeting keys. + statement = {:query => "LIMIT 500"} + + # Get custom targeting keys by statement. + page = custom_targeting_service.get_custom_targeting_keys_by_statement( + statement) + keys = page[:results] + + raise 'No targeting keys found to update' if !keys || keys.empty? + + # Update each local custom targeting key object by changing its display name. + keys.each do |key| + display_name = (key[:display_name].nil?) ? key[:name] : key[:display_name] + key[:display_name] = display_name + ' (Deprecated)' + end + + # Update the custom targeting keys on the server. + result_keys = custom_targeting_service.update_custom_targeting_keys(keys) + + if result_keys + # Print details about each key in results. + result_keys.each_with_index do |custom_targeting_key, index| + puts ("%d) Custom targeting key with ID [%d], name: %s," + + " displayName: %s type: %s was updated") % [index, + custom_targeting_key[:id], custom_targeting_key[:name], + custom_targeting_key[:display_name], custom_targeting_key[:type]] + end + else + puts 'No targeting keys were updated' + end +end + +if __FILE__ == $0 + begin + update_custom_targeting_keys() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/custom_targeting_service/update_custom_targeting_values.rb b/dfp_api/examples/v201311/custom_targeting_service/update_custom_targeting_values.rb new file mode 100755 index 000000000..9b83d97df --- /dev/null +++ b/dfp_api/examples/v201311/custom_targeting_service/update_custom_targeting_values.rb @@ -0,0 +1,106 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example updates the display name of each custom targeting value up to +# the first 500. To determine which custom targeting keys exist, run +# get_all_custom_targeting_keys_and_values.rb. +# +# Tags: CustomTargetingService.getCustomTargetingValuesByStatement +# Tags: CustomTargetingService.updateCustomTargetingValues + +require 'dfp_api' + +API_VERSION = :v201311 + +def update_custom_targeting_values() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CustomTargetingService. + custom_targeting_service = dfp.service(:CustomTargetingService, API_VERSION) + + # Set the ID of the custom targeting key to get custom targeting values for. + custom_targeting_key_id = 'INSERT_CUSTOM_TARGETING_KEY_ID_HERE'.to_i + + # Create a statement to get first 500 custom targeting keys. + statement = { + :query => 'WHERE customTargetingKeyId = :key_id LIMIT 500', + :values => [ + {:key => 'key_id', + :value => {:value => custom_targeting_key_id, + :xsi_type => 'NumberValue'} + } + ] + } + + # Get custom targeting keys by statement. + page = custom_targeting_service.get_custom_targeting_values_by_statement( + statement) + values = page[:results] + + raise 'No targeting values found to update' if !values || values.empty? + + # Update each local custom targeting values object by changing its display + # name. + values.each do |value| + display_name = (value[:display_name].nil?) ? + value[:name] : value[:display_name] + value[:display_name] = display_name + ' (Deprecated)' + end + + # Update the custom targeting keys on the server. + result_values = custom_targeting_service.update_custom_targeting_values(values) + + if result_values + # Print details about each value in results. + result_values.each_with_index do |custom_targeting_value, index| + puts ("%d) Custom targeting key with ID [%d], name: %s," + + " displayName: %s was updated") % [index, custom_targeting_value[:id], + custom_targeting_value[:name], custom_targeting_value[:display_name]] + end + else + puts 'No targeting keys values updated' + end +end + +if __FILE__ == $0 + begin + update_custom_targeting_values() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/forecast_service/get_forecast.rb b/dfp_api/examples/v201311/forecast_service/get_forecast.rb new file mode 100755 index 000000000..7b75fffbb --- /dev/null +++ b/dfp_api/examples/v201311/forecast_service/get_forecast.rb @@ -0,0 +1,108 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets a forecast for a prospective line item. To determine which +# placements exist, run get_all_placements.rb. +# +# Tags: ForecastService.getForecast + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_forecast() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CreativeService. + forecast_service = dfp.service(:ForecastService, API_VERSION) + + # Set the placement that the prospective line item will target. + targeted_placement_ids = ['INSERT_PLACEMENT_ID_HERE'.to_i] + + # Create targeting. + targeting = { + :inventory_targeting => + {:targeted_placement_ids => targeted_placement_ids} + } + + # Create the creative placeholder. + creative_placeholder = { + :size => {:width => 300, :height => 250, :is_aspect_ratio => false} + } + + # Create prospective line item. + line_item = { + :line_item_type => 'SPONSORSHIP', + :targeting => targeting, + # Set the size of creatives that can be associated with this line item. + :creative_placeholders => [creative_placeholder], + # Set the line item's time to be now until the projected end date time. + :start_date_time_type => 'IMMEDIATELY', + :end_date_time => Time.utc(2014, 01, 01), + # Set the line item to use 50% of the impressions. + :unit_type => 'IMPRESSIONS', + :units_bought => 50, + # Set the cost type to match the unit type. + :cost_type => 'CPM' + } + + # Get forecast for the line item. + forecast = forecast_service.get_forecast(line_item) + + if forecast + # Display results. + matched = forecast[:matched_units] + available_percent = forecast[:available_units] * 100.0 / matched + unit_type = forecast[:unit_type].to_s.downcase + puts "%.2f %s matched." % [matched, unit_type] + puts "%.2f%% %s available." % [available_percent, unit_type] + if forecast[:possible_units] + possible_percent = forecast[:possible_units] * 100.0 / matched + puts "%.2f%% %s possible." % [possible_percent, unit_type] + end + puts "%d contending line items." % forecast[:contending_line_items].size + end +end + +if __FILE__ == $0 + begin + get_forecast() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/forecast_service/get_forecast_by_id.rb b/dfp_api/examples/v201311/forecast_service/get_forecast_by_id.rb new file mode 100755 index 000000000..57e1d36e2 --- /dev/null +++ b/dfp_api/examples/v201311/forecast_service/get_forecast_by_id.rb @@ -0,0 +1,81 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets a forecast for an existing line item. To determine which +# line items exist, run get_all_line_items.rb. +# +# Tags: ForecastService.getForecastById + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_forecast_by_id() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the CreativeService. + forecast_service = dfp.service(:ForecastService, API_VERSION) + + # Set the line item to get a forecast for. + line_item_id = 'INSERT_LINE_ITEM_ID_HERE'.to_i + + # Get forecast for line item. + forecast = forecast_service.get_forecast_by_id(line_item_id) + + if forecast + # Display results. + matched = forecast[:matched_units] + available_percent = forecast[:available_units] * 100.0 / matched + unit_type = forecast[:unit_type].to_s.downcase + puts "%.2f %s matched." % [matched, unit_type] + puts "%.2f%% %s available." % [available_percent, unit_type] + if forecast[:possible_units] + possible_percent = forecast[:possible_units] * 100.0 / matched + puts "%.2f%% %s possible." % [possible_percent, unit_type] + end + puts "%d contending line items." % forecast[:contending_line_items].size + end +end + +if __FILE__ == $0 + begin + get_forecast_by_id() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/inventory_service/create_ad_units.rb b/dfp_api/examples/v201311/inventory_service/create_ad_units.rb new file mode 100755 index 000000000..848ae8665 --- /dev/null +++ b/dfp_api/examples/v201311/inventory_service/create_ad_units.rb @@ -0,0 +1,101 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates new ad units under a the effective root ad unit. To +# determine which ad units exist, run get_inventory_tree.rb or +# get_all_ad_units.rb. +# +# Tags: InventoryService.createAdUnits, NetworkService.getCurrentNetwork + +require 'dfp_api' + +API_VERSION = :v201311 +# Number of ad units to create. +ITEM_COUNT = 5 + +def create_ad_units() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the InventoryService. + inventory_service = dfp.service(:InventoryService, API_VERSION) + + # Get the NetworkService. + network_service = dfp.service(:NetworkService, API_VERSION) + + # Get the effective root ad unit ID of the network. + effective_root_ad_unit_id = + network_service.get_current_network[:effective_root_ad_unit_id] + + puts "Using effective root ad unit: %d" % effective_root_ad_unit_id + + # Create the creative placeholder. + creative_placeholder = { + :size => {:width => 300, :height => 250, :is_aspect_ratio => false}, + :environment_type => 'BROWSER' + } + + # Create an array to store local ad unit objects. + ad_units = (1..ITEM_COUNT).map do |index| + {:name => "Ad_Unit_%d" % index, + :parent_id => effective_root_ad_unit_id, + :description => 'Ad unit description.', + :target_window => 'BLANK', + # Set the size of possible creatives that can match this ad unit. + :ad_unit_sizes => [creative_placeholder]} + end + + # Create the ad units on the server. + return_ad_units = inventory_service.create_ad_units(ad_units) + + if return_ad_units + return_ad_units.each do |ad_unit| + puts "Ad unit with ID: %d, name: %s and status: %s was created." % + [ad_unit[:id], ad_unit[:name], ad_unit[:status]] + end + else + raise 'No ad units were created.' + end +end + +if __FILE__ == $0 + begin + create_ad_units() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/inventory_service/create_mobile_ad_unit.rb b/dfp_api/examples/v201311/inventory_service/create_mobile_ad_unit.rb new file mode 100755 index 000000000..2c52f83a6 --- /dev/null +++ b/dfp_api/examples/v201311/inventory_service/create_mobile_ad_unit.rb @@ -0,0 +1,101 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates a new mobile ad unit under the effective root ad unit. +# To determine which ad units exist, run get_inventory_tree.rb or +# get_all_ad_units.rb. +# +# Mobile features need to be enabled on your account to use mobile targeting. +# +# Tags: InventoryService.createAdUnits, NetworkService.getCurrentNetwork + +require 'dfp_api' + +API_VERSION = :v201311 + +def create_mobile_ad_unit() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the InventoryService. + inventory_service = dfp.service(:InventoryService, API_VERSION) + + # Get the NetworkService. + network_service = dfp.service(:NetworkService, API_VERSION) + + # Get the effective root ad unit ID of the network. + effective_root_ad_unit_id = + network_service.get_current_network[:effective_root_ad_unit_id] + + puts "Using effective root ad unit: %s" % effective_root_ad_unit_id.to_s + + # Create ad unit size. + ad_unit_size = { + :size => {:width => 400, :height => 300, :is_aspect_ratio => false}, + :environment_type => 'BROWSER' + } + + # Create local ad unit object. + ad_unit = { + :name => "Mobile_Ad_Unit_%d" % (Time.new.to_f * 1000).to_i, + :parent_id => effective_root_ad_unit_id, + :description => 'Mobile Ad unit description', + :target_window => 'BLANK', + :target_platform => 'MOBILE', + :mobile_platform => 'APPLICATION', + # Set the size of possible creatives that can match this ad unit. + :ad_unit_sizes => [ad_unit_size] + } + + # Create the ad unit on the server. + return_ad_unit = inventory_service.create_ad_unit(ad_unit) + + if return_ad_unit + puts "Ad unit with ID: %d, name: %s and status: %s was created." % + [return_ad_unit[:id], return_ad_unit[:name], return_ad_unit[:status]] + else + raise 'No ad units were created.' + end +end + +if __FILE__ == $0 + begin + create_mobile_ad_unit() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/inventory_service/create_video_ad_unit.rb b/dfp_api/examples/v201311/inventory_service/create_video_ad_unit.rb new file mode 100755 index 000000000..b96fab400 --- /dev/null +++ b/dfp_api/examples/v201311/inventory_service/create_video_ad_unit.rb @@ -0,0 +1,108 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates a new video ad unit under a the effective root ad unit. +# To determine which ad units exist, run get_inventory_tree.rb or +# get_all_ad_units.rb. +# +# This feature is only available to DFP premium solution networks. +# +# Tags: InventoryService.createAdUnits, NetworkService.getCurrentNetwork + +require 'dfp_api' + +API_VERSION = :v201311 + +def create_video_ad_unit() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the InventoryService. + inventory_service = dfp.service(:InventoryService, API_VERSION) + + # Get the NetworkService. + network_service = dfp.service(:NetworkService, API_VERSION) + + # Get the effective root ad unit ID of the network. + effective_root_ad_unit_id = + network_service.get_current_network[:effective_root_ad_unit_id] + + puts "Using effective root ad unit: %s" % effective_root_ad_unit_id.to_s + + # Create master ad unit size. + master_ad_unit_size = { + :size => {:width => 400, :height => 300, :is_aspect_ratio => false}, + :environment_type => 'VIDEO_PLAYER', + # Add companions to master ad unit size. + :companions => [ + {:size => {:width => 300, :height => 250, :is_aspect_ratio => false}, + :environment_type => 'BROWSER'}, + {:size => {:width => 728, :height => 90, :is_aspect_ratio => false}, + :environment_type => 'BROWSER'} + ] + } + + # Create local ad unit object. + ad_unit = { + :name => "Video_Ad_Unit_%d" % (Time.new.to_f * 1000).to_i, + :parent_id => effective_root_ad_unit_id, + :description => 'Video Ad unit description', + :target_window => 'BLANK', + :explicitly_targeted => true, + :target_platform => 'WEB', + # Set the size of possible creatives that can match this ad unit. + :ad_unit_sizes => [master_ad_unit_size] + } + + # Create the ad unit on the server. + return_ad_unit = inventory_service.create_ad_unit(ad_unit) + + if return_ad_unit + puts "Ad unit with ID: %d, name: %s and status: %s was created." % + [return_ad_unit[:id], return_ad_unit[:name], return_ad_unit[:status]] + else + raise 'No ad units were created.' + end +end + +if __FILE__ == $0 + begin + create_video_ad_unit() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/inventory_service/deactivate_ad_units.rb b/dfp_api/examples/v201311/inventory_service/deactivate_ad_units.rb new file mode 100755 index 000000000..985564c3e --- /dev/null +++ b/dfp_api/examples/v201311/inventory_service/deactivate_ad_units.rb @@ -0,0 +1,119 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example deactivates all active ad units. To determine which ad units +# exist, run get_all_ad_units.rb or get_inventory_tree.rb. +# +# Tags: InventoryService.getLineItemsByStatement +# Tags: InventoryService.performAdUnitAction + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def deactivate_ad_units() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the InventoryService. + inventory_service = dfp.service(:InventoryService, API_VERSION) + + # Create statement text to select active ad units. + statement_text = 'WHERE status = :status' + statement = { + :values => [ + {:key => 'status', + :value => {:value => 'ACTIVE', :xsi_type => 'TextValue'}} + ] + } + + # Define initial values. + offset = 0 + page = {} + ad_unit_ids = [] + + begin + # Create a statement to get one page with the current offset. + statement[:query] = statement_text + + " LIMIT %d OFFSET %d" % [PAGE_SIZE, offset] + + # Get ad units by statement. + page = inventory_service.get_ad_units_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + page[:results].each do |ad_unit| + puts ("%d) Ad unit with ID: %d, status: %s and name: %s will be " + + "deactivated.") % [ad_unit_ids.size, ad_unit[:id], + ad_unit[:status], ad_unit[:name]] + ad_unit_ids << ad_unit[:id] + end + end + end while offset < page[:total_result_set_size] + + puts "Number of ad units to be deactivated: %d" % ad_unit_ids.size + + if !ad_unit_ids.empty? + # Modify statement for action. Note, the values are still present. + statement[:query] = statement_text + " AND id IN (%s)" % + ad_unit_ids.join(', ') + + # Perform action. + result = inventory_service.perform_ad_unit_action( + {:xsi_type => 'DeactivateAdUnits'}, statement) + + # Display results. + if result and result[:num_changes] > 0 + puts "Number of ad units deactivated: %d" % result[:num_changes] + else + puts 'No ad units were deactivated.' + end + else + puts 'No ad units found to deactivate.' + end +end + +if __FILE__ == $0 + begin + deactivate_ad_units() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/inventory_service/get_ad_unit.rb b/dfp_api/examples/v201311/inventory_service/get_ad_unit.rb new file mode 100755 index 000000000..665d83696 --- /dev/null +++ b/dfp_api/examples/v201311/inventory_service/get_ad_unit.rb @@ -0,0 +1,72 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets an ad unit by its ID. To determine which ad units +# exist, run get_inventory_tree.rb or get_all_ad_units.rb. +# +# Tags: InventoryService.getAdUnit + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_ad_unit() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the InventoryService. + inventory_service = dfp.service(:InventoryService, API_VERSION) + + # Set the ID of the ad unit to get. + ad_unit_id = 'INSERT_AD_UNIT_ID_HERE'.to_i + + # Get the ad unit. + ad_unit = inventory_service.get_ad_unit(ad_unit_id) + + if ad_unit + puts "Ad unit with ID: %d, name: %s and status: %s was found." % + [ad_unit[:id], ad_unit[:name], ad_unit[:status]] + end +end + +if __FILE__ == $0 + begin + get_ad_unit() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/inventory_service/get_ad_unit_sizes.rb b/dfp_api/examples/v201311/inventory_service/get_ad_unit_sizes.rb new file mode 100755 index 000000000..1b084f252 --- /dev/null +++ b/dfp_api/examples/v201311/inventory_service/get_ad_unit_sizes.rb @@ -0,0 +1,85 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This code example gets all web target platform ad unit sizes. +# +# Tags: InventoryService.getAdUnitSizesByStatement + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_all_ad_unit_sizes() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the InventoryService. + inventory_service = dfp.service(:InventoryService, API_VERSION) + + target_platform = 'WEB' + + # Create statement object to only select web ad unit sizes. + statement = { + :query => 'WHERE targetPlatform = :target_platform', + :values => [ + {:key => 'target_platform', + :value => {:value => target_platform, + :xsi_type => 'TextValue'}} + ] + } + + # Get ad unit sizes by statement. + ad_unit_sizes = inventory_service.get_ad_unit_sizes_by_statement(statement) + + if ad_unit_sizes + # Print details about each ad unit in results. + ad_unit_sizes.each_with_index do |ad_unit_size, index| + puts "%d) Web ad unit size of dimensions %s was found." % + [index, ad_unit_size[:full_display_string]] + end + else + puts 'No ad unit sizes found.' + end +end + +if __FILE__ == $0 + begin + get_all_ad_unit_sizes() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/inventory_service/get_ad_units_by_statement.rb b/dfp_api/examples/v201311/inventory_service/get_ad_units_by_statement.rb new file mode 100755 index 000000000..11ddf46ca --- /dev/null +++ b/dfp_api/examples/v201311/inventory_service/get_ad_units_by_statement.rb @@ -0,0 +1,96 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets first 500 children below the effective root ad unit. To +# create ad units, run create_ad_units.rb. +# +# Tags: InventoryService.getAdUnitsByStatement, NetworkService.getCurrentNetwork + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_ad_units_by_statement() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the InventoryService. + inventory_service = dfp.service(:InventoryService, API_VERSION) + + # Get the NetworkService. + network_service = dfp.service(:NetworkService, API_VERSION) + + # Get the effective root ad unit ID of the network. + effective_root_ad_unit_id = + network_service.get_current_network[:effective_root_ad_unit_id] + + puts "Using effective root ad unit: %d" % effective_root_ad_unit_id + + # Create a statement to select the children of the effective root ad unit. + statement = { + :query => 'WHERE parentId = :id LIMIT 500', + :values => [ + {:key => 'id', + :value => {:value => effective_root_ad_unit_id, + :xsi_type => 'NumberValue'}} + ] + } + + # Get ad units by statement. + page = inventory_service.get_ad_units_by_statement(statement) + + if page[:results] + # Print details about each ad unit in results. + page[:results].each_with_index do |ad_unit, index| + puts "%d) Ad unit ID: %d, name: %s, status: %s." % + [index, ad_unit[:id], ad_unit[:name], ad_unit[:status]] + end + end + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Total number of ad units: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_ad_units_by_statement() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/inventory_service/get_all_ad_units.rb b/dfp_api/examples/v201311/inventory_service/get_all_ad_units.rb new file mode 100755 index 000000000..2924937e9 --- /dev/null +++ b/dfp_api/examples/v201311/inventory_service/get_all_ad_units.rb @@ -0,0 +1,93 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all ad units. To create ad units, run create_ad_units.rb. +# +# Tags: InventoryService.getAdUnitsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_ad_units() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the InventoryService. + inventory_service = dfp.service(:InventoryService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create a statement to get one page with current offset. + statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]} + + # Get ad units by statement. + page = inventory_service.get_ad_units_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each ad unit in results. + page[:results].each_with_index do |ad_unit, index| + puts "%d) Ad unit ID: %d, name: %s, status: %s." % + [index + start_index, ad_unit[:id], + ad_unit[:name], ad_unit[:status]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Total number of ad units: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_ad_units() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/inventory_service/update_ad_units.rb b/dfp_api/examples/v201311/inventory_service/update_ad_units.rb new file mode 100755 index 000000000..b773834df --- /dev/null +++ b/dfp_api/examples/v201311/inventory_service/update_ad_units.rb @@ -0,0 +1,96 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example updates an ad unit by enabling AdSense to the first 500. To +# determine which ad units exist, run get_all_ad_units.rb or +# get_inventory_tree.rb. +# +# Tags: InventoryService.getAdUnitsByStatement, InventoryService.updateAdUnits + +require 'dfp_api' + +API_VERSION = :v201311 + +def update_ad_units() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the InventoryService. + inventory_service = dfp.service(:InventoryService, API_VERSION) + + # Create a statement to get first 500 ad units. + statement = {:query => "LIMIT 500"} + + # Get ad units by statement. + page = inventory_service.get_ad_units_by_statement(statement) + + if page[:results] + ad_units = page[:results] + + # Update each local ad unit object by enabling AdSense. + ad_units.each do |ad_unit| + ad_unit[:inherited_ad_sense_settings] = + {:value => {:ad_sense_enabled => true}} + # Workaround for issue #94. + ad_unit[:description] = "" if ad_unit[:description].nil? + end + + # Update the ad units on the server. + return_ad_units = inventory_service.update_ad_units(ad_units) + + if return_ad_units + return_ad_units.each do |ad_unit| + puts ("Ad unit with ID: %d, name: %s and status: %s was updated " + + "with AdSense enabled: %s") % + [ad_unit[:id], ad_unit[:name], ad_unit[:status], + ad_unit[:inherited_ad_sense_settings][:value][:ad_sense_enabled]] + end + else + raise 'No ad units were updated.' + end + else + puts 'No ad units found to update.' + end +end + +if __FILE__ == $0 + begin + update_ad_units() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/label_service/create_labels.rb b/dfp_api/examples/v201311/label_service/create_labels.rb new file mode 100755 index 000000000..1fed62ef2 --- /dev/null +++ b/dfp_api/examples/v201311/label_service/create_labels.rb @@ -0,0 +1,83 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates new labels. To determine which labels exist, run +# get_all_labels.rb. +# +# This feature is only available to DFP premium solution networks. +# +# Tags: LabelService.createLabels + +require 'dfp_api' + +API_VERSION = :v201311 +# Number of labels to create. +ITEM_COUNT = 5 + +def create_labels() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LabelService. + label_service = dfp.service(:LabelService, API_VERSION) + + # Create an array to store local label objects. + labels = (1..ITEM_COUNT).map do |index| + {:name => "Label #%d" % index, :types => ['COMPETITIVE_EXCLUSION']} + end + + # Create the labels on the server. + return_labels = label_service.create_labels(labels) + + if return_labels + return_labels.each do |label| + puts "Label with ID: %d, name: '%s' and types: '%s' was created." % + [label[:id], label[:name], label[:types].join(', ')] + end + else + raise 'No labels were created.' + end + +end + +if __FILE__ == $0 + begin + create_labels() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/label_service/deactivate_labels.rb b/dfp_api/examples/v201311/label_service/deactivate_labels.rb new file mode 100755 index 000000000..f71bd5746 --- /dev/null +++ b/dfp_api/examples/v201311/label_service/deactivate_labels.rb @@ -0,0 +1,118 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example deactivates all active labels. To determine which labels exist, +# run get_all_labels.rb. +# +# This feature is only available to DFP premium solution networks. +# +# Tags: LabelService.getLabelsByStatement, LabelService.performLabelAction + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def deactivate_labels() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LabelService. + label_service = dfp.service(:LabelService, API_VERSION) + + # Create statement text and statement to select active labels. + statement_text = 'WHERE isActive = :is_active' + statement = { + :values => [ + {:key => 'is_active', + :value => {:value => true, :xsi_type => 'BooleanValue'}} + ] + } + + # Define initial values. + offset = 0 + page = {} + label_ids = [] + + begin + # Modify the statement to get one page with current offset. + statement[:query] = statement_text + + " LIMIT %d OFFSET %d" % [PAGE_SIZE, offset] + + # Get labels by statement. + page = label_service.get_labels_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + page[:results].each do |label| + puts ("%d) Label ID: %d, name: %s will be deactivated.") % + [label_ids.size, label[:id], label[:name]] + label_ids << label[:id] + end + end + end while offset < page[:total_result_set_size] + + puts "Number of labels to be deactivated: %d" % label_ids.size + + if !label_ids.empty? + # Create a statement for action. + statement = {:query => "WHERE id IN (%s)" % label_ids.join(', ')} + + # Perform action. + result = label_service.perform_label_action( + {:xsi_type => 'DeactivateLabels'}, statement) + + # Display results. + if result and result[:num_changes] > 0 + puts "Number of labels deactivated: %d" % result[:num_changes] + else + puts 'No labels were deactivated.' + end + else + puts 'No labels found to deactivate.' + end +end + +if __FILE__ == $0 + begin + deactivate_labels() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/label_service/get_all_labels.rb b/dfp_api/examples/v201311/label_service/get_all_labels.rb new file mode 100755 index 000000000..1089cda39 --- /dev/null +++ b/dfp_api/examples/v201311/label_service/get_all_labels.rb @@ -0,0 +1,95 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all labels. To create labels, run create_labels.rb +# +# This feature is only available to DFP premium solution networks. +# +# Tags: LabelService.getLabelsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_labels() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LabelService. + label_service = dfp.service(:LabelService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create statement for one page with current offset. + statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]} + + # Get labels by statement. + page = label_service.get_labels_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each label in results page. + page[:results].each_with_index do |label, index| + puts "%d) Label ID: %d, name: '%s', types: '%s'." % + [index + start_index, label[:id], label[:name], + label[:types].join(', ')] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer + if page.include?(:total_result_set_size) + puts "Total number of labels: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_labels() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/label_service/get_label.rb b/dfp_api/examples/v201311/label_service/get_label.rb new file mode 100755 index 000000000..45dbd6cb0 --- /dev/null +++ b/dfp_api/examples/v201311/label_service/get_label.rb @@ -0,0 +1,76 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets a label by its ID. To determine which labels exist, +# run get_all_labels.rb. +# +# This feature is only available to DFP premium solution networks. +# +# Tags: LabelService.getLabel + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_label() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LabelService. + label_service = dfp.service(:LabelService, API_VERSION) + + # Set the ID of the label to get. + label_id = 'INSERT_LABEL_ID_HERE'.to_i + + # Get the label. + label = label_service.get_label(label_id) + + if label + puts "Label with ID: %d, name: '%s' and types '%s' was found." % + [label[:id], label[:name], label[:types].join(', ')] + else + puts 'No label found for this ID.' + end +end + +if __FILE__ == $0 + begin + get_label() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/label_service/get_labels_by_statement.rb b/dfp_api/examples/v201311/label_service/get_labels_by_statement.rb new file mode 100755 index 000000000..e294d3fea --- /dev/null +++ b/dfp_api/examples/v201311/label_service/get_labels_by_statement.rb @@ -0,0 +1,81 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all labels ordered by name. The statement retrieves up to +# the maximum page size limit of 500. To create labels, run create_labels.rb. +# +# This feature is only available to DFP premium solution networks. +# +# Tags: LabelService.getLabelsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_labels_by_statement() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LabelService. + label_service = dfp.service(:LabelService, API_VERSION) + + # Create a statement to select labels ordered by name. + statement = {:query => 'ORDER BY name LIMIT 500'} + + # Get labels by statement. + page = label_service.get_labels_by_statement(statement) + + if page and page[:results] + page[:results].each_with_index do |label, index| + puts "%d) Label ID: %d, name: '%s', types: '%s'." % [index, + label[:id], label[:name], label[:types].join(', ')] + end + end + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Number of results found: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_labels_by_statement() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/label_service/update_labels.rb b/dfp_api/examples/v201311/label_service/update_labels.rb new file mode 100755 index 000000000..214f02c45 --- /dev/null +++ b/dfp_api/examples/v201311/label_service/update_labels.rb @@ -0,0 +1,102 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example updates the descriptions of all active labels by updating its +# description, up to the first 500. To determine which labels exist, run +# get_all_labels.rb. +# +# This feature is only available to DFP premium solution networks. +# +# Tags: LabelService.getLabelsByStatement, LabelService.updateLabels + +require 'dfp_api' + +API_VERSION = :v201311 + +def update_labels() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LabelService. + label_service = dfp.service(:LabelService, API_VERSION) + + # Create a statement to only select active labels. + statement = { + :query => 'WHERE isActive = :is_active LIMIT 500', + :values => [ + {:key => 'is_active', + :value => { + :value => 'true', + :xsi_type => 'BooleanValue'} + } + ] + } + + # Get labels by statement. + page = label_service.get_labels_by_statement(statement) + + if page[:results] + labels = page[:results] + + # Update each local label object by changing its description. + labels.each do |label| + label[:description] = 'This label was updated' + end + + # Update the labels on the server. + return_labels = label_service.update_labels(labels) + + if return_labels + return_labels.each do |label| + puts("Label ID: %d, name: %s was updated with description: %s.") % + [label[:id], label[:name], label[:description]] + end + else + raise 'No labels were updated.' + end + else + puts 'No labels found to update.' + end +end + +if __FILE__ == $0 + begin + update_labels() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/line_item_creative_association_service/create_licas.rb b/dfp_api/examples/v201311/line_item_creative_association_service/create_licas.rb new file mode 100755 index 000000000..86a6d3ecd --- /dev/null +++ b/dfp_api/examples/v201311/line_item_creative_association_service/create_licas.rb @@ -0,0 +1,94 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates new line item creative associations (LICAs) for an +# existing line item and a set of creative ids. For small business networks, +# the creative ids must represent new or copied creatives as creatives cannot +# be used for more than one line item. For premium solution networks, the +# creative ids can represent any creatvie. To copy creatives, run +# copy_image_creatives.rb. To determine which LICAs exist, run get_all_licas.rb. +# +# Tags: LineItemCreativeAssociationService.createLineItemCreativeAssociations + +require 'dfp_api' + +API_VERSION = :v201311 + +def create_licas() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LineItemCreativeAssociationService. + lica_service = dfp.service(:LineItemCreativeAssociationService, API_VERSION) + + # Get the CreativeService. + creative_service = dfp.service(:CreativeService, API_VERSION) + + # Set the line item ID and creative IDs to associate. + line_item_id = 'INSERT_LINE_ITEM_ID_HERE'.to_i + creative_ids = [ + 'INSERT_CREATIVE_ID_HERE'.to_i, + 'INSERT_CREATIVE_ID_HERE'.to_i + ] + + # Create an array to store local LICA objects. + licas = creative_ids.map do |creative_id| + # For each line item, associate it with the given creative. + {:line_item_id => line_item_id, :creative_id => creative_id} + end + + # Create the LICAs on the server. + return_licas = lica_service.create_line_item_creative_associations(licas) + + if return_licas + return_licas.each do |lica| + puts ("LICA with line item ID: %d, creative ID: %d and status: %s was " + + "created.") % [lica[:line_item_id], lica[:creative_id], lica[:status]] + end + else + raise 'No LICAs were created.' + end + +end + +if __FILE__ == $0 + begin + create_licas() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/line_item_creative_association_service/deactivate_licas.rb b/dfp_api/examples/v201311/line_item_creative_association_service/deactivate_licas.rb new file mode 100755 index 000000000..8397466cc --- /dev/null +++ b/dfp_api/examples/v201311/line_item_creative_association_service/deactivate_licas.rb @@ -0,0 +1,127 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example deactivates all LICAs for the line item. To determine which LICAs +# exist, run get_all_licas.rb. To determine which line items exist, run +# get_all_line_items.rb. +# +# Tags: InventoryService.getLineItemsByStatement +# Tags: InventoryService.performAdUnitAction + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def deactivate_licas() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LineItemCreativeAssociationService. + lica_service = dfp.service(:LineItemCreativeAssociationService, API_VERSION) + + # Set the line item to get LICAs by. + line_item_id = 'INSERT_LINE_ITEM_ID_HERE'.to_i + + # Create statement text to select active LICAs for a given line item. + statement_text = 'WHERE lineItemId = :line_item_id AND status = :status' + + statement = { + :values => [ + {:key => 'line_item_id', + :value => {:value => line_item_id, :xsi_type => 'NumberValue'}}, + {:key => 'status', + :value => {:value => 'ACTIVE', :xsi_type => 'TextValue'}} + ] + } + + # Define initial values. + offset = 0 + page = {} + creative_ids = [] + + begin + # Create a statement to get one page with current offset. + statement[:query] = statement_text + + " LIMIT %d OFFSET %d" % [PAGE_SIZE, offset] + + # Get LICAs by statement. + page = + lica_service.get_line_item_creative_associations_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + page[:results].each do |lica| + puts ("%d) LICA with line item ID: %d, creative ID: %d and status: %s" + + " will be deactivated.") % [creative_ids.size, lica[:line_item_id], + lica[:creative_id], lica[:status]] + creative_ids << lica[:creative_id] + end + end + end while offset < page[:total_result_set_size] + + puts "Number of LICAs to be deactivated: %d" % creative_ids.size + + if !creative_ids.empty? + # Modify statement for action. Note, the values are still present. + statement[:query] = statement_text + " AND creativeId IN (%s)" % + creative_ids.join(', ') + + # Perform action. + result = lica_service.perform_line_item_creative_association_action( + {:xsi_type => 'DeactivateLineItemCreativeAssociations'}, statement) + + # Display results. + if result and result[:num_changes] > 0 + puts "Number of LICAs deactivated: %d" % result[:num_changes] + else + puts 'No LICAs were deactivated.' + end + else + puts 'No LICAs found to deactivate.' + end +end + +if __FILE__ == $0 + begin + deactivate_licas() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/line_item_creative_association_service/get_all_licas.rb b/dfp_api/examples/v201311/line_item_creative_association_service/get_all_licas.rb new file mode 100755 index 000000000..b14c6b3c8 --- /dev/null +++ b/dfp_api/examples/v201311/line_item_creative_association_service/get_all_licas.rb @@ -0,0 +1,98 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all line item creative associations (LICA). To create LICAs, +# run create_licas.rb or associate_creative_set_to_line_item.rb. +# +# Tags: LineItemCreativeAssociationService.getLineItemCreativeAssociationsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_licas() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LineItemCreativeAssociationService. + lica_service = dfp.service(:LineItemCreativeAssociationService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create statement for one page with current offset. + statement = {:query => 'LIMIT %d OFFSET %d' % [PAGE_SIZE, offset]} + + # Get LICAs by statement. + page = + lica_service.get_line_item_creative_associations_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each LICA in results page. + page[:results].each_with_index do |lica, index| + creative_text = (lica[:creative_set_id] != nil) ? + 'creative set ID %d' % lica[:creative_set_id] : + 'creative ID %d' % lica[:creative_id] + puts '%d) LICA with line item ID: %d, %s and status: %s' % + [index + start_index, lica[:line_item_id], creative_text, + lica[:status]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer + if page.include?(:total_result_set_size) + puts 'Total number of LICAs: %d' % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_licas() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts 'HTTP Error: %s' % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts 'Message: %s' % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/line_item_creative_association_service/get_lica.rb b/dfp_api/examples/v201311/line_item_creative_association_service/get_lica.rb new file mode 100755 index 000000000..122ad6481 --- /dev/null +++ b/dfp_api/examples/v201311/line_item_creative_association_service/get_lica.rb @@ -0,0 +1,77 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets a line item creative association (LICA) by the line item and +# creative ID. To determine which line items exist, run get_all_line_items.rb. +# To determine which creatives exit, run get_all_creatives.rb. +# +# Tags: LineItemCreativeAssociationService.getLineItemCreativeAssociation + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_lica() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LineItemCreativeAssociationService. + lica_service = dfp.service(:LineItemCreativeAssociationService, API_VERSION) + + # Set the line item and creative IDs to use to retrieve the LICA. + line_item_id = 'INSERT_LINE_ITEM_ID_HERE'.to_i + creative_id = 'INSERT_CREATIVE_ID_HERE'.to_i + + # Get the LICA. + lica = + lica_service.get_line_item_creative_association(line_item_id, creative_id) + + if lica + puts ("LICA with line item ID: %d, creative ID: %d and status: %s was " + + "found.") % [lica[:line_item_id], lica[:creative_id], lica[:status]] + else + puts 'No lica found for this ID.' + end +end + +if __FILE__ == $0 + begin + get_lica() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/line_item_creative_association_service/get_licas_by_statement.rb b/dfp_api/examples/v201311/line_item_creative_association_service/get_licas_by_statement.rb new file mode 100755 index 000000000..df2db3111 --- /dev/null +++ b/dfp_api/examples/v201311/line_item_creative_association_service/get_licas_by_statement.rb @@ -0,0 +1,91 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all line item creative associations for a given line item +# ID. The statement retrieves up to the maximum page size limit of 500. To +# create LICAs, run create_licas.rb. To determine which line items exist, run +# get_all_line_items.rb. +# +# Tags: LineItemCreativeAssociationService.getLineItemCreativeAssociationsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_licas_by_statement() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LineItemCreativeAssociationService. + lica_service = dfp.service(:LineItemCreativeAssociationService, API_VERSION) + + # Set the line item to get LICAs by. + line_item_id = 'INSERT_LINE_ITEM_ID_HERE'.to_i + + # Create a statement to only select LICAs for the given line item ID. + statement = { + :query => 'WHERE lineItemId = :line_item_id LIMIT 500', + :values => [ + {:key => 'line_item_id', + :value => {:value => line_item_id, :xsi_type => 'NumberValue'}} + ] + } + + # Get LICAs by statement. + page = + lica_service.get_line_item_creative_associations_by_statement(statement) + + if page and page[:results] + page[:results].each_with_index do |lica, index| + puts "%d) LICA with line item ID: %d, creative ID: %d and status: %s." % + [index, lica[:line_item_id], lica[:creative_id], lica[:status]] + end + end + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Number of results found: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_licas_by_statement() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/line_item_creative_association_service/update_licas.rb b/dfp_api/examples/v201311/line_item_creative_association_service/update_licas.rb new file mode 100755 index 000000000..c16371956 --- /dev/null +++ b/dfp_api/examples/v201311/line_item_creative_association_service/update_licas.rb @@ -0,0 +1,91 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example updates the destination URL of all LICAs up to the first 500. To +# determine which LICAs exist, run get_all_licas.rb. +# +# Tags: LineItemCreativeAssociationService.getLineItemCreativeAssociationsByStatement +# Tags: LineItemCreativeAssociationService.updateLineItemCreativeAssociations + +require 'dfp_api' + +API_VERSION = :v201311 + +def update_licas() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LineItemCreativeAssociationService. + lica_service = dfp.service(:LineItemCreativeAssociationService, API_VERSION) + + # Create a statement to get all LICAs. + statement = {:query => 'LIMIT 500'} + + # Get LICAs by statement. + page = + lica_service.get_line_item_creative_associations_by_statement(statement) + + if page[:results] + licas = page[:results] + + # Update each local LICA object by changing its destination URL. + licas.each {|lica| lica[:destination_url] = 'http://news.google.com'} + + # Update the LICAs on the server. + return_licas = lica_service.update_line_item_creative_associations(licas) + + if return_licas + return_licas.each do |lica| + puts ("LICA with line item ID: %d and creative ID: %d was updated " + + "with destination url [%s]") % + [lica[:line_item_id], lica[:creative_id], lica[:destination_url]] + end + else + raise 'No LICAs were updated.' + end + else + puts 'No LICAs found to update.' + end +end + +if __FILE__ == $0 + begin + update_licas() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/line_item_service/activate_line_items.rb b/dfp_api/examples/v201311/line_item_service/activate_line_items.rb new file mode 100755 index 000000000..a41057637 --- /dev/null +++ b/dfp_api/examples/v201311/line_item_service/activate_line_items.rb @@ -0,0 +1,131 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example activates all line items for the given order. To be activated, +# line items need to be in the approved (needs creatives) state and have at +# least one creative associated with them. To approve line items, approve the +# order to which they belong by running approve_orders.rb. To create LICAs, run +# create_licas.rb. To determine which line items exist, run +# get_all_line_items.rb. To determine which orders exist, run get_all_orders.rb. +# +# Tags: LineItemService.getLineItemsByStatement +# Tags: LineItemService.performLineItemAction + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def activate_line_items() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LineItemService. + line_item_service = dfp.service(:LineItemService, API_VERSION) + + # Set the ID of the order to get line items from. + order_id = 'INSERT_ORDER_ID_HERE'.to_i + + # Create a statement to only select line items from the specified order that + # are in the approved (needs creatives) state. + statement_text = 'WHERE orderID = :order_id AND status = :status' + statement = { + :values => [ + {:key => 'order_id', + :value => {:value => order_id, :xsi_type => 'NumberValue'}}, + {:key => 'status', + :value => {:value => 'NEEDS_CREATIVES', :xsi_type => 'TextValue'}} + ] + } + + # Define initial values. + offset = 0 + page = {} + line_item_ids = [] + + begin + # Create a statement to get one page with current offset. + statement[:query] = statement_text + + " LIMIT %d OFFSET %d" % [PAGE_SIZE, offset] + + # Get line items by statement. + page = line_item_service.get_line_items_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + page[:results].each do |line_item| + if !line_item[:is_archived] + puts ("%d) Line item with ID: %d, order ID: %d and name: %s will " + + "be activated.") % [line_item_ids.size, line_item[:id], + line_item[:order_id], line_item[:name]] + line_item_ids << line_item[:id] + end + end + end + end while offset < page[:total_result_set_size] + + puts "Number of line items to be activated: %d" % line_item_ids.size + + if !line_item_ids.empty? + # Modify statement for action. Note, the values are still present. + statement[:query] = statement_text + " AND id IN (%s)" % + line_item_ids.join(', ') + + # Perform action. + result = line_item_service.perform_line_item_action( + {:xsi_type => 'ActivateLineItems'}, statement) + + # Display results. + if result and result[:num_changes] > 0 + puts "Number of line items activated: %d" % result[:num_changes] + else + puts 'No line items were activated.' + end + else + puts 'No line items found to activate.' + end +end + +if __FILE__ == $0 + begin + activate_line_items() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/line_item_service/create_line_items.rb b/dfp_api/examples/v201311/line_item_service/create_line_items.rb new file mode 100755 index 000000000..870289a5d --- /dev/null +++ b/dfp_api/examples/v201311/line_item_service/create_line_items.rb @@ -0,0 +1,177 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates new line items. To determine which line items exist, run +# get_all_line_items.rb. To determine which orders exist, run +# get_all_orders.rb. To determine which placements exist, run +# get_all_placements.rb. To determine the IDs for locations, run +# get_all_cities.rb, get_all_countries.rb, get_all_metros.rb and +# get_all_regions.rb. +# +# Tags: LineItemService.createLineItems + +require 'dfp_api' + +API_VERSION = :v201311 +# Number of line items to create. +ITEM_COUNT = 5 + +def create_line_items() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LineItemService. + line_item_service = dfp.service(:LineItemService, API_VERSION) + + # Set the order that all created line items will belong to and the placement + # ID to target. + order_id = 'INSERT_ORDER_ID_HERE'.to_i + targeted_placement_ids = Array.new(ITEM_COUNT) do + 'INSERT_PLACEMENT_ID_HERE'.to_i + end + + # Create inventory targeting. + inventory_targeting = {:targeted_placement_ids => targeted_placement_ids} + + # Create geographical targeting. + geo_targeting = { + # Include targets. + :targeted_locations => [ + {:id => 2840}, # USA. + {:id => 20123}, # Quebec, Canada. + {:id => 9000093} # Postal code B3P (Canada). + ], + # Exclude targets. + :excluded_locations => [ + {:id => 1016367}, # Chicago. + {:id => 200501} # New York. + ] + } + + # Create user domain targeting. Exclude domains that are not under the + # network's control. + user_domain_targeting = {:domains => ['usa.gov'], :targeted => false} + + # Create day-part targeting. + day_part_targeting = { + # Target only the weekend in the browser's timezone. + :time_zone => 'BROWSER', + :day_parts => [ + {:day_of_week => 'SATURDAY', + :start_time => {:hour => 0, :minute => 'ZERO'}, + :end_time => {:hour => 24, :minute => 'ZERO'}}, + {:day_of_week => 'SUNDAY', + :start_time => {:hour => 0, :minute => 'ZERO'}, + :end_time => {:hour => 24, :minute => 'ZERO'}} + ] + } + + # Create technology targeting. + technology_targeting = { + # Create browser targeting. + :browser_targeting => { + :is_targeted => true, + # Target just the Chrome browser. + :browsers => [{:id => 500072}] + } + } + + # Create targeting. + targeting = {:geo_targeting => geo_targeting, + :inventory_targeting => inventory_targeting, + :user_domain_targeting => user_domain_targeting, + :day_part_targeting => day_part_targeting, + :technology_targeting => technology_targeting + } + + # Create an array to store local line item objects. + line_items = (1..ITEM_COUNT).map do |index| + line_item = {:name => "Line item #%d-%d" % [Time.new.to_f * 1000, index], + :order_id => order_id, + :targeting => targeting, + :line_item_type => 'STANDARD', + :allow_overbook => true} + # Set the creative rotation type to even. + line_item[:creative_rotation_type] = 'EVEN' + + # Create the creative placeholder. + creative_placeholder = { + :size => {:width => 300, :height => 250, :is_aspect_ratio => false} + } + + # Set the size of creatives that can be associated with this line item. + line_item[:creative_placeholders] = [creative_placeholder] + + # Set the length of the line item to run. + line_item[:start_date_time_type] = 'IMMEDIATELY' + line_item[:end_date_time] = Time.new + 60 * 60 * 24 * 7 + + # Set the cost per unit to $2. + line_item[:cost_type] = 'CPM' + line_item[:cost_per_unit] = { + :currency_code => 'USD', + :micro_amount => 2000000 + } + + # Set the number of units bought to 500,000 so that the budget is $1,000. + line_item[:units_bought] = 500000 + line_item[:unit_type] = 'IMPRESSIONS' + + line_item + end + + # Create the line items on the server. + return_line_items = line_item_service.create_line_items(line_items) + + if return_line_items + return_line_items.each do |line_item| + puts ("Line item with ID: %d, belonging to order ID: %d, " + + "and named: %s was created.") % + [line_item[:id], line_item[:order_id], line_item[:name]] + end + else + raise 'No line items were created.' + end +end + +if __FILE__ == $0 + begin + create_line_items() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/line_item_service/create_mobile_line_item.rb b/dfp_api/examples/v201311/line_item_service/create_mobile_line_item.rb new file mode 100755 index 000000000..7de109ae3 --- /dev/null +++ b/dfp_api/examples/v201311/line_item_service/create_mobile_line_item.rb @@ -0,0 +1,135 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example create a new line item to serve to the mobile platform. To +# determine which line items exist, run get_all_line_items.rb. To determine +# which orders exist, run get_all_orders.rb. To create a mobile ad unit, run +# create_mobile_ad_unit.rb. To determine which placements exist, run +# get_all_placements.rb. +# +# Mobile features needs to be enabled in your account to use mobile targeting. +# +# Tags: LineItemService.createLineItem + +require 'dfp_api' + +API_VERSION = :v201311 + +def create_mobile_line_item() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LineItemService. + line_item_service = dfp.service(:LineItemService, API_VERSION) + + # Set the order that all created line items will belong to and the + # placement containing ad units with a mobile target platform. + order_id = 'INSERT_ORDER_ID_HERE'.to_i + targeted_placement_id = 'INSERT_MOBILE_PLACEMENT_ID_HERE'.to_i + + # Create inventory targeting. + inventory_targeting = {:targeted_placement_ids => [targeted_placement_id]} + + # Create technology targeting. + technology_targeting = { + :device_manufacturer_targeting => { + # Target the Google device manufacturer (40100). + :device_manufacturers => [{:id => 40100}], + :is_targeted => true + }, + :mobile_device_targeting => { + # Exclude the Nexus One device (604046). + :excluded_mobile_devices => [{:id => 604046}] + }, + :mobile_device_submodel_targeting => { + # Target the iPhone 4 device submodel (640003). + :targeted_mobile_device_submodels => [{:id => 640003}] + } + } + + # Create targeting. + targeting = { + :inventory_targeting => inventory_targeting, + :technology_targeting => technology_targeting + } + + # Create local line item object. + line_item = { + :name => 'Mobile line item', + :order_id => order_id, + :targeting => targeting, + :line_item_type => 'STANDARD', + :allow_overbook => true, + # Set the target platform to mobile. + :target_platform => 'MOBILE', + # Set the creative rotation type to even. + :creative_rotation_type => 'EVEN', + # Set the size of creatives that can be associated with this line item. + :creative_placeholders => [ + {:size => {:width => 300, :height => 250, :is_aspect_ratio => false}} + ], + # Set the length of the line item to run. + :start_date_time_type => 'IMMEDIATELY', + :end_date_time => Time.new + 60 * 60 * 24 * 7, + # Set the cost per day to $2. + :cost_type => 'CPM', + :cost_per_unit => {:currency_code => 'USD', :micro_amount => 2000000}, + # Set the number of units bought to 500,000 so that the budget is $1,000. + :units_bought => 500000, + :unit_type => 'IMPRESSIONS' + } + + # Create the line item on the server. + return_line_item = line_item_service.create_line_item(line_item) + + if return_line_item + puts(("Line item with ID: %d, belonging to order ID: %d, " + + "and named: %s was created.") % + [return_line_item[:id], return_line_item[:order_id], + return_line_item[:name]]) + else + raise 'No line items were created.' + end +end + +if __FILE__ == $0 + begin + create_mobile_line_item() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/line_item_service/create_video_line_item.rb b/dfp_api/examples/v201311/line_item_service/create_video_line_item.rb new file mode 100755 index 000000000..bd5030060 --- /dev/null +++ b/dfp_api/examples/v201311/line_item_service/create_video_line_item.rb @@ -0,0 +1,158 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example create a new line item to serve to video content. To determine +# which line items exist, run get_all_line_items.rb. To determine which orders +# exist, run get_all_orders.rb. To create a video ad unit, run +# create_video_ad_unit.rb. To create criteria for categories, run +# create_custom_targeting_keys_and_values.rb. +# +# This feature is only available to DFP premium solution networks. +# +# Tags: LineItemService.createLineItem + +require 'dfp_api' + +API_VERSION = :v201311 + +def create_video_line_item() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LineItemService. + line_item_service = dfp.service(:LineItemService, API_VERSION) + + # Set the order that the created line item will belong to and the video ad + # unit ID to target. + order_id = 'INSERT_ORDER_ID_HERE'.to_i + targeted_video_ad_unit_id = 'INSERT_VIDEO_AD_UNIT_ID_HERE'.to_s + + # Set the custom targeting key ID and value ID representing the metadata on + # the content to target. This would typically be a key representing a "genre" + # and a value representing something like "comedy". + content_custom_targeting_key_id = + 'INSERT_CONTENT_CUSTOM_TARGETING_KEY_ID_HERE'.to_i + content_custom_targeting_value_id = + 'INSERT_CONTENT_CUSTOM_TARGETING_VALUE_ID_HERE'.to_i + + # Create custom criteria for the content metadata targeting. + content_custom_criteria = { + :xsi_type => 'CustomCriteria', + :key_id => content_custom_targeting_key_id, + :value_ids => [content_custom_targeting_value_id], + :operator => 'IS' + } + + # Create custom criteria set. + custom_criteria_set = { + :children => [content_custom_criteria] + } + + # Create inventory targeting. + inventory_targeting = { + :targeted_ad_units => [ + {:ad_unit_id => targeted_video_ad_unit_id} + ] + } + + # Create video position targeting. + video_position = {:position_type => 'PREROLL'} + video_position_target = {:video_position => video_position} + video_position_targeting = {:targeted_positions => [video_position_target]} + + # Create targeting. + targeting = { + :custom_targeting => custom_criteria_set, + :inventory_targeting => inventory_targeting, + :video_position_targeting => video_position_targeting + } + + # Create local line item object. + line_item = { + :name => 'Video line item', + :order_id => order_id, + :targeting => targeting, + :line_item_type => 'SPONSORSHIP', + :allow_overbook => true, + # Set the environment type to video. + :environment_type => 'VIDEO_PLAYER', + # Set the creative rotation type to optimized. + :creative_rotation_type => 'OPTIMIZED', + # Set delivery of video companions to optional. + :companion_delivery_option => 'OPTIONAL', + # Set the length of the line item to run. + :start_date_time_type => 'IMMEDIATELY', + :end_date_time => Time.new + 60 * 60 * 24 * 7, + # Set the cost per day to $1. + :cost_type => 'CPD', + :cost_per_unit => {:currency_code => 'USD', :micro_amount => 1000000}, + # Set the percentage to be 100%. + :units_bought => 100 + } + + # Create the master creative placeholder and companion creative placeholders. + creative_master_placeholder = { + :size => {:width => 400, :height => 300, :is_aspect_ratio => false}, + :companions => [ + {:size => {:width => 300, :height => 250, :is_aspect_ratio => false}}, + {:size => {:width => 728, :height => 90, :is_aspect_ratio => false}} + ] + } + + # Set the size of creatives that can be associated with this line item. + line_item[:creative_placeholders] = [creative_master_placeholder] + + # Create the line item on the server. + return_line_item = line_item_service.create_line_item(line_item) + + if return_line_item + puts(("Line item with ID: %d, belonging to order ID: %d, " + + "and named: %s was created.") % + [return_line_item[:id], return_line_item[:order_id], + return_line_item[:name]]) + else + raise 'No line items were created.' + end +end + +if __FILE__ == $0 + begin + create_video_line_item() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/line_item_service/get_all_line_items.rb b/dfp_api/examples/v201311/line_item_service/get_all_line_items.rb new file mode 100755 index 000000000..572058d52 --- /dev/null +++ b/dfp_api/examples/v201311/line_item_service/get_all_line_items.rb @@ -0,0 +1,94 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all line items. To create line items, run +# create_line_items.rb. +# +# Tags: LineItemService.getLineItemsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_line_items() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LineItemService. + line_item_service = dfp.service(:LineItemService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create a statement to get one page with current offset. + statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]} + + # Get line items by statement. + page = line_item_service.get_line_items_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each line item in results. + page[:results].each_with_index do |line_item, index| + puts "%d) Line item ID: %d, order ID: %d, name: %s" % + [index + start_index, line_item[:id], + line_item[:order_id], line_item[:name]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Total number of line items: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_line_items() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/line_item_service/get_line_item.rb b/dfp_api/examples/v201311/line_item_service/get_line_item.rb new file mode 100755 index 000000000..2cbbb0640 --- /dev/null +++ b/dfp_api/examples/v201311/line_item_service/get_line_item.rb @@ -0,0 +1,74 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets a line item by its ID. To determine which line items +# exist, run get_all_line_items.rb. +# +# Tags: LineItemService.getLineItem + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_line_item() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LineItemService. + line_item_service = dfp.service(:LineItemService, API_VERSION) + + # Set the ID of the line_item to get. + line_item_id = 'INSERT_LINE_ITEM_ID_HERE'.to_i + + # Get the line item. + line_item = line_item_service.get_line_item(line_item_id) + + if line_item + puts "Line item with ID: %d, name: %s and order id: %d was found." % + [line_item[:id], line_item[:name], line_item[:order_id]] + else + puts 'No line item found for this ID.' + end +end + +if __FILE__ == $0 + begin + get_line_item() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/line_item_service/get_line_items_by_statement.rb b/dfp_api/examples/v201311/line_item_service/get_line_items_by_statement.rb new file mode 100755 index 000000000..e642a06aa --- /dev/null +++ b/dfp_api/examples/v201311/line_item_service/get_line_items_by_statement.rb @@ -0,0 +1,93 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all line items that need creatves for the given order. The +# statement retrieves up to the maximum page size limit of 500. To create line +# items, run create_line_items.rb. To determine which orders exist, run +# get_all_orders.rb. +# +# Tags: LineItemService.getLineItemsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_line_items_by_statement() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LineItemService. + line_item_service = dfp.service(:LineItemService, API_VERSION) + + # Set the ID of the order to get line items from. + order_id = 'INSERT_ORDER_ID_HERE'.to_i + + # Create a statement to only select line items that need creatives from a + # given order. + statement = { + :query => 'WHERE orderId = :order_id AND status = :status LIMIT 500', + :values => [ + {:key => 'order_id', + :value => {:value => order_id, :xsi_type => 'NumberValue'}}, + {:key => 'status', + :value => {:value => 'NEEDS_CREATIVES', :xsi_type => 'TextValue'}} + ] + } + + # Get line items by statement. + page = line_item_service.get_line_items_by_statement(statement) + + if page and page[:results] + page[:results].each_with_index do |line_item, index| + puts "%d) [%d] belongs to order ID %d, name: %s." % [index, + line_item[:id], line_item[:order_id], line_item[:name]] + end + end + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Number of results found: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_line_items_by_statement() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/line_item_service/get_recently_updated_line_items.rb b/dfp_api/examples/v201311/line_item_service/get_recently_updated_line_items.rb new file mode 100755 index 000000000..7c1e23436 --- /dev/null +++ b/dfp_api/examples/v201311/line_item_service/get_recently_updated_line_items.rb @@ -0,0 +1,98 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This code example shows how to get recently updated line items. To create line +# items, run create_line_items.rb. To determine which orders exist, run +# get_all_orders.rb. +# +# Tags: LineItemService.getLineItemsByStatement + +require 'date' + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_recently_updated_line_items() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LineItemService. + line_item_service = dfp.service(:LineItemService, API_VERSION) + + # Set the ID of the order to get line items from. + order_id = 'INSERT_ORDER_ID_HERE'.to_i + + # Create statement object to only select line items belonging to the order and + # have been modified in the last 3 days. + statement = { + :query => 'WHERE lastModifiedDateTime >= :date_time_string AND ' + + 'orderId = :order_id LIMIT 500', + :values => [ + {:key => 'order_id', + :value => {:value => order_id, :xsi_type => 'NumberValue'}}, + {:key => 'date_time_string', + :value => { + :value => (DateTime.now - 3).strftime('%Y-%m-%dT%H:%M:%S'), + :xsi_type => 'TextValue' + }}, + ] + } + + # Get line items by statement. + page = line_item_service.get_line_items_by_statement(statement) + + if page and page[:results] + page[:results].each_with_index do |line_item, index| + puts "%d) [%d] belongs to order ID %d, name: %s." % [index, + line_item[:id], line_item[:order_id], line_item[:name]] + end + end + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Number of results found: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_recently_updated_line_items() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/line_item_service/target_custom_criteria.rb b/dfp_api/examples/v201311/line_item_service/target_custom_criteria.rb new file mode 100755 index 000000000..ce7f43cc0 --- /dev/null +++ b/dfp_api/examples/v201311/line_item_service/target_custom_criteria.rb @@ -0,0 +1,129 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example updates a line item to add custom criteria targeting. To +# determine which line items exist, run get_all_line_items.rb. To determine +# which custom targeting keys and values exist, run +# get_all_custom_targeting_keys_and_values.rb. +# +# Tags: LineItemService.getLineItem, LineItemService.updateLineItem + +require 'dfp_api' + +require 'pp' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def target_custom_criteria() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LineItemService. + line_item_service = dfp.service(:LineItemService, API_VERSION) + + # Set the ID of the line item to update targeting. + line_item_id = 'INSERT_LINE_ITEM_ID_HERE'.to_i + + # Set the IDs of the custom targeting keys. + custom_criteria_ids = [ + {:key => 'INSERT_CUSTOM_TARGETING_KEY_ID_HERE'.to_i, + :values => ['INSERT_CUSTOM_TARGETING_VALUE_IDS_HERE'.to_i]}, + {:key => 'INSERT_CUSTOM_TARGETING_KEY_ID_HERE'.to_i, + :values => ['INSERT_CUSTOM_TARGETING_VALUE_IDS_HERE'.to_i]}, + {:key => 'INSERT_CUSTOM_TARGETING_KEY_ID_HERE'.to_i, + :values => ['INSERT_CUSTOM_TARGETING_VALUE_IDS_HERE'.to_i]} + ] + + # Create custom criteria. + custom_criteria = [ + {:xsi_type => 'CustomCriteria', + :key_id => custom_criteria_ids[0][:key], + :value_ids => custom_criteria_ids[0][:values], + :operator => 'IS'}, + {:xsi_type => 'CustomCriteria', + :key_id => custom_criteria_ids[1][:key], + :value_ids => custom_criteria_ids[1][:values], + :operator => 'IS_NOT'}, + {:xsi_type => 'CustomCriteria', + :key_id => custom_criteria_ids[2][:key], + :value_ids => custom_criteria_ids[2][:values], + :operator => 'IS'} + ] + + # Create the custom criteria set that will resemble: + # + # (custom_criteria[0].key == custom_criteria[0].values OR + # (custom_criteria[1].key != custom_criteria[1].values AND + # custom_criteria[2].key == custom_criteria[2].values)) + sub_custom_criteria_set = { + :xsi_type => 'CustomCriteriaSet', + :logical_operator => 'AND', + :children => [custom_criteria[1], custom_criteria[2]] + } + top_custom_criteria_set = { + :xsi_type => 'CustomCriteriaSet', + :logical_operator => 'OR', + :children => [custom_criteria[0], sub_custom_criteria_set] + } + + # Get the line item. + line_item = line_item_service.get_line_item(line_item_id) + + # Set the custom criteria targeting on the line item. + line_item[:targeting] = {:custom_targeting => top_custom_criteria_set} + + # Update the line items on the server. + return_line_item = line_item_service.update_line_item(line_item) + + # Display the updated line item. + if return_line_item + puts "Line item ID: %d was updated with custom criteria targeting:" % + return_line_item[:id] + pp return_line_item[:targeting] + else + puts 'Line item update failed.' + end +end + +if __FILE__ == $0 + begin + target_custom_criteria() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/line_item_service/update_line_items.rb b/dfp_api/examples/v201311/line_item_service/update_line_items.rb new file mode 100755 index 000000000..5f89f956d --- /dev/null +++ b/dfp_api/examples/v201311/line_item_service/update_line_items.rb @@ -0,0 +1,109 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example updates the delivery rate of all line items for an order up to +# the first 500. To determine which line items exist, run get_all_line_items.rb. +# To determine which order exist, run get_all_orders.rb. +# +# Tags: LineItemService.getLineItemsByStatement, LineItemService.updateLineItems + +require 'dfp_api' + +API_VERSION = :v201311 + +def update_line_items() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LineItemService. + line_item_service = dfp.service(:LineItemService, API_VERSION) + + # Set the ID of the order to get line items from. + order_id = 'INSERT_ORDER_ID_HERE'.to_i + + # Create a statement to get line items with even delivery rates. + statement = { + :query => 'WHERE deliveryRateType = :delivery_rate_type AND ' + + 'orderId = :order_id LIMIT 500', + :values => [ + {:key => 'delivery_rate_type', + :value => {:value => 'EVENLY', :xsi_type => 'TextValue'}}, + {:key => 'order_id', + :value => {:value => order_id, :xsi_type => 'NumberValue'}} + ] + } + + # Get line items by statement. + page = line_item_service.get_line_items_by_statement(statement) + + if page[:results] + line_items = page[:results] + + # Update each local line item object by changing its delivery rate. + new_line_items = line_items.inject([]) do |new_line_items, line_item| + # Archived line items can not be updated. + if !line_item[:is_archived] + line_item[:delivery_rate_type] = 'AS_FAST_AS_POSSIBLE' + new_line_items << line_item + end + new_line_items + end + + # Update the line items on the server. + return_line_items = line_item_service.update_line_items(new_line_items) + + if return_line_items + return_line_items.each do |line_item| + puts ("Line item ID: %d, order ID: %d, name: %s was updated with " + + "delivery rate: %s") % [line_item[:id], line_item[:order_id], + line_item[:name], line_item[:delivery_rate_type]] + end + else + raise 'No line items were updated.' + end + else + puts 'No line items found to update.' + end +end + +if __FILE__ == $0 + begin + update_line_items() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/network_service/get_all_networks.rb b/dfp_api/examples/v201311/network_service/get_all_networks.rb new file mode 100755 index 000000000..d1888c29f --- /dev/null +++ b/dfp_api/examples/v201311/network_service/get_all_networks.rb @@ -0,0 +1,74 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all Networks to which the current login has access. +# +# Tags: NetworkService.getAllNetworks + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_all_networks() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the NetworkService. + network_service = dfp.service(:NetworkService, API_VERSION) + + # Execute request and get the response. + networks = network_service.get_all_networks() + + if networks + # Print details about each network in results page. + networks.each_with_index do |network, index| + puts "%d) Network ID: %d, name: %s, code: %s." % + [index, network[:id], network[:display_name], + network[:network_code]] + end + # Print a footer + puts "Total number of networks: %d" % networks.size + end +end + +if __FILE__ == $0 + begin + get_all_networks() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/network_service/get_current_network.rb b/dfp_api/examples/v201311/network_service/get_current_network.rb new file mode 100755 index 000000000..b92e10e6d --- /dev/null +++ b/dfp_api/examples/v201311/network_service/get_current_network.rb @@ -0,0 +1,66 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets the current network that you can make requests against. +# +# Tags: NetworkService.getCurrentNetwork + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_current_network() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the NetworkService. + network_service = dfp.service(:NetworkService, API_VERSION) + + # Get the current network. + network = network_service.get_current_network() + + puts "Current network has network code %d and display name %s." % + [network[:network_code], network[:display_name]] +end + +if __FILE__ == $0 + begin + get_current_network() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/network_service/make_test_network.rb b/dfp_api/examples/v201311/network_service/make_test_network.rb new file mode 100755 index 000000000..a844cf606 --- /dev/null +++ b/dfp_api/examples/v201311/network_service/make_test_network.rb @@ -0,0 +1,79 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates a test network. You do not need to have a DFP account to +# run this example, but you do need to have a Google account (created at +# http://www.google.com/accounts/newaccount if you currently don't have one) +# that is not associated with any other DFP test networks (including old sandbox +# networks). Once this network is created, you can supply the network code in +# your settings to make calls to other services. +# +# Please see the following URL for more information: +# https://developers.google.com/doubleclick-publishers/docs/signup +# +# Alternatively, if you do not wish to run this example, you can create a test +# network at: https://dfp-playground.appspot.com +# +# Tags: NetworkService.makeTestNetwork + +require 'dfp_api' + +API_VERSION = :v201311 + +def make_test_network() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the NetworkService. + network_service = dfp.service(:NetworkService, API_VERSION) + + # Make a test network. + network = network_service.make_test_network() + + puts "Test network with network code %s and display name '%s' created." % + [network[:network_code], network[:display_name]] + puts "You may now sign in at http://www.google.com/dfp/main?networkCode=%s" % + network[:network_code] +end + +if __FILE__ == $0 + begin + make_test_network() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/order_service/approve_orders.rb b/dfp_api/examples/v201311/order_service/approve_orders.rb new file mode 100755 index 000000000..0caef9f8d --- /dev/null +++ b/dfp_api/examples/v201311/order_service/approve_orders.rb @@ -0,0 +1,122 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example approves and overbooks all eligible draft or pending orders. To +# determine which orders exist, run get_all_orders.rb. +# +# Tags: OrderService.getOrdersByStatement +# Tags: OrderService.performOrderAction + +require 'date' +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def approve_orders() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the OrderService. + order_service = dfp.service(:OrderService, API_VERSION) + + # Create a statement text to select all eligible draft or pending orders. + statement_text = "WHERE status IN ('DRAFT', 'PENDING_APPROVAL') " + + "AND endDateTime >= :today AND isArchived = FALSE" + statement = { + :query => statement_text, + :values => [ + {:key => 'today', + :value => {:value => Date.today.strftime('%Y-%m-%dT%H:%M:%S'), + :xsi_type => 'TextValue'}} + ] + } + + # Define initial values. + offset = 0 + page = {} + order_ids = [] + + begin + # Update the statement to get one page with current offset. + statement[:query] = + statement_text + " LIMIT %d OFFSET %d" % [PAGE_SIZE, offset] + + # Get orders by statement. + page = order_service.get_orders_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + page[:results].each do |order| + puts ("%d) Order ID: %d, status: %s and name: %s will be " + + "approved.") % [order_ids.size, order[:id], order[:status], + order[:name]] + order_ids << order[:id] + end + end + end while offset < page[:total_result_set_size] + + puts "Number of orders to be approved: %d" % order_ids.size + + if !order_ids.empty? + # Create statement for action. + statement = {:query => "WHERE id IN (%s)" % order_ids.join(', ')} + + # Perform action. + result = order_service.perform_order_action( + {:xsi_type => 'ApproveAndOverbookOrders'}, statement) + + # Display results. + if result and result[:num_changes] > 0 + puts "Number of orders approved: %d" % result[:num_changes] + else + puts 'No orders were approved.' + end + else + puts 'No order found to approve.' + end +end + +if __FILE__ == $0 + begin + approve_orders() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/order_service/create_orders.rb b/dfp_api/examples/v201311/order_service/create_orders.rb new file mode 100755 index 000000000..e022bacae --- /dev/null +++ b/dfp_api/examples/v201311/order_service/create_orders.rb @@ -0,0 +1,92 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates new orders. To determine which orders exist, run +# get_all_orders.rb. To determine which companies are advertisers, run +# get_companies_by_statement.rb. To get salespeople and traffickers, run +# get_all_users.rb. +# +# Tags: OrderService.createOrders + +require 'dfp_api' + +API_VERSION = :v201311 +# Number of orders to create. +ITEM_COUNT = 5 + +def create_orders() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the OrderService. + order_service = dfp.service(:OrderService, API_VERSION) + + # Set the advertiser (company), salesperson, and trafficker to assign to each + # order. + advertiser_id = 'INSERT_ADVERTISER_COMPANY_ID_HERE'.to_i + salesperson_id = 'INSERT_SALESPERSON_ID_HERE'.to_i + trafficker_id = 'INSERT_TRAFFICKER_ID_HERE'.to_i + + # Create an array to store local order objects. + orders = (1..ITEM_COUNT).map do |index| + {:name => "Order #%d" % index, + :advertiser_id => advertiser_id, + :salesperson_id => salesperson_id, + :trafficker_id => trafficker_id} + end + + # Create the orders on the server. + return_orders = order_service.create_orders(orders) + + if return_orders + return_orders.each do |order| + puts "Order with ID: %d and name: %s was created." % + [order[:id], order[:name]] + end + else + raise 'No orders were created.' + end + +end + +if __FILE__ == $0 + begin + create_orders() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/order_service/get_all_orders.rb b/dfp_api/examples/v201311/order_service/get_all_orders.rb new file mode 100755 index 000000000..9fb285024 --- /dev/null +++ b/dfp_api/examples/v201311/order_service/get_all_orders.rb @@ -0,0 +1,93 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all orders. To create orders, run create_orders.rb. +# +# Tags: OrderService.getOrdersByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_orders() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the OrderService. + order_service = dfp.service(:OrderService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create statement for one page with current offset. + statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]} + + # Get orders by statement. + page = order_service.get_orders_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each order in results page. + page[:results].each_with_index do |order, index| + puts "%d) Order ID: %d, name: %s, advertiser ID: %d" % + [index + start_index, order[:id], order[:name], + order[:advertiser_id]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer + if page.include?(:total_result_set_size) + puts "Total number of orders: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_orders() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/order_service/get_order.rb b/dfp_api/examples/v201311/order_service/get_order.rb new file mode 100755 index 000000000..664703913 --- /dev/null +++ b/dfp_api/examples/v201311/order_service/get_order.rb @@ -0,0 +1,74 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets an order by its ID. To determine which orders exist, run +# get_all_orders.rb. +# +# Tags: OrderService.getOrder + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_order() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the OrderService. + order_service = dfp.service(:OrderService, API_VERSION) + + # Set the ID of the order to get. + order_id = 'INSERT_ORDER_ID_HERE'.to_i + + # Get the order. + order = order_service.get_order(order_id) + + if order + puts "Order with ID: %d, advertiser ID: %d and name %s was found." % + [order[:id], order[:advertiser_id], order[:name]] + else + puts 'No order found for this ID.' + end +end + +if __FILE__ == $0 + begin + get_order() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/order_service/get_orders_by_statement.rb b/dfp_api/examples/v201311/order_service/get_orders_by_statement.rb new file mode 100755 index 000000000..b4e61d0b6 --- /dev/null +++ b/dfp_api/examples/v201311/order_service/get_orders_by_statement.rb @@ -0,0 +1,90 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all orders for a given advertiser. The statement retrieves +# up to the maximum page size limit of 500. To create orders, run +# create_orders.rb. To determine which companies are advertisers, run +# get_companies_by_statement.rb. +# +# Tags: OrderService.getOrdersByStatement + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_orders_by_statement() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the OrderService. + order_service = dfp.service(:OrderService, API_VERSION) + + # Set the ID of the advertiser (company) to get orders for. + advertiser_id = 'INSERT_ADVERTISER_COMPANY_ID_HERE'.to_i + + # Create a statement to only select orders for a given advertiser. + statement = { + :query => 'WHERE advertiserId = :advertiser_id LIMIT 500', + :values => [ + {:key => 'advertiser_id', + :value => {:value => advertiser_id, :xsi_type => 'NumberValue'}} + ] + } + + # Get orders by statement. + page = order_service.get_orders_by_statement(statement) + + if page and page[:results] + page[:results].each_with_index do |order, index| + puts "%d) Order ID: %d, belongs to advertiser ID: %d, name: %s." % [index, + order[:id], order[:advertiser_id], order[:name]] + end + end + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Number of results found: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_orders_by_statement() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/order_service/update_orders.rb b/dfp_api/examples/v201311/order_service/update_orders.rb new file mode 100755 index 000000000..240e5b719 --- /dev/null +++ b/dfp_api/examples/v201311/order_service/update_orders.rb @@ -0,0 +1,97 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example updates the notes of each order up to the first 500. +# To determine which orders exist, run get_all_orders.rb. +# +# Tags: OrderService.getOrdersByStatement, OrderService.updateOrders + +require 'dfp_api' + +API_VERSION = :v201311 + +def update_orders() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the OrderService. + order_service = dfp.service(:OrderService, API_VERSION) + + # Create a statement to get first 500 orders. + statement = {:query => 'LIMIT 500'} + + # Get orders by statement. + page = order_service.get_orders_by_statement(statement) + + if page[:results] + orders = page[:results] + + new_orders = orders.inject([]) do |new_orders, order| + # Archived orders can not be updated. + if !order[:is_archived] + order[:notes] = 'Spoke to advertiser. All is well.' + # Workaround for issue #94. + order[:po_number] = "" if order[:po_number].nil? + new_orders << order + end + new_orders + end + + # Update the orders on the server. + return_orders = order_service.update_orders(orders) + + if return_orders + return_orders.each do |order| + puts ("Order ID: %d, advertiser ID: %d, name: %s was updated " + + "with notes %s") % [order[:id], order[:advertiser_id], + order[:name], order[:notes]] + end + else + raise 'No orders were updated.' + end + else + puts 'No orders found to update.' + end +end + +if __FILE__ == $0 + begin + update_orders() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/placement_service/create_placements.rb b/dfp_api/examples/v201311/placement_service/create_placements.rb new file mode 100755 index 000000000..ea818586b --- /dev/null +++ b/dfp_api/examples/v201311/placement_service/create_placements.rb @@ -0,0 +1,131 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates new placements for various ad unit sizes. To determine +# which placements exist, run get_all_placements.rb. +# +# Tags: PlacementService.createPlacements +# Tags: InventoryService.getAdUnitsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 + +def create_placements() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the InventoryService. + inventory_service = dfp.service(:InventoryService, API_VERSION) + + # Get the PlacementService. + placement_service = dfp.service(:PlacementService, API_VERSION) + + # Create local placement object to store skyscraper ad units. + skyscraper_ad_unit_placement = { + :name => "Skyscraper AdUnit Placement #%d" % (Time.new.to_f * 1000), + :description => 'Contains ad units for creatives of size 120x600', + :targeted_ad_unit_ids => [] + } + + # Create local placement object to store medium square ad units. + medium_square_ad_unit_placement = { + :name => "Medium Square AdUnit Placement #%d" % (Time.new.to_f * 1000), + :description => 'Contains ad units for creatives of size 300x250', + :targeted_ad_unit_ids => [] + } + + # Create local placement object to store banner ad units. + banner_ad_unit_placement = { + :name => "Banner AdUnit Placement #%d" % (Time.new.to_f * 1000), + :description => 'Contains ad units for creatives of size 468x60', + :targeted_ad_unit_ids => [] + } + + # Get the first 500 ad units. + page = inventory_service.get_ad_units_by_statement({:query => 'LIMIT 500'}) + + # Separate the ad units by size. + if page and page[:results] + page[:results].each do |ad_unit| + if ad_unit[:parent_id] and ad_unit[:sizes] + ad_unit[:ad_unit_sizes].each do |ad_unit_size| + size = ad_unit_size[:size] + receiver = case size[:width] + when 120 + skyscraper_ad_unit_placement if size[:height] == 600 + when 300 + medium_square_ad_unit_placement if size[:height] == 250 + when 468 + banner_ad_unit_placement if size[:height] == 60 + else nil + end + receiver[:targeted_ad_unit_ids] |= [ad_unit[:id]] if receiver + end + end + end + end + + # Only create placements with one or more ad units. + non_empty_placements = [ + medium_square_ad_unit_placement, + skyscraper_ad_unit_placement, + banner_ad_unit_placement].delete_if {|plc| plc.empty?} + + # Create the placements on the server. + placements = placement_service.create_placements(non_empty_placements) + + # Display results. + if placements + placements.each do |placement| + puts "Placement with ID: %d and name: %s created with ad units: [%s]" % + [placement[:id], placement[:name], + placement[:targeted_ad_unit_ids].join(', ')] + end + else + raise 'No placements created.' + end + +end + +if __FILE__ == $0 + begin + create_placements() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/placement_service/deactivate_placements.rb b/dfp_api/examples/v201311/placement_service/deactivate_placements.rb new file mode 100755 index 000000000..366338161 --- /dev/null +++ b/dfp_api/examples/v201311/placement_service/deactivate_placements.rb @@ -0,0 +1,118 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example deactivates all active placements. To determine which placements +# exist, run get_all_placements.rb. +# +# Tags: PlacementService.getPlacementsByStatement +# Tags: PlacementService.performPlacementAction + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def deactivate_placements() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the PlacementService. + placement_service = dfp.service(:PlacementService, API_VERSION) + + # Create statement text and statement to select active placements. + statement_text = 'WHERE status = :status' + statement = { + :values => [ + {:key => 'status', + :value => {:value => 'ACTIVE', :xsi_type => 'TextValue'}} + ] + } + + # Define initial values. + offset = 0 + page = {} + placement_ids = [] + + begin + # Modify the statement to get one page with current offset. + statement[:query] = statement_text + + " LIMIT %d OFFSET %d" % [PAGE_SIZE, offset] + + # Get placements by statement. + page = placement_service.get_placements_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + page[:results].each do |placement| + puts ("%d) Placement ID: %d, name: %s and status: %s will be " + + "deactivated.") % [placement_ids.size, placement[:id], + placement[:name], placement[:status]] + placement_ids << placement[:id] + end + end + end while offset < page[:total_result_set_size] + + puts "Number of placements to be deactivated: %d" % placement_ids.size + + if !placement_ids.empty? + # Create a statement for action. + statement = {:query => "WHERE id IN (%s)" % placement_ids.join(', ')} + + # Perform action. + result = placement_service.perform_placement_action( + {:xsi_type => 'DeactivatePlacements'}, statement) + + # Display results. + if result and result[:num_changes] > 0 + puts "Number of placements deactivated: %d" % result[:num_changes] + else + puts 'No placements were deactivated.' + end + else + puts 'No placements found to deactivate.' + end +end + +if __FILE__ == $0 + begin + deactivate_placements() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/placement_service/get_all_placements.rb b/dfp_api/examples/v201311/placement_service/get_all_placements.rb new file mode 100755 index 000000000..90da536e5 --- /dev/null +++ b/dfp_api/examples/v201311/placement_service/get_all_placements.rb @@ -0,0 +1,93 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all placements. To create placements, run +# create_placements.rb +# +# Tags: PlacementService.getPlacementsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_placements() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the PlacementService. + placement_service = dfp.service(:PlacementService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create statement for one page with current offset. + statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]} + + # Get placements by statement. + page = placement_service.get_placements_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each placement in results page. + page[:results].each_with_index do |placement, index| + puts "%d) Placement ID: %d, name: %s." % + [index + start_index, placement[:id], placement[:name]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer + if page.include?(:total_result_set_size) + puts "Total number of placements: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_placements() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/placement_service/get_placement.rb b/dfp_api/examples/v201311/placement_service/get_placement.rb new file mode 100755 index 000000000..070dfce2f --- /dev/null +++ b/dfp_api/examples/v201311/placement_service/get_placement.rb @@ -0,0 +1,74 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets a placement by its ID. To determine which placements exist, +# run get_all_placements.rb. +# +# Tags: PlacementService.getPlacement + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_placement() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the PlacementService. + placement_service = dfp.service(:PlacementService, API_VERSION) + + # Set the ID of the placement to get. + placement_id = 'INSERT_PLACEMENT_ID_HERE'.to_i + + # Get the placement. + placement = placement_service.get_placement(placement_id) + + if placement + puts "Placement with ID: %d, name: %s and status %s was found." % + [placement[:id], placement[:name], placement[:status]] + else + puts 'No placement found for this ID.' + end +end + +if __FILE__ == $0 + begin + get_placement() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/placement_service/get_placements_by_statement.rb b/dfp_api/examples/v201311/placement_service/get_placements_by_statement.rb new file mode 100755 index 000000000..d1030b29a --- /dev/null +++ b/dfp_api/examples/v201311/placement_service/get_placements_by_statement.rb @@ -0,0 +1,86 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all active placements. The statement retrieves up to the +# maximum page size limit of 500. To create a placement, run +# create_placements.rb. +# +# Tags: PlacementService.getPlacementsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_placements_by_statement() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the PlacementService. + placement_service = dfp.service(:PlacementService, API_VERSION) + + # Create a statement to only select active placements. + statement = { + :query => 'WHERE status = :status LIMIT 500', + :values => [ + {:key => 'status', + :value => {:value => 'ACTIVE', :xsi_type => 'TextValue'}} + ] + } + + # Get placements by statement. + page = placement_service.get_placements_by_statement(statement) + + if page and page[:results] + page[:results].each_with_index do |placement, index| + puts "%d) Placement ID: %d, name: %s, status: %s." % [index, + placement[:id], placement[:name], placement[:status]] + end + end + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Number of results found: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_placements_by_statement() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/placement_service/update_placements.rb b/dfp_api/examples/v201311/placement_service/update_placements.rb new file mode 100755 index 000000000..8c25a6e6a --- /dev/null +++ b/dfp_api/examples/v201311/placement_service/update_placements.rb @@ -0,0 +1,97 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example updates all placements to allow for AdSense targeting up to the +# first 500. To determine which placements exist, run get_all_placements.rb. +# +# Tags: PlacementService.getPlacementsByStatement +# Tags: PlacementService.updatePlacements + +require 'dfp_api' + +API_VERSION = :v201311 + +def update_placements() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the PlacementService. + placement_service = dfp.service(:PlacementService, API_VERSION) + + # Create a statement to get first 500 placements. + statement = {:query => 'LIMIT 500'} + + # Get placements by statement. + page = placement_service.get_placements_by_statement(statement) + + if page[:results] + placements = page[:results] + + # Update each local placement object by enabling AdSense targeting. + placements.each do |placement| + placement[:targeting_description] = + (placement[:description].nil? || placement[:description].empty?) ? + 'Generic description' : placement[:description] + placement[:targeting_ad_location] = 'All images on sports pages.' + placement[:targeting_site_name] = 'http://code.google.com' + placement[:is_ad_sense_targeting_enabled] = true + end + + # Update the placements on the server. + return_placements = placement_service.update_placements(placements) + + if return_placements + return_placements.each do |placement| + puts ("Placement ID: %d, name: %s was updated with AdSense targeting " + + "enabled: %s.") % [placement[:id], placement[:name], + placement[:is_ad_sense_targeting_enabled]] + end + else + raise 'No placements were updated.' + end + else + puts 'No placements found to update.' + end +end + +if __FILE__ == $0 + begin + update_placements() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/publisher_query_language_service/fetch_match_tables.rb b/dfp_api/examples/v201311/publisher_query_language_service/fetch_match_tables.rb new file mode 100755 index 000000000..d6eab2f7c --- /dev/null +++ b/dfp_api/examples/v201311/publisher_query_language_service/fetch_match_tables.rb @@ -0,0 +1,113 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example fetches and creates match table files from the Line_Item and +# Ad_Unit tables. This example may take a while to run. +# +# A full list of available tables can be found at: +# https://developers.google.com/doubleclick-publishers/docs/reference/v201311/PublisherQueryLanguageService +# +# Tags: PublisherQueryLanguageService.select + +require 'tempfile' + +require 'dfp_api' + +API_VERSION = :v201311 +# A string to separate columns in output. Use "," to get CSV. +COLUMN_SEPARATOR = ',' +PAGE_SIZE = 500 + +def fetch_match_tables() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the PublisherQueryLanguageService. + pql_service = dfp.service(:PublisherQueryLanguageService, API_VERSION) + + # List of tables to fetch. + fetch_tables = ['Line_Item', 'Ad_Unit'] + + fetch_tables.each do |table| + results_file_path = fetch_match_table(table, pql_service) + puts "%s table saved to:\n\t%s" % [table, results_file_path] + end +end + +# Fetches a match table from a PQL statement and writes it to a file. +def fetch_match_table(table_name, pql_service) + # Create a statement to select all items for the table. + statement_text = ('SELECT Id, Name, Status FROM %s ' % table_name) + + 'ORDER BY Id ASC LIMIT %d OFFSET %d' + + # Set initial values. + offset = 0 + file_path = '%s.csv' % table_name + + open(file_path, 'wb') do |file| + file_path = file.path() + begin + # Create statement for a page. + statement = {:query => statement_text % [PAGE_SIZE, offset]} + result_set = pql_service.select(statement) + + if result_set + # Only write column names if the first page. + if (offset == 0) + columns = result_set[:column_types].collect {|col| col[:label_name]} + file.write(columns.join(COLUMN_SEPARATOR) + "\n") + end + # Print out every row. + result_set[:rows].each do |row_set| + row = row_set[:values].collect {|item| item[:value]} + file.write(row.join(COLUMN_SEPARATOR) + "\n") + end + end + # Update the counters. + offset += PAGE_SIZE + end while result_set[:rows].size == PAGE_SIZE + end + return file_path +end + +if __FILE__ == $0 + begin + fetch_match_tables() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/publisher_query_language_service/get_all_line_items.rb b/dfp_api/examples/v201311/publisher_query_language_service/get_all_line_items.rb new file mode 100755 index 000000000..a8406260a --- /dev/null +++ b/dfp_api/examples/v201311/publisher_query_language_service/get_all_line_items.rb @@ -0,0 +1,100 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all line items in your network using the Line_Item table. +# The Line_Item PQL table schema can be found here: +# +# https://developers.google.com/doubleclick-publishers/docs/reference/latest/PublisherQueryLanguageService +# +# Tags: PublisherQueryLanguageService.select + +require 'dfp_api' + +API_VERSION = :v201311 +# A string to separate columns in output. Use "," to get CSV. +COLUMN_SEPARATOR = "\t" +PAGE_SIZE = 500 + +def get_all_line_items() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the PublisherQueryLanguageService. + pql_service = dfp.service(:PublisherQueryLanguageService, API_VERSION) + + # Statement parts to help build a statement to select all line items. + statement_text = 'SELECT Id, Name, Status FROM Line_Item LIMIT %d OFFSET %d' + + # Set initial values for paging. + offset, result_set, all_rows = 0, nil, 0 + + # Get all line items with paging. + begin + # Create statement for a page. + statement = {:query => statement_text % [PAGE_SIZE, offset]} + result_set = pql_service.select(statement) + + if result_set + # Print out columns header. + columns = result_set[:column_types].collect {|col| col[:label_name]} + puts columns.join(COLUMN_SEPARATOR) + + # Print out every row. + result_set[:rows].each do |row_set| + row = row_set[:values].collect {|item| item[:value]} + puts row.join(COLUMN_SEPARATOR) + end + end + + # Update the counters. + offset += PAGE_SIZE + all_rows += result_set[:rows].size + end while result_set[:rows].size == PAGE_SIZE + + # Print a footer. + if result_set[:rows] + puts "Total number of rows found: %d" % all_rows + end +end + +if __FILE__ == $0 + begin + get_all_line_items() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/publisher_query_language_service/get_geo_targets.rb b/dfp_api/examples/v201311/publisher_query_language_service/get_geo_targets.rb new file mode 100755 index 000000000..b628fa8ab --- /dev/null +++ b/dfp_api/examples/v201311/publisher_query_language_service/get_geo_targets.rb @@ -0,0 +1,102 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets first 500 cities available to target. A full list of +# available PQL tables can be found at: +# +# https://developers.google.com/doubleclick-publishers/docs/reference/latest/PublisherQueryLanguageService +# +# Tags: PublisherQueryLanguageService.select + +require 'dfp_api' + +API_VERSION = :v201311 +# A string to separate columns in output. Use "," to get CSV. +COLUMN_SEPARATOR = "\t" +PAGE_SIZE = 500 + +def get_geo_targets() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the PublisherQueryLanguageService. + pql_service = dfp.service(:PublisherQueryLanguageService, API_VERSION) + + # Create a statement to select all targetable cities. + statement_text = "SELECT Id, Name, CanonicalParentId, ParentIds, " + + "CountryCode, Type, Targetable FROM Geo_Target WHERE Type = 'City' " + + "AND Targetable = true LIMIT %d OFFSET %d" + + # Set initial values for paging. + offset, result_set, all_rows = 0, nil, 0 + + # Get all cities with paging. + begin + # Create statement for a page. + statement = {:query => statement_text % [PAGE_SIZE, offset]} + result_set = pql_service.select(statement) + + if result_set + # Print out columns header. + columns = result_set[:column_types].collect {|col| col[:label_name]} + puts columns.join(COLUMN_SEPARATOR) + + # Print out every row. + result_set[:rows].each do |row_set| + row = row_set[:values].collect {|item| item[:value]} + puts row.join(COLUMN_SEPARATOR) + end + end + + # Update the counters. + offset += PAGE_SIZE + all_rows += result_set[:rows].size + end while result_set[:rows].size == PAGE_SIZE + + # Print a footer. + if result_set[:rows] + puts "Total number of rows found: %d" % all_rows + end +end + +if __FILE__ == $0 + begin + get_geo_targets() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/publisher_query_language_service/get_line_items_named_like.rb b/dfp_api/examples/v201311/publisher_query_language_service/get_line_items_named_like.rb new file mode 100755 index 000000000..e23f6c07f --- /dev/null +++ b/dfp_api/examples/v201311/publisher_query_language_service/get_line_items_named_like.rb @@ -0,0 +1,100 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all line items which have a name beginning with "line item". +# This example may take a while to run. +# +# Tags: PublisherQueryLanguageService.select + +require 'dfp_api' + +API_VERSION = :v201311 +# A string to separate columns in output. Use "," to get CSV. +COLUMN_SEPARATOR = "\t" +PAGE_SIZE = 500 + +def get_line_items_named_like() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the PublisherQueryLanguageService. + pql_service = dfp.service(:PublisherQueryLanguageService, API_VERSION) + + # Create a statement to select all line items matching subtext. + statement_text = + "SELECT Id, Name, Status FROM Line_Item WHERE Name LIKE 'line item%%' " + + "ORDER BY Id ASC LIMIT %d OFFSET %d" + + # Set initial values for paging. + offset, result_set, all_rows = 0, nil, 0 + + # Get all cities starting with "Santa". + begin + # Create statement for a page. + statement = {:query => statement_text % [PAGE_SIZE, offset]} + result_set = pql_service.select(statement) + + if result_set + # Print out columns header. + columns = result_set[:column_types].collect {|col| col[:label_name]} + puts columns.join(COLUMN_SEPARATOR) + + # Print out every row. + result_set[:rows].each do |row_set| + row = row_set[:values].collect {|item| item[:value]} + puts row.join(COLUMN_SEPARATOR) + end + end + + # Update the counters. + offset += PAGE_SIZE + all_rows += result_set[:rows].size + end while result_set[:rows].size == PAGE_SIZE + + # Print a footer. + if result_set[:rows] + puts "Total number of rows found: %d" % all_rows + end +end + +if __FILE__ == $0 + begin + get_line_items_named_like() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/report_service/display_report.rb b/dfp_api/examples/v201311/report_service/display_report.rb new file mode 100755 index 000000000..7e36755cc --- /dev/null +++ b/dfp_api/examples/v201311/report_service/display_report.rb @@ -0,0 +1,81 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.davidtorres@gmail.com (David Torres) +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example downloads a completed report and prints out its contents. To +# download a completed report to a file, run download_report.rb. To run +# a report, run run_delivery_report.rb. +# +# Tags: ReportService.getReportDownloadURL + +require 'dfp_api' + +require 'open-uri' + +API_VERSION = :v201311 + +def display_report() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the ReportService. + report_service = dfp.service(:ReportService, API_VERSION) + + # Set the ID of the completed report. + report_job_id = 'INSERT_REPORT_JOB_ID_HERE'.to_i + + # Set the format of the report (e.g. CSV_DUMP) and download without + # compression so we can print it. + report_download_options = { + :export_format => 'CSV_DUMP', + :use_gzip_compression => false + } + + # Get the report URL. + download_url = report_service.get_report_download_url_with_options( + report_job_id, report_download_options); + + puts "Downloading report from URL %s.\n" % download_url + puts open(download_url).read() +end + +if __FILE__ == $0 + begin + display_report() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/report_service/download_report.rb b/dfp_api/examples/v201311/report_service/download_report.rb new file mode 100755 index 000000000..615374900 --- /dev/null +++ b/dfp_api/examples/v201311/report_service/download_report.rb @@ -0,0 +1,81 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example downloads a completed report. To run a report, run +# run_delivery_report.rb, run_sales_report.rb or run_inventory_report.rb. +# +# Tags: ReportService.getReportDownloadURL + +require 'dfp_api' + +require 'open-uri' + +API_VERSION = :v201311 + +def download_report() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the ReportService. + report_service = dfp.service(:ReportService, API_VERSION) + + # Set the ID of the completed report. + report_job_id = 'INSERT_REPORT_JOB_ID_HERE'.to_i + + # Set the file path and name to save to. + file_name = 'INSERT_FILE_PATH_AND_NAME_HERE' + + # Change to your preffered export format. + export_format = 'CSV_DUMP' + + # Get the report URL. + download_url = report_service.get_report_download_url( + report_job_id, export_format); + + puts "Downloading [%s] to [%s]..." % [download_url, file_name] + open(file_name, 'wb') do |local_file| + local_file << open(download_url).read() + end +end + +if __FILE__ == $0 + begin + download_report() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/report_service/run_delivery_report.rb b/dfp_api/examples/v201311/report_service/run_delivery_report.rb new file mode 100755 index 000000000..9b4fc1674 --- /dev/null +++ b/dfp_api/examples/v201311/report_service/run_delivery_report.rb @@ -0,0 +1,103 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example runs a report similar to the "Orders report" on the DFP website +# with additional attributes and can filter to include just one order. +# To download the report see download_report.rb. +# +# Tags: ReportService.runReportJob, ReportService.getReportJob + +require 'dfp_api' + +API_VERSION = :v201311 +MAX_RETRIES = 10 +RETRY_INTERVAL = 30 + +def run_delivery_report() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the ReportService. + report_service = dfp.service(:ReportService, API_VERSION) + + # Specify the order ID to filter by. + order_id = 'INSERT_ORDER_ID_HERE'.to_i + + # Create report query. + report_query = { + :date_range_type => 'LAST_MONTH', + :dimensions => ['ORDER_ID', 'ORDER_NAME'], + :dimension_attributes => ['ORDER_TRAFFICKER', 'ORDER_START_DATE_TIME', + 'ORDER_END_DATE_TIME'], + :columns => ['AD_SERVER_IMPRESSIONS', 'AD_SERVER_CLICKS', 'AD_SERVER_CTR', + 'AD_SERVER_CPM_AND_CPC_REVENUE', 'AD_SERVER_WITHOUT_CPD_AVERAGE_ECPM'], + # Create statement object to filter for an order. + :statement => { + :query => 'WHERE ORDER_ID = :order_id', + :values => [ + {:key => 'order_id', + :value => {:value => order_id, :xsi_type => 'NumberValue'}} + ] + } + } + + # Create report job. + report_job = {:report_query => report_query} + + # Run report job. + report_job = report_service.run_report_job(report_job); + + MAX_RETRIES.times do |retry_count| + # Get the report job status. + report_job = report_service.get_report_job(report_job[:id]) + + break unless report_job[:report_job_status] == 'IN_PROGRESS' + puts "Report with ID: %d is still running." % report_job[:id] + sleep(RETRY_INTERVAL) + end + + puts "Report job with ID: %d finished with status %s." % + [report_job[:id], report_job[:report_job_status]] +end + +if __FILE__ == $0 + begin + run_delivery_report() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/report_service/run_inventory_report.rb b/dfp_api/examples/v201311/report_service/run_inventory_report.rb new file mode 100755 index 000000000..f308425ef --- /dev/null +++ b/dfp_api/examples/v201311/report_service/run_inventory_report.rb @@ -0,0 +1,112 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example runs a report equal to the "Whole network report" on the DFP +# website. To download the report see download_report.rb. +# +# Tags: ReportService.runReportJob, ReportService.getReportJob + +require 'dfp_api' + +API_VERSION = :v201311 +MAX_RETRIES = 10 +RETRY_INTERVAL = 30 + +def run_inventory_report() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the ReportService and NetworkService. + report_service = dfp.service(:ReportService, API_VERSION) + network_service = dfp.service(:NetworkService, API_VERSION) + + # Get the root ad unit ID to filter on. + root_ad_unit_id = + network_service.get_current_network()[:effective_root_ad_unit_id] + + # Create statement to filter on an ancestor ad unit with the root ad unit ID + # to include all ad units in the network. + statement = { + :query => 'WHERE AD_UNIT_ANCESTOR_AD_UNIT_ID = :ancestor_ad_unit_id', + :values => [ + {:key => 'ancestor_ad_unit_id', + :value => {:value => root_ad_unit_id, :xsi_type => 'NumberValue'}} + ] + } + + # Create report query. + report_query = { + :date_range_type => 'LAST_WEEK', + :dimensions => ['DATE', 'AD_UNIT_NAME'], + :ad_unit_view => 'HIERARCHICAL', + :columns => [ + 'AD_SERVER_IMPRESSIONS', + 'AD_SERVER_CLICKS', + 'DYNAMIC_ALLOCATION_INVENTORY_LEVEL_IMPRESSIONS', + 'DYNAMIC_ALLOCATION_INVENTORY_LEVEL_CLICKS', + 'TOTAL_INVENTORY_LEVEL_IMPRESSIONS', + 'TOTAL_INVENTORY_LEVEL_CPM_AND_CPC_REVENUE' + ], + :statement => statement + } + + # Create report job. + report_job = {:report_query => report_query} + + # Run report job. + report_job = report_service.run_report_job(report_job); + + MAX_RETRIES.times do |retry_count| + # Get the report job status. + report_job = report_service.get_report_job(report_job[:id]) + + break unless report_job[:report_job_status] == 'IN_PROGRESS' + puts "Report with ID: %d is still running." % report_job[:id] + sleep(RETRY_INTERVAL) + end + + puts "Report job with ID: %d finished with status %s." % + [report_job[:id], report_job[:report_job_status]] +end + +if __FILE__ == $0 + begin + run_inventory_report() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/report_service/run_merged_delivery_report.rb b/dfp_api/examples/v201311/report_service/run_merged_delivery_report.rb new file mode 100755 index 000000000..9a74c4b69 --- /dev/null +++ b/dfp_api/examples/v201311/report_service/run_merged_delivery_report.rb @@ -0,0 +1,94 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example runs a report that an upgraded publisher would use to include +# statistics before the upgrade. To download the report see download_report.rb. +# +# Tags: ReportService.runReportJob, ReportService.getReportJob + +require 'dfp_api' + +API_VERSION = :v201311 +MAX_RETRIES = 10 +RETRY_INTERVAL = 30 + +def run_merged_delivery_report() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the ReportService. + report_service = dfp.service(:ReportService, API_VERSION) + + # Create report query. + report_query = { + :date_range_type => 'LAST_MONTH', + :dimensions => ['ORDER_ID', 'ORDER_NAME'], + :columns => [ + 'MERGED_AD_SERVER_IMPRESSIONS', + 'MERGED_AD_SERVER_CLICKS', + 'MERGED_AD_SERVER_CTR', + 'MERGED_AD_SERVER_CPM_AND_CPC_REVENUE', + 'MERGED_AD_SERVER_WITHOUT_CPD_AVERAGE_ECPM' + ] + } + + # Create report job. + report_job = {:report_query => report_query} + + # Run report job. + report_job = report_service.run_report_job(report_job); + + MAX_RETRIES.times do |retry_count| + # Get the report job status. + report_job = report_service.get_report_job(report_job[:id]) + + break unless report_job[:report_job_status] == 'IN_PROGRESS' + puts "Report with ID: %d is still running." % report_job[:id] + sleep(RETRY_INTERVAL) + end + + puts "Report job with ID: %d finished with status %s." % + [report_job[:id], report_job[:report_job_status]] +end + +if __FILE__ == $0 + begin + run_merged_delivery_report() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/report_service/run_reach_report.rb b/dfp_api/examples/v201311/report_service/run_reach_report.rb new file mode 100755 index 000000000..37ae14e89 --- /dev/null +++ b/dfp_api/examples/v201311/report_service/run_reach_report.rb @@ -0,0 +1,87 @@ +#!/usr/bin/env ruby +# +# Author:: api.davidtorres@gmail.com (David Torres) +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example runs a reach report. To download the report see +# download_report.rb. +# +# Tags: ReportService.runReportJob, ReportService.getReportJob + +require 'dfp_api' + +API_VERSION = :v201311 +MAX_RETRIES = 10 +RETRY_INTERVAL = 30 + +def run_reach_report() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the ReportService. + report_service = dfp.service(:ReportService, API_VERSION) + + # Create report query. + report_query = { + :date_range_type => 'REACH_LIFETIME', + :dimensions => ['LINE_ITEM_ID', 'LINE_ITEM_NAME'], + :columns => ['REACH_FREQUENCY', 'REACH_AVERAGE_REVENUE', 'REACH'] + } + + # Create report job. + report_job = {:report_query => report_query} + + # Run report job. + report_job = report_service.run_report_job(report_job); + + MAX_RETRIES.times do |retry_count| + # Get the report job status. + report_job = report_service.get_report_job(report_job[:id]) + + break unless report_job[:report_job_status] == 'IN_PROGRESS' + puts "Report with ID: %d is still running." % report_job[:id] + sleep(RETRY_INTERVAL) + end + + puts "Report job with ID: %d finished with status %s." % + [report_job[:id], report_job[:report_job_status]] +end + +if __FILE__ == $0 + begin + run_reach_report() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/report_service/run_report_with_custom_fields.rb b/dfp_api/examples/v201311/report_service/run_report_with_custom_fields.rb new file mode 100755 index 000000000..82bebd81a --- /dev/null +++ b/dfp_api/examples/v201311/report_service/run_report_with_custom_fields.rb @@ -0,0 +1,135 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example runs a report that includes custom fields found in the line items +# of an order. To download the report see download_report.rb. +# +# Tags: LineItemService.getLineItemByStatement +# Tags: ReportService.runReportJob, ReportService.getReportJob + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 +MAX_RETRIES = 10 +RETRY_INTERVAL = 30 + +def run_report_with_custom_fields() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the LineItemService. + line_item_service = dfp.service(:LineItemService, API_VERSION) + + # Get the ReportService. + report_service = dfp.service(:ReportService, API_VERSION) + + # Set the ID of the order to get line items from. + order_id = 'INSERT_ORDER_ID_HERE'.to_i + + # Define initial values. + offset = 0 + page = {} + custom_field_ids = [] + + # Create a statement to only select line items from a given order. + statement = { + :values => [ + {:key => 'order_id', + :value => {:value => order_id, :xsi_type => 'NumberValue'}} + ] + } + query_text = 'WHERE orderId = :order_id LIMIT %d OFFSET %d' + + begin + # Update the statement to get one page with current offset. + statement[:query] = query_text % [PAGE_SIZE, offset] + + # Get line items by statement. + page = line_item_service.get_line_items_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get custom field IDs from the line items of an order. + page[:results].each do |line_item| + if line_item[:custom_field_values] + line_item[:custom_field_values].each do |value| + custom_field_ids |= [value[:custom_field_id]] + end + end + end + end + end while offset < page[:total_result_set_size] + + # Create report query. + statement[:query] = 'WHERE ORDER_ID = :order_id' + report_query = { + :date_range_type => 'LAST_MONTH', + :dimensions => ['LINE_ITEM_ID', 'LINE_ITEM_NAME'], + :custom_field_ids => custom_field_ids, + :columns => ['AD_SERVER_IMPRESSIONS'], + :statement => statement + } + + # Create report job. + report_job = {:report_query => report_query} + + # Run report job. + report_job = report_service.run_report_job(report_job); + + MAX_RETRIES.times do |retry_count| + # Get the report job status. + report_job = report_service.get_report_job(report_job[:id]) + + break unless report_job[:report_job_status] == 'IN_PROGRESS' + puts "Report with ID: %d is still running." % report_job[:id] + sleep(RETRY_INTERVAL) + end + + puts "Report job with ID: %d finished with status %s." % + [report_job[:id], report_job[:report_job_status]] +end + +if __FILE__ == $0 + begin + run_report_with_custom_fields() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/report_service/run_sales_report.rb b/dfp_api/examples/v201311/report_service/run_sales_report.rb new file mode 100755 index 000000000..3ebfbefed --- /dev/null +++ b/dfp_api/examples/v201311/report_service/run_sales_report.rb @@ -0,0 +1,92 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example runs a report equal to the "Sales by salespersons report" on the +# DFP website. To download the report see download_report.rb. +# +# Tags: ReportService.runReportJob, ReportService.getReportJob + +require 'dfp_api' + +API_VERSION = :v201311 +MAX_RETRIES = 10 +RETRY_INTERVAL = 30 + +def run_sales_report() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the ReportService. + report_service = dfp.service(:ReportService, API_VERSION) + + # Create report query. + report_query = { + :date_range_type => 'LAST_MONTH', + :dimensions => ['SALESPERSON_ID', 'SALESPERSON_NAME'], + :columns => [ + 'AD_SERVER_IMPRESSIONS', + 'AD_SERVER_CPM_AND_CPC_REVENUE', + 'AD_SERVER_WITHOUT_CPD_AVERAGE_ECPM' + ] + } + + # Create report job. + report_job = {:report_query => report_query} + + # Run report job. + report_job = report_service.run_report_job(report_job); + + MAX_RETRIES.times do |retry_count| + # Get the report job status. + report_job = report_service.get_report_job(report_job[:id]) + + break unless report_job[:report_job_status] == 'IN_PROGRESS' + puts "Report with ID: %d is still running." % report_job[:id] + sleep(RETRY_INTERVAL) + end + + puts "Report job with ID: %d finished with status %s." % + [report_job[:id], report_job[:report_job_status]] +end + +if __FILE__ == $0 + begin + run_sales_report() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/suggested_ad_unit_service/approve_all_suggested_ad_units.rb b/dfp_api/examples/v201311/suggested_ad_unit_service/approve_all_suggested_ad_units.rb new file mode 100755 index 000000000..12239ed12 --- /dev/null +++ b/dfp_api/examples/v201311/suggested_ad_unit_service/approve_all_suggested_ad_units.rb @@ -0,0 +1,109 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This code example approves all suggested ad units with 50 or more requests. +# +# This feature is only available to DFP premium solution networks. +# +# Tags: SuggestedAdUnitService.getSuggestedAdUnitsByStatement +# Tags: SuggestedAdUnitService.performSuggestedAdUnitAction + +require 'dfp_api' + +API_VERSION = :v201311 +NUMBER_OF_REQUESTS = 50 + +def approve_suggested_ad_units() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the SuggestedAdUnitService. + suggested_ad_unit_service = dfp.service(:SuggestedAdUnitService, API_VERSION) + + # Create a statement to only select suggested ad units with 50 or more + # requests (with maximum limit of 500). + statement = { + :query => 'WHERE numRequests >= :num_requests', + :values => [ + {:key => 'num_requests', + :value => {:value => NUMBER_OF_REQUESTS, + :xsi_type => 'NumberValue'}} + ] + } + + # Get suggested ad units by statement. + page = + suggested_ad_unit_service.get_suggested_ad_units_by_statement(statement) + + unit_count_to_approve = 0 + + if page[:results] + page[:results].each do |ad_unit| + if ad_unit[:num_requests] >= NUMBER_OF_REQUESTS + puts(("%d) Suggested ad unit with ID '%s' and %d requests will be " + + "approved.") % [suggested_ad_unit_ids.size, ad_unit[:id], + ad_unit[:num_requests]]) + unit_count_to_approve += 1 + end + end + end + + puts "Number of suggested ad units to be approved: %d" % unit_count_to_approve + + if unit_count_to_approve > 0 + # Perform action with the same statement. + result = suggested_ad_unit_service.perform_suggested_ad_unit_action( + {:xsi_type => 'ApproveSuggestedAdUnit'}, statement) + + # Display results. + if result and result[:num_changes] > 0 + puts "Number of ad units approved: %d" % result[:num_changes] + else + puts 'No ad units were approved.' + end + else + puts 'No ad units found to approve.' + end +end + +if __FILE__ == $0 + begin + approve_suggested_ad_units() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/suggested_ad_unit_service/get_all_suggested_ad_units.rb b/dfp_api/examples/v201311/suggested_ad_unit_service/get_all_suggested_ad_units.rb new file mode 100755 index 000000000..1829e00db --- /dev/null +++ b/dfp_api/examples/v201311/suggested_ad_unit_service/get_all_suggested_ad_units.rb @@ -0,0 +1,96 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all suggested ad units. To approve suggested ad units, run +# approve_suggested_ad_units.rb. +# +# This feature is only available to DFP premium solution networks. +# +# Tags: SuggestedAdUnitService.getSuggestedAdUnitsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_suggested_ad_units() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the SuggestedAdUnitService. + suggested_ad_unit_service = dfp.service(:SuggestedAdUnitService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create a statement to get one page with current offset. + statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]} + + # Get suggested ad units by statement. + page = + suggested_ad_unit_service.get_suggested_ad_units_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each suggested ad unit in results. + page[:results].each_with_index do |ad_unit, index| + puts "%d) Suggested ad unit ID: '%s' with number of requests: %d" % + [index + start_index, ad_unit[:id], ad_unit[:num_requests]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Total number of suggested ad units: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_suggested_ad_units() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/suggested_ad_unit_service/get_suggested_ad_unit.rb b/dfp_api/examples/v201311/suggested_ad_unit_service/get_suggested_ad_unit.rb new file mode 100755 index 000000000..babc43c4c --- /dev/null +++ b/dfp_api/examples/v201311/suggested_ad_unit_service/get_suggested_ad_unit.rb @@ -0,0 +1,75 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets a suggested ad unit by its ID. To determine which suggested +# ad units exist, run get_all_suggested_ad_units.rb. +# +# This feature is only available to DFP premium solution networks. +# +# Tags: SuggestedAdUnitService.getSuggestedAdUnit + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_suggested_ad_unit() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the SuggestedAdUnitService. + suggested_ad_unit_service = dfp.service(:SuggestedAdUnitService, API_VERSION) + + # Set the ID of the ad unit to get. + suggested_ad_unit_id = 'INSERT_SUGGESTED_AD_UNIT_ID_HERE' + + # Get the suggested ad unit. + suggested_ad_unit = + suggested_ad_unit_service.get_suggested_ad_unit(suggested_ad_unit_id) + + if suggested_ad_unit + puts "Suggested ad unit with ID: '%s' and number of requests: %d" % + [suggested_ad_unit[:id], suggested_ad_unit[:num_requests]] + end +end + +if __FILE__ == $0 + begin + get_suggested_ad_unit() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/suggested_ad_unit_service/get_suggested_ad_units_by_statement.rb b/dfp_api/examples/v201311/suggested_ad_unit_service/get_suggested_ad_units_by_statement.rb new file mode 100755 index 000000000..19151f7e9 --- /dev/null +++ b/dfp_api/examples/v201311/suggested_ad_unit_service/get_suggested_ad_units_by_statement.rb @@ -0,0 +1,92 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets suggested ad units that have more than 50 requests. The +# statement retrieves up to the maximum page size limit of 500. +# +# This feature is only available to DFP premium solution networks. +# +# Tags: SuggestedAdUnitService.getSuggestedAdUnitsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +NUMBER_OF_REQUESTS = 50 + +def get_suggested_ad_units_by_statement() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the SuggestedAdUnitService. + suggested_ad_unit_service = dfp.service(:SuggestedAdUnitService, API_VERSION) + + # Create a statement to only select suggested ad units with more than 50 + # requests (with maximum limit of 500). + statement = { + :query => 'WHERE numRequests > :num_requests LIMIT 500', + :values => [ + {:key => 'num_requests', + :value => {:value => NUMBER_OF_REQUESTS, + :xsi_type => 'NumberValue'}} + ] + } + + # Get ad units by statement. + page = + suggested_ad_unit_service.get_suggested_ad_units_by_statement(statement) + + if page[:results] + # Print details about each suggested ad unit in results. + page[:results].each_with_index do |ad_unit, index| + puts "%d) Suggested ad unit ID: '%s', number of requests: %d" % + [index, ad_unit[:id], ad_unit[:num_requests]] + end + end + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Total number of suggested ad units: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_suggested_ad_units_by_statement() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/team_service/create_teams.rb b/dfp_api/examples/v201311/team_service/create_teams.rb new file mode 100755 index 000000000..37df2283e --- /dev/null +++ b/dfp_api/examples/v201311/team_service/create_teams.rb @@ -0,0 +1,83 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates new teams with the logged in user added to each team. To +# determine which teams exist, run get_all_teams.rb. +# +# Tags: TeamService.createTeams + +require 'dfp_api' + +API_VERSION = :v201311 +ITEM_COUNT = 5 + +def create_teams() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the TeamService. + team_service = dfp.service(:TeamService, API_VERSION) + + # Create an array to store local team objects. + teams = (1..ITEM_COUNT).map do |index| + { + :name => "Team #%d" % index, + :has_all_companies => false, + :has_all_inventory => false + } + end + + # Create the teams on the server. + return_teams = team_service.create_teams(teams) + + if return_teams + return_teams.each do |team| + puts "Team with ID: %d and name: '%s' was created." % + [team[:id], team[:name]] + end + else + raise 'No teams were created.' + end +end + +if __FILE__ == $0 + begin + create_teams() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/team_service/get_all_teams.rb b/dfp_api/examples/v201311/team_service/get_all_teams.rb new file mode 100755 index 000000000..9a637235b --- /dev/null +++ b/dfp_api/examples/v201311/team_service/get_all_teams.rb @@ -0,0 +1,92 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all teams. To create teams, run create_teams.rb. +# +# Tags: TeamService.getTeamsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_teams() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the TeamService. + team_service = dfp.service(:TeamService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create statement for one page with current offset. + statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]} + + # Get teams by statement. + page = team_service.get_teams_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each team in results page. + page[:results].each_with_index do |team, index| + puts "%d) Team ID: %d, name: %s" % + [index + start_index, team[:id], team[:name]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer + if page.include?(:total_result_set_size) + puts "Total number of teams: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_teams() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/team_service/get_team.rb b/dfp_api/examples/v201311/team_service/get_team.rb new file mode 100755 index 000000000..924f41a3e --- /dev/null +++ b/dfp_api/examples/v201311/team_service/get_team.rb @@ -0,0 +1,74 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets a team by its ID. To determine which teams exist, run +# get_all_teams.rb. +# +# Tags: TeamService.getTeam + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_team() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the TeamService. + team_service = dfp.service(:TeamService, API_VERSION) + + # Set the ID of the team to get. + team_id = 'INSERT_TEAM_ID_HERE'.to_i + + # Get the team. + team = team_service.get_team(team_id) + + if team + puts "Team with ID: %d and name '%s' was found." % + [team[:id], team[:name]] + else + puts 'No team found for this ID.' + end +end + +if __FILE__ == $0 + begin + get_team() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/team_service/get_teams_by_statement.rb b/dfp_api/examples/v201311/team_service/get_teams_by_statement.rb new file mode 100755 index 000000000..864a44b10 --- /dev/null +++ b/dfp_api/examples/v201311/team_service/get_teams_by_statement.rb @@ -0,0 +1,78 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all teams ordered by name. The statement retrieves up to the +# maximum page size limit of 500. To create teams, run create_teams.rb. +# +# Tags: TeamService.getTeamsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_teams_by_statement() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the TeamService. + team_service = dfp.service(:TeamService, API_VERSION) + + # Create a statement to order teams by name. + statement = {:query => "ORDER BY name LIMIT 500"} + + # Get teams by statement. + page = team_service.get_teams_by_statement(statement) + + if page and page[:results] + page[:results].each_with_index do |team, index| + puts "%d) Team ID: %d, name: %s." % [index, team[:id], team[:name]] + end + end + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Number of results found: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_teams_by_statement() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/team_service/update_teams.rb b/dfp_api/examples/v201311/team_service/update_teams.rb new file mode 100755 index 000000000..b7f1cb817 --- /dev/null +++ b/dfp_api/examples/v201311/team_service/update_teams.rb @@ -0,0 +1,97 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example updates teams by adding an ad unit to the first 5. To determine +# which teams exist, run get_all_teams.rb. To determine which ad units exist, +# run get_all_ad_units.rb. +# +# Tags: TeamService.getTeamsByStatement, TeamService.updateTeams + +require 'dfp_api' + +API_VERSION = :v201311 + +def update_teams() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Set the ID of the ad unit to add to the teams. + ad_unit_id = 'INSERT_AD_UNIT_ID_HERE'.to_i + + # Get the TeamService. + team_service = dfp.service(:TeamService, API_VERSION) + + # Create a statement to select first 5 teams that aren't built-in. + statement = {:query => 'WHERE id > 0 LIMIT 5'} + + # Get teams by statement. + page = team_service.get_teams_by_statement(statement) + + if page[:results] + teams = page[:results] + + # Create a local set of teams than need to be updated. We are updating by + # adding an ad unit to it. + updated_teams = teams.inject([]) do |updated_teams, team| + # Don't add ad unit if the team has all inventory already. + unless team[:has_all_inventory] + team[:ad_unit_ids] ||= [] + team[:ad_unit_ids] << ad_unit_id + # Workaround for issue #94. + team[:description] = "" if team[:description].nil? + updated_teams << team + end + updated_teams + end + + # Update the teams on the server. + return_teams = team_service.update_teams(updated_teams) + return_teams.each do |team| + puts "Team ID: %d was updated" % team[:id] + end + else + puts 'No teams found to update.' + end +end + +if __FILE__ == $0 + begin + update_teams() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/user_service/create_users.rb b/dfp_api/examples/v201311/user_service/create_users.rb new file mode 100755 index 000000000..bbe299859 --- /dev/null +++ b/dfp_api/examples/v201311/user_service/create_users.rb @@ -0,0 +1,89 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example creates new users. To determine which users exist, run +# get_all_users.rb. To determine which roles exist, run get_all_roles.rb. +# +# Tags: UserService.createUsers + +require 'dfp_api' + +API_VERSION = :v201311 + +def create_users() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the UserService. + user_service = dfp.service(:UserService, API_VERSION) + + # Set the user's email addresses and names. + emails_and_names = [ + {:name => 'INSERT_NAME_HERE', + :email => 'INSERT_EMAIL_ADDRESS_HERE'}, + {:name => 'INSERT_NAME_HERE', + :email => 'INSERT_EMAIL_ADDRESS_HERE'} + ] + + # Set the role ID for new users. + role_id = 'INSERT_ROLE_ID_HERE'.to_i + + # Create an array to store local user objects. + users = emails_and_names.map do |email_and_name| + email_and_name.merge({:role_id => role_id, :preferred_locale => 'en_US'}) + end + + # Create the users on the server. + return_users = user_service.create_users(users) + + if return_users + return_users.each do |user| + puts "User with ID: %d, name: %s and email: %s was created." % + [user[:id], user[:name], user[:email]] + end + else + raise 'No users were created.' + end +end + +if __FILE__ == $0 + begin + create_users() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/user_service/deactivate_users.rb b/dfp_api/examples/v201311/user_service/deactivate_users.rb new file mode 100755 index 000000000..4f4ed87af --- /dev/null +++ b/dfp_api/examples/v201311/user_service/deactivate_users.rb @@ -0,0 +1,97 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example deactivates a user. Deactivated users can no longer make requests +# to the API. The user making the request cannot deactivate itself. To determine +# which users exist, run get_all_users.rb. +# +# Tags: UserService.getUsersByStatement, UserService.performUserAction + +require 'dfp_api' + +API_VERSION = :v201311 + +def deactivate_users() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the UserService. + user_service = dfp.service(:UserService, API_VERSION) + + # Set the ID of the user to deactivate + user_id = 'INSERT_USER_ID_HERE' + + # Create filter text to select user by id. + statement = { + :query => 'WHERE id = :user_id', + :values => [ + {:key => 'user_id', + :value => {:value => user_id, :xsi_type => 'NumberValue'}} + ] + } + + # Get users by statement. + page = user_service.get_users_by_statement(statement) + + if page[:results] + page[:results].each do |user| + puts "User ID: %d, name: %s and status: %s will be deactivated." % + [user[:id], user[:name], user[:status]] + end + + # Perform action. + result = user_service.perform_user_action( + {:xsi_type => 'DeactivateUsers'}, statement) + + # Display results. + if result and result[:num_changes] > 0 + puts "Number of users deactivated: %d" % result[:num_changes] + else + puts 'No users were deactivated.' + end + else + puts 'No user found to deactivate.' + end +end + +if __FILE__ == $0 + begin + deactivate_users() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/user_service/get_all_roles.rb b/dfp_api/examples/v201311/user_service/get_all_roles.rb new file mode 100755 index 000000000..2a76d76eb --- /dev/null +++ b/dfp_api/examples/v201311/user_service/get_all_roles.rb @@ -0,0 +1,73 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all roles. This example can be used to determine which role +# ID is needed when getting and creating users. +# +# Tags: UserService.getAllRoles + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_all_roles() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the UserService. + user_service = dfp.service(:UserService, API_VERSION) + + # Get all roles. + roles = user_service.get_all_roles() + + if roles + # Print details about each role in results page. + roles.each_with_index do |role, index| + puts "%d) Role ID: %d, name: %s" % [index, role[:id], role[:name]] + end + # Print a footer + puts "Total number of roles: %d" % roles.size + end +end + +if __FILE__ == $0 + begin + get_all_roles() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/user_service/get_all_users.rb b/dfp_api/examples/v201311/user_service/get_all_users.rb new file mode 100755 index 000000000..958751611 --- /dev/null +++ b/dfp_api/examples/v201311/user_service/get_all_users.rb @@ -0,0 +1,93 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all users for an account. To create users run +# create_users.rb. +# +# Tags: UserService.getUsersByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_users() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the UserService. + user_service = dfp.service(:UserService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create statement for one page with current offset. + statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]} + + # Get users by statement. + page = user_service.get_users_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each user in results page. + page[:results].each_with_index do |user, index| + puts "%d) User ID: %d, name: %s, email: %s" % + [index + start_index, user[:id], user[:name], user[:email]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer + if page.include?(:total_result_set_size) + puts "Total number of users: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_users() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/user_service/get_current_user.rb b/dfp_api/examples/v201311/user_service/get_current_user.rb new file mode 100755 index 000000000..e90430fa4 --- /dev/null +++ b/dfp_api/examples/v201311/user_service/get_current_user.rb @@ -0,0 +1,66 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets the current user. +# +# Tags: UserService.getCurrentUser + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_current_user() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the UserService. + user_service = dfp.service(:UserService, API_VERSION) + + # Get the current user. + user = user_service.get_current_user() + + puts "Current user has ID %d, email %s and role %s." % + [user[:id], user[:email], user[:role_name]] +end + +if __FILE__ == $0 + begin + get_current_user() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/user_service/get_user.rb b/dfp_api/examples/v201311/user_service/get_user.rb new file mode 100755 index 000000000..10e8a66f7 --- /dev/null +++ b/dfp_api/examples/v201311/user_service/get_user.rb @@ -0,0 +1,73 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets a user by its ID. To create users, run create_users.rb. +# +# Tags: UserService.getUser + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_user() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the UserService. + user_service = dfp.service(:UserService, API_VERSION) + + # Set the ID of the user to get. + user_id = 'INSERT_USER_ID_HERE'.to_i + + # Get the user. + user = user_service.get_user(user_id) + + if user + puts "User with ID: %d, name: %s, email: %s and role: %s was found." % + [user[:id], user[:name], user[:email], user[:role_name]] + else + puts 'No user found for this ID.' + end +end + +if __FILE__ == $0 + begin + get_user() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/user_service/get_users_by_statement.rb b/dfp_api/examples/v201311/user_service/get_users_by_statement.rb new file mode 100755 index 000000000..311cd106f --- /dev/null +++ b/dfp_api/examples/v201311/user_service/get_users_by_statement.rb @@ -0,0 +1,79 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all users sorted by name. The statement retrieves up to the +# maximum page size limit of 500. To create new users, run create_users.rb. +# +# Tags: UserService.getUsersByStatement + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_users_by_statement() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the UserService. + user_service = dfp.service(:UserService, API_VERSION) + + # Create a statement to get all users sorted by name. + statement = {:query => 'ORDER BY name LIMIT 500'} + + # Get users by statement. + page = user_service.get_users_by_statement(statement) + + if page and page[:results] + page[:results].each_with_index do |user, index| + puts "%d) User ID: %d, name: %s, email: %s, role: %s." % [index, + user[:id], user[:name], user[:email], user[:role_name]] + end + end + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Number of results found: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_users_by_statement() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/user_service/update_users.rb b/dfp_api/examples/v201311/user_service/update_users.rb new file mode 100755 index 000000000..2433a7d5b --- /dev/null +++ b/dfp_api/examples/v201311/user_service/update_users.rb @@ -0,0 +1,89 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2011, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example updates all users by adding "Sr." to the end of each name (after +# a very large baby boom and lack of creativity). To determine which users +# exist, run get_all_users.rb. +# +# Tags: UserService.getUsersByStatement, UserService.updateUsers + +require 'dfp_api' + +API_VERSION = :v201311 + +def update_users() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the UserService. + user_service = dfp.service(:UserService, API_VERSION) + + # Create a statement to get all users. + statement = {:query => 'LIMIT 500'} + + # Get users by statement. + page = user_service.get_users_by_statement(statement) + + if page[:results] + users = page[:results] + + # Update each local users object by changing its name. + users.each {|user| user[:name] += ' Sr.'} + + # Update the users on the server. + return_users = user_service.update_users(users) + + if return_users + return_users.each do |user| + puts ("User ID: %d, email: %s was updated with name %s") % + [user[:id], user[:email], user[:name]] + end + else + raise 'No users were updated.' + end + else + puts 'No users found to update.' + end +end + +if __FILE__ == $0 + begin + update_users() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/user_team_association_service/create_user_team_associations.rb b/dfp_api/examples/v201311/user_team_association_service/create_user_team_associations.rb new file mode 100755 index 000000000..079d2e1ff --- /dev/null +++ b/dfp_api/examples/v201311/user_team_association_service/create_user_team_associations.rb @@ -0,0 +1,86 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example adds a user to a team by creating an association between the two. +# To determine which teams exist, run get_all_teams.rb. To determine which users +# exist, run get_all_users.rb. +# +# Tags: UserTeamAssociationService.createUserTeamAssociations + +require 'dfp_api' + +API_VERSION = :v201311 + +def create_user_team_associations() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the UserTeamAssociationService. + uta_service = dfp.service(:UserTeamAssociationService, API_VERSION) + + # Set the users and team to add them to. + team_id = 'INSERT_TEAM_ID_HERE'.to_i + user_ids = ['INSERT_USER_ID_HERE'.to_i] + + # Create an array to store local user team association objects. + associations = user_ids.map do |user_id| + { + :user_id => user_id, + :team_id => team_id + } + end + + # Create the user team associations on the server. + return_associations = uta_service.create_user_team_associations(associations) + + if return_associations + return_associations.each do |association| + puts ("A user team association between user ID %d and team ID %d was " + + "created.") % [association[:user_id], association[:team_id]] + end + else + raise 'No user team associations were created.' + end +end + +if __FILE__ == $0 + begin + create_user_team_associations() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/user_team_association_service/delete_user_team_associations.rb b/dfp_api/examples/v201311/user_team_association_service/delete_user_team_associations.rb new file mode 100755 index 000000000..ac60a7a7b --- /dev/null +++ b/dfp_api/examples/v201311/user_team_association_service/delete_user_team_associations.rb @@ -0,0 +1,111 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example removes the user from all its teams. To determine which users +# exist, run get_all_users.rb. +# +# Tags: UserTeamAssociationService.getUserTeamAssociationsByStatement +# Tags: UserTeamAssociationService.performUserTeamAssociationAction + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def delete_user_team_associations() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the UserTeamAssociationService. + uta_service = dfp.service(:UserTeamAssociationService, API_VERSION) + + # Set the user to remove from its teams. + user_id = 'INSERT_USER_ID_HERE'.to_i + + # Create filter text to remove association by user ID. + statement_text = 'WHERE userId = :user_id' + statement = { + :values => [ + {:key => 'user_id', + :value => {:value => user_id, :xsi_type => 'NumberValue'}} + ] + } + + offset = 0 + page = {} + + begin + # Update statement with the current offset. + statement[:query] = statement_text + " LIMIT %d OFFSET %d" % + [PAGE_SIZE, offset] + + # Get user team associations by statement. + page = uta_service.get_user_team_associations_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + page[:results].each do |association| + puts ("User team association of user ID %d with team ID %d will be " + + "deleted.") % [association[:user_id], association[:team_id]] + end + end + end while offset < page[:total_result_set_size] + + # Update statement for deletion. + statement[:query] = statement_text + + # Perform the action. + result = uta_service.perform_user_team_association_action( + {:xsi_type => 'DeleteUserTeamAssociations'}, statement) + + # Display results. + if result and result[:num_changes] > 0 + puts "Number of user team associations deleted: %d" % result[:num_changes] + else + puts 'No user team associations were deleted.' + end +end + +if __FILE__ == $0 + begin + delete_user_team_associations() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/user_team_association_service/get_all_user_team_associations.rb b/dfp_api/examples/v201311/user_team_association_service/get_all_user_team_associations.rb new file mode 100755 index 000000000..c9ad4b64c --- /dev/null +++ b/dfp_api/examples/v201311/user_team_association_service/get_all_user_team_associations.rb @@ -0,0 +1,94 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all user team associations. To create user team +# associations, run create_user_team_assocations.rb. +# +# Tags: UserTeamAssociationService.getUserTeamAssociationsByStatement + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_all_user_team_associations() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the UserTeamAssociationService. + uta_service = dfp.service(:UserTeamAssociationService, API_VERSION) + + # Define initial values. + offset = 0 + page = {} + + begin + # Create statement for one page with current offset. + statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]} + + # Get the user team associations by statement. + page = uta_service.get_user_team_associations_by_statement(statement) + + if page[:results] + # Increase query offset by page size. + offset += PAGE_SIZE + + # Get the start index for printout. + start_index = page[:start_index] + + # Print details about each user team association in results page. + page[:results].each_with_index do |association, index| + puts "%d) User team association between team ID: %d and user ID %d" % + [index + start_index, association[:team_id], association[:user_id]] + end + end + end while offset < page[:total_result_set_size] + + # Print a footer + if page.include?(:total_result_set_size) + puts "Total number of user team associations: %d" % + page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_all_user_team_associations() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/user_team_association_service/get_user_team_association.rb b/dfp_api/examples/v201311/user_team_association_service/get_user_team_association.rb new file mode 100755 index 000000000..d6f81d4a8 --- /dev/null +++ b/dfp_api/examples/v201311/user_team_association_service/get_user_team_association.rb @@ -0,0 +1,76 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets a user team association by user and team IDs. To determine +# which teams exist, run get_all_teams.rb. To determine which users exist, run +# get_all_users.rb. +# +# Tags: UserTeamAssociationService.getUserTeamAssociation + +require 'dfp_api' + +API_VERSION = :v201311 + +def get_user_team_association() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the UserTeamAssociationService. + uta_service = dfp.service(:UserTeamAssociationService, API_VERSION) + + # Set the users and team to add them to. + team_id = 'INSERT_TEAM_ID_HERE'.to_i + user_id = 'INSERT_USER_ID_HERE'.to_i + + # Get the user team association. + association = uta_service.get_user_team_association(team_id, user_id) + + if association + puts "User team association with team ID %d and user ID %d was found." % + [association[:team_id], association[:user_id]] + else + puts 'No user team associations found for these IDs.' + end +end + +if __FILE__ == $0 + begin + get_user_team_association() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/user_team_association_service/get_user_team_associations_by_statement.rb b/dfp_api/examples/v201311/user_team_association_service/get_user_team_associations_by_statement.rb new file mode 100755 index 000000000..7e58291bb --- /dev/null +++ b/dfp_api/examples/v201311/user_team_association_service/get_user_team_associations_by_statement.rb @@ -0,0 +1,94 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example gets all teams that the current user belongs to. The statement +# retrieves up to the maximum page size limit of 500. To create teams, run +# create_user_team_associations.rb. +# +# Tags: UserTeamAssociationService.getUserTeamAssociationsByStatement +# Tags: UserService.getCurrentUser + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def get_user_team_associations_by_statement() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the UserTeamAssociationService. + uta_service = dfp.service(:UserTeamAssociationService, API_VERSION) + + # Get the UserService. + user_service = dfp.service(:UserService, API_VERSION) + + # Get the current user. + user = user_service.get_current_user() + + # Create filter text to select user team associations by the user ID. + statement = { + :query => "WHERE userId = :user_id LIMIT %s" % PAGE_SIZE, + :values => [ + {:key => 'user_id', + :value => {:value => user[:id], :xsi_type => 'NumberValue'}}, + ] + } + + # Get user team associations by statement. + page = uta_service.get_user_team_associations_by_statement(statement) + + if page and page[:results] + page[:results].each_with_index do |association, index| + puts "%d) Team user association between team ID %d and user ID %d." % + [index, association[:team_id], association[:user_id]] + end + end + + # Print a footer. + if page.include?(:total_result_set_size) + puts "Number of results found: %d" % page[:total_result_set_size] + end +end + +if __FILE__ == $0 + begin + get_user_team_associations_by_statement() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/examples/v201311/user_team_association_service/update_user_team_associations.rb b/dfp_api/examples/v201311/user_team_association_service/update_user_team_associations.rb new file mode 100755 index 000000000..49a6b056b --- /dev/null +++ b/dfp_api/examples/v201311/user_team_association_service/update_user_team_associations.rb @@ -0,0 +1,102 @@ +#!/usr/bin/env ruby +# Encoding: utf-8 +# +# Author:: api.dklimkin@gmail.com (Danial Klimkin) +# +# Copyright:: Copyright 2012, Google Inc. All Rights Reserved. +# +# License:: Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This example updates user team associations. It updates a user team +# association by setting the overridden access type to read only for the first +# 500 teams that the user belongs to. To determine which users exists, run +# get_all_users.rb. +# +# Tags: UserTeamAssociationService.getUserTeamAssociationsByStatement +# Tags: UserTeamAssociationService.updateUserTeamAssociations + +require 'dfp_api' + +API_VERSION = :v201311 +PAGE_SIZE = 500 + +def update_user_team_associations() + # Get DfpApi instance and load configuration from ~/dfp_api.yml. + dfp = DfpApi::Api.new + + # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in + # the configuration file or provide your own logger: + # dfp.logger = Logger.new('dfp_xml.log') + + # Get the UserTeamAssociationService. + uta_service = dfp.service(:UserTeamAssociationService, API_VERSION) + + # Set the user to set to read only access within its teams. + user_id = 'INSERT_USER_ID_HERE'.to_i + + # Create filter text to select user team associations by the user ID. + statement = { + :query => "WHERE userId = :user_id LIMIT %s" % PAGE_SIZE, + :values => [ + {:key => 'user_id', + :value => {:value => user_id, :xsi_type => 'NumberValue'}}, + ] + } + + # Get user team associations by statement. + page = uta_service.get_user_team_associations_by_statement(statement) + + if page[:results] and !page[:results].empty? + associations = page[:results] + associations.each do |association| + # Update local user team association to read-only access. + association[:overridden_team_access_type] = 'READ_ONLY' + end + + # Update the user team association on the server. + return_associations = + uta_service.update_user_team_associations(associations) + + # Display results. + return_associations.each do |association| + puts ("User team association between user ID %d and team ID %d was " + + "updated with access type '%s'") % + [association[:user_id], association[:team_id], + association[:overridden_team_access_type]] + end + else + puts 'No user team associations were updated.' + end +end + +if __FILE__ == $0 + begin + update_user_team_associations() + + # HTTP errors. + rescue AdsCommon::Errors::HttpError => e + puts "HTTP Error: %s" % e + + # API errors. + rescue DfpApi::Errors::ApiException => e + puts "Message: %s" % e.message + puts 'Errors:' + e.errors.each_with_index do |error, index| + puts "\tError [%d]:" % (index + 1) + error.each do |field, value| + puts "\t\t%s: %s" % [field, value] + end + end + end +end diff --git a/dfp_api/google-dfp-api.gemspec b/dfp_api/google-dfp-api.gemspec index adc22bc20..f2ffb7018 100644 --- a/dfp_api/google-dfp-api.gemspec +++ b/dfp_api/google-dfp-api.gemspec @@ -38,5 +38,5 @@ Gem::Specification.new do |s| s.files = Dir.glob('{examples,lib,test}/**/*') + %w(COPYING README ChangeLog dfp_api.yml) s.test_files = Dir.glob('test/**/test_*.rb') - s.add_dependency('google-ads-common', '~> 0.9.1') + s.add_dependency('google-ads-common', '~> 0.9.4') end diff --git a/dfp_api/lib/dfp_api/api_config.rb b/dfp_api/lib/dfp_api/api_config.rb index 62257b820..e5164357d 100644 --- a/dfp_api/lib/dfp_api/api_config.rb +++ b/dfp_api/lib/dfp_api/api_config.rb @@ -35,9 +35,9 @@ class << ApiConfig end # Set defaults - DEFAULT_VERSION = :v201308 + DEFAULT_VERSION = :v201311 DEFAULT_ENVIRONMENT = :PRODUCTION - LATEST_VERSION = :v201308 + LATEST_VERSION = :v201311 # Set other constants API_NAME = 'DfpApi' @@ -113,7 +113,51 @@ class << ApiConfig :ReconciliationOrderReportService, :ReconciliationReportService, :ReconciliationReportRowService, - :WorkflowActionService, :LineItemTemplateService] + :WorkflowActionService, :LineItemTemplateService], + :v201311 => [ + :ActivityGroupService, + :ActivityService, + :AdRuleService, + :AudienceSegmentService, + :BaseRateService, + :CompanyService, + :ContactService, + :ContentBundleService, + :ContentMetadataKeyHierarchyService, + :ContentService, + :CreativeService, + :CreativeSetService, + :CreativeTemplateService, + :CreativeWrapperService, + :CustomFieldService, + :CustomTargetingService, + :ExchangeRateService, + :ForecastService, + :InventoryService, + :LabelService, + :LineItemCreativeAssociationService, + :LineItemService, + :LineItemTemplateService, + :NetworkService, + :OrderService, + :PlacementService, + :ProductService, + :ProductTemplateService, + :ProposalLineItemService, + :ProposalService, + :PublisherQueryLanguageService, + :RateCardCustomizationService, + :RateCardService, + :ReconciliationOrderReportService, + :ReconciliationReportRowService, + :ReconciliationReportService, + :ReportService, + :SuggestedAdUnitService, + :TeamService, + :UserService, + :UserTeamAssociationService, + :WorkflowRequestService + ] } # Configure the different environments, with the base URL for each one @@ -125,7 +169,8 @@ class << ApiConfig :v201211 => 'https://www.google.com/apis/ads/publisher/', :v201302 => 'https://www.google.com/apis/ads/publisher/', :v201306 => 'https://www.google.com/apis/ads/publisher/', - :v201308 => 'https://www.google.com/apis/ads/publisher/' + :v201308 => 'https://www.google.com/apis/ads/publisher/', + :v201311 => 'https://www.google.com/apis/ads/publisher/' } } diff --git a/dfp_api/lib/dfp_api/v201311/activity_group_service.rb b/dfp_api/lib/dfp_api/v201311/activity_group_service.rb new file mode 100644 index 000000000..115c06155 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/activity_group_service.rb @@ -0,0 +1,54 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:24:51. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/activity_group_service_registry' + +module DfpApi; module V201311; module ActivityGroupService + class ActivityGroupService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_activity_group(*args, &block) + return execute_action('create_activity_group', args, &block) + end + + def create_activity_groups(*args, &block) + return execute_action('create_activity_groups', args, &block) + end + + def get_activity_group(*args, &block) + return execute_action('get_activity_group', args, &block) + end + + def get_activity_groups_by_statement(*args, &block) + return execute_action('get_activity_groups_by_statement', args, &block) + end + + def update_activity_group(*args, &block) + return execute_action('update_activity_group', args, &block) + end + + def update_activity_groups(*args, &block) + return execute_action('update_activity_groups', args, &block) + end + + private + + def get_service_registry() + return ActivityGroupServiceRegistry + end + + def get_module() + return DfpApi::V201311::ActivityGroupService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/activity_group_service_registry.rb b/dfp_api/lib/dfp_api/v201311/activity_group_service_registry.rb new file mode 100644 index 000000000..4c0d8f755 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/activity_group_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:24:51. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module ActivityGroupService + class ActivityGroupServiceRegistry + ACTIVITYGROUPSERVICE_METHODS = {:create_activity_group=>{:input=>[{:name=>:activity_group, :type=>"ActivityGroup", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_activity_group_response", :fields=>[{:name=>:rval, :type=>"ActivityGroup", :min_occurs=>0, :max_occurs=>1}]}}, :create_activity_groups=>{:input=>[{:name=>:activity_groups, :type=>"ActivityGroup", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_activity_groups_response", :fields=>[{:name=>:rval, :type=>"ActivityGroup", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_activity_group=>{:input=>[{:name=>:activity_group_id, :type=>"int", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_activity_group_response", :fields=>[{:name=>:rval, :type=>"ActivityGroup", :min_occurs=>0, :max_occurs=>1}]}}, :get_activity_groups_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_activity_groups_by_statement_response", :fields=>[{:name=>:rval, :type=>"ActivityGroupPage", :min_occurs=>0, :max_occurs=>1}]}}, :update_activity_group=>{:input=>[{:name=>:activity_group, :type=>"ActivityGroup", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_activity_group_response", :fields=>[{:name=>:rval, :type=>"ActivityGroup", :min_occurs=>0, :max_occurs=>1}]}}, :update_activity_groups=>{:input=>[{:name=>:activity_groups, :type=>"ActivityGroup", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_activity_groups_response", :fields=>[{:name=>:rval, :type=>"ActivityGroup", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + ACTIVITYGROUPSERVICE_TYPES = {:ActivityError=>{:fields=>[{:name=>:reason, :type=>"ActivityError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ActivityGroup=>{:fields=>[{:name=>:id, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:company_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:impressions_lookback, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:clicks_lookback, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"ActivityGroup.Status", :min_occurs=>0, :max_occurs=>1}]}, :ActivityGroupPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"ActivityGroup", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ActivityError.Reason"=>{:fields=>[]}, :"ActivityGroup.Status"=>{:fields=>[]}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RangeError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}} + ACTIVITYGROUPSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return ACTIVITYGROUPSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return ACTIVITYGROUPSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return ACTIVITYGROUPSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, ActivityGroupServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/activity_service.rb b/dfp_api/lib/dfp_api/v201311/activity_service.rb new file mode 100644 index 000000000..dc44f5114 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/activity_service.rb @@ -0,0 +1,54 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:24:53. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/activity_service_registry' + +module DfpApi; module V201311; module ActivityService + class ActivityService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_activities(*args, &block) + return execute_action('create_activities', args, &block) + end + + def create_activity(*args, &block) + return execute_action('create_activity', args, &block) + end + + def get_activities_by_statement(*args, &block) + return execute_action('get_activities_by_statement', args, &block) + end + + def get_activity(*args, &block) + return execute_action('get_activity', args, &block) + end + + def update_activities(*args, &block) + return execute_action('update_activities', args, &block) + end + + def update_activity(*args, &block) + return execute_action('update_activity', args, &block) + end + + private + + def get_service_registry() + return ActivityServiceRegistry + end + + def get_module() + return DfpApi::V201311::ActivityService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/activity_service_registry.rb b/dfp_api/lib/dfp_api/v201311/activity_service_registry.rb new file mode 100644 index 000000000..5885b52f6 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/activity_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:24:53. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module ActivityService + class ActivityServiceRegistry + ACTIVITYSERVICE_METHODS = {:create_activities=>{:input=>[{:name=>:activities, :type=>"Activity", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_activities_response", :fields=>[{:name=>:rval, :type=>"Activity", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :create_activity=>{:input=>[{:name=>:activity, :type=>"Activity", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_activity_response", :fields=>[{:name=>:rval, :type=>"Activity", :min_occurs=>0, :max_occurs=>1}]}}, :get_activities_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_activities_by_statement_response", :fields=>[{:name=>:rval, :type=>"ActivityPage", :min_occurs=>0, :max_occurs=>1}]}}, :get_activity=>{:input=>[{:name=>:activity_id, :type=>"int", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_activity_response", :fields=>[{:name=>:rval, :type=>"Activity", :min_occurs=>0, :max_occurs=>1}]}}, :update_activities=>{:input=>[{:name=>:activities, :type=>"Activity", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_activities_response", :fields=>[{:name=>:rval, :type=>"Activity", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :update_activity=>{:input=>[{:name=>:activity, :type=>"Activity", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_activity_response", :fields=>[{:name=>:rval, :type=>"Activity", :min_occurs=>0, :max_occurs=>1}]}}} + ACTIVITYSERVICE_TYPES = {:Activity=>{:fields=>[{:name=>:id, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:activity_group_id, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:expected_url, :original_name=>"expectedURL", :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"Activity.Status", :min_occurs=>0, :max_occurs=>1}, {:name=>:type, :type=>"Activity.Type", :min_occurs=>0, :max_occurs=>1}]}, :ActivityError=>{:fields=>[{:name=>:reason, :type=>"ActivityError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ActivityPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"Activity", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"Activity.Status"=>{:fields=>[]}, :"Activity.Type"=>{:fields=>[]}, :"ActivityError.Reason"=>{:fields=>[]}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RangeError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}} + ACTIVITYSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return ACTIVITYSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return ACTIVITYSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return ACTIVITYSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, ActivityServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/ad_rule_service.rb b/dfp_api/lib/dfp_api/v201311/ad_rule_service.rb new file mode 100644 index 000000000..1f0d77d02 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/ad_rule_service.rb @@ -0,0 +1,58 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:24:54. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/ad_rule_service_registry' + +module DfpApi; module V201311; module AdRuleService + class AdRuleService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_ad_rule(*args, &block) + return execute_action('create_ad_rule', args, &block) + end + + def create_ad_rules(*args, &block) + return execute_action('create_ad_rules', args, &block) + end + + def get_ad_rule(*args, &block) + return execute_action('get_ad_rule', args, &block) + end + + def get_ad_rules_by_statement(*args, &block) + return execute_action('get_ad_rules_by_statement', args, &block) + end + + def perform_ad_rule_action(*args, &block) + return execute_action('perform_ad_rule_action', args, &block) + end + + def update_ad_rule(*args, &block) + return execute_action('update_ad_rule', args, &block) + end + + def update_ad_rules(*args, &block) + return execute_action('update_ad_rules', args, &block) + end + + private + + def get_service_registry() + return AdRuleServiceRegistry + end + + def get_module() + return DfpApi::V201311::AdRuleService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/ad_rule_service_registry.rb b/dfp_api/lib/dfp_api/v201311/ad_rule_service_registry.rb new file mode 100644 index 000000000..725b4e96a --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/ad_rule_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:24:54. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module AdRuleService + class AdRuleServiceRegistry + ADRULESERVICE_METHODS = {:create_ad_rule=>{:input=>[{:name=>:ad_rule, :type=>"AdRule", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_ad_rule_response", :fields=>[{:name=>:rval, :type=>"AdRule", :min_occurs=>0, :max_occurs=>1}]}}, :create_ad_rules=>{:input=>[{:name=>:ad_rules, :type=>"AdRule", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_ad_rules_response", :fields=>[{:name=>:rval, :type=>"AdRule", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_ad_rule=>{:input=>[{:name=>:ad_rule_id, :type=>"int", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_ad_rule_response", :fields=>[{:name=>:rval, :type=>"AdRule", :min_occurs=>0, :max_occurs=>1}]}}, :get_ad_rules_by_statement=>{:input=>[{:name=>:statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_ad_rules_by_statement_response", :fields=>[{:name=>:rval, :type=>"AdRulePage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_ad_rule_action=>{:input=>[{:name=>:ad_rule_action, :type=>"AdRuleAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_ad_rule_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_ad_rule=>{:input=>[{:name=>:ad_rule, :type=>"AdRule", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_ad_rule_response", :fields=>[{:name=>:rval, :type=>"AdRule", :min_occurs=>0, :max_occurs=>1}]}}, :update_ad_rules=>{:input=>[{:name=>:ad_rules, :type=>"AdRule", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_ad_rules_response", :fields=>[{:name=>:rval, :type=>"AdRule", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + ADRULESERVICE_TYPES = {:ActivateAdRules=>{:fields=>[], :base=>"AdRuleAction"}, :AdRuleAction=>{:fields=>[{:name=>:ad_rule_action_type, :original_name=>"AdRuleAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AdRuleDateError=>{:fields=>[{:name=>:reason, :type=>"AdRuleDateError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :AdRule=>{:fields=>[{:name=>:id, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:priority, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:targeting, :type=>"Targeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_date_time_type, :type=>"StartDateTimeType", :min_occurs=>0, :max_occurs=>1}, {:name=>:end_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:unlimited_end_date_time, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"AdRuleStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:frequency_cap_behavior, :type=>"FrequencyCapBehavior", :min_occurs=>0, :max_occurs=>1}, {:name=>:max_impressions_per_line_item_per_stream, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:max_impressions_per_line_item_per_pod, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:preroll, :type=>"BaseAdRuleSlot", :min_occurs=>0, :max_occurs=>1}, {:name=>:midroll, :type=>"BaseAdRuleSlot", :min_occurs=>0, :max_occurs=>1}, {:name=>:postroll, :type=>"BaseAdRuleSlot", :min_occurs=>0, :max_occurs=>1}]}, :AdRuleFrequencyCapError=>{:fields=>[{:name=>:reason, :type=>"AdRuleFrequencyCapError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NoPoddingAdRuleSlot=>{:fields=>[], :base=>"BaseAdRuleSlot"}, :OptimizedPoddingAdRuleSlot=>{:fields=>[], :base=>"BaseAdRuleSlot"}, :AdRulePage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"AdRule", :min_occurs=>0, :max_occurs=>:unbounded}]}, :AdRulePriorityError=>{:fields=>[{:name=>:reason, :type=>"AdRulePriorityError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BaseAdRuleSlot=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:slot_behavior, :type=>"AdRuleSlotBehavior", :min_occurs=>0, :max_occurs=>1}, {:name=>:min_video_ad_duration, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:max_video_ad_duration, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:video_midroll_frequency_type, :type=>"MidrollFrequencyType", :min_occurs=>0, :max_occurs=>1}, {:name=>:video_midroll_frequency, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:bumper, :type=>"AdRuleSlotBumper", :min_occurs=>0, :max_occurs=>1}, {:name=>:max_bumper_duration, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:min_pod_duration, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:max_pod_duration, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:max_ads_in_pod, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:base_ad_rule_slot_type, :original_name=>"BaseAdRuleSlot.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AdRuleSlotError=>{:fields=>[{:name=>:reason, :type=>"AdRuleSlotError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StandardPoddingAdRuleSlot=>{:fields=>[], :base=>"BaseAdRuleSlot"}, :AdUnitTargeting=>{:fields=>[{:name=>:ad_unit_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:include_descendants, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :TechnologyTargeting=>{:fields=>[{:name=>:bandwidth_group_targeting, :type=>"BandwidthGroupTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:browser_targeting, :type=>"BrowserTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:browser_language_targeting, :type=>"BrowserLanguageTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_capability_targeting, :type=>"DeviceCapabilityTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_category_targeting, :type=>"DeviceCategoryTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_manufacturer_targeting, :type=>"DeviceManufacturerTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:mobile_carrier_targeting, :type=>"MobileCarrierTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:mobile_device_targeting, :type=>"MobileDeviceTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:mobile_device_submodel_targeting, :type=>"MobileDeviceSubmodelTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:operating_system_targeting, :type=>"OperatingSystemTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:operating_system_version_targeting, :type=>"OperatingSystemVersionTargeting", :min_occurs=>0, :max_occurs=>1}]}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BandwidthGroup=>{:fields=>[], :base=>"Technology"}, :BandwidthGroupTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:bandwidth_groups, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :Browser=>{:fields=>[{:name=>:major_version, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:minor_version, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :BrowserLanguage=>{:fields=>[], :base=>"Technology"}, :BrowserLanguageTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:browser_languages, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :BrowserTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:browsers, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ContentMetadataKeyHierarchyTargeting=>{:fields=>[{:name=>:custom_targeting_value_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ContentMetadataTargetingError=>{:fields=>[{:name=>:reason, :type=>"ContentMetadataTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ContentTargeting=>{:fields=>[{:name=>:targeted_content_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_content_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted_video_category_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_video_category_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted_video_content_bundle_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_video_content_bundle_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted_content_metadata, :type=>"ContentMetadataKeyHierarchyTargeting", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_content_metadata, :type=>"ContentMetadataKeyHierarchyTargeting", :min_occurs=>0, :max_occurs=>:unbounded}]}, :CustomCriteria=>{:fields=>[{:name=>:key_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:value_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:operator, :type=>"CustomCriteria.ComparisonOperator", :min_occurs=>0, :max_occurs=>1}], :base=>"CustomCriteriaLeaf"}, :CustomCriteriaSet=>{:fields=>[{:name=>:logical_operator, :type=>"CustomCriteriaSet.LogicalOperator", :min_occurs=>0, :max_occurs=>1}, {:name=>:children, :type=>"CustomCriteriaNode", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"CustomCriteriaNode"}, :CustomTargetingError=>{:fields=>[{:name=>:reason, :type=>"CustomTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomCriteriaLeaf=>{:fields=>[], :abstract=>true, :base=>"CustomCriteriaNode"}, :CustomCriteriaNode=>{:fields=>[{:name=>:custom_criteria_node_type, :original_name=>"CustomCriteriaNode.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AudienceSegmentCriteria=>{:fields=>[{:name=>:operator, :type=>"AudienceSegmentCriteria.ComparisonOperator", :min_occurs=>0, :max_occurs=>1}, {:name=>:audience_segment_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"CustomCriteriaLeaf"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DayPart=>{:fields=>[{:name=>:day_of_week, :type=>"DayOfWeek", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_time, :type=>"TimeOfDay", :min_occurs=>0, :max_occurs=>1}, {:name=>:end_time, :type=>"TimeOfDay", :min_occurs=>0, :max_occurs=>1}]}, :DayPartTargeting=>{:fields=>[{:name=>:day_parts, :type=>"DayPart", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:time_zone, :type=>"DeliveryTimeZone", :min_occurs=>0, :max_occurs=>1}]}, :DeactivateAdRules=>{:fields=>[], :base=>"AdRuleAction"}, :DeleteAdRules=>{:fields=>[], :base=>"AdRuleAction"}, :DeviceCapability=>{:fields=>[], :base=>"Technology"}, :DeviceCapabilityTargeting=>{:fields=>[{:name=>:targeted_device_capabilities, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_device_capabilities, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :DeviceCategory=>{:fields=>[], :base=>"Technology"}, :DeviceCategoryTargeting=>{:fields=>[{:name=>:targeted_device_categories, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_device_categories, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :DeviceManufacturer=>{:fields=>[], :base=>"Technology"}, :DeviceManufacturerTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_manufacturers, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :GeoTargeting=>{:fields=>[{:name=>:targeted_locations, :type=>"Location", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_locations, :type=>"Location", :min_occurs=>0, :max_occurs=>:unbounded}]}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InventoryTargeting=>{:fields=>[{:name=>:targeted_ad_units, :type=>"AdUnitTargeting", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_ad_units, :type=>"AdUnitTargeting", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted_placement_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}]}, :InventoryTargetingError=>{:fields=>[{:name=>:reason, :type=>"InventoryTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Location=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:type, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:canonical_parent_id, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:display_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:location_type, :original_name=>"Location.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :MobileCarrier=>{:fields=>[], :base=>"Technology"}, :MobileCarrierTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:mobile_carriers, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :MobileDevice=>{:fields=>[{:name=>:manufacturer_criterion_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :MobileDeviceSubmodel=>{:fields=>[{:name=>:mobile_device_criterion_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_manufacturer_criterion_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :MobileDeviceSubmodelTargeting=>{:fields=>[{:name=>:targeted_mobile_device_submodels, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_mobile_device_submodels, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :MobileDeviceTargeting=>{:fields=>[{:name=>:targeted_mobile_devices, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_mobile_devices, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :OperatingSystem=>{:fields=>[], :base=>"Technology"}, :OperatingSystemTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:operating_systems, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :OperatingSystemVersion=>{:fields=>[{:name=>:major_version, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minor_version, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:micro_version, :type=>"int", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :OperatingSystemVersionTargeting=>{:fields=>[{:name=>:targeted_operating_system_versions, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_operating_system_versions, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PoddingError=>{:fields=>[{:name=>:reason, :type=>"PoddingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredNumberError=>{:fields=>[{:name=>:reason, :type=>"RequiredNumberError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :Targeting=>{:fields=>[{:name=>:geo_targeting, :type=>"GeoTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:inventory_targeting, :type=>"InventoryTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:day_part_targeting, :type=>"DayPartTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:technology_targeting, :type=>"TechnologyTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:custom_targeting, :type=>"CustomCriteriaSet", :min_occurs=>0, :max_occurs=>1}, {:name=>:user_domain_targeting, :type=>"UserDomainTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:content_targeting, :type=>"ContentTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:video_position_targeting, :type=>"VideoPositionTargeting", :min_occurs=>0, :max_occurs=>1}]}, :Technology=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:technology_type, :original_name=>"Technology.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TimeOfDay=>{:fields=>[{:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"MinuteOfHour", :min_occurs=>0, :max_occurs=>1}]}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :UnknownAdRuleSlot=>{:fields=>[], :base=>"BaseAdRuleSlot"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :UserDomainTargeting=>{:fields=>[{:name=>:domains, :type=>"string", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :VideoPosition=>{:fields=>[{:name=>:position_type, :type=>"VideoPosition.Type", :min_occurs=>0, :max_occurs=>1}, {:name=>:midroll_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :VideoPositionTargeting=>{:fields=>[{:name=>:targeted_positions, :type=>"VideoPositionTarget", :min_occurs=>0, :max_occurs=>:unbounded}]}, :VideoPositionWithinPod=>{:fields=>[{:name=>:index, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :VideoPositionTarget=>{:fields=>[{:name=>:video_position, :type=>"VideoPosition", :min_occurs=>0, :max_occurs=>1}, {:name=>:video_bumper_type, :type=>"VideoBumperType", :min_occurs=>0, :max_occurs=>1}, {:name=>:video_position_within_pod, :type=>"VideoPositionWithinPod", :min_occurs=>0, :max_occurs=>1}]}, :"AdRuleDateError.Reason"=>{:fields=>[]}, :"AdRuleFrequencyCapError.Reason"=>{:fields=>[]}, :"AdRulePriorityError.Reason"=>{:fields=>[]}, :AdRuleSlotBehavior=>{:fields=>[]}, :AdRuleSlotBumper=>{:fields=>[]}, :"AdRuleSlotError.Reason"=>{:fields=>[]}, :AdRuleStatus=>{:fields=>[]}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"ContentMetadataTargetingError.Reason"=>{:fields=>[]}, :"CustomCriteria.ComparisonOperator"=>{:fields=>[]}, :"CustomCriteriaSet.LogicalOperator"=>{:fields=>[]}, :"CustomTargetingError.Reason"=>{:fields=>[]}, :"AudienceSegmentCriteria.ComparisonOperator"=>{:fields=>[]}, :DayOfWeek=>{:fields=>[]}, :DeliveryTimeZone=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :FrequencyCapBehavior=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"InventoryTargetingError.Reason"=>{:fields=>[]}, :MidrollFrequencyType=>{:fields=>[]}, :MinuteOfHour=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PoddingError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"RequiredNumberError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :StartDateTimeType=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}, :VideoBumperType=>{:fields=>[]}, :"VideoPosition.Type"=>{:fields=>[]}} + ADRULESERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return ADRULESERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return ADRULESERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return ADRULESERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, AdRuleServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/audience_segment_service.rb b/dfp_api/lib/dfp_api/v201311/audience_segment_service.rb new file mode 100644 index 000000000..0e3273b61 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/audience_segment_service.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:24:56. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/audience_segment_service_registry' + +module DfpApi; module V201311; module AudienceSegmentService + class AudienceSegmentService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_audience_segments(*args, &block) + return execute_action('create_audience_segments', args, &block) + end + + def get_audience_segments_by_statement(*args, &block) + return execute_action('get_audience_segments_by_statement', args, &block) + end + + def perform_audience_segment_action(*args, &block) + return execute_action('perform_audience_segment_action', args, &block) + end + + def update_audience_segments(*args, &block) + return execute_action('update_audience_segments', args, &block) + end + + private + + def get_service_registry() + return AudienceSegmentServiceRegistry + end + + def get_module() + return DfpApi::V201311::AudienceSegmentService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/audience_segment_service_registry.rb b/dfp_api/lib/dfp_api/v201311/audience_segment_service_registry.rb new file mode 100644 index 000000000..4b18fb6c3 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/audience_segment_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:24:56. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module AudienceSegmentService + class AudienceSegmentServiceRegistry + AUDIENCESEGMENTSERVICE_METHODS = {:create_audience_segments=>{:input=>[{:name=>:segments, :type=>"FirstPartyAudienceSegment", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_audience_segments_response", :fields=>[{:name=>:rval, :type=>"FirstPartyAudienceSegment", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_audience_segments_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_audience_segments_by_statement_response", :fields=>[{:name=>:rval, :type=>"AudienceSegmentPage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_audience_segment_action=>{:input=>[{:name=>:action, :type=>"AudienceSegmentAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_audience_segment_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_audience_segments=>{:input=>[{:name=>:segments, :type=>"FirstPartyAudienceSegment", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_audience_segments_response", :fields=>[{:name=>:rval, :type=>"FirstPartyAudienceSegment", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + AUDIENCESEGMENTSERVICE_TYPES = {:ActivateAudienceSegments=>{:fields=>[], :base=>"AudienceSegmentAction"}, :AdUnitTargeting=>{:fields=>[{:name=>:ad_unit_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:include_descendants, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :ApproveAudienceSegments=>{:fields=>[], :base=>"AudienceSegmentAction"}, :AudienceSegmentDataProvider=>{:fields=>[{:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :AudienceSegmentPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"AudienceSegment", :min_occurs=>0, :max_occurs=>:unbounded}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :FirstPartyAudienceSegment=>{:fields=>[], :abstract=>true, :base=>"AudienceSegment"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomCriteria=>{:fields=>[{:name=>:key_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:value_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:operator, :type=>"CustomCriteria.ComparisonOperator", :min_occurs=>0, :max_occurs=>1}], :base=>"CustomCriteriaLeaf"}, :CustomCriteriaSet=>{:fields=>[{:name=>:logical_operator, :type=>"CustomCriteriaSet.LogicalOperator", :min_occurs=>0, :max_occurs=>1}, {:name=>:children, :type=>"CustomCriteriaNode", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"CustomCriteriaNode"}, :CustomCriteriaLeaf=>{:fields=>[], :abstract=>true, :base=>"CustomCriteriaNode"}, :CustomCriteriaNode=>{:fields=>[{:name=>:custom_criteria_node_type, :original_name=>"CustomCriteriaNode.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AudienceSegmentCriteria=>{:fields=>[{:name=>:operator, :type=>"AudienceSegmentCriteria.ComparisonOperator", :min_occurs=>0, :max_occurs=>1}, {:name=>:audience_segment_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"CustomCriteriaLeaf"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DeactivateAudienceSegments=>{:fields=>[], :base=>"AudienceSegmentAction"}, :ThirdPartyAudienceSegment=>{:fields=>[{:name=>:approval_status, :type=>"ThirdPartyAudienceSegment.AudienceSegmentApprovalStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:cost, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:end_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"AudienceSegment"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InventoryTargeting=>{:fields=>[{:name=>:targeted_ad_units, :type=>"AdUnitTargeting", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_ad_units, :type=>"AdUnitTargeting", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted_placement_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}]}, :Money=>{:fields=>[{:name=>:currency_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:micro_amount, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :NonRuleBasedFirstPartyAudienceSegment=>{:fields=>[], :base=>"FirstPartyAudienceSegment"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PopulateAudienceSegments=>{:fields=>[], :base=>"AudienceSegmentAction"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :FirstPartyAudienceSegmentRule=>{:fields=>[{:name=>:inventory_rule, :type=>"InventoryTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:custom_criteria_rule, :type=>"CustomCriteriaSet", :min_occurs=>0, :max_occurs=>1}]}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RejectAudienceSegments=>{:fields=>[], :base=>"AudienceSegmentAction"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RuleBasedFirstPartyAudienceSegment=>{:fields=>[{:name=>:rule, :type=>"FirstPartyAudienceSegmentRule", :min_occurs=>0, :max_occurs=>1}], :base=>"RuleBasedFirstPartyAudienceSegmentSummary"}, :RuleBasedFirstPartyAudienceSegmentSummary=>{:fields=>[{:name=>:page_views, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:recency_days, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:membership_expiration_days, :type=>"int", :min_occurs=>0, :max_occurs=>1}], :base=>"FirstPartyAudienceSegment"}, :AudienceSegmentAction=>{:fields=>[{:name=>:audience_segment_action_type, :original_name=>"AudienceSegmentAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AudienceSegment=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:description, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"AudienceSegment.Status", :min_occurs=>0, :max_occurs=>1}, {:name=>:size, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:data_provider, :type=>"AudienceSegmentDataProvider", :min_occurs=>0, :max_occurs=>1}, {:name=>:type, :type=>"AudienceSegment.AudienceSegmentType", :min_occurs=>0, :max_occurs=>1}, {:name=>:audience_segment_type, :original_name=>"AudienceSegment.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :AudienceSegmentError=>{:fields=>[{:name=>:reason, :type=>"AudienceSegmentError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SharedAudienceSegment=>{:fields=>[], :base=>"AudienceSegment"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"CustomCriteria.ComparisonOperator"=>{:fields=>[]}, :"CustomCriteriaSet.LogicalOperator"=>{:fields=>[]}, :"AudienceSegmentCriteria.ComparisonOperator"=>{:fields=>[]}, :"ThirdPartyAudienceSegment.AudienceSegmentApprovalStatus"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"AudienceSegment.AudienceSegmentType"=>{:fields=>[]}, :"AudienceSegment.Status"=>{:fields=>[]}, :"AudienceSegmentError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}} + AUDIENCESEGMENTSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return AUDIENCESEGMENTSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return AUDIENCESEGMENTSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return AUDIENCESEGMENTSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, AudienceSegmentServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/base_rate_service.rb b/dfp_api/lib/dfp_api/v201311/base_rate_service.rb new file mode 100644 index 000000000..0cde74c9c --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/base_rate_service.rb @@ -0,0 +1,58 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:24:58. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/base_rate_service_registry' + +module DfpApi; module V201311; module BaseRateService + class BaseRateService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_base_rate(*args, &block) + return execute_action('create_base_rate', args, &block) + end + + def create_base_rates(*args, &block) + return execute_action('create_base_rates', args, &block) + end + + def get_base_rate(*args, &block) + return execute_action('get_base_rate', args, &block) + end + + def get_base_rates_by_statement(*args, &block) + return execute_action('get_base_rates_by_statement', args, &block) + end + + def perform_base_rate_action(*args, &block) + return execute_action('perform_base_rate_action', args, &block) + end + + def update_base_rate(*args, &block) + return execute_action('update_base_rate', args, &block) + end + + def update_base_rates(*args, &block) + return execute_action('update_base_rates', args, &block) + end + + private + + def get_service_registry() + return BaseRateServiceRegistry + end + + def get_module() + return DfpApi::V201311::BaseRateService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/base_rate_service_registry.rb b/dfp_api/lib/dfp_api/v201311/base_rate_service_registry.rb new file mode 100644 index 000000000..d3a558438 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/base_rate_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:24:58. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module BaseRateService + class BaseRateServiceRegistry + BASERATESERVICE_METHODS = {:create_base_rate=>{:input=>[{:name=>:base_rate, :type=>"BaseRate", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_base_rate_response", :fields=>[{:name=>:rval, :type=>"BaseRate", :min_occurs=>0, :max_occurs=>1}]}}, :create_base_rates=>{:input=>[{:name=>:base_rates, :type=>"BaseRate", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_base_rates_response", :fields=>[{:name=>:rval, :type=>"BaseRate", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_base_rate=>{:input=>[{:name=>:base_rate_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_base_rate_response", :fields=>[{:name=>:rval, :type=>"BaseRate", :min_occurs=>0, :max_occurs=>1}]}}, :get_base_rates_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_base_rates_by_statement_response", :fields=>[{:name=>:rval, :type=>"BaseRatePage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_base_rate_action=>{:input=>[{:name=>:base_rate_action, :type=>"BaseRateAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_base_rate_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_base_rate=>{:input=>[{:name=>:base_rate, :type=>"BaseRate", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_base_rate_response", :fields=>[{:name=>:rval, :type=>"BaseRate", :min_occurs=>0, :max_occurs=>1}]}}, :update_base_rates=>{:input=>[{:name=>:base_rates, :type=>"BaseRate", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_base_rates_response", :fields=>[{:name=>:rval, :type=>"BaseRate", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + BASERATESERVICE_TYPES = {:ActivateBaseRates=>{:fields=>[], :base=>"BaseRateAction"}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BaseRateAction=>{:fields=>[{:name=>:base_rate_action_type, :original_name=>"BaseRateAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :BaseRateActionError=>{:fields=>[{:name=>:reason, :type=>"BaseRateActionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BaseRate=>{:fields=>[{:name=>:rate_card_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"BaseRateStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:base_rate_type, :original_name=>"BaseRate.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :BaseRateError=>{:fields=>[{:name=>:reason, :type=>"BaseRateError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BaseRatePage=>{:fields=>[{:name=>:results, :type=>"BaseRate", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DeactivateBaseRates=>{:fields=>[], :base=>"BaseRateAction"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Money=>{:fields=>[{:name=>:currency_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:micro_amount, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ProductBaseRate=>{:fields=>[{:name=>:product_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:rate, :type=>"Money", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseRate"}, :ProductTemplateBaseRate=>{:fields=>[{:name=>:product_template_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:rate, :type=>"Money", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseRate"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"BaseRateActionError.Reason"=>{:fields=>[]}, :"BaseRateError.Reason"=>{:fields=>[]}, :BaseRateStatus=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RangeError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}} + BASERATESERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return BASERATESERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return BASERATESERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return BASERATESERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, BaseRateServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/company_service.rb b/dfp_api/lib/dfp_api/v201311/company_service.rb new file mode 100644 index 000000000..10e80ef88 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/company_service.rb @@ -0,0 +1,54 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:00. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/company_service_registry' + +module DfpApi; module V201311; module CompanyService + class CompanyService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_companies(*args, &block) + return execute_action('create_companies', args, &block) + end + + def create_company(*args, &block) + return execute_action('create_company', args, &block) + end + + def get_companies_by_statement(*args, &block) + return execute_action('get_companies_by_statement', args, &block) + end + + def get_company(*args, &block) + return execute_action('get_company', args, &block) + end + + def update_companies(*args, &block) + return execute_action('update_companies', args, &block) + end + + def update_company(*args, &block) + return execute_action('update_company', args, &block) + end + + private + + def get_service_registry() + return CompanyServiceRegistry + end + + def get_module() + return DfpApi::V201311::CompanyService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/company_service_registry.rb b/dfp_api/lib/dfp_api/v201311/company_service_registry.rb new file mode 100644 index 000000000..32bf7a6f9 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/company_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:00. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module CompanyService + class CompanyServiceRegistry + COMPANYSERVICE_METHODS = {:create_companies=>{:input=>[{:name=>:companies, :type=>"Company", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_companies_response", :fields=>[{:name=>:rval, :type=>"Company", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :create_company=>{:input=>[{:name=>:company, :type=>"Company", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_company_response", :fields=>[{:name=>:rval, :type=>"Company", :min_occurs=>0, :max_occurs=>1}]}}, :get_companies_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_companies_by_statement_response", :fields=>[{:name=>:rval, :type=>"CompanyPage", :min_occurs=>0, :max_occurs=>1}]}}, :get_company=>{:input=>[{:name=>:company_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_company_response", :fields=>[{:name=>:rval, :type=>"Company", :min_occurs=>0, :max_occurs=>1}]}}, :update_companies=>{:input=>[{:name=>:companies, :type=>"Company", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_companies_response", :fields=>[{:name=>:rval, :type=>"Company", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :update_company=>{:input=>[{:name=>:company, :type=>"Company", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_company_response", :fields=>[{:name=>:rval, :type=>"Company", :min_occurs=>0, :max_occurs=>1}]}}} + COMPANYSERVICE_TYPES = {:ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :AppliedLabel=>{:fields=>[{:name=>:label_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_negated, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CompanyCreditStatusError=>{:fields=>[{:name=>:reason, :type=>"CompanyCreditStatusError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Company=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:type, :type=>"Company.Type", :min_occurs=>0, :max_occurs=>1}, {:name=>:address, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:email, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:fax_phone, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:primary_phone, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:external_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:comment, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:credit_status, :type=>"Company.CreditStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:enable_same_advertiser_competitive_exclusion, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:primary_contact_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:applied_team_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:third_party_company_id, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:last_modified_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}]}, :CompanyError=>{:fields=>[{:name=>:reason, :type=>"CompanyError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CompanyPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"Company", :min_occurs=>0, :max_occurs=>:unbounded}]}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InvalidEmailError=>{:fields=>[{:name=>:reason, :type=>"InvalidEmailError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LabelEntityAssociationError=>{:fields=>[{:name=>:reason, :type=>"LabelEntityAssociationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :ParseError=>{:fields=>[{:name=>:reason, :type=>"ParseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TeamError=>{:fields=>[{:name=>:reason, :type=>"TeamError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"CompanyCreditStatusError.Reason"=>{:fields=>[]}, :"Company.CreditStatus"=>{:fields=>[]}, :"Company.Type"=>{:fields=>[]}, :"CompanyError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"InvalidEmailError.Reason"=>{:fields=>[]}, :"LabelEntityAssociationError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"ParseError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}, :"TeamError.Reason"=>{:fields=>[]}} + COMPANYSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return COMPANYSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return COMPANYSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return COMPANYSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, CompanyServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/contact_service.rb b/dfp_api/lib/dfp_api/v201311/contact_service.rb new file mode 100644 index 000000000..e252b5912 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/contact_service.rb @@ -0,0 +1,54 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:01. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/contact_service_registry' + +module DfpApi; module V201311; module ContactService + class ContactService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_contact(*args, &block) + return execute_action('create_contact', args, &block) + end + + def create_contacts(*args, &block) + return execute_action('create_contacts', args, &block) + end + + def get_contact(*args, &block) + return execute_action('get_contact', args, &block) + end + + def get_contacts_by_statement(*args, &block) + return execute_action('get_contacts_by_statement', args, &block) + end + + def update_contact(*args, &block) + return execute_action('update_contact', args, &block) + end + + def update_contacts(*args, &block) + return execute_action('update_contacts', args, &block) + end + + private + + def get_service_registry() + return ContactServiceRegistry + end + + def get_module() + return DfpApi::V201311::ContactService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/contact_service_registry.rb b/dfp_api/lib/dfp_api/v201311/contact_service_registry.rb new file mode 100644 index 000000000..c25cf6a0a --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/contact_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:01. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module ContactService + class ContactServiceRegistry + CONTACTSERVICE_METHODS = {:create_contact=>{:input=>[{:name=>:contact, :type=>"Contact", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_contact_response", :fields=>[{:name=>:rval, :type=>"Contact", :min_occurs=>0, :max_occurs=>1}]}}, :create_contacts=>{:input=>[{:name=>:contacts, :type=>"Contact", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_contacts_response", :fields=>[{:name=>:rval, :type=>"Contact", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_contact=>{:input=>[{:name=>:contact_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_contact_response", :fields=>[{:name=>:rval, :type=>"Contact", :min_occurs=>0, :max_occurs=>1}]}}, :get_contacts_by_statement=>{:input=>[{:name=>:statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_contacts_by_statement_response", :fields=>[{:name=>:rval, :type=>"ContactPage", :min_occurs=>0, :max_occurs=>1}]}}, :update_contact=>{:input=>[{:name=>:contact, :type=>"Contact", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_contact_response", :fields=>[{:name=>:rval, :type=>"Contact", :min_occurs=>0, :max_occurs=>1}]}}, :update_contacts=>{:input=>[{:name=>:contacts, :type=>"Contact", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_contacts_response", :fields=>[{:name=>:rval, :type=>"Contact", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + CONTACTSERVICE_TYPES = {:ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Contact=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:company_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"Contact.Status", :min_occurs=>0, :max_occurs=>1}, {:name=>:address, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:cell_phone, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:comment, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:email, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:fax_phone, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:title, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:work_phone, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseContact"}, :ContactError=>{:fields=>[{:name=>:reason, :type=>"ContactError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ContactPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"Contact", :min_occurs=>0, :max_occurs=>:unbounded}]}, :BaseContact=>{:fields=>[{:name=>:base_contact_type, :original_name=>"BaseContact.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InvalidEmailError=>{:fields=>[{:name=>:reason, :type=>"InvalidEmailError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"Contact.Status"=>{:fields=>[]}, :"ContactError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"InvalidEmailError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}} + CONTACTSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return CONTACTSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return CONTACTSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return CONTACTSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, ContactServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/content_bundle_service.rb b/dfp_api/lib/dfp_api/v201311/content_bundle_service.rb new file mode 100644 index 000000000..c52a2f9ce --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/content_bundle_service.rb @@ -0,0 +1,58 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:02. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/content_bundle_service_registry' + +module DfpApi; module V201311; module ContentBundleService + class ContentBundleService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_content_bundle(*args, &block) + return execute_action('create_content_bundle', args, &block) + end + + def create_content_bundles(*args, &block) + return execute_action('create_content_bundles', args, &block) + end + + def get_content_bundle(*args, &block) + return execute_action('get_content_bundle', args, &block) + end + + def get_content_bundles_by_statement(*args, &block) + return execute_action('get_content_bundles_by_statement', args, &block) + end + + def perform_content_bundle_action(*args, &block) + return execute_action('perform_content_bundle_action', args, &block) + end + + def update_content_bundle(*args, &block) + return execute_action('update_content_bundle', args, &block) + end + + def update_content_bundles(*args, &block) + return execute_action('update_content_bundles', args, &block) + end + + private + + def get_service_registry() + return ContentBundleServiceRegistry + end + + def get_module() + return DfpApi::V201311::ContentBundleService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/content_bundle_service_registry.rb b/dfp_api/lib/dfp_api/v201311/content_bundle_service_registry.rb new file mode 100644 index 000000000..a1ec57511 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/content_bundle_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:02. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module ContentBundleService + class ContentBundleServiceRegistry + CONTENTBUNDLESERVICE_METHODS = {:create_content_bundle=>{:input=>[{:name=>:content_bundle, :type=>"ContentBundle", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_content_bundle_response", :fields=>[{:name=>:rval, :type=>"ContentBundle", :min_occurs=>0, :max_occurs=>1}]}}, :create_content_bundles=>{:input=>[{:name=>:content_bundles, :type=>"ContentBundle", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_content_bundles_response", :fields=>[{:name=>:rval, :type=>"ContentBundle", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_content_bundle=>{:input=>[{:name=>:content_bundle_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_content_bundle_response", :fields=>[{:name=>:rval, :type=>"ContentBundle", :min_occurs=>0, :max_occurs=>1}]}}, :get_content_bundles_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_content_bundles_by_statement_response", :fields=>[{:name=>:rval, :type=>"ContentBundlePage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_content_bundle_action=>{:input=>[{:name=>:content_bundle_action, :type=>"ContentBundleAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_content_bundle_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_content_bundle=>{:input=>[{:name=>:content_bundle, :type=>"ContentBundle", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_content_bundle_response", :fields=>[{:name=>:rval, :type=>"ContentBundle", :min_occurs=>0, :max_occurs=>1}]}}, :update_content_bundles=>{:input=>[{:name=>:content_bundles, :type=>"ContentBundle", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_content_bundles_response", :fields=>[{:name=>:rval, :type=>"ContentBundle", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + CONTENTBUNDLESERVICE_TYPES = {:ActivateContentBundles=>{:fields=>[], :base=>"ContentBundleAction"}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ContentBundleAction=>{:fields=>[{:name=>:content_bundle_action_type, :original_name=>"ContentBundleAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ContentBundle=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:description, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"ContentBundleStatus", :min_occurs=>0, :max_occurs=>1}]}, :ContentBundlePage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"ContentBundle", :min_occurs=>0, :max_occurs=>:unbounded}]}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DeactivateContentBundles=>{:fields=>[], :base=>"ContentBundleAction"}, :ExcludeContentFromContentBundle=>{:fields=>[{:name=>:content_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :base=>"ContentBundleAction"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :IncludeContentInContentBundle=>{:fields=>[{:name=>:content_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :base=>"ContentBundleAction"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PlacementError=>{:fields=>[{:name=>:reason, :type=>"PlacementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :ContentBundleStatus=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PlacementError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}} + CONTENTBUNDLESERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return CONTENTBUNDLESERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return CONTENTBUNDLESERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return CONTENTBUNDLESERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, ContentBundleServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/content_metadata_key_hierarchy_service.rb b/dfp_api/lib/dfp_api/v201311/content_metadata_key_hierarchy_service.rb new file mode 100644 index 000000000..223248086 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/content_metadata_key_hierarchy_service.rb @@ -0,0 +1,34 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:04. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/content_metadata_key_hierarchy_service_registry' + +module DfpApi; module V201311; module ContentMetadataKeyHierarchyService + class ContentMetadataKeyHierarchyService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def get_content_metadata_key_hierarchies_by_statement(*args, &block) + return execute_action('get_content_metadata_key_hierarchies_by_statement', args, &block) + end + + private + + def get_service_registry() + return ContentMetadataKeyHierarchyServiceRegistry + end + + def get_module() + return DfpApi::V201311::ContentMetadataKeyHierarchyService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/content_metadata_key_hierarchy_service_registry.rb b/dfp_api/lib/dfp_api/v201311/content_metadata_key_hierarchy_service_registry.rb new file mode 100644 index 000000000..bfe95a93b --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/content_metadata_key_hierarchy_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:04. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module ContentMetadataKeyHierarchyService + class ContentMetadataKeyHierarchyServiceRegistry + CONTENTMETADATAKEYHIERARCHYSERVICE_METHODS = {:get_content_metadata_key_hierarchies_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_content_metadata_key_hierarchies_by_statement_response", :fields=>[{:name=>:rval, :type=>"ContentMetadataKeyHierarchyPage", :min_occurs=>0, :max_occurs=>1}]}}} + CONTENTMETADATAKEYHIERARCHYSERVICE_TYPES = {:ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ContentMetadataKeyHierarchy=>{:fields=>[{:name=>:id, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:hierarchy_levels, :type=>"ContentMetadataKeyHierarchyLevel", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ContentMetadataKeyHierarchyError=>{:fields=>[{:name=>:reason, :type=>"ContentMetadataKeyHierarchyError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ContentMetadataKeyHierarchyLevel=>{:fields=>[{:name=>:custom_targeting_key_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:hierarchy_level, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :ContentMetadataKeyHierarchyPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"ContentMetadataKeyHierarchy", :min_occurs=>0, :max_occurs=>:unbounded}]}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredCollectionError=>{:fields=>[{:name=>:reason, :type=>"RequiredCollectionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredNumberError=>{:fields=>[{:name=>:reason, :type=>"RequiredNumberError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"ContentMetadataKeyHierarchyError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RequiredCollectionError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"RequiredNumberError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}} + CONTENTMETADATAKEYHIERARCHYSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return CONTENTMETADATAKEYHIERARCHYSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return CONTENTMETADATAKEYHIERARCHYSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return CONTENTMETADATAKEYHIERARCHYSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, ContentMetadataKeyHierarchyServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/content_service.rb b/dfp_api/lib/dfp_api/v201311/content_service.rb new file mode 100644 index 000000000..7ce20e964 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/content_service.rb @@ -0,0 +1,38 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:04. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/content_service_registry' + +module DfpApi; module V201311; module ContentService + class ContentService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def get_content_by_statement(*args, &block) + return execute_action('get_content_by_statement', args, &block) + end + + def get_content_by_statement_and_custom_targeting_value(*args, &block) + return execute_action('get_content_by_statement_and_custom_targeting_value', args, &block) + end + + private + + def get_service_registry() + return ContentServiceRegistry + end + + def get_module() + return DfpApi::V201311::ContentService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/content_service_registry.rb b/dfp_api/lib/dfp_api/v201311/content_service_registry.rb new file mode 100644 index 000000000..8e4a1e508 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/content_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:04. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module ContentService + class ContentServiceRegistry + CONTENTSERVICE_METHODS = {:get_content_by_statement=>{:input=>[{:name=>:statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_content_by_statement_response", :fields=>[{:name=>:rval, :type=>"ContentPage", :min_occurs=>0, :max_occurs=>1}]}}, :get_content_by_statement_and_custom_targeting_value=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}, {:name=>:custom_targeting_value_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_content_by_statement_and_custom_targeting_value_response", :fields=>[{:name=>:rval, :type=>"ContentPage", :min_occurs=>0, :max_occurs=>1}]}}} + CONTENTSERVICE_TYPES = {:ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CmsContent=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:display_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:cms_content_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Content=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"ContentStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:status_defined_by, :type=>"ContentStatusDefinedBy", :min_occurs=>0, :max_occurs=>1}, {:name=>:last_modified_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:user_defined_custom_targeting_value_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:mapping_rule_defined_custom_targeting_value_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:cms_sources, :type=>"CmsContent", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ContentPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"Content", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ContentPartnerError=>{:fields=>[{:name=>:reason, :type=>"ContentPartnerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InvalidUrlError=>{:fields=>[{:name=>:reason, :type=>"InvalidUrlError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredCollectionError=>{:fields=>[{:name=>:reason, :type=>"RequiredCollectionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredNumberError=>{:fields=>[{:name=>:reason, :type=>"RequiredNumberError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"ContentPartnerError.Reason"=>{:fields=>[]}, :ContentStatus=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"InvalidUrlError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RequiredCollectionError.Reason"=>{:fields=>[]}, :"RequiredNumberError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :ContentStatusDefinedBy=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}} + CONTENTSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return CONTENTSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return CONTENTSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return CONTENTSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, ContentServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/creative_service.rb b/dfp_api/lib/dfp_api/v201311/creative_service.rb new file mode 100644 index 000000000..e35ec4b71 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/creative_service.rb @@ -0,0 +1,54 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:05. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/creative_service_registry' + +module DfpApi; module V201311; module CreativeService + class CreativeService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_creative(*args, &block) + return execute_action('create_creative', args, &block) + end + + def create_creatives(*args, &block) + return execute_action('create_creatives', args, &block) + end + + def get_creative(*args, &block) + return execute_action('get_creative', args, &block) + end + + def get_creatives_by_statement(*args, &block) + return execute_action('get_creatives_by_statement', args, &block) + end + + def update_creative(*args, &block) + return execute_action('update_creative', args, &block) + end + + def update_creatives(*args, &block) + return execute_action('update_creatives', args, &block) + end + + private + + def get_service_registry() + return CreativeServiceRegistry + end + + def get_module() + return DfpApi::V201311::CreativeService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/creative_service_registry.rb b/dfp_api/lib/dfp_api/v201311/creative_service_registry.rb new file mode 100644 index 000000000..0619ecf4f --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/creative_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:05. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module CreativeService + class CreativeServiceRegistry + CREATIVESERVICE_METHODS = {:create_creative=>{:input=>[{:name=>:creative, :type=>"Creative", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_creative_response", :fields=>[{:name=>:rval, :type=>"Creative", :min_occurs=>0, :max_occurs=>1}]}}, :create_creatives=>{:input=>[{:name=>:creatives, :type=>"Creative", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_creatives_response", :fields=>[{:name=>:rval, :type=>"Creative", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_creative=>{:input=>[{:name=>:creative_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_creative_response", :fields=>[{:name=>:rval, :type=>"Creative", :min_occurs=>0, :max_occurs=>1}]}}, :get_creatives_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_creatives_by_statement_response", :fields=>[{:name=>:rval, :type=>"CreativePage", :min_occurs=>0, :max_occurs=>1}]}}, :update_creative=>{:input=>[{:name=>:creative, :type=>"Creative", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_creative_response", :fields=>[{:name=>:rval, :type=>"Creative", :min_occurs=>0, :max_occurs=>1}]}}, :update_creatives=>{:input=>[{:name=>:creatives, :type=>"Creative", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_creatives_response", :fields=>[{:name=>:rval, :type=>"Creative", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + CREATIVESERVICE_TYPES = {:BaseDynamicAllocationCreative=>{:fields=>[], :abstract=>true, :base=>"Creative"}, :BaseCreativeTemplateVariableValue=>{:fields=>[{:name=>:unique_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:base_creative_template_variable_value_type, :original_name=>"BaseCreativeTemplateVariableValue.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AdExchangeCreative=>{:fields=>[], :base=>"HasHtmlSnippetDynamicAllocationCreative"}, :AdMobBackfillCreative=>{:fields=>[{:name=>:additional_parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:publisher_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseDynamicAllocationCreative"}, :AdSenseCreative=>{:fields=>[], :base=>"HasHtmlSnippetDynamicAllocationCreative"}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :AppliedLabel=>{:fields=>[{:name=>:label_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_negated, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :AspectRatioImageCreative=>{:fields=>[{:name=>:image_assets, :type=>"CreativeAsset", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:alt_text, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:third_party_impression_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:override_size, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"HasDestinationUrlCreative"}, :AssetCreativeTemplateVariableValue=>{:fields=>[{:name=>:asset_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:asset_byte_array, :type=>"base64Binary", :min_occurs=>0, :max_occurs=>1}, {:name=>:file_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCreativeTemplateVariableValue"}, :Asset=>{:fields=>[{:name=>:asset_type, :original_name=>"Asset.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AssetError=>{:fields=>[{:name=>:reason, :type=>"AssetError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BaseCustomFieldValue=>{:fields=>[{:name=>:custom_field_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:base_custom_field_value_type, :original_name=>"BaseCustomFieldValue.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :BaseFlashCreative=>{:fields=>[{:name=>:flash_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:flash_byte_array, :type=>"base64Binary", :min_occurs=>0, :max_occurs=>1}, {:name=>:fallback_image_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:fallback_image_byte_array, :type=>"base64Binary", :min_occurs=>0, :max_occurs=>1}, {:name=>:override_size, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:click_tag_required, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:fallback_preview_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:flash_asset_size, :type=>"Size", :min_occurs=>0, :max_occurs=>1}, {:name=>:fallback_asset_size, :type=>"Size", :min_occurs=>0, :max_occurs=>1}], :abstract=>true, :base=>"HasDestinationUrlCreative"}, :BaseFlashRedirectCreative=>{:fields=>[{:name=>:flash_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:fallback_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:fallback_preview_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true, :base=>"HasDestinationUrlCreative"}, :BaseImageCreative=>{:fields=>[{:name=>:override_size, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:primary_image_asset, :type=>"CreativeAsset", :min_occurs=>0, :max_occurs=>1}], :abstract=>true, :base=>"HasDestinationUrlCreative"}, :BaseImageRedirectCreative=>{:fields=>[{:name=>:image_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true, :base=>"HasDestinationUrlCreative"}, :BaseRichMediaStudioCreative=>{:fields=>[{:name=>:studio_creative_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_format, :type=>"RichMediaStudioCreativeFormat", :min_occurs=>0, :max_occurs=>1}, {:name=>:artwork_type, :type=>"RichMediaStudioCreativeArtworkType", :min_occurs=>0, :max_occurs=>1}, {:name=>:total_file_size, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:ad_tag_keys, :type=>"string", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:custom_key_values, :type=>"string", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:survey_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:all_impressions_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:rich_media_impressions_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:backup_image_impressions_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:override_css, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:required_flash_plugin_version, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:duration, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:billing_attribute, :type=>"RichMediaStudioCreativeBillingAttribute", :min_occurs=>0, :max_occurs=>1}, {:name=>:rich_media_studio_child_asset_properties, :type=>"RichMediaStudioChildAssetProperty", :min_occurs=>0, :max_occurs=>:unbounded}], :abstract=>true, :base=>"Creative"}, :BaseVideoCreative=>{:fields=>[{:name=>:duration, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:allow_duration_override, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:tracking_urls, :type=>"ConversionEvent_TrackingUrlsMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:companion_creative_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:custom_parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:vast_preview_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true, :base=>"HasDestinationUrlCreative"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClickTrackingCreative=>{:fields=>[{:name=>:click_tracking_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Creative"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ConversionEvent_TrackingUrlsMapEntry=>{:fields=>[{:name=>:key, :type=>"ConversionEvent", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"TrackingUrls", :min_occurs=>0, :max_occurs=>1}]}, :CreativeAsset=>{:fields=>[{:name=>:asset_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:asset_byte_array, :type=>"base64Binary", :min_occurs=>0, :max_occurs=>1}, {:name=>:file_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:file_size, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:asset_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:size, :type=>"Size", :min_occurs=>0, :max_occurs=>1}, {:name=>:image_density, :type=>"ImageDensity", :min_occurs=>0, :max_occurs=>1}]}, :CustomCreativeAsset=>{:fields=>[{:name=>:macro_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:asset_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:asset_byte_array, :type=>"base64Binary", :min_occurs=>0, :max_occurs=>1}, {:name=>:file_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:file_size, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :CreativeAssetMacroError=>{:fields=>[{:name=>:reason, :type=>"CreativeAssetMacroError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Creative=>{:fields=>[{:name=>:advertiser_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:size, :type=>"Size", :min_occurs=>0, :max_occurs=>1}, {:name=>:preview_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:last_modified_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:custom_field_values, :type=>"BaseCustomFieldValue", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:creative_type, :original_name=>"Creative.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :CreativeError=>{:fields=>[{:name=>:reason, :type=>"CreativeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CreativePage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"Creative", :min_occurs=>0, :max_occurs=>:unbounded}]}, :CreativeSetError=>{:fields=>[{:name=>:reason, :type=>"CreativeSetError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomCreative=>{:fields=>[{:name=>:html_snippet, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:custom_creative_assets, :type=>"CustomCreativeAsset", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:is_interstitial, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"HasDestinationUrlCreative"}, :CustomCreativeError=>{:fields=>[{:name=>:reason, :type=>"CustomCreativeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomFieldValue=>{:fields=>[{:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCustomFieldValue"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :LegacyDfpMobileCreative=>{:fields=>[], :base=>"HasDestinationUrlCreative"}, :DropDownCustomFieldValue=>{:fields=>[{:name=>:custom_field_option_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCustomFieldValue"}, :EntityLimitReachedError=>{:fields=>[], :base=>"ApiError"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :FileError=>{:fields=>[{:name=>:reason, :type=>"FileError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :FlashCreative=>{:fields=>[{:name=>:swiffy_asset, :type=>"SwiffyFallbackAsset", :min_occurs=>0, :max_occurs=>1}, {:name=>:create_swiffy_asset, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseFlashCreative"}, :FlashOverlayCreative=>{:fields=>[{:name=>:companion_creative_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:tracking_urls, :type=>"ConversionEvent_TrackingUrlsMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:custom_parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_framework, :type=>"ApiFramework", :min_occurs=>0, :max_occurs=>1}, {:name=>:duration, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:vast_preview_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseFlashCreative"}, :FlashRedirectCreative=>{:fields=>[], :base=>"BaseFlashRedirectCreative"}, :FlashRedirectOverlayCreative=>{:fields=>[{:name=>:companion_creative_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:tracking_urls, :type=>"ConversionEvent_TrackingUrlsMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:custom_parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_framework, :type=>"ApiFramework", :min_occurs=>0, :max_occurs=>1}, {:name=>:duration, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:flash_asset_size, :type=>"Size", :min_occurs=>0, :max_occurs=>1}, {:name=>:vast_preview_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseFlashRedirectCreative"}, :HasDestinationUrlCreative=>{:fields=>[{:name=>:destination_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true, :base=>"Creative"}, :HasHtmlSnippetDynamicAllocationCreative=>{:fields=>[{:name=>:code_snippet, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true, :base=>"BaseDynamicAllocationCreative"}, :ImageCreative=>{:fields=>[{:name=>:alt_text, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:third_party_impression_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:secondary_image_assets, :type=>"CreativeAsset", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"BaseImageCreative"}, :ImageError=>{:fields=>[{:name=>:reason, :type=>"ImageError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ImageOverlayCreative=>{:fields=>[{:name=>:companion_creative_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:tracking_urls, :type=>"ConversionEvent_TrackingUrlsMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:custom_parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:duration, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:vast_preview_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseImageCreative"}, :ImageRedirectCreative=>{:fields=>[{:name=>:alt_text, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:third_party_impression_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseImageRedirectCreative"}, :ImageRedirectOverlayCreative=>{:fields=>[{:name=>:asset_size, :type=>"Size", :min_occurs=>0, :max_occurs=>1}, {:name=>:duration, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:companion_creative_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:tracking_urls, :type=>"ConversionEvent_TrackingUrlsMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:custom_parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:vast_preview_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseImageRedirectCreative"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalRedirectCreative=>{:fields=>[{:name=>:asset_size, :type=>"Size", :min_occurs=>0, :max_occurs=>1}, {:name=>:internal_redirect_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:override_size, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_interstitial, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Creative"}, :InvalidUrlError=>{:fields=>[{:name=>:reason, :type=>"InvalidUrlError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LabelEntityAssociationError=>{:fields=>[{:name=>:reason, :type=>"LabelEntityAssociationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LegacyDfpCreative=>{:fields=>[], :base=>"Creative"}, :LineItemCreativeAssociationError=>{:fields=>[{:name=>:reason, :type=>"LineItemCreativeAssociationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LongCreativeTemplateVariableValue=>{:fields=>[{:name=>:value, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCreativeTemplateVariableValue"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :ParseError=>{:fields=>[{:name=>:reason, :type=>"ParseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RedirectAsset=>{:fields=>[{:name=>:redirect_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true, :base=>"Asset"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredNumberError=>{:fields=>[{:name=>:reason, :type=>"RequiredNumberError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredSizeError=>{:fields=>[{:name=>:reason, :type=>"RequiredSizeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RichMediaStudioChildAssetProperty=>{:fields=>[{:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:type, :type=>"RichMediaStudioChildAssetProperty.Type", :min_occurs=>0, :max_occurs=>1}, {:name=>:total_file_size, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:width, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:height, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:url, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :RichMediaStudioCreative=>{:fields=>[{:name=>:is_interstitial, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseRichMediaStudioCreative"}, :RichMediaStudioCreativeError=>{:fields=>[{:name=>:reason, :type=>"RichMediaStudioCreativeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :Size=>{:fields=>[{:name=>:width, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:height, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_aspect_ratio, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StringCreativeTemplateVariableValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCreativeTemplateVariableValue"}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :SwiffyConversionError=>{:fields=>[{:name=>:reason, :type=>"SwiffyConversionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SwiffyFallbackAsset=>{:fields=>[{:name=>:asset, :type=>"CreativeAsset", :min_occurs=>0, :max_occurs=>1}, {:name=>:html5_features, :type=>"Html5Feature", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:localized_info_messages, :type=>"string", :min_occurs=>0, :max_occurs=>:unbounded}]}, :TemplateCreative=>{:fields=>[{:name=>:creative_template_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_interstitial, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:destination_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_template_variable_values, :type=>"BaseCreativeTemplateVariableValue", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Creative"}, :TemplateInstantiatedCreativeError=>{:fields=>[{:name=>:reason, :type=>"TemplateInstantiatedCreativeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ThirdPartyCreative=>{:fields=>[{:name=>:snippet, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:expanded_snippet, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Creative"}, :TrackingUrls=>{:fields=>[{:name=>:urls, :type=>"string", :min_occurs=>0, :max_occurs=>:unbounded}]}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :UnsupportedCreative=>{:fields=>[{:name=>:unsupported_creative_type, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Creative"}, :UrlCreativeTemplateVariableValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCreativeTemplateVariableValue"}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :VastRedirectCreative=>{:fields=>[{:name=>:vast_xml_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:vast_redirect_type, :type=>"VastRedirectType", :min_occurs=>0, :max_occurs=>1}, {:name=>:duration, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:companion_creative_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:tracking_urls, :type=>"ConversionEvent_TrackingUrlsMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:vast_preview_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Creative"}, :VideoCreative=>{:fields=>[], :base=>"BaseVideoCreative"}, :VideoRedirectAsset=>{:fields=>[], :base=>"RedirectAsset"}, :VideoRedirectCreative=>{:fields=>[{:name=>:video_assets, :type=>"VideoRedirectAsset", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"BaseVideoCreative"}, :VpaidLinearCreative=>{:fields=>[{:name=>:flash_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:flash_byte_array, :type=>"base64Binary", :min_occurs=>0, :max_occurs=>1}, {:name=>:override_size, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:flash_asset_size, :type=>"Size", :min_occurs=>0, :max_occurs=>1}, {:name=>:companion_creative_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:tracking_urls, :type=>"ConversionEvent_TrackingUrlsMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:custom_parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:duration, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:vast_preview_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"HasDestinationUrlCreative"}, :VpaidLinearRedirectCreative=>{:fields=>[{:name=>:companion_creative_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:tracking_urls, :type=>"ConversionEvent_TrackingUrlsMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:custom_parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:duration, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:flash_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:flash_asset_size, :type=>"Size", :min_occurs=>0, :max_occurs=>1}, {:name=>:vast_preview_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"HasDestinationUrlCreative"}, :ApiFramework=>{:fields=>[]}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AssetError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :ConversionEvent=>{:fields=>[]}, :"CreativeAssetMacroError.Reason"=>{:fields=>[]}, :"CreativeError.Reason"=>{:fields=>[]}, :"CreativeSetError.Reason"=>{:fields=>[]}, :"CustomCreativeError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"FileError.Reason"=>{:fields=>[]}, :Html5Feature=>{:fields=>[]}, :ImageDensity=>{:fields=>[]}, :"ImageError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"InvalidUrlError.Reason"=>{:fields=>[]}, :"LabelEntityAssociationError.Reason"=>{:fields=>[]}, :"LineItemCreativeAssociationError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"ParseError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RangeError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"RequiredNumberError.Reason"=>{:fields=>[]}, :"RequiredSizeError.Reason"=>{:fields=>[]}, :"RichMediaStudioChildAssetProperty.Type"=>{:fields=>[]}, :RichMediaStudioCreativeArtworkType=>{:fields=>[]}, :RichMediaStudioCreativeBillingAttribute=>{:fields=>[]}, :"RichMediaStudioCreativeError.Reason"=>{:fields=>[]}, :RichMediaStudioCreativeFormat=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}, :"SwiffyConversionError.Reason"=>{:fields=>[]}, :"TemplateInstantiatedCreativeError.Reason"=>{:fields=>[]}, :VastRedirectType=>{:fields=>[]}} + CREATIVESERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return CREATIVESERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return CREATIVESERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return CREATIVESERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, CreativeServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/creative_set_service.rb b/dfp_api/lib/dfp_api/v201311/creative_set_service.rb new file mode 100644 index 000000000..78334aa6d --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/creative_set_service.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:08. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/creative_set_service_registry' + +module DfpApi; module V201311; module CreativeSetService + class CreativeSetService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_creative_set(*args, &block) + return execute_action('create_creative_set', args, &block) + end + + def get_creative_set(*args, &block) + return execute_action('get_creative_set', args, &block) + end + + def get_creative_sets_by_statement(*args, &block) + return execute_action('get_creative_sets_by_statement', args, &block) + end + + def update_creative_set(*args, &block) + return execute_action('update_creative_set', args, &block) + end + + private + + def get_service_registry() + return CreativeSetServiceRegistry + end + + def get_module() + return DfpApi::V201311::CreativeSetService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/creative_set_service_registry.rb b/dfp_api/lib/dfp_api/v201311/creative_set_service_registry.rb new file mode 100644 index 000000000..7a7f84620 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/creative_set_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:08. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module CreativeSetService + class CreativeSetServiceRegistry + CREATIVESETSERVICE_METHODS = {:create_creative_set=>{:input=>[{:name=>:creative_set, :type=>"CreativeSet", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_creative_set_response", :fields=>[{:name=>:rval, :type=>"CreativeSet", :min_occurs=>0, :max_occurs=>1}]}}, :get_creative_set=>{:input=>[{:name=>:creative_set_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_creative_set_response", :fields=>[{:name=>:rval, :type=>"CreativeSet", :min_occurs=>0, :max_occurs=>1}]}}, :get_creative_sets_by_statement=>{:input=>[{:name=>:statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_creative_sets_by_statement_response", :fields=>[{:name=>:rval, :type=>"CreativeSetPage", :min_occurs=>0, :max_occurs=>1}]}}, :update_creative_set=>{:input=>[{:name=>:creative_set, :type=>"CreativeSet", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_creative_set_response", :fields=>[{:name=>:rval, :type=>"CreativeSet", :min_occurs=>0, :max_occurs=>1}]}}} + CREATIVESETSERVICE_TYPES = {:ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :AssetError=>{:fields=>[{:name=>:reason, :type=>"AssetError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CreativeAssetMacroError=>{:fields=>[{:name=>:reason, :type=>"CreativeAssetMacroError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CreativeError=>{:fields=>[{:name=>:reason, :type=>"CreativeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CreativeSet=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:master_creative_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:companion_creative_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:last_modified_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}]}, :CreativeSetError=>{:fields=>[{:name=>:reason, :type=>"CreativeSetError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CreativeSetPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"CreativeSet", :min_occurs=>0, :max_occurs=>:unbounded}]}, :CustomCreativeError=>{:fields=>[{:name=>:reason, :type=>"CustomCreativeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :FileError=>{:fields=>[{:name=>:reason, :type=>"FileError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ImageError=>{:fields=>[{:name=>:reason, :type=>"ImageError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InvalidUrlError=>{:fields=>[{:name=>:reason, :type=>"InvalidUrlError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LabelEntityAssociationError=>{:fields=>[{:name=>:reason, :type=>"LabelEntityAssociationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :ParseError=>{:fields=>[{:name=>:reason, :type=>"ParseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredNumberError=>{:fields=>[{:name=>:reason, :type=>"RequiredNumberError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredSizeError=>{:fields=>[{:name=>:reason, :type=>"RequiredSizeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AssetError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"CreativeAssetMacroError.Reason"=>{:fields=>[]}, :"CreativeError.Reason"=>{:fields=>[]}, :"CreativeSetError.Reason"=>{:fields=>[]}, :"CustomCreativeError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"FileError.Reason"=>{:fields=>[]}, :"ImageError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"InvalidUrlError.Reason"=>{:fields=>[]}, :"LabelEntityAssociationError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"ParseError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"RequiredNumberError.Reason"=>{:fields=>[]}, :"RequiredSizeError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}} + CREATIVESETSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return CREATIVESETSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return CREATIVESETSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return CREATIVESETSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, CreativeSetServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/creative_template_service.rb b/dfp_api/lib/dfp_api/v201311/creative_template_service.rb new file mode 100644 index 000000000..1bb52f884 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/creative_template_service.rb @@ -0,0 +1,38 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:10. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/creative_template_service_registry' + +module DfpApi; module V201311; module CreativeTemplateService + class CreativeTemplateService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def get_creative_template(*args, &block) + return execute_action('get_creative_template', args, &block) + end + + def get_creative_templates_by_statement(*args, &block) + return execute_action('get_creative_templates_by_statement', args, &block) + end + + private + + def get_service_registry() + return CreativeTemplateServiceRegistry + end + + def get_module() + return DfpApi::V201311::CreativeTemplateService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/creative_template_service_registry.rb b/dfp_api/lib/dfp_api/v201311/creative_template_service_registry.rb new file mode 100644 index 000000000..373f62417 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/creative_template_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:10. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module CreativeTemplateService + class CreativeTemplateServiceRegistry + CREATIVETEMPLATESERVICE_METHODS = {:get_creative_template=>{:input=>[{:name=>:creative_template_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_creative_template_response", :fields=>[{:name=>:rval, :type=>"CreativeTemplate", :min_occurs=>0, :max_occurs=>1}]}}, :get_creative_templates_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_creative_templates_by_statement_response", :fields=>[{:name=>:rval, :type=>"CreativeTemplatePage", :min_occurs=>0, :max_occurs=>1}]}}} + CREATIVETEMPLATESERVICE_TYPES = {:ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :AssetCreativeTemplateVariable=>{:fields=>[{:name=>:mime_types, :type=>"AssetCreativeTemplateVariable.MimeType", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"CreativeTemplateVariable"}, :CreativeTemplate=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:description, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:variables, :type=>"CreativeTemplateVariable", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:status, :type=>"CreativeTemplateStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:type, :type=>"CreativeTemplateType", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_interstitial, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :CreativeTemplateError=>{:fields=>[{:name=>:reason, :type=>"CreativeTemplateError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ListStringCreativeTemplateVariable=>{:fields=>[{:name=>:choices, :type=>"ListStringCreativeTemplateVariable.VariableChoice", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:allow_other_choice, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"StringCreativeTemplateVariable"}, :"ListStringCreativeTemplateVariable.VariableChoice"=>{:fields=>[{:name=>:label, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :LongCreativeTemplateVariable=>{:fields=>[{:name=>:default_value, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"CreativeTemplateVariable"}, :CreativeTemplatePage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"CreativeTemplate", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StringCreativeTemplateVariable=>{:fields=>[{:name=>:default_value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"CreativeTemplateVariable"}, :UrlCreativeTemplateVariable=>{:fields=>[{:name=>:default_value, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_tracking_url, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"CreativeTemplateVariable"}, :CreativeTemplateVariable=>{:fields=>[{:name=>:label, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:unique_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:description, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_required, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_template_variable_type, :original_name=>"CreativeTemplateVariable.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InvalidUrlError=>{:fields=>[{:name=>:reason, :type=>"InvalidUrlError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :ParseError=>{:fields=>[{:name=>:reason, :type=>"ParseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredNumberError=>{:fields=>[{:name=>:reason, :type=>"RequiredNumberError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"AssetCreativeTemplateVariable.MimeType"=>{:fields=>[]}, :"CreativeTemplateError.Reason"=>{:fields=>[]}, :CreativeTemplateStatus=>{:fields=>[]}, :CreativeTemplateType=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"InvalidUrlError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"ParseError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RangeError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"RequiredNumberError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}} + CREATIVETEMPLATESERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return CREATIVETEMPLATESERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return CREATIVETEMPLATESERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return CREATIVETEMPLATESERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, CreativeTemplateServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/creative_wrapper_service.rb b/dfp_api/lib/dfp_api/v201311/creative_wrapper_service.rb new file mode 100644 index 000000000..bf24c4d7f --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/creative_wrapper_service.rb @@ -0,0 +1,58 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:11. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/creative_wrapper_service_registry' + +module DfpApi; module V201311; module CreativeWrapperService + class CreativeWrapperService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_creative_wrapper(*args, &block) + return execute_action('create_creative_wrapper', args, &block) + end + + def create_creative_wrappers(*args, &block) + return execute_action('create_creative_wrappers', args, &block) + end + + def get_creative_wrapper(*args, &block) + return execute_action('get_creative_wrapper', args, &block) + end + + def get_creative_wrappers_by_statement(*args, &block) + return execute_action('get_creative_wrappers_by_statement', args, &block) + end + + def perform_creative_wrapper_action(*args, &block) + return execute_action('perform_creative_wrapper_action', args, &block) + end + + def update_creative_wrapper(*args, &block) + return execute_action('update_creative_wrapper', args, &block) + end + + def update_creative_wrappers(*args, &block) + return execute_action('update_creative_wrappers', args, &block) + end + + private + + def get_service_registry() + return CreativeWrapperServiceRegistry + end + + def get_module() + return DfpApi::V201311::CreativeWrapperService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/creative_wrapper_service_registry.rb b/dfp_api/lib/dfp_api/v201311/creative_wrapper_service_registry.rb new file mode 100644 index 000000000..82abcd8d9 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/creative_wrapper_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:11. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module CreativeWrapperService + class CreativeWrapperServiceRegistry + CREATIVEWRAPPERSERVICE_METHODS = {:create_creative_wrapper=>{:input=>[{:name=>:creative_wrapper, :type=>"CreativeWrapper", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_creative_wrapper_response", :fields=>[{:name=>:rval, :type=>"CreativeWrapper", :min_occurs=>0, :max_occurs=>1}]}}, :create_creative_wrappers=>{:input=>[{:name=>:creative_wrappers, :type=>"CreativeWrapper", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_creative_wrappers_response", :fields=>[{:name=>:rval, :type=>"CreativeWrapper", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_creative_wrapper=>{:input=>[{:name=>:creative_wrapper_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_creative_wrapper_response", :fields=>[{:name=>:rval, :type=>"CreativeWrapper", :min_occurs=>0, :max_occurs=>1}]}}, :get_creative_wrappers_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_creative_wrappers_by_statement_response", :fields=>[{:name=>:rval, :type=>"CreativeWrapperPage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_creative_wrapper_action=>{:input=>[{:name=>:creative_wrapper_action, :type=>"CreativeWrapperAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_creative_wrapper_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_creative_wrapper=>{:input=>[{:name=>:creative_wrapper, :type=>"CreativeWrapper", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_creative_wrapper_response", :fields=>[{:name=>:rval, :type=>"CreativeWrapper", :min_occurs=>0, :max_occurs=>1}]}}, :update_creative_wrappers=>{:input=>[{:name=>:creative_wrappers, :type=>"CreativeWrapper", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_creative_wrappers_response", :fields=>[{:name=>:rval, :type=>"CreativeWrapper", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + CREATIVEWRAPPERSERVICE_TYPES = {:ActivateCreativeWrappers=>{:fields=>[], :base=>"CreativeWrapperAction"}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CreativeWrapperAction=>{:fields=>[{:name=>:creative_wrapper_action_type, :original_name=>"CreativeWrapperAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :CreativeWrapper=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:label_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:header, :type=>"CreativeWrapperHtmlSnippet", :min_occurs=>0, :max_occurs=>1}, {:name=>:footer, :type=>"CreativeWrapperHtmlSnippet", :min_occurs=>0, :max_occurs=>1}, {:name=>:ordering, :type=>"CreativeWrapperOrdering", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"CreativeWrapperStatus", :min_occurs=>0, :max_occurs=>1}]}, :CreativeWrapperError=>{:fields=>[{:name=>:reason, :type=>"CreativeWrapperError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CreativeWrapperPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"CreativeWrapper", :min_occurs=>0, :max_occurs=>:unbounded}]}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DeactivateCreativeWrappers=>{:fields=>[], :base=>"CreativeWrapperAction"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CreativeWrapperHtmlSnippet=>{:fields=>[{:name=>:html_snippet, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LabelError=>{:fields=>[{:name=>:reason, :type=>"LabelError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :ParseError=>{:fields=>[{:name=>:reason, :type=>"ParseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"CreativeWrapperError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :CreativeWrapperOrdering=>{:fields=>[]}, :CreativeWrapperStatus=>{:fields=>[]}, :"LabelError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"ParseError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}} + CREATIVEWRAPPERSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return CREATIVEWRAPPERSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return CREATIVEWRAPPERSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return CREATIVEWRAPPERSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, CreativeWrapperServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/custom_field_service.rb b/dfp_api/lib/dfp_api/v201311/custom_field_service.rb new file mode 100644 index 000000000..5468674ec --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/custom_field_service.rb @@ -0,0 +1,78 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:13. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/custom_field_service_registry' + +module DfpApi; module V201311; module CustomFieldService + class CustomFieldService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_custom_field(*args, &block) + return execute_action('create_custom_field', args, &block) + end + + def create_custom_field_option(*args, &block) + return execute_action('create_custom_field_option', args, &block) + end + + def create_custom_field_options(*args, &block) + return execute_action('create_custom_field_options', args, &block) + end + + def create_custom_fields(*args, &block) + return execute_action('create_custom_fields', args, &block) + end + + def get_custom_field(*args, &block) + return execute_action('get_custom_field', args, &block) + end + + def get_custom_field_option(*args, &block) + return execute_action('get_custom_field_option', args, &block) + end + + def get_custom_fields_by_statement(*args, &block) + return execute_action('get_custom_fields_by_statement', args, &block) + end + + def perform_custom_field_action(*args, &block) + return execute_action('perform_custom_field_action', args, &block) + end + + def update_custom_field(*args, &block) + return execute_action('update_custom_field', args, &block) + end + + def update_custom_field_option(*args, &block) + return execute_action('update_custom_field_option', args, &block) + end + + def update_custom_field_options(*args, &block) + return execute_action('update_custom_field_options', args, &block) + end + + def update_custom_fields(*args, &block) + return execute_action('update_custom_fields', args, &block) + end + + private + + def get_service_registry() + return CustomFieldServiceRegistry + end + + def get_module() + return DfpApi::V201311::CustomFieldService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/custom_field_service_registry.rb b/dfp_api/lib/dfp_api/v201311/custom_field_service_registry.rb new file mode 100644 index 000000000..949cd0f94 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/custom_field_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:13. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module CustomFieldService + class CustomFieldServiceRegistry + CUSTOMFIELDSERVICE_METHODS = {:create_custom_field=>{:input=>[{:name=>:custom_field, :type=>"CustomField", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_custom_field_response", :fields=>[{:name=>:rval, :type=>"CustomField", :min_occurs=>0, :max_occurs=>1}]}}, :create_custom_field_option=>{:input=>[{:name=>:custom_field_option, :type=>"CustomFieldOption", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_custom_field_option_response", :fields=>[{:name=>:rval, :type=>"CustomFieldOption", :min_occurs=>0, :max_occurs=>1}]}}, :create_custom_field_options=>{:input=>[{:name=>:custom_field_options, :type=>"CustomFieldOption", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_custom_field_options_response", :fields=>[{:name=>:rval, :type=>"CustomFieldOption", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :create_custom_fields=>{:input=>[{:name=>:custom_fields, :type=>"CustomField", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_custom_fields_response", :fields=>[{:name=>:rval, :type=>"CustomField", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_custom_field=>{:input=>[{:name=>:custom_field_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_custom_field_response", :fields=>[{:name=>:rval, :type=>"CustomField", :min_occurs=>0, :max_occurs=>1}]}}, :get_custom_field_option=>{:input=>[{:name=>:custom_field_option_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_custom_field_option_response", :fields=>[{:name=>:rval, :type=>"CustomFieldOption", :min_occurs=>0, :max_occurs=>1}]}}, :get_custom_fields_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_custom_fields_by_statement_response", :fields=>[{:name=>:rval, :type=>"CustomFieldPage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_custom_field_action=>{:input=>[{:name=>:custom_field_action, :type=>"CustomFieldAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_custom_field_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_custom_field=>{:input=>[{:name=>:custom_field, :type=>"CustomField", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_custom_field_response", :fields=>[{:name=>:rval, :type=>"CustomField", :min_occurs=>0, :max_occurs=>1}]}}, :update_custom_field_option=>{:input=>[{:name=>:custom_field_option, :type=>"CustomFieldOption", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_custom_field_option_response", :fields=>[{:name=>:rval, :type=>"CustomFieldOption", :min_occurs=>0, :max_occurs=>1}]}}, :update_custom_field_options=>{:input=>[{:name=>:custom_field_options, :type=>"CustomFieldOption", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_custom_field_options_response", :fields=>[{:name=>:rval, :type=>"CustomFieldOption", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :update_custom_fields=>{:input=>[{:name=>:custom_fields, :type=>"CustomField", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_custom_fields_response", :fields=>[{:name=>:rval, :type=>"CustomField", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + CUSTOMFIELDSERVICE_TYPES = {:ActivateCustomFields=>{:fields=>[], :base=>"CustomFieldAction"}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomFieldAction=>{:fields=>[{:name=>:custom_field_action_type, :original_name=>"CustomFieldAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :CustomField=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:description, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_active, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:entity_type, :type=>"CustomFieldEntityType", :min_occurs=>0, :max_occurs=>1}, {:name=>:data_type, :type=>"CustomFieldDataType", :min_occurs=>0, :max_occurs=>1}, {:name=>:visibility, :type=>"CustomFieldVisibility", :min_occurs=>0, :max_occurs=>1}, {:name=>:custom_field_type, :original_name=>"CustomField.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :CustomFieldError=>{:fields=>[{:name=>:reason, :type=>"CustomFieldError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomFieldOption=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:custom_field_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:display_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :CustomFieldPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"CustomField", :min_occurs=>0, :max_occurs=>:unbounded}]}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DeactivateCustomFields=>{:fields=>[], :base=>"CustomFieldAction"}, :DropDownCustomField=>{:fields=>[{:name=>:options, :type=>"CustomFieldOption", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"CustomField"}, :EntityLimitReachedError=>{:fields=>[], :base=>"ApiError"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :ParseError=>{:fields=>[{:name=>:reason, :type=>"ParseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :CustomFieldDataType=>{:fields=>[]}, :CustomFieldEntityType=>{:fields=>[]}, :"CustomFieldError.Reason"=>{:fields=>[]}, :CustomFieldVisibility=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"ParseError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}} + CUSTOMFIELDSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return CUSTOMFIELDSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return CUSTOMFIELDSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return CUSTOMFIELDSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, CustomFieldServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/custom_targeting_service.rb b/dfp_api/lib/dfp_api/v201311/custom_targeting_service.rb new file mode 100644 index 000000000..9572e4a18 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/custom_targeting_service.rb @@ -0,0 +1,62 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:15. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/custom_targeting_service_registry' + +module DfpApi; module V201311; module CustomTargetingService + class CustomTargetingService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_custom_targeting_keys(*args, &block) + return execute_action('create_custom_targeting_keys', args, &block) + end + + def create_custom_targeting_values(*args, &block) + return execute_action('create_custom_targeting_values', args, &block) + end + + def get_custom_targeting_keys_by_statement(*args, &block) + return execute_action('get_custom_targeting_keys_by_statement', args, &block) + end + + def get_custom_targeting_values_by_statement(*args, &block) + return execute_action('get_custom_targeting_values_by_statement', args, &block) + end + + def perform_custom_targeting_key_action(*args, &block) + return execute_action('perform_custom_targeting_key_action', args, &block) + end + + def perform_custom_targeting_value_action(*args, &block) + return execute_action('perform_custom_targeting_value_action', args, &block) + end + + def update_custom_targeting_keys(*args, &block) + return execute_action('update_custom_targeting_keys', args, &block) + end + + def update_custom_targeting_values(*args, &block) + return execute_action('update_custom_targeting_values', args, &block) + end + + private + + def get_service_registry() + return CustomTargetingServiceRegistry + end + + def get_module() + return DfpApi::V201311::CustomTargetingService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/custom_targeting_service_registry.rb b/dfp_api/lib/dfp_api/v201311/custom_targeting_service_registry.rb new file mode 100644 index 000000000..6d0ea4da5 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/custom_targeting_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:15. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module CustomTargetingService + class CustomTargetingServiceRegistry + CUSTOMTARGETINGSERVICE_METHODS = {:create_custom_targeting_keys=>{:input=>[{:name=>:keys, :type=>"CustomTargetingKey", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_custom_targeting_keys_response", :fields=>[{:name=>:rval, :type=>"CustomTargetingKey", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :create_custom_targeting_values=>{:input=>[{:name=>:values, :type=>"CustomTargetingValue", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_custom_targeting_values_response", :fields=>[{:name=>:rval, :type=>"CustomTargetingValue", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_custom_targeting_keys_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_custom_targeting_keys_by_statement_response", :fields=>[{:name=>:rval, :type=>"CustomTargetingKeyPage", :min_occurs=>0, :max_occurs=>1}]}}, :get_custom_targeting_values_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_custom_targeting_values_by_statement_response", :fields=>[{:name=>:rval, :type=>"CustomTargetingValuePage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_custom_targeting_key_action=>{:input=>[{:name=>:custom_targeting_key_action, :type=>"CustomTargetingKeyAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_custom_targeting_key_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :perform_custom_targeting_value_action=>{:input=>[{:name=>:custom_targeting_value_action, :type=>"CustomTargetingValueAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_custom_targeting_value_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_custom_targeting_keys=>{:input=>[{:name=>:keys, :type=>"CustomTargetingKey", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_custom_targeting_keys_response", :fields=>[{:name=>:rval, :type=>"CustomTargetingKey", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :update_custom_targeting_values=>{:input=>[{:name=>:values, :type=>"CustomTargetingValue", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_custom_targeting_values_response", :fields=>[{:name=>:rval, :type=>"CustomTargetingValue", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + CUSTOMTARGETINGSERVICE_TYPES = {:ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomTargetingError=>{:fields=>[{:name=>:reason, :type=>"CustomTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomTargetingKeyAction=>{:fields=>[{:name=>:custom_targeting_key_action_type, :original_name=>"CustomTargetingKeyAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :CustomTargetingKey=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:display_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:type, :type=>"CustomTargetingKey.Type", :min_occurs=>0, :max_occurs=>1}]}, :CustomTargetingKeyPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"CustomTargetingKey", :min_occurs=>0, :max_occurs=>:unbounded}]}, :CustomTargetingValueAction=>{:fields=>[{:name=>:custom_targeting_value_action_type, :original_name=>"CustomTargetingValueAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :CustomTargetingValue=>{:fields=>[{:name=>:custom_targeting_key_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:display_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:match_type, :type=>"CustomTargetingValue.MatchType", :min_occurs=>0, :max_occurs=>1}]}, :CustomTargetingValuePage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"CustomTargetingValue", :min_occurs=>0, :max_occurs=>:unbounded}]}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DeleteCustomTargetingKeys=>{:fields=>[], :base=>"CustomTargetingKeyAction"}, :DeleteCustomTargetingValues=>{:fields=>[], :base=>"CustomTargetingValueAction"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :ParseError=>{:fields=>[{:name=>:reason, :type=>"ParseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"CustomTargetingError.Reason"=>{:fields=>[]}, :"CustomTargetingKey.Type"=>{:fields=>[]}, :"CustomTargetingValue.MatchType"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"ParseError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}} + CUSTOMTARGETINGSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return CUSTOMTARGETINGSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return CUSTOMTARGETINGSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return CUSTOMTARGETINGSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, CustomTargetingServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/exchange_rate_service.rb b/dfp_api/lib/dfp_api/v201311/exchange_rate_service.rb new file mode 100644 index 000000000..fca413d6e --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/exchange_rate_service.rb @@ -0,0 +1,50 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:17. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/exchange_rate_service_registry' + +module DfpApi; module V201311; module ExchangeRateService + class ExchangeRateService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_exchange_rates(*args, &block) + return execute_action('create_exchange_rates', args, &block) + end + + def get_exchange_rate(*args, &block) + return execute_action('get_exchange_rate', args, &block) + end + + def get_exchange_rates_by_statement(*args, &block) + return execute_action('get_exchange_rates_by_statement', args, &block) + end + + def perform_exchange_rate_action(*args, &block) + return execute_action('perform_exchange_rate_action', args, &block) + end + + def update_exchange_rates(*args, &block) + return execute_action('update_exchange_rates', args, &block) + end + + private + + def get_service_registry() + return ExchangeRateServiceRegistry + end + + def get_module() + return DfpApi::V201311::ExchangeRateService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/exchange_rate_service_registry.rb b/dfp_api/lib/dfp_api/v201311/exchange_rate_service_registry.rb new file mode 100644 index 000000000..8db4e03fd --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/exchange_rate_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:17. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module ExchangeRateService + class ExchangeRateServiceRegistry + EXCHANGERATESERVICE_METHODS = {:create_exchange_rates=>{:input=>[{:name=>:exchange_rates, :type=>"ExchangeRate", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_exchange_rates_response", :fields=>[{:name=>:rval, :type=>"ExchangeRate", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_exchange_rate=>{:input=>[{:name=>:exchange_rate_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_exchange_rate_response", :fields=>[{:name=>:rval, :type=>"ExchangeRate", :min_occurs=>0, :max_occurs=>1}]}}, :get_exchange_rates_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_exchange_rates_by_statement_response", :fields=>[{:name=>:rval, :type=>"ExchangeRatePage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_exchange_rate_action=>{:input=>[{:name=>:exchange_rate_action, :type=>"ExchangeRateAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_exchange_rate_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_exchange_rates=>{:input=>[{:name=>:exchange_rates, :type=>"ExchangeRate", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_exchange_rates_response", :fields=>[{:name=>:rval, :type=>"ExchangeRate", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + EXCHANGERATESERVICE_TYPES = {:ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DeleteExchangeRates=>{:fields=>[], :base=>"ExchangeRateAction"}, :ExchangeRateAction=>{:fields=>[{:name=>:exchange_rate_action_type, :original_name=>"ExchangeRateAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ExchangeRate=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:currency_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:refresh_rate, :type=>"ExchangeRateRefreshRate", :min_occurs=>0, :max_occurs=>1}, {:name=>:direction, :type=>"ExchangeRateDirection", :min_occurs=>0, :max_occurs=>1}, {:name=>:exchange_rate, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :ExchangeRateError=>{:fields=>[{:name=>:reason, :type=>"ExchangeRateError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ExchangeRatePage=>{:fields=>[{:name=>:results, :type=>"ExchangeRate", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredNumberError=>{:fields=>[{:name=>:reason, :type=>"RequiredNumberError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :ExchangeRateDirection=>{:fields=>[]}, :"ExchangeRateError.Reason"=>{:fields=>[]}, :ExchangeRateRefreshRate=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RequiredNumberError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}} + EXCHANGERATESERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return EXCHANGERATESERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return EXCHANGERATESERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return EXCHANGERATESERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, ExchangeRateServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/forecast_service.rb b/dfp_api/lib/dfp_api/v201311/forecast_service.rb new file mode 100644 index 000000000..3254aeb17 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/forecast_service.rb @@ -0,0 +1,38 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:18. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/forecast_service_registry' + +module DfpApi; module V201311; module ForecastService + class ForecastService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def get_forecast(*args, &block) + return execute_action('get_forecast', args, &block) + end + + def get_forecast_by_id(*args, &block) + return execute_action('get_forecast_by_id', args, &block) + end + + private + + def get_service_registry() + return ForecastServiceRegistry + end + + def get_module() + return DfpApi::V201311::ForecastService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/forecast_service_registry.rb b/dfp_api/lib/dfp_api/v201311/forecast_service_registry.rb new file mode 100644 index 000000000..8d5aac9b2 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/forecast_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:18. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module ForecastService + class ForecastServiceRegistry + FORECASTSERVICE_METHODS = {:get_forecast=>{:input=>[{:name=>:line_item, :type=>"LineItem", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_forecast_response", :fields=>[{:name=>:rval, :type=>"Forecast", :min_occurs=>0, :max_occurs=>1}]}}, :get_forecast_by_id=>{:input=>[{:name=>:line_item_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_forecast_by_id_response", :fields=>[{:name=>:rval, :type=>"Forecast", :min_occurs=>0, :max_occurs=>1}]}}} + FORECASTSERVICE_TYPES = {:AdUnitAfcSizeError=>{:fields=>[{:name=>:reason, :type=>"AdUnitAfcSizeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :AdUnitCodeError=>{:fields=>[{:name=>:reason, :type=>"AdUnitCodeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :AdUnitTargeting=>{:fields=>[{:name=>:ad_unit_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:include_descendants, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :TechnologyTargeting=>{:fields=>[{:name=>:bandwidth_group_targeting, :type=>"BandwidthGroupTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:browser_targeting, :type=>"BrowserTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:browser_language_targeting, :type=>"BrowserLanguageTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_capability_targeting, :type=>"DeviceCapabilityTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_category_targeting, :type=>"DeviceCategoryTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_manufacturer_targeting, :type=>"DeviceManufacturerTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:mobile_carrier_targeting, :type=>"MobileCarrierTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:mobile_device_targeting, :type=>"MobileDeviceTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:mobile_device_submodel_targeting, :type=>"MobileDeviceSubmodelTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:operating_system_targeting, :type=>"OperatingSystemTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:operating_system_version_targeting, :type=>"OperatingSystemVersionTargeting", :min_occurs=>0, :max_occurs=>1}]}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :AppliedLabel=>{:fields=>[{:name=>:label_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_negated, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :AudienceExtensionError=>{:fields=>[{:name=>:reason, :type=>"AudienceExtensionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BandwidthGroup=>{:fields=>[], :base=>"Technology"}, :BandwidthGroupTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:bandwidth_groups, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :BaseCustomFieldValue=>{:fields=>[{:name=>:custom_field_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:base_custom_field_value_type, :original_name=>"BaseCustomFieldValue.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :Browser=>{:fields=>[{:name=>:major_version, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:minor_version, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :BrowserLanguage=>{:fields=>[], :base=>"Technology"}, :BrowserLanguageTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:browser_languages, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :BrowserTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:browsers, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ClickTrackingLineItemError=>{:fields=>[{:name=>:reason, :type=>"ClickTrackingLineItemError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CompanyCreditStatusError=>{:fields=>[{:name=>:reason, :type=>"CompanyCreditStatusError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ContendingLineItem=>{:fields=>[{:name=>:line_item_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:contending_impressions, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :ContentMetadataKeyHierarchyTargeting=>{:fields=>[{:name=>:custom_targeting_value_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ContentMetadataTargetingError=>{:fields=>[{:name=>:reason, :type=>"ContentMetadataTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ContentTargeting=>{:fields=>[{:name=>:targeted_content_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_content_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted_video_category_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_video_category_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted_video_content_bundle_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_video_content_bundle_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted_content_metadata, :type=>"ContentMetadataKeyHierarchyTargeting", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_content_metadata, :type=>"ContentMetadataKeyHierarchyTargeting", :min_occurs=>0, :max_occurs=>:unbounded}]}, :CreativePlaceholder=>{:fields=>[{:name=>:size, :type=>"Size", :min_occurs=>0, :max_occurs=>1}, {:name=>:companions, :type=>"CreativePlaceholder", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:effective_applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:expected_creative_count, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_size_type, :type=>"CreativeSizeType", :min_occurs=>0, :max_occurs=>1}]}, :CustomCriteria=>{:fields=>[{:name=>:key_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:value_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:operator, :type=>"CustomCriteria.ComparisonOperator", :min_occurs=>0, :max_occurs=>1}], :base=>"CustomCriteriaLeaf"}, :CustomCriteriaSet=>{:fields=>[{:name=>:logical_operator, :type=>"CustomCriteriaSet.LogicalOperator", :min_occurs=>0, :max_occurs=>1}, {:name=>:children, :type=>"CustomCriteriaNode", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"CustomCriteriaNode"}, :CustomFieldValue=>{:fields=>[{:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCustomFieldValue"}, :CustomFieldValueError=>{:fields=>[{:name=>:reason, :type=>"CustomFieldValueError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomTargetingError=>{:fields=>[{:name=>:reason, :type=>"CustomTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomCriteriaLeaf=>{:fields=>[], :abstract=>true, :base=>"CustomCriteriaNode"}, :CustomCriteriaNode=>{:fields=>[{:name=>:custom_criteria_node_type, :original_name=>"CustomCriteriaNode.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AudienceSegmentCriteria=>{:fields=>[{:name=>:operator, :type=>"AudienceSegmentCriteria.ComparisonOperator", :min_occurs=>0, :max_occurs=>1}, {:name=>:audience_segment_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"CustomCriteriaLeaf"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeRangeTargetingError=>{:fields=>[{:name=>:reason, :type=>"DateTimeRangeTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DayPart=>{:fields=>[{:name=>:day_of_week, :type=>"DayOfWeek", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_time, :type=>"TimeOfDay", :min_occurs=>0, :max_occurs=>1}, {:name=>:end_time, :type=>"TimeOfDay", :min_occurs=>0, :max_occurs=>1}]}, :DayPartTargeting=>{:fields=>[{:name=>:day_parts, :type=>"DayPart", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:time_zone, :type=>"DeliveryTimeZone", :min_occurs=>0, :max_occurs=>1}]}, :DayPartTargetingError=>{:fields=>[{:name=>:reason, :type=>"DayPartTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :DeliveryData=>{:fields=>[{:name=>:units, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}]}, :DeliveryIndicator=>{:fields=>[{:name=>:expected_delivery_percentage, :type=>"double", :min_occurs=>0, :max_occurs=>1}, {:name=>:actual_delivery_percentage, :type=>"double", :min_occurs=>0, :max_occurs=>1}]}, :DeviceCapability=>{:fields=>[], :base=>"Technology"}, :DeviceCapabilityTargeting=>{:fields=>[{:name=>:targeted_device_capabilities, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_device_capabilities, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :DeviceCategory=>{:fields=>[], :base=>"Technology"}, :DeviceCategoryTargeting=>{:fields=>[{:name=>:targeted_device_categories, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_device_categories, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :DeviceManufacturer=>{:fields=>[], :base=>"Technology"}, :DeviceManufacturerTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_manufacturers, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :DropDownCustomFieldValue=>{:fields=>[{:name=>:custom_field_option_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCustomFieldValue"}, :EntityLimitReachedError=>{:fields=>[], :base=>"ApiError"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Forecast=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:order_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:unit_type, :type=>"UnitType", :min_occurs=>0, :max_occurs=>1}, {:name=>:available_units, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:delivered_units, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:matched_units, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:possible_units, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:reserved_units, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:contending_line_items, :type=>"ContendingLineItem", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ForecastError=>{:fields=>[{:name=>:reason, :type=>"ForecastError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :FrequencyCap=>{:fields=>[{:name=>:max_impressions, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:num_time_units, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_unit, :type=>"TimeUnit", :min_occurs=>0, :max_occurs=>1}]}, :FrequencyCapError=>{:fields=>[{:name=>:reason, :type=>"FrequencyCapError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :GenericTargetingError=>{:fields=>[{:name=>:reason, :type=>"GenericTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :GeoTargeting=>{:fields=>[{:name=>:targeted_locations, :type=>"Location", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_locations, :type=>"Location", :min_occurs=>0, :max_occurs=>:unbounded}]}, :GeoTargetingError=>{:fields=>[{:name=>:reason, :type=>"GeoTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InvalidUrlError=>{:fields=>[{:name=>:reason, :type=>"InvalidUrlError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InventoryTargeting=>{:fields=>[{:name=>:targeted_ad_units, :type=>"AdUnitTargeting", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_ad_units, :type=>"AdUnitTargeting", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted_placement_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}]}, :InventoryTargetingError=>{:fields=>[{:name=>:reason, :type=>"InventoryTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InventoryUnitError=>{:fields=>[{:name=>:reason, :type=>"InventoryUnitError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LabelEntityAssociationError=>{:fields=>[{:name=>:reason, :type=>"LabelEntityAssociationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItemCreativeAssociationError=>{:fields=>[{:name=>:reason, :type=>"LineItemCreativeAssociationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItem=>{:fields=>[{:name=>:targeting, :type=>"Targeting", :min_occurs=>0, :max_occurs=>1}], :base=>"LineItemSummary"}, :LineItemError=>{:fields=>[{:name=>:reason, :type=>"LineItemError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItemFlightDateError=>{:fields=>[{:name=>:reason, :type=>"LineItemFlightDateError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItemOperationError=>{:fields=>[{:name=>:reason, :type=>"LineItemOperationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItemSummary=>{:fields=>[{:name=>:order_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:external_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:order_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_date_time_type, :type=>"StartDateTimeType", :min_occurs=>0, :max_occurs=>1}, {:name=>:end_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:auto_extension_days, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:unlimited_end_date_time, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_rotation_type, :type=>"CreativeRotationType", :min_occurs=>0, :max_occurs=>1}, {:name=>:delivery_rate_type, :type=>"DeliveryRateType", :min_occurs=>0, :max_occurs=>1}, {:name=>:roadblocking_type, :type=>"RoadblockingType", :min_occurs=>0, :max_occurs=>1}, {:name=>:frequency_caps, :type=>"FrequencyCap", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:line_item_type, :type=>"LineItemType", :min_occurs=>0, :max_occurs=>1}, {:name=>:priority, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:unit_type, :type=>"UnitType", :min_occurs=>0, :max_occurs=>1}, {:name=>:duration, :type=>"LineItemSummary.Duration", :min_occurs=>0, :max_occurs=>1}, {:name=>:units_bought, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:cost_per_unit, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:value_cost_per_unit, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:cost_type, :type=>"CostType", :min_occurs=>0, :max_occurs=>1}, {:name=>:discount_type, :type=>"LineItemDiscountType", :min_occurs=>0, :max_occurs=>1}, {:name=>:discount, :type=>"double", :min_occurs=>0, :max_occurs=>1}, {:name=>:contracted_units_bought, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_placeholders, :type=>"CreativePlaceholder", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:target_platform, :type=>"TargetPlatform", :min_occurs=>0, :max_occurs=>1}, {:name=>:environment_type, :type=>"EnvironmentType", :min_occurs=>0, :max_occurs=>1}, {:name=>:companion_delivery_option, :type=>"CompanionDeliveryOption", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_persistence_type, :type=>"CreativePersistenceType", :min_occurs=>0, :max_occurs=>1}, {:name=>:allow_overbook, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:skip_inventory_check, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:reserve_at_creation, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:stats, :type=>"Stats", :min_occurs=>0, :max_occurs=>1}, {:name=>:delivery_indicator, :type=>"DeliveryIndicator", :min_occurs=>0, :max_occurs=>1}, {:name=>:delivery_data, :type=>"DeliveryData", :min_occurs=>0, :max_occurs=>1}, {:name=>:budget, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"ComputedStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:reservation_status, :type=>"LineItemSummary.ReservationStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_archived, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:web_property_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:effective_applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:disable_same_advertiser_competitive_exclusion, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:last_modified_by_app, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:notes, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:last_modified_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:creation_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_prioritized_preferred_deals_enabled, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:ad_exchange_auction_opening_priority, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:custom_field_values, :type=>"BaseCustomFieldValue", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:is_missing_creatives, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:line_item_summary_type, :original_name=>"LineItemSummary.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Location=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:type, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:canonical_parent_id, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:display_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:location_type, :original_name=>"Location.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :MobileCarrier=>{:fields=>[], :base=>"Technology"}, :MobileCarrierTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:mobile_carriers, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :MobileDevice=>{:fields=>[{:name=>:manufacturer_criterion_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :MobileDeviceSubmodel=>{:fields=>[{:name=>:mobile_device_criterion_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_manufacturer_criterion_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :MobileDeviceSubmodelTargeting=>{:fields=>[{:name=>:targeted_mobile_device_submodels, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_mobile_device_submodels, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :MobileDeviceTargeting=>{:fields=>[{:name=>:targeted_mobile_devices, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_mobile_devices, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :Money=>{:fields=>[{:name=>:currency_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:micro_amount, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :OperatingSystem=>{:fields=>[], :base=>"Technology"}, :OperatingSystemTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:operating_systems, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :OperatingSystemVersion=>{:fields=>[{:name=>:major_version, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minor_version, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:micro_version, :type=>"int", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :OperatingSystemVersionTargeting=>{:fields=>[{:name=>:targeted_operating_system_versions, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_operating_system_versions, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :OrderError=>{:fields=>[{:name=>:reason, :type=>"OrderError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ParseError=>{:fields=>[{:name=>:reason, :type=>"ParseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RegExError=>{:fields=>[{:name=>:reason, :type=>"RegExError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredCollectionError=>{:fields=>[{:name=>:reason, :type=>"RequiredCollectionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredNumberError=>{:fields=>[{:name=>:reason, :type=>"RequiredNumberError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredSizeError=>{:fields=>[{:name=>:reason, :type=>"RequiredSizeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ReservationDetailsError=>{:fields=>[{:name=>:reason, :type=>"ReservationDetailsError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :Size=>{:fields=>[{:name=>:width, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:height, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_aspect_ratio, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Stats=>{:fields=>[{:name=>:impressions_delivered, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:clicks_delivered, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:video_completions_delivered, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:video_starts_delivered, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Targeting=>{:fields=>[{:name=>:geo_targeting, :type=>"GeoTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:inventory_targeting, :type=>"InventoryTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:day_part_targeting, :type=>"DayPartTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:technology_targeting, :type=>"TechnologyTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:custom_targeting, :type=>"CustomCriteriaSet", :min_occurs=>0, :max_occurs=>1}, {:name=>:user_domain_targeting, :type=>"UserDomainTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:content_targeting, :type=>"ContentTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:video_position_targeting, :type=>"VideoPositionTargeting", :min_occurs=>0, :max_occurs=>1}]}, :TeamError=>{:fields=>[{:name=>:reason, :type=>"TeamError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Technology=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:technology_type, :original_name=>"Technology.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :TechnologyTargetingError=>{:fields=>[{:name=>:reason, :type=>"TechnologyTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TimeOfDay=>{:fields=>[{:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"MinuteOfHour", :min_occurs=>0, :max_occurs=>1}]}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :UserDomainTargeting=>{:fields=>[{:name=>:domains, :type=>"string", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :UserDomainTargetingError=>{:fields=>[{:name=>:reason, :type=>"UserDomainTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :VideoPosition=>{:fields=>[{:name=>:position_type, :type=>"VideoPosition.Type", :min_occurs=>0, :max_occurs=>1}, {:name=>:midroll_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :VideoPositionTargeting=>{:fields=>[{:name=>:targeted_positions, :type=>"VideoPositionTarget", :min_occurs=>0, :max_occurs=>:unbounded}]}, :VideoPositionWithinPod=>{:fields=>[{:name=>:index, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :VideoPositionTarget=>{:fields=>[{:name=>:video_position, :type=>"VideoPosition", :min_occurs=>0, :max_occurs=>1}, {:name=>:video_bumper_type, :type=>"VideoBumperType", :min_occurs=>0, :max_occurs=>1}, {:name=>:video_position_within_pod, :type=>"VideoPositionWithinPod", :min_occurs=>0, :max_occurs=>1}]}, :"AdUnitAfcSizeError.Reason"=>{:fields=>[]}, :"AdUnitCodeError.Reason"=>{:fields=>[]}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AudienceExtensionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"ClickTrackingLineItemError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :CompanionDeliveryOption=>{:fields=>[]}, :"CompanyCreditStatusError.Reason"=>{:fields=>[]}, :ComputedStatus=>{:fields=>[]}, :"ContentMetadataTargetingError.Reason"=>{:fields=>[]}, :CostType=>{:fields=>[]}, :CreativeRotationType=>{:fields=>[]}, :CreativeSizeType=>{:fields=>[]}, :"CustomCriteria.ComparisonOperator"=>{:fields=>[]}, :"CustomCriteriaSet.LogicalOperator"=>{:fields=>[]}, :"CustomFieldValueError.Reason"=>{:fields=>[]}, :"CustomTargetingError.Reason"=>{:fields=>[]}, :"AudienceSegmentCriteria.ComparisonOperator"=>{:fields=>[]}, :"DateTimeRangeTargetingError.Reason"=>{:fields=>[]}, :DayOfWeek=>{:fields=>[]}, :"DayPartTargetingError.Reason"=>{:fields=>[]}, :DeliveryTimeZone=>{:fields=>[]}, :DeliveryRateType=>{:fields=>[]}, :EnvironmentType=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"ForecastError.Reason"=>{:fields=>[]}, :"FrequencyCapError.Reason"=>{:fields=>[]}, :"GenericTargetingError.Reason"=>{:fields=>[]}, :"GeoTargetingError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"InvalidUrlError.Reason"=>{:fields=>[]}, :"InventoryTargetingError.Reason"=>{:fields=>[]}, :"InventoryUnitError.Reason"=>{:fields=>[]}, :"LabelEntityAssociationError.Reason"=>{:fields=>[]}, :"LineItemCreativeAssociationError.Reason"=>{:fields=>[]}, :LineItemDiscountType=>{:fields=>[]}, :"LineItemError.Reason"=>{:fields=>[]}, :"LineItemFlightDateError.Reason"=>{:fields=>[]}, :"LineItemOperationError.Reason"=>{:fields=>[]}, :"LineItemSummary.Duration"=>{:fields=>[]}, :"LineItemSummary.ReservationStatus"=>{:fields=>[]}, :LineItemType=>{:fields=>[]}, :MinuteOfHour=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"OrderError.Reason"=>{:fields=>[]}, :"ParseError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :CreativePersistenceType=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RangeError.Reason"=>{:fields=>[]}, :"RegExError.Reason"=>{:fields=>[]}, :"RequiredCollectionError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"RequiredNumberError.Reason"=>{:fields=>[]}, :"RequiredSizeError.Reason"=>{:fields=>[]}, :"ReservationDetailsError.Reason"=>{:fields=>[]}, :RoadblockingType=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :StartDateTimeType=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}, :TargetPlatform=>{:fields=>[]}, :"TeamError.Reason"=>{:fields=>[]}, :"TechnologyTargetingError.Reason"=>{:fields=>[]}, :TimeUnit=>{:fields=>[]}, :UnitType=>{:fields=>[]}, :"UserDomainTargetingError.Reason"=>{:fields=>[]}, :VideoBumperType=>{:fields=>[]}, :"VideoPosition.Type"=>{:fields=>[]}} + FORECASTSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return FORECASTSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return FORECASTSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return FORECASTSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, ForecastServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/inventory_service.rb b/dfp_api/lib/dfp_api/v201311/inventory_service.rb new file mode 100644 index 000000000..6b5ebd495 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/inventory_service.rb @@ -0,0 +1,62 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:21. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/inventory_service_registry' + +module DfpApi; module V201311; module InventoryService + class InventoryService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_ad_unit(*args, &block) + return execute_action('create_ad_unit', args, &block) + end + + def create_ad_units(*args, &block) + return execute_action('create_ad_units', args, &block) + end + + def get_ad_unit(*args, &block) + return execute_action('get_ad_unit', args, &block) + end + + def get_ad_unit_sizes_by_statement(*args, &block) + return execute_action('get_ad_unit_sizes_by_statement', args, &block) + end + + def get_ad_units_by_statement(*args, &block) + return execute_action('get_ad_units_by_statement', args, &block) + end + + def perform_ad_unit_action(*args, &block) + return execute_action('perform_ad_unit_action', args, &block) + end + + def update_ad_unit(*args, &block) + return execute_action('update_ad_unit', args, &block) + end + + def update_ad_units(*args, &block) + return execute_action('update_ad_units', args, &block) + end + + private + + def get_service_registry() + return InventoryServiceRegistry + end + + def get_module() + return DfpApi::V201311::InventoryService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/inventory_service_registry.rb b/dfp_api/lib/dfp_api/v201311/inventory_service_registry.rb new file mode 100644 index 000000000..63962766f --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/inventory_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:21. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module InventoryService + class InventoryServiceRegistry + INVENTORYSERVICE_METHODS = {:create_ad_unit=>{:input=>[{:name=>:ad_unit, :type=>"AdUnit", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_ad_unit_response", :fields=>[{:name=>:rval, :type=>"AdUnit", :min_occurs=>0, :max_occurs=>1}]}}, :create_ad_units=>{:input=>[{:name=>:ad_units, :type=>"AdUnit", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_ad_units_response", :fields=>[{:name=>:rval, :type=>"AdUnit", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_ad_unit=>{:input=>[{:name=>:ad_unit_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_ad_unit_response", :fields=>[{:name=>:rval, :type=>"AdUnit", :min_occurs=>0, :max_occurs=>1}]}}, :get_ad_unit_sizes_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_ad_unit_sizes_by_statement_response", :fields=>[{:name=>:rval, :type=>"AdUnitSize", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_ad_units_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_ad_units_by_statement_response", :fields=>[{:name=>:rval, :type=>"AdUnitPage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_ad_unit_action=>{:input=>[{:name=>:ad_unit_action, :type=>"AdUnitAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_ad_unit_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_ad_unit=>{:input=>[{:name=>:ad_unit, :type=>"AdUnit", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_ad_unit_response", :fields=>[{:name=>:rval, :type=>"AdUnit", :min_occurs=>0, :max_occurs=>1}]}}, :update_ad_units=>{:input=>[{:name=>:ad_units, :type=>"AdUnit", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_ad_units_response", :fields=>[{:name=>:rval, :type=>"AdUnit", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + INVENTORYSERVICE_TYPES = {:ActivateAdUnits=>{:fields=>[], :base=>"AdUnitAction"}, :AdSenseAccountError=>{:fields=>[{:name=>:reason, :type=>"AdSenseAccountError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :AdSenseSettings=>{:fields=>[{:name=>:ad_sense_enabled, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:border_color, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:title_color, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:background_color, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:text_color, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:url_color, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:ad_type, :type=>"AdSenseSettings.AdType", :min_occurs=>0, :max_occurs=>1}, {:name=>:border_style, :type=>"AdSenseSettings.BorderStyle", :min_occurs=>0, :max_occurs=>1}, {:name=>:font_family, :type=>"AdSenseSettings.FontFamily", :min_occurs=>0, :max_occurs=>1}, {:name=>:font_size, :type=>"AdSenseSettings.FontSize", :min_occurs=>0, :max_occurs=>1}, {:name=>:afc_formats, :type=>"Size_StringMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :AdSenseSettingsInheritedProperty=>{:fields=>[{:name=>:value, :type=>"AdSenseSettings", :min_occurs=>0, :max_occurs=>1}]}, :AdUnitAction=>{:fields=>[{:name=>:ad_unit_action_type, :original_name=>"AdUnitAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AdUnitAfcSizeError=>{:fields=>[{:name=>:reason, :type=>"AdUnitAfcSizeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :AdUnitCodeError=>{:fields=>[{:name=>:reason, :type=>"AdUnitCodeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :AdUnit=>{:fields=>[{:name=>:id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:parent_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:has_children, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:parent_path, :type=>"AdUnitParent", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:description, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:target_window, :type=>"AdUnit.TargetWindow", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"InventoryStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:ad_unit_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:ad_unit_sizes, :type=>"AdUnitSize", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:target_platform, :type=>"TargetPlatform", :min_occurs=>0, :max_occurs=>1}, {:name=>:mobile_platform, :type=>"MobilePlatform", :min_occurs=>0, :max_occurs=>1}, {:name=>:explicitly_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:inherited_ad_sense_settings, :type=>"AdSenseSettingsInheritedProperty", :min_occurs=>0, :max_occurs=>1}, {:name=>:partner_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:applied_label_frequency_caps, :type=>"LabelFrequencyCap", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:effective_label_frequency_caps, :type=>"LabelFrequencyCap", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:effective_applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:effective_team_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:applied_team_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:last_modified_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:smart_size_mode, :type=>"SmartSizeMode", :min_occurs=>0, :max_occurs=>1}]}, :AdUnitHierarchyError=>{:fields=>[{:name=>:reason, :type=>"AdUnitHierarchyError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :AdUnitPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"AdUnit", :min_occurs=>0, :max_occurs=>:unbounded}]}, :AdUnitParent=>{:fields=>[{:name=>:id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:ad_unit_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :AppliedLabel=>{:fields=>[{:name=>:label_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_negated, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :ArchiveAdUnits=>{:fields=>[], :base=>"AdUnitAction"}, :AssignAdUnitsToPlacement=>{:fields=>[{:name=>:placement_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"AdUnitAction"}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CreativeWrapperError=>{:fields=>[{:name=>:reason, :type=>"CreativeWrapperError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DeactivateAdUnits=>{:fields=>[], :base=>"AdUnitAction"}, :EntityLimitReachedError=>{:fields=>[], :base=>"ApiError"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :FrequencyCap=>{:fields=>[{:name=>:max_impressions, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:num_time_units, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_unit, :type=>"TimeUnit", :min_occurs=>0, :max_occurs=>1}]}, :FrequencyCapError=>{:fields=>[{:name=>:reason, :type=>"FrequencyCapError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InvalidColorError=>{:fields=>[{:name=>:reason, :type=>"InvalidColorError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InventoryUnitError=>{:fields=>[{:name=>:reason, :type=>"InventoryUnitError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InventoryUnitPartnerAssociationError=>{:fields=>[{:name=>:reason, :type=>"InventoryUnitPartnerAssociationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :AdUnitSize=>{:fields=>[{:name=>:size, :type=>"Size", :min_occurs=>0, :max_occurs=>1}, {:name=>:environment_type, :type=>"EnvironmentType", :min_occurs=>0, :max_occurs=>1}, {:name=>:companions, :type=>"AdUnitSize", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:full_display_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :InventoryUnitSizesError=>{:fields=>[{:name=>:reason, :type=>"InventoryUnitSizesError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :AdUnitTypeError=>{:fields=>[{:name=>:reason, :type=>"AdUnitTypeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LabelFrequencyCap=>{:fields=>[{:name=>:frequency_cap, :type=>"FrequencyCap", :min_occurs=>0, :max_occurs=>1}, {:name=>:label_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :ParseError=>{:fields=>[{:name=>:reason, :type=>"ParseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RegExError=>{:fields=>[{:name=>:reason, :type=>"RegExError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RemoveAdUnitsFromPlacement=>{:fields=>[{:name=>:placement_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"AdUnitAction"}, :RequiredCollectionError=>{:fields=>[{:name=>:reason, :type=>"RequiredCollectionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :Size=>{:fields=>[{:name=>:width, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:height, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_aspect_ratio, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :Size_StringMapEntry=>{:fields=>[{:name=>:key, :type=>"Size", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TeamError=>{:fields=>[{:name=>:reason, :type=>"TeamError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"AdSenseAccountError.Reason"=>{:fields=>[]}, :"AdSenseSettings.AdType"=>{:fields=>[]}, :"AdSenseSettings.BorderStyle"=>{:fields=>[]}, :"AdSenseSettings.FontFamily"=>{:fields=>[]}, :"AdSenseSettings.FontSize"=>{:fields=>[]}, :"AdUnitAfcSizeError.Reason"=>{:fields=>[]}, :"AdUnitCodeError.Reason"=>{:fields=>[]}, :"AdUnit.TargetWindow"=>{:fields=>[]}, :"AdUnitHierarchyError.Reason"=>{:fields=>[]}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"CreativeWrapperError.Reason"=>{:fields=>[]}, :EnvironmentType=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"FrequencyCapError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"InvalidColorError.Reason"=>{:fields=>[]}, :InventoryStatus=>{:fields=>[]}, :"InventoryUnitError.Reason"=>{:fields=>[]}, :"InventoryUnitPartnerAssociationError.Reason"=>{:fields=>[]}, :"InventoryUnitSizesError.Reason"=>{:fields=>[]}, :"AdUnitTypeError.Reason"=>{:fields=>[]}, :MobilePlatform=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"ParseError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RegExError.Reason"=>{:fields=>[]}, :"RequiredCollectionError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :SmartSizeMode=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}, :TargetPlatform=>{:fields=>[]}, :"TeamError.Reason"=>{:fields=>[]}, :TimeUnit=>{:fields=>[]}} + INVENTORYSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return INVENTORYSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return INVENTORYSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return INVENTORYSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, InventoryServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/label_service.rb b/dfp_api/lib/dfp_api/v201311/label_service.rb new file mode 100644 index 000000000..f33fbd748 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/label_service.rb @@ -0,0 +1,58 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:24. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/label_service_registry' + +module DfpApi; module V201311; module LabelService + class LabelService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_label(*args, &block) + return execute_action('create_label', args, &block) + end + + def create_labels(*args, &block) + return execute_action('create_labels', args, &block) + end + + def get_label(*args, &block) + return execute_action('get_label', args, &block) + end + + def get_labels_by_statement(*args, &block) + return execute_action('get_labels_by_statement', args, &block) + end + + def perform_label_action(*args, &block) + return execute_action('perform_label_action', args, &block) + end + + def update_label(*args, &block) + return execute_action('update_label', args, &block) + end + + def update_labels(*args, &block) + return execute_action('update_labels', args, &block) + end + + private + + def get_service_registry() + return LabelServiceRegistry + end + + def get_module() + return DfpApi::V201311::LabelService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/label_service_registry.rb b/dfp_api/lib/dfp_api/v201311/label_service_registry.rb new file mode 100644 index 000000000..2f5410a10 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/label_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:24. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module LabelService + class LabelServiceRegistry + LABELSERVICE_METHODS = {:create_label=>{:input=>[{:name=>:label, :type=>"Label", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_label_response", :fields=>[{:name=>:rval, :type=>"Label", :min_occurs=>0, :max_occurs=>1}]}}, :create_labels=>{:input=>[{:name=>:labels, :type=>"Label", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_labels_response", :fields=>[{:name=>:rval, :type=>"Label", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_label=>{:input=>[{:name=>:label_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_label_response", :fields=>[{:name=>:rval, :type=>"Label", :min_occurs=>0, :max_occurs=>1}]}}, :get_labels_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_labels_by_statement_response", :fields=>[{:name=>:rval, :type=>"LabelPage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_label_action=>{:input=>[{:name=>:label_action, :type=>"LabelAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_label_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_label=>{:input=>[{:name=>:label, :type=>"Label", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_label_response", :fields=>[{:name=>:rval, :type=>"Label", :min_occurs=>0, :max_occurs=>1}]}}, :update_labels=>{:input=>[{:name=>:labels, :type=>"Label", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_labels_response", :fields=>[{:name=>:rval, :type=>"Label", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + LABELSERVICE_TYPES = {:ActivateLabels=>{:fields=>[], :base=>"LabelAction"}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CreativeWrapperError=>{:fields=>[{:name=>:reason, :type=>"CreativeWrapperError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DeactivateLabels=>{:fields=>[], :base=>"LabelAction"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LabelAction=>{:fields=>[{:name=>:label_action_type, :original_name=>"LabelAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :Label=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:description, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_active, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:types, :type=>"LabelType", :min_occurs=>0, :max_occurs=>:unbounded}]}, :LabelError=>{:fields=>[{:name=>:reason, :type=>"LabelError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LabelPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"Label", :min_occurs=>0, :max_occurs=>:unbounded}]}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :ParseError=>{:fields=>[{:name=>:reason, :type=>"ParseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"CreativeWrapperError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"LabelError.Reason"=>{:fields=>[]}, :LabelType=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"ParseError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}} + LABELSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return LABELSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return LABELSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return LABELSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, LabelServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/line_item_creative_association_service.rb b/dfp_api/lib/dfp_api/v201311/line_item_creative_association_service.rb new file mode 100644 index 000000000..42dc15019 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/line_item_creative_association_service.rb @@ -0,0 +1,62 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:26. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/line_item_creative_association_service_registry' + +module DfpApi; module V201311; module LineItemCreativeAssociationService + class LineItemCreativeAssociationService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_line_item_creative_association(*args, &block) + return execute_action('create_line_item_creative_association', args, &block) + end + + def create_line_item_creative_associations(*args, &block) + return execute_action('create_line_item_creative_associations', args, &block) + end + + def get_line_item_creative_association(*args, &block) + return execute_action('get_line_item_creative_association', args, &block) + end + + def get_line_item_creative_associations_by_statement(*args, &block) + return execute_action('get_line_item_creative_associations_by_statement', args, &block) + end + + def get_preview_url(*args, &block) + return execute_action('get_preview_url', args, &block) + end + + def perform_line_item_creative_association_action(*args, &block) + return execute_action('perform_line_item_creative_association_action', args, &block) + end + + def update_line_item_creative_association(*args, &block) + return execute_action('update_line_item_creative_association', args, &block) + end + + def update_line_item_creative_associations(*args, &block) + return execute_action('update_line_item_creative_associations', args, &block) + end + + private + + def get_service_registry() + return LineItemCreativeAssociationServiceRegistry + end + + def get_module() + return DfpApi::V201311::LineItemCreativeAssociationService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/line_item_creative_association_service_registry.rb b/dfp_api/lib/dfp_api/v201311/line_item_creative_association_service_registry.rb new file mode 100644 index 000000000..d2bba7648 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/line_item_creative_association_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:26. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module LineItemCreativeAssociationService + class LineItemCreativeAssociationServiceRegistry + LINEITEMCREATIVEASSOCIATIONSERVICE_METHODS = {:create_line_item_creative_association=>{:input=>[{:name=>:line_item_creative_association, :type=>"LineItemCreativeAssociation", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_line_item_creative_association_response", :fields=>[{:name=>:rval, :type=>"LineItemCreativeAssociation", :min_occurs=>0, :max_occurs=>1}]}}, :create_line_item_creative_associations=>{:input=>[{:name=>:line_item_creative_associations, :type=>"LineItemCreativeAssociation", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_line_item_creative_associations_response", :fields=>[{:name=>:rval, :type=>"LineItemCreativeAssociation", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_line_item_creative_association=>{:input=>[{:name=>:line_item_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_line_item_creative_association_response", :fields=>[{:name=>:rval, :type=>"LineItemCreativeAssociation", :min_occurs=>0, :max_occurs=>1}]}}, :get_line_item_creative_associations_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_line_item_creative_associations_by_statement_response", :fields=>[{:name=>:rval, :type=>"LineItemCreativeAssociationPage", :min_occurs=>0, :max_occurs=>1}]}}, :get_preview_url=>{:input=>[{:name=>:line_item_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:site_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_preview_url_response", :fields=>[{:name=>:rval, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}}, :perform_line_item_creative_association_action=>{:input=>[{:name=>:line_item_creative_association_action, :type=>"LineItemCreativeAssociationAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_line_item_creative_association_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_line_item_creative_association=>{:input=>[{:name=>:line_item_creative_association, :type=>"LineItemCreativeAssociation", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_line_item_creative_association_response", :fields=>[{:name=>:rval, :type=>"LineItemCreativeAssociation", :min_occurs=>0, :max_occurs=>1}]}}, :update_line_item_creative_associations=>{:input=>[{:name=>:line_item_creative_associations, :type=>"LineItemCreativeAssociation", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_line_item_creative_associations_response", :fields=>[{:name=>:rval, :type=>"LineItemCreativeAssociation", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + LINEITEMCREATIVEASSOCIATIONSERVICE_TYPES = {:ActivateLineItemCreativeAssociations=>{:fields=>[], :base=>"LineItemCreativeAssociationAction"}, :AdSenseAccountError=>{:fields=>[{:name=>:reason, :type=>"AdSenseAccountError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :AssetError=>{:fields=>[{:name=>:reason, :type=>"AssetError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :AudienceExtensionError=>{:fields=>[{:name=>:reason, :type=>"AudienceExtensionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CreativeAssetMacroError=>{:fields=>[{:name=>:reason, :type=>"CreativeAssetMacroError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CreativeError=>{:fields=>[{:name=>:reason, :type=>"CreativeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CreativeSetError=>{:fields=>[{:name=>:reason, :type=>"CreativeSetError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomCreativeError=>{:fields=>[{:name=>:reason, :type=>"CustomCreativeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DeactivateLineItemCreativeAssociations=>{:fields=>[], :base=>"LineItemCreativeAssociationAction"}, :EntityLimitReachedError=>{:fields=>[], :base=>"ApiError"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :FileError=>{:fields=>[{:name=>:reason, :type=>"FileError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ImageError=>{:fields=>[{:name=>:reason, :type=>"ImageError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InvalidUrlError=>{:fields=>[{:name=>:reason, :type=>"InvalidUrlError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LabelEntityAssociationError=>{:fields=>[{:name=>:reason, :type=>"LabelEntityAssociationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItemCreativeAssociationAction=>{:fields=>[{:name=>:line_item_creative_association_action_type, :original_name=>"LineItemCreativeAssociationAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :LineItemCreativeAssociation=>{:fields=>[{:name=>:line_item_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_set_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:manual_creative_rotation_weight, :type=>"double", :min_occurs=>0, :max_occurs=>1}, {:name=>:sequential_creative_rotation_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_date_time_type, :type=>"StartDateTimeType", :min_occurs=>0, :max_occurs=>1}, {:name=>:end_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:destination_url, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:sizes, :type=>"Size", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:status, :type=>"LineItemCreativeAssociation.Status", :min_occurs=>0, :max_occurs=>1}, {:name=>:stats, :type=>"LineItemCreativeAssociationStats", :min_occurs=>0, :max_occurs=>1}, {:name=>:last_modified_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}]}, :LineItemCreativeAssociationError=>{:fields=>[{:name=>:reason, :type=>"LineItemCreativeAssociationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItemCreativeAssociationOperationError=>{:fields=>[{:name=>:reason, :type=>"LineItemCreativeAssociationOperationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItemCreativeAssociationPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"LineItemCreativeAssociation", :min_occurs=>0, :max_occurs=>:unbounded}]}, :LineItemCreativeAssociationStats=>{:fields=>[{:name=>:stats, :type=>"Stats", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_set_stats, :type=>"Long_StatsMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:cost_in_order_currency, :type=>"Money", :min_occurs=>0, :max_occurs=>1}]}, :Long_StatsMapEntry=>{:fields=>[{:name=>:key, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Stats", :min_occurs=>0, :max_occurs=>1}]}, :Money=>{:fields=>[{:name=>:currency_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:micro_amount, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :ParseError=>{:fields=>[{:name=>:reason, :type=>"ParseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredNumberError=>{:fields=>[{:name=>:reason, :type=>"RequiredNumberError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredSizeError=>{:fields=>[{:name=>:reason, :type=>"RequiredSizeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RichMediaStudioCreativeError=>{:fields=>[{:name=>:reason, :type=>"RichMediaStudioCreativeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :Size=>{:fields=>[{:name=>:width, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:height, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_aspect_ratio, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Stats=>{:fields=>[{:name=>:impressions_delivered, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:clicks_delivered, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:video_completions_delivered, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:video_starts_delivered, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :SwiffyConversionError=>{:fields=>[{:name=>:reason, :type=>"SwiffyConversionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :TemplateInstantiatedCreativeError=>{:fields=>[{:name=>:reason, :type=>"TemplateInstantiatedCreativeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"AdSenseAccountError.Reason"=>{:fields=>[]}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AssetError.Reason"=>{:fields=>[]}, :"AudienceExtensionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"CreativeAssetMacroError.Reason"=>{:fields=>[]}, :"CreativeError.Reason"=>{:fields=>[]}, :"CreativeSetError.Reason"=>{:fields=>[]}, :"CustomCreativeError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"FileError.Reason"=>{:fields=>[]}, :"ImageError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"InvalidUrlError.Reason"=>{:fields=>[]}, :"LabelEntityAssociationError.Reason"=>{:fields=>[]}, :"LineItemCreativeAssociation.Status"=>{:fields=>[]}, :"LineItemCreativeAssociationError.Reason"=>{:fields=>[]}, :"LineItemCreativeAssociationOperationError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"ParseError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RangeError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"RequiredNumberError.Reason"=>{:fields=>[]}, :"RequiredSizeError.Reason"=>{:fields=>[]}, :"RichMediaStudioCreativeError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :StartDateTimeType=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}, :"SwiffyConversionError.Reason"=>{:fields=>[]}, :"TemplateInstantiatedCreativeError.Reason"=>{:fields=>[]}} + LINEITEMCREATIVEASSOCIATIONSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return LINEITEMCREATIVEASSOCIATIONSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return LINEITEMCREATIVEASSOCIATIONSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return LINEITEMCREATIVEASSOCIATIONSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, LineItemCreativeAssociationServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/line_item_service.rb b/dfp_api/lib/dfp_api/v201311/line_item_service.rb new file mode 100644 index 000000000..112ba61d6 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/line_item_service.rb @@ -0,0 +1,58 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:28. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/line_item_service_registry' + +module DfpApi; module V201311; module LineItemService + class LineItemService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_line_item(*args, &block) + return execute_action('create_line_item', args, &block) + end + + def create_line_items(*args, &block) + return execute_action('create_line_items', args, &block) + end + + def get_line_item(*args, &block) + return execute_action('get_line_item', args, &block) + end + + def get_line_items_by_statement(*args, &block) + return execute_action('get_line_items_by_statement', args, &block) + end + + def perform_line_item_action(*args, &block) + return execute_action('perform_line_item_action', args, &block) + end + + def update_line_item(*args, &block) + return execute_action('update_line_item', args, &block) + end + + def update_line_items(*args, &block) + return execute_action('update_line_items', args, &block) + end + + private + + def get_service_registry() + return LineItemServiceRegistry + end + + def get_module() + return DfpApi::V201311::LineItemService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/line_item_service_registry.rb b/dfp_api/lib/dfp_api/v201311/line_item_service_registry.rb new file mode 100644 index 000000000..af913d2be --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/line_item_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:28. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module LineItemService + class LineItemServiceRegistry + LINEITEMSERVICE_METHODS = {:create_line_item=>{:input=>[{:name=>:line_item, :type=>"LineItem", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_line_item_response", :fields=>[{:name=>:rval, :type=>"LineItem", :min_occurs=>0, :max_occurs=>1}]}}, :create_line_items=>{:input=>[{:name=>:line_items, :type=>"LineItem", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_line_items_response", :fields=>[{:name=>:rval, :type=>"LineItem", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_line_item=>{:input=>[{:name=>:line_item_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_line_item_response", :fields=>[{:name=>:rval, :type=>"LineItem", :min_occurs=>0, :max_occurs=>1}]}}, :get_line_items_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_line_items_by_statement_response", :fields=>[{:name=>:rval, :type=>"LineItemPage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_line_item_action=>{:input=>[{:name=>:line_item_action, :type=>"LineItemAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_line_item_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_line_item=>{:input=>[{:name=>:line_item, :type=>"LineItem", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_line_item_response", :fields=>[{:name=>:rval, :type=>"LineItem", :min_occurs=>0, :max_occurs=>1}]}}, :update_line_items=>{:input=>[{:name=>:line_items, :type=>"LineItem", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_line_items_response", :fields=>[{:name=>:rval, :type=>"LineItem", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + LINEITEMSERVICE_TYPES = {:ActivateLineItems=>{:fields=>[], :base=>"LineItemAction"}, :AdUnitTargeting=>{:fields=>[{:name=>:ad_unit_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:include_descendants, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :TechnologyTargeting=>{:fields=>[{:name=>:bandwidth_group_targeting, :type=>"BandwidthGroupTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:browser_targeting, :type=>"BrowserTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:browser_language_targeting, :type=>"BrowserLanguageTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_capability_targeting, :type=>"DeviceCapabilityTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_category_targeting, :type=>"DeviceCategoryTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_manufacturer_targeting, :type=>"DeviceManufacturerTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:mobile_carrier_targeting, :type=>"MobileCarrierTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:mobile_device_targeting, :type=>"MobileDeviceTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:mobile_device_submodel_targeting, :type=>"MobileDeviceSubmodelTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:operating_system_targeting, :type=>"OperatingSystemTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:operating_system_version_targeting, :type=>"OperatingSystemVersionTargeting", :min_occurs=>0, :max_occurs=>1}]}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :AppliedLabel=>{:fields=>[{:name=>:label_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_negated, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :ArchiveLineItems=>{:fields=>[], :base=>"LineItemAction"}, :AudienceExtensionError=>{:fields=>[{:name=>:reason, :type=>"AudienceExtensionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BandwidthGroup=>{:fields=>[], :base=>"Technology"}, :BandwidthGroupTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:bandwidth_groups, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :BaseCustomFieldValue=>{:fields=>[{:name=>:custom_field_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:base_custom_field_value_type, :original_name=>"BaseCustomFieldValue.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :Browser=>{:fields=>[{:name=>:major_version, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:minor_version, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :BrowserLanguage=>{:fields=>[], :base=>"Technology"}, :BrowserLanguageTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:browser_languages, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :BrowserTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:browsers, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ClickTrackingLineItemError=>{:fields=>[{:name=>:reason, :type=>"ClickTrackingLineItemError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CompanyCreditStatusError=>{:fields=>[{:name=>:reason, :type=>"CompanyCreditStatusError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ContentMetadataKeyHierarchyTargeting=>{:fields=>[{:name=>:custom_targeting_value_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ContentMetadataTargetingError=>{:fields=>[{:name=>:reason, :type=>"ContentMetadataTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ContentTargeting=>{:fields=>[{:name=>:targeted_content_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_content_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted_video_category_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_video_category_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted_video_content_bundle_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_video_content_bundle_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted_content_metadata, :type=>"ContentMetadataKeyHierarchyTargeting", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_content_metadata, :type=>"ContentMetadataKeyHierarchyTargeting", :min_occurs=>0, :max_occurs=>:unbounded}]}, :CreativePlaceholder=>{:fields=>[{:name=>:size, :type=>"Size", :min_occurs=>0, :max_occurs=>1}, {:name=>:companions, :type=>"CreativePlaceholder", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:effective_applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:expected_creative_count, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_size_type, :type=>"CreativeSizeType", :min_occurs=>0, :max_occurs=>1}]}, :CustomCriteria=>{:fields=>[{:name=>:key_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:value_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:operator, :type=>"CustomCriteria.ComparisonOperator", :min_occurs=>0, :max_occurs=>1}], :base=>"CustomCriteriaLeaf"}, :CustomCriteriaSet=>{:fields=>[{:name=>:logical_operator, :type=>"CustomCriteriaSet.LogicalOperator", :min_occurs=>0, :max_occurs=>1}, {:name=>:children, :type=>"CustomCriteriaNode", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"CustomCriteriaNode"}, :CustomFieldValue=>{:fields=>[{:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCustomFieldValue"}, :CustomFieldValueError=>{:fields=>[{:name=>:reason, :type=>"CustomFieldValueError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomTargetingError=>{:fields=>[{:name=>:reason, :type=>"CustomTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomCriteriaLeaf=>{:fields=>[], :abstract=>true, :base=>"CustomCriteriaNode"}, :CustomCriteriaNode=>{:fields=>[{:name=>:custom_criteria_node_type, :original_name=>"CustomCriteriaNode.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AudienceSegmentCriteria=>{:fields=>[{:name=>:operator, :type=>"AudienceSegmentCriteria.ComparisonOperator", :min_occurs=>0, :max_occurs=>1}, {:name=>:audience_segment_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"CustomCriteriaLeaf"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeRangeTargetingError=>{:fields=>[{:name=>:reason, :type=>"DateTimeRangeTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DayPart=>{:fields=>[{:name=>:day_of_week, :type=>"DayOfWeek", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_time, :type=>"TimeOfDay", :min_occurs=>0, :max_occurs=>1}, {:name=>:end_time, :type=>"TimeOfDay", :min_occurs=>0, :max_occurs=>1}]}, :DayPartTargeting=>{:fields=>[{:name=>:day_parts, :type=>"DayPart", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:time_zone, :type=>"DeliveryTimeZone", :min_occurs=>0, :max_occurs=>1}]}, :DayPartTargetingError=>{:fields=>[{:name=>:reason, :type=>"DayPartTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :DeleteLineItems=>{:fields=>[], :base=>"LineItemAction"}, :DeliveryData=>{:fields=>[{:name=>:units, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}]}, :DeliveryIndicator=>{:fields=>[{:name=>:expected_delivery_percentage, :type=>"double", :min_occurs=>0, :max_occurs=>1}, {:name=>:actual_delivery_percentage, :type=>"double", :min_occurs=>0, :max_occurs=>1}]}, :DeviceCapability=>{:fields=>[], :base=>"Technology"}, :DeviceCapabilityTargeting=>{:fields=>[{:name=>:targeted_device_capabilities, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_device_capabilities, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :DeviceCategory=>{:fields=>[], :base=>"Technology"}, :DeviceCategoryTargeting=>{:fields=>[{:name=>:targeted_device_categories, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_device_categories, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :DeviceManufacturer=>{:fields=>[], :base=>"Technology"}, :DeviceManufacturerTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_manufacturers, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :DropDownCustomFieldValue=>{:fields=>[{:name=>:custom_field_option_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCustomFieldValue"}, :EntityLimitReachedError=>{:fields=>[], :base=>"ApiError"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ForecastError=>{:fields=>[{:name=>:reason, :type=>"ForecastError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :FrequencyCap=>{:fields=>[{:name=>:max_impressions, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:num_time_units, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_unit, :type=>"TimeUnit", :min_occurs=>0, :max_occurs=>1}]}, :FrequencyCapError=>{:fields=>[{:name=>:reason, :type=>"FrequencyCapError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :GenericTargetingError=>{:fields=>[{:name=>:reason, :type=>"GenericTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :GeoTargeting=>{:fields=>[{:name=>:targeted_locations, :type=>"Location", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_locations, :type=>"Location", :min_occurs=>0, :max_occurs=>:unbounded}]}, :GeoTargetingError=>{:fields=>[{:name=>:reason, :type=>"GeoTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InvalidUrlError=>{:fields=>[{:name=>:reason, :type=>"InvalidUrlError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InventoryTargeting=>{:fields=>[{:name=>:targeted_ad_units, :type=>"AdUnitTargeting", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_ad_units, :type=>"AdUnitTargeting", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted_placement_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}]}, :InventoryTargetingError=>{:fields=>[{:name=>:reason, :type=>"InventoryTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LabelEntityAssociationError=>{:fields=>[{:name=>:reason, :type=>"LabelEntityAssociationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItemAction=>{:fields=>[{:name=>:line_item_action_type, :original_name=>"LineItemAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :LineItemCreativeAssociationError=>{:fields=>[{:name=>:reason, :type=>"LineItemCreativeAssociationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItem=>{:fields=>[{:name=>:targeting, :type=>"Targeting", :min_occurs=>0, :max_occurs=>1}], :base=>"LineItemSummary"}, :LineItemError=>{:fields=>[{:name=>:reason, :type=>"LineItemError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItemFlightDateError=>{:fields=>[{:name=>:reason, :type=>"LineItemFlightDateError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItemOperationError=>{:fields=>[{:name=>:reason, :type=>"LineItemOperationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItemPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"LineItem", :min_occurs=>0, :max_occurs=>:unbounded}]}, :LineItemSummary=>{:fields=>[{:name=>:order_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:external_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:order_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_date_time_type, :type=>"StartDateTimeType", :min_occurs=>0, :max_occurs=>1}, {:name=>:end_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:auto_extension_days, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:unlimited_end_date_time, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_rotation_type, :type=>"CreativeRotationType", :min_occurs=>0, :max_occurs=>1}, {:name=>:delivery_rate_type, :type=>"DeliveryRateType", :min_occurs=>0, :max_occurs=>1}, {:name=>:roadblocking_type, :type=>"RoadblockingType", :min_occurs=>0, :max_occurs=>1}, {:name=>:frequency_caps, :type=>"FrequencyCap", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:line_item_type, :type=>"LineItemType", :min_occurs=>0, :max_occurs=>1}, {:name=>:priority, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:unit_type, :type=>"UnitType", :min_occurs=>0, :max_occurs=>1}, {:name=>:duration, :type=>"LineItemSummary.Duration", :min_occurs=>0, :max_occurs=>1}, {:name=>:units_bought, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:cost_per_unit, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:value_cost_per_unit, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:cost_type, :type=>"CostType", :min_occurs=>0, :max_occurs=>1}, {:name=>:discount_type, :type=>"LineItemDiscountType", :min_occurs=>0, :max_occurs=>1}, {:name=>:discount, :type=>"double", :min_occurs=>0, :max_occurs=>1}, {:name=>:contracted_units_bought, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_placeholders, :type=>"CreativePlaceholder", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:target_platform, :type=>"TargetPlatform", :min_occurs=>0, :max_occurs=>1}, {:name=>:environment_type, :type=>"EnvironmentType", :min_occurs=>0, :max_occurs=>1}, {:name=>:companion_delivery_option, :type=>"CompanionDeliveryOption", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_persistence_type, :type=>"CreativePersistenceType", :min_occurs=>0, :max_occurs=>1}, {:name=>:allow_overbook, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:skip_inventory_check, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:reserve_at_creation, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:stats, :type=>"Stats", :min_occurs=>0, :max_occurs=>1}, {:name=>:delivery_indicator, :type=>"DeliveryIndicator", :min_occurs=>0, :max_occurs=>1}, {:name=>:delivery_data, :type=>"DeliveryData", :min_occurs=>0, :max_occurs=>1}, {:name=>:budget, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"ComputedStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:reservation_status, :type=>"LineItemSummary.ReservationStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_archived, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:web_property_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:effective_applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:disable_same_advertiser_competitive_exclusion, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:last_modified_by_app, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:notes, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:last_modified_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:creation_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_prioritized_preferred_deals_enabled, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:ad_exchange_auction_opening_priority, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:custom_field_values, :type=>"BaseCustomFieldValue", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:is_missing_creatives, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:line_item_summary_type, :original_name=>"LineItemSummary.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Location=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:type, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:canonical_parent_id, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:display_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:location_type, :original_name=>"Location.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :MobileCarrier=>{:fields=>[], :base=>"Technology"}, :MobileCarrierTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:mobile_carriers, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :MobileDevice=>{:fields=>[{:name=>:manufacturer_criterion_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :MobileDeviceSubmodel=>{:fields=>[{:name=>:mobile_device_criterion_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_manufacturer_criterion_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :MobileDeviceSubmodelTargeting=>{:fields=>[{:name=>:targeted_mobile_device_submodels, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_mobile_device_submodels, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :MobileDeviceTargeting=>{:fields=>[{:name=>:targeted_mobile_devices, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_mobile_devices, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :Money=>{:fields=>[{:name=>:currency_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:micro_amount, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :OperatingSystem=>{:fields=>[], :base=>"Technology"}, :OperatingSystemTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:operating_systems, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :OperatingSystemVersion=>{:fields=>[{:name=>:major_version, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minor_version, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:micro_version, :type=>"int", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :OperatingSystemVersionTargeting=>{:fields=>[{:name=>:targeted_operating_system_versions, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_operating_system_versions, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :OrderError=>{:fields=>[{:name=>:reason, :type=>"OrderError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ParseError=>{:fields=>[{:name=>:reason, :type=>"ParseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PauseLineItems=>{:fields=>[], :base=>"LineItemAction"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ReleaseLineItems=>{:fields=>[], :base=>"LineItemAction"}, :RequiredCollectionError=>{:fields=>[{:name=>:reason, :type=>"RequiredCollectionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredNumberError=>{:fields=>[{:name=>:reason, :type=>"RequiredNumberError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredSizeError=>{:fields=>[{:name=>:reason, :type=>"RequiredSizeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ReservationDetailsError=>{:fields=>[{:name=>:reason, :type=>"ReservationDetailsError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ReserveAndOverbookLineItems=>{:fields=>[], :base=>"ReserveLineItems"}, :ReserveLineItems=>{:fields=>[{:name=>:skip_inventory_check, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"LineItemAction"}, :ResumeAndOverbookLineItems=>{:fields=>[], :base=>"ResumeLineItems"}, :ResumeLineItems=>{:fields=>[{:name=>:skip_inventory_check, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"LineItemAction"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :Size=>{:fields=>[{:name=>:width, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:height, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_aspect_ratio, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Stats=>{:fields=>[{:name=>:impressions_delivered, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:clicks_delivered, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:video_completions_delivered, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:video_starts_delivered, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :Targeting=>{:fields=>[{:name=>:geo_targeting, :type=>"GeoTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:inventory_targeting, :type=>"InventoryTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:day_part_targeting, :type=>"DayPartTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:technology_targeting, :type=>"TechnologyTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:custom_targeting, :type=>"CustomCriteriaSet", :min_occurs=>0, :max_occurs=>1}, {:name=>:user_domain_targeting, :type=>"UserDomainTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:content_targeting, :type=>"ContentTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:video_position_targeting, :type=>"VideoPositionTargeting", :min_occurs=>0, :max_occurs=>1}]}, :TeamError=>{:fields=>[{:name=>:reason, :type=>"TeamError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Technology=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:technology_type, :original_name=>"Technology.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :TechnologyTargetingError=>{:fields=>[{:name=>:reason, :type=>"TechnologyTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TimeOfDay=>{:fields=>[{:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"MinuteOfHour", :min_occurs=>0, :max_occurs=>1}]}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UnarchiveLineItems=>{:fields=>[], :base=>"LineItemAction"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :UserDomainTargeting=>{:fields=>[{:name=>:domains, :type=>"string", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :UserDomainTargetingError=>{:fields=>[{:name=>:reason, :type=>"UserDomainTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :VideoPosition=>{:fields=>[{:name=>:position_type, :type=>"VideoPosition.Type", :min_occurs=>0, :max_occurs=>1}, {:name=>:midroll_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :VideoPositionTargeting=>{:fields=>[{:name=>:targeted_positions, :type=>"VideoPositionTarget", :min_occurs=>0, :max_occurs=>:unbounded}]}, :VideoPositionWithinPod=>{:fields=>[{:name=>:index, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :VideoPositionTarget=>{:fields=>[{:name=>:video_position, :type=>"VideoPosition", :min_occurs=>0, :max_occurs=>1}, {:name=>:video_bumper_type, :type=>"VideoBumperType", :min_occurs=>0, :max_occurs=>1}, {:name=>:video_position_within_pod, :type=>"VideoPositionWithinPod", :min_occurs=>0, :max_occurs=>1}]}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AudienceExtensionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"ClickTrackingLineItemError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :CompanionDeliveryOption=>{:fields=>[]}, :"CompanyCreditStatusError.Reason"=>{:fields=>[]}, :ComputedStatus=>{:fields=>[]}, :"ContentMetadataTargetingError.Reason"=>{:fields=>[]}, :CostType=>{:fields=>[]}, :CreativeRotationType=>{:fields=>[]}, :CreativeSizeType=>{:fields=>[]}, :"CustomCriteria.ComparisonOperator"=>{:fields=>[]}, :"CustomCriteriaSet.LogicalOperator"=>{:fields=>[]}, :"CustomFieldValueError.Reason"=>{:fields=>[]}, :"CustomTargetingError.Reason"=>{:fields=>[]}, :"AudienceSegmentCriteria.ComparisonOperator"=>{:fields=>[]}, :"DateTimeRangeTargetingError.Reason"=>{:fields=>[]}, :DayOfWeek=>{:fields=>[]}, :"DayPartTargetingError.Reason"=>{:fields=>[]}, :DeliveryTimeZone=>{:fields=>[]}, :DeliveryRateType=>{:fields=>[]}, :EnvironmentType=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"ForecastError.Reason"=>{:fields=>[]}, :"FrequencyCapError.Reason"=>{:fields=>[]}, :"GenericTargetingError.Reason"=>{:fields=>[]}, :"GeoTargetingError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"InvalidUrlError.Reason"=>{:fields=>[]}, :"InventoryTargetingError.Reason"=>{:fields=>[]}, :"LabelEntityAssociationError.Reason"=>{:fields=>[]}, :"LineItemCreativeAssociationError.Reason"=>{:fields=>[]}, :LineItemDiscountType=>{:fields=>[]}, :"LineItemError.Reason"=>{:fields=>[]}, :"LineItemFlightDateError.Reason"=>{:fields=>[]}, :"LineItemOperationError.Reason"=>{:fields=>[]}, :"LineItemSummary.Duration"=>{:fields=>[]}, :"LineItemSummary.ReservationStatus"=>{:fields=>[]}, :LineItemType=>{:fields=>[]}, :MinuteOfHour=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"OrderError.Reason"=>{:fields=>[]}, :"ParseError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :CreativePersistenceType=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RangeError.Reason"=>{:fields=>[]}, :"RequiredCollectionError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"RequiredNumberError.Reason"=>{:fields=>[]}, :"RequiredSizeError.Reason"=>{:fields=>[]}, :"ReservationDetailsError.Reason"=>{:fields=>[]}, :RoadblockingType=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :StartDateTimeType=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}, :TargetPlatform=>{:fields=>[]}, :"TeamError.Reason"=>{:fields=>[]}, :"TechnologyTargetingError.Reason"=>{:fields=>[]}, :TimeUnit=>{:fields=>[]}, :UnitType=>{:fields=>[]}, :"UserDomainTargetingError.Reason"=>{:fields=>[]}, :VideoBumperType=>{:fields=>[]}, :"VideoPosition.Type"=>{:fields=>[]}} + LINEITEMSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return LINEITEMSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return LINEITEMSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return LINEITEMSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, LineItemServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/line_item_template_service.rb b/dfp_api/lib/dfp_api/v201311/line_item_template_service.rb new file mode 100644 index 000000000..5ddb61af7 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/line_item_template_service.rb @@ -0,0 +1,34 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:33. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/line_item_template_service_registry' + +module DfpApi; module V201311; module LineItemTemplateService + class LineItemTemplateService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def get_line_item_templates_by_statement(*args, &block) + return execute_action('get_line_item_templates_by_statement', args, &block) + end + + private + + def get_service_registry() + return LineItemTemplateServiceRegistry + end + + def get_module() + return DfpApi::V201311::LineItemTemplateService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/line_item_template_service_registry.rb b/dfp_api/lib/dfp_api/v201311/line_item_template_service_registry.rb new file mode 100644 index 000000000..fe9862309 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/line_item_template_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:33. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module LineItemTemplateService + class LineItemTemplateServiceRegistry + LINEITEMTEMPLATESERVICE_METHODS = {:get_line_item_templates_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_line_item_templates_by_statement_response", :fields=>[{:name=>:rval, :type=>"LineItemTemplatePage", :min_occurs=>0, :max_occurs=>1}]}}} + LINEITEMTEMPLATESERVICE_TYPES = {:ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :AudienceExtensionError=>{:fields=>[{:name=>:reason, :type=>"AudienceExtensionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClickTrackingLineItemError=>{:fields=>[{:name=>:reason, :type=>"ClickTrackingLineItemError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CompanyCreditStatusError=>{:fields=>[{:name=>:reason, :type=>"CompanyCreditStatusError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ContentMetadataTargetingError=>{:fields=>[{:name=>:reason, :type=>"ContentMetadataTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomFieldValueError=>{:fields=>[{:name=>:reason, :type=>"CustomFieldValueError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomTargetingError=>{:fields=>[{:name=>:reason, :type=>"CustomTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeRangeTargetingError=>{:fields=>[{:name=>:reason, :type=>"DateTimeRangeTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DayPartTargetingError=>{:fields=>[{:name=>:reason, :type=>"DayPartTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :EntityLimitReachedError=>{:fields=>[], :base=>"ApiError"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ForecastError=>{:fields=>[{:name=>:reason, :type=>"ForecastError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :FrequencyCapError=>{:fields=>[{:name=>:reason, :type=>"FrequencyCapError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :GenericTargetingError=>{:fields=>[{:name=>:reason, :type=>"GenericTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :GeoTargetingError=>{:fields=>[{:name=>:reason, :type=>"GeoTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InvalidUrlError=>{:fields=>[{:name=>:reason, :type=>"InvalidUrlError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InventoryTargetingError=>{:fields=>[{:name=>:reason, :type=>"InventoryTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LabelEntityAssociationError=>{:fields=>[{:name=>:reason, :type=>"LabelEntityAssociationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItemCreativeAssociationError=>{:fields=>[{:name=>:reason, :type=>"LineItemCreativeAssociationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItemError=>{:fields=>[{:name=>:reason, :type=>"LineItemError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItemFlightDateError=>{:fields=>[{:name=>:reason, :type=>"LineItemFlightDateError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItemOperationError=>{:fields=>[{:name=>:reason, :type=>"LineItemOperationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItemTemplate=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_default, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:line_item_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:target_platform, :type=>"TargetPlatform", :min_occurs=>0, :max_occurs=>1}, {:name=>:enabled_for_same_advertiser_exception, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:notes, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:line_item_type, :type=>"LineItemType", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:end_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:delivery_rate_type, :type=>"DeliveryRateType", :min_occurs=>0, :max_occurs=>1}, {:name=>:roadblocking_type, :type=>"RoadblockingType", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_rotation_type, :type=>"CreativeRotationType", :min_occurs=>0, :max_occurs=>1}]}, :LineItemTemplatePage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"LineItemTemplate", :min_occurs=>0, :max_occurs=>:unbounded}]}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :OrderError=>{:fields=>[{:name=>:reason, :type=>"OrderError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ParseError=>{:fields=>[{:name=>:reason, :type=>"ParseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredCollectionError=>{:fields=>[{:name=>:reason, :type=>"RequiredCollectionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredNumberError=>{:fields=>[{:name=>:reason, :type=>"RequiredNumberError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredSizeError=>{:fields=>[{:name=>:reason, :type=>"RequiredSizeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ReservationDetailsError=>{:fields=>[{:name=>:reason, :type=>"ReservationDetailsError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TeamError=>{:fields=>[{:name=>:reason, :type=>"TeamError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :TechnologyTargetingError=>{:fields=>[{:name=>:reason, :type=>"TechnologyTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :UserDomainTargetingError=>{:fields=>[{:name=>:reason, :type=>"UserDomainTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AudienceExtensionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"ClickTrackingLineItemError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"CompanyCreditStatusError.Reason"=>{:fields=>[]}, :"ContentMetadataTargetingError.Reason"=>{:fields=>[]}, :CreativeRotationType=>{:fields=>[]}, :"CustomFieldValueError.Reason"=>{:fields=>[]}, :"CustomTargetingError.Reason"=>{:fields=>[]}, :"DateTimeRangeTargetingError.Reason"=>{:fields=>[]}, :"DayPartTargetingError.Reason"=>{:fields=>[]}, :DeliveryRateType=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"ForecastError.Reason"=>{:fields=>[]}, :"FrequencyCapError.Reason"=>{:fields=>[]}, :"GenericTargetingError.Reason"=>{:fields=>[]}, :"GeoTargetingError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"InvalidUrlError.Reason"=>{:fields=>[]}, :"InventoryTargetingError.Reason"=>{:fields=>[]}, :"LabelEntityAssociationError.Reason"=>{:fields=>[]}, :"LineItemCreativeAssociationError.Reason"=>{:fields=>[]}, :"LineItemError.Reason"=>{:fields=>[]}, :"LineItemFlightDateError.Reason"=>{:fields=>[]}, :"LineItemOperationError.Reason"=>{:fields=>[]}, :LineItemType=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"OrderError.Reason"=>{:fields=>[]}, :"ParseError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RangeError.Reason"=>{:fields=>[]}, :"RequiredCollectionError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"RequiredNumberError.Reason"=>{:fields=>[]}, :"RequiredSizeError.Reason"=>{:fields=>[]}, :"ReservationDetailsError.Reason"=>{:fields=>[]}, :RoadblockingType=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}, :TargetPlatform=>{:fields=>[]}, :"TeamError.Reason"=>{:fields=>[]}, :"TechnologyTargetingError.Reason"=>{:fields=>[]}, :"UserDomainTargetingError.Reason"=>{:fields=>[]}} + LINEITEMTEMPLATESERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return LINEITEMTEMPLATESERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return LINEITEMTEMPLATESERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return LINEITEMTEMPLATESERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, LineItemTemplateServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/network_service.rb b/dfp_api/lib/dfp_api/v201311/network_service.rb new file mode 100644 index 000000000..0b994baeb --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/network_service.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:34. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/network_service_registry' + +module DfpApi; module V201311; module NetworkService + class NetworkService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def get_all_networks(*args, &block) + return execute_action('get_all_networks', args, &block) + end + + def get_current_network(*args, &block) + return execute_action('get_current_network', args, &block) + end + + def make_test_network(*args, &block) + return execute_action('make_test_network', args, &block) + end + + def update_network(*args, &block) + return execute_action('update_network', args, &block) + end + + private + + def get_service_registry() + return NetworkServiceRegistry + end + + def get_module() + return DfpApi::V201311::NetworkService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/network_service_registry.rb b/dfp_api/lib/dfp_api/v201311/network_service_registry.rb new file mode 100644 index 000000000..2646dd17e --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/network_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:34. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module NetworkService + class NetworkServiceRegistry + NETWORKSERVICE_METHODS = {:get_all_networks=>{:input=>[], :output=>{:name=>"get_all_networks_response", :fields=>[{:name=>:rval, :type=>"Network", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_current_network=>{:input=>[], :output=>{:name=>"get_current_network_response", :fields=>[{:name=>:rval, :type=>"Network", :min_occurs=>0, :max_occurs=>1}]}}, :make_test_network=>{:input=>[], :output=>{:name=>"make_test_network_response", :fields=>[{:name=>:rval, :type=>"Network", :min_occurs=>0, :max_occurs=>1}]}}, :update_network=>{:input=>[{:name=>:network, :type=>"Network", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_network_response", :fields=>[{:name=>:rval, :type=>"Network", :min_occurs=>0, :max_occurs=>1}]}}} + NETWORKSERVICE_TYPES = {:ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ExchangeRateError=>{:fields=>[{:name=>:reason, :type=>"ExchangeRateError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InvalidEmailError=>{:fields=>[{:name=>:reason, :type=>"InvalidEmailError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Network=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:display_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:property_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:currency_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:secondary_currency_codes, :type=>"string", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:effective_root_ad_unit_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:content_browse_custom_targeting_key_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_test, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :NetworkError=>{:fields=>[{:name=>:reason, :type=>"NetworkError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :ParseError=>{:fields=>[{:name=>:reason, :type=>"ParseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredNumberError=>{:fields=>[{:name=>:reason, :type=>"RequiredNumberError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"ExchangeRateError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"InvalidEmailError.Reason"=>{:fields=>[]}, :"NetworkError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"ParseError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"RequiredNumberError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}} + NETWORKSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return NETWORKSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return NETWORKSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return NETWORKSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, NetworkServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/order_service.rb b/dfp_api/lib/dfp_api/v201311/order_service.rb new file mode 100644 index 000000000..6d9a13ab5 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/order_service.rb @@ -0,0 +1,58 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:36. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/order_service_registry' + +module DfpApi; module V201311; module OrderService + class OrderService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_order(*args, &block) + return execute_action('create_order', args, &block) + end + + def create_orders(*args, &block) + return execute_action('create_orders', args, &block) + end + + def get_order(*args, &block) + return execute_action('get_order', args, &block) + end + + def get_orders_by_statement(*args, &block) + return execute_action('get_orders_by_statement', args, &block) + end + + def perform_order_action(*args, &block) + return execute_action('perform_order_action', args, &block) + end + + def update_order(*args, &block) + return execute_action('update_order', args, &block) + end + + def update_orders(*args, &block) + return execute_action('update_orders', args, &block) + end + + private + + def get_service_registry() + return OrderServiceRegistry + end + + def get_module() + return DfpApi::V201311::OrderService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/order_service_registry.rb b/dfp_api/lib/dfp_api/v201311/order_service_registry.rb new file mode 100644 index 000000000..3aacd6132 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/order_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:36. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module OrderService + class OrderServiceRegistry + ORDERSERVICE_METHODS = {:create_order=>{:input=>[{:name=>:order, :type=>"Order", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_order_response", :fields=>[{:name=>:rval, :type=>"Order", :min_occurs=>0, :max_occurs=>1}]}}, :create_orders=>{:input=>[{:name=>:orders, :type=>"Order", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_orders_response", :fields=>[{:name=>:rval, :type=>"Order", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_order=>{:input=>[{:name=>:order_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_order_response", :fields=>[{:name=>:rval, :type=>"Order", :min_occurs=>0, :max_occurs=>1}]}}, :get_orders_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_orders_by_statement_response", :fields=>[{:name=>:rval, :type=>"OrderPage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_order_action=>{:input=>[{:name=>:order_action, :type=>"OrderAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_order_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_order=>{:input=>[{:name=>:order, :type=>"Order", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_order_response", :fields=>[{:name=>:rval, :type=>"Order", :min_occurs=>0, :max_occurs=>1}]}}, :update_orders=>{:input=>[{:name=>:orders, :type=>"Order", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_orders_response", :fields=>[{:name=>:rval, :type=>"Order", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + ORDERSERVICE_TYPES = {:ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :AppliedLabel=>{:fields=>[{:name=>:label_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_negated, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :ApproveAndOverbookOrders=>{:fields=>[], :base=>"ApproveOrders"}, :ApproveOrders=>{:fields=>[{:name=>:skip_inventory_check, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"OrderAction"}, :ApproveOrdersWithoutReservationChanges=>{:fields=>[], :base=>"OrderAction"}, :ArchiveOrders=>{:fields=>[], :base=>"OrderAction"}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BaseCustomFieldValue=>{:fields=>[{:name=>:custom_field_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:base_custom_field_value_type, :original_name=>"BaseCustomFieldValue.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CompanyCreditStatusError=>{:fields=>[{:name=>:reason, :type=>"CompanyCreditStatusError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomFieldValue=>{:fields=>[{:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCustomFieldValue"}, :CustomFieldValueError=>{:fields=>[{:name=>:reason, :type=>"CustomFieldValueError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DeleteOrders=>{:fields=>[], :base=>"OrderAction"}, :DisapproveOrders=>{:fields=>[], :base=>"OrderAction"}, :DisapproveOrdersWithoutReservationChanges=>{:fields=>[], :base=>"OrderAction"}, :DropDownCustomFieldValue=>{:fields=>[{:name=>:custom_field_option_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCustomFieldValue"}, :EntityLimitReachedError=>{:fields=>[], :base=>"ApiError"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ForecastError=>{:fields=>[{:name=>:reason, :type=>"ForecastError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InvalidEmailError=>{:fields=>[{:name=>:reason, :type=>"InvalidEmailError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InvalidUrlError=>{:fields=>[{:name=>:reason, :type=>"InvalidUrlError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InventoryTargetingError=>{:fields=>[{:name=>:reason, :type=>"InventoryTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LabelEntityAssociationError=>{:fields=>[{:name=>:reason, :type=>"LabelEntityAssociationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Money=>{:fields=>[{:name=>:currency_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:micro_amount, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :OrderAction=>{:fields=>[{:name=>:order_action_type, :original_name=>"OrderAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :OrderActionError=>{:fields=>[{:name=>:reason, :type=>"OrderActionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Order=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:end_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:unlimited_end_date_time, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"OrderStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_archived, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:notes, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:external_order_id, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:po_number, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:currency_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:advertiser_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:advertiser_contact_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:agency_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:agency_contact_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:creator_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:trafficker_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:secondary_trafficker_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:salesperson_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:secondary_salesperson_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:total_impressions_delivered, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:total_clicks_delivered, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:total_budget, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:effective_applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:last_modified_by_app, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:applied_team_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:last_modified_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:custom_field_values, :type=>"BaseCustomFieldValue", :min_occurs=>0, :max_occurs=>:unbounded}]}, :OrderError=>{:fields=>[{:name=>:reason, :type=>"OrderError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :OrderPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"Order", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ParseError=>{:fields=>[{:name=>:reason, :type=>"ParseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PauseOrders=>{:fields=>[], :base=>"OrderAction"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredCollectionError=>{:fields=>[{:name=>:reason, :type=>"RequiredCollectionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredNumberError=>{:fields=>[{:name=>:reason, :type=>"RequiredNumberError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ResumeAndOverbookOrders=>{:fields=>[], :base=>"ResumeOrders"}, :ResumeOrders=>{:fields=>[{:name=>:skip_inventory_check, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"OrderAction"}, :RetractOrders=>{:fields=>[], :base=>"OrderAction"}, :RetractOrdersWithoutReservationChanges=>{:fields=>[], :base=>"OrderAction"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :SubmitOrdersForApproval=>{:fields=>[{:name=>:skip_inventory_check, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"OrderAction"}, :SubmitOrdersForApprovalAndOverbook=>{:fields=>[], :base=>"SubmitOrdersForApproval"}, :SubmitOrdersForApprovalWithoutReservationChanges=>{:fields=>[], :base=>"OrderAction"}, :TeamError=>{:fields=>[{:name=>:reason, :type=>"TeamError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :TemplateInstantiatedCreativeError=>{:fields=>[{:name=>:reason, :type=>"TemplateInstantiatedCreativeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UnarchiveOrders=>{:fields=>[], :base=>"OrderAction"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"CompanyCreditStatusError.Reason"=>{:fields=>[]}, :"CustomFieldValueError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"ForecastError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"InvalidEmailError.Reason"=>{:fields=>[]}, :"InvalidUrlError.Reason"=>{:fields=>[]}, :"InventoryTargetingError.Reason"=>{:fields=>[]}, :"LabelEntityAssociationError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"OrderActionError.Reason"=>{:fields=>[]}, :"OrderError.Reason"=>{:fields=>[]}, :OrderStatus=>{:fields=>[]}, :"ParseError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RangeError.Reason"=>{:fields=>[]}, :"RequiredCollectionError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"RequiredNumberError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}, :"TeamError.Reason"=>{:fields=>[]}, :"TemplateInstantiatedCreativeError.Reason"=>{:fields=>[]}} + ORDERSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return ORDERSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return ORDERSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return ORDERSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, OrderServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/placement_service.rb b/dfp_api/lib/dfp_api/v201311/placement_service.rb new file mode 100644 index 000000000..08b6e1565 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/placement_service.rb @@ -0,0 +1,58 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:38. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/placement_service_registry' + +module DfpApi; module V201311; module PlacementService + class PlacementService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_placement(*args, &block) + return execute_action('create_placement', args, &block) + end + + def create_placements(*args, &block) + return execute_action('create_placements', args, &block) + end + + def get_placement(*args, &block) + return execute_action('get_placement', args, &block) + end + + def get_placements_by_statement(*args, &block) + return execute_action('get_placements_by_statement', args, &block) + end + + def perform_placement_action(*args, &block) + return execute_action('perform_placement_action', args, &block) + end + + def update_placement(*args, &block) + return execute_action('update_placement', args, &block) + end + + def update_placements(*args, &block) + return execute_action('update_placements', args, &block) + end + + private + + def get_service_registry() + return PlacementServiceRegistry + end + + def get_module() + return DfpApi::V201311::PlacementService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/placement_service_registry.rb b/dfp_api/lib/dfp_api/v201311/placement_service_registry.rb new file mode 100644 index 000000000..ed756f9af --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/placement_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:38. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module PlacementService + class PlacementServiceRegistry + PLACEMENTSERVICE_METHODS = {:create_placement=>{:input=>[{:name=>:placement, :type=>"Placement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_placement_response", :fields=>[{:name=>:rval, :type=>"Placement", :min_occurs=>0, :max_occurs=>1}]}}, :create_placements=>{:input=>[{:name=>:placements, :type=>"Placement", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_placements_response", :fields=>[{:name=>:rval, :type=>"Placement", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_placement=>{:input=>[{:name=>:placement_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_placement_response", :fields=>[{:name=>:rval, :type=>"Placement", :min_occurs=>0, :max_occurs=>1}]}}, :get_placements_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_placements_by_statement_response", :fields=>[{:name=>:rval, :type=>"PlacementPage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_placement_action=>{:input=>[{:name=>:placement_action, :type=>"PlacementAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_placement_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_placement=>{:input=>[{:name=>:placement, :type=>"Placement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_placement_response", :fields=>[{:name=>:rval, :type=>"Placement", :min_occurs=>0, :max_occurs=>1}]}}, :update_placements=>{:input=>[{:name=>:placements, :type=>"Placement", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_placements_response", :fields=>[{:name=>:rval, :type=>"Placement", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + PLACEMENTSERVICE_TYPES = {:ActivatePlacements=>{:fields=>[], :base=>"PlacementAction"}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :ArchivePlacements=>{:fields=>[], :base=>"PlacementAction"}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DeactivatePlacements=>{:fields=>[], :base=>"PlacementAction"}, :EntityLimitReachedError=>{:fields=>[], :base=>"ApiError"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :ParseError=>{:fields=>[{:name=>:reason, :type=>"ParseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PlacementAction=>{:fields=>[{:name=>:placement_action_type, :original_name=>"PlacementAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :Placement=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:description, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:placement_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"InventoryStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_ad_sense_targeting_enabled, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_ad_planner_targeting_enabled, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:ad_sense_targeting_locale, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:targeted_ad_unit_ids, :type=>"string", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:last_modified_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"SiteTargetingInfo"}, :PlacementError=>{:fields=>[{:name=>:reason, :type=>"PlacementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PlacementPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"Placement", :min_occurs=>0, :max_occurs=>:unbounded}]}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RegExError=>{:fields=>[{:name=>:reason, :type=>"RegExError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredCollectionError=>{:fields=>[{:name=>:reason, :type=>"RequiredCollectionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SiteTargetingInfo=>{:fields=>[{:name=>:targeting_description, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:targeting_site_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:targeting_ad_location, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:site_targeting_info_type, :original_name=>"SiteTargetingInfo.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :InventoryStatus=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"ParseError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PlacementError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RangeError.Reason"=>{:fields=>[]}, :"RegExError.Reason"=>{:fields=>[]}, :"RequiredCollectionError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}} + PLACEMENTSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return PLACEMENTSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return PLACEMENTSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return PLACEMENTSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, PlacementServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/product_service.rb b/dfp_api/lib/dfp_api/v201311/product_service.rb new file mode 100644 index 000000000..4ba246136 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/product_service.rb @@ -0,0 +1,50 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:39. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/product_service_registry' + +module DfpApi; module V201311; module ProductService + class ProductService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def get_product(*args, &block) + return execute_action('get_product', args, &block) + end + + def get_products_by_statement(*args, &block) + return execute_action('get_products_by_statement', args, &block) + end + + def perform_product_action(*args, &block) + return execute_action('perform_product_action', args, &block) + end + + def update_product(*args, &block) + return execute_action('update_product', args, &block) + end + + def update_products(*args, &block) + return execute_action('update_products', args, &block) + end + + private + + def get_service_registry() + return ProductServiceRegistry + end + + def get_module() + return DfpApi::V201311::ProductService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/product_service_registry.rb b/dfp_api/lib/dfp_api/v201311/product_service_registry.rb new file mode 100644 index 000000000..9fb22f50f --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/product_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:39. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module ProductService + class ProductServiceRegistry + PRODUCTSERVICE_METHODS = {:get_product=>{:input=>[{:name=>:product_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_product_response", :fields=>[{:name=>:rval, :type=>"Product", :min_occurs=>0, :max_occurs=>1}]}}, :get_products_by_statement=>{:input=>[{:name=>:statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_products_by_statement_response", :fields=>[{:name=>:rval, :type=>"ProductPage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_product_action=>{:input=>[{:name=>:product_action, :type=>"ProductAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_product_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_product=>{:input=>[{:name=>:product, :type=>"Product", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_product_response", :fields=>[{:name=>:rval, :type=>"Product", :min_occurs=>0, :max_occurs=>1}]}}, :update_products=>{:input=>[{:name=>:products, :type=>"Product", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_products_response", :fields=>[{:name=>:rval, :type=>"Product", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + PRODUCTSERVICE_TYPES = {:ActivateProducts=>{:fields=>[], :base=>"ProductAction"}, :AdUnitTargeting=>{:fields=>[{:name=>:ad_unit_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:include_descendants, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :AppliedLabel=>{:fields=>[{:name=>:label_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_negated, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :ArchiveProducts=>{:fields=>[], :base=>"ProductAction"}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BandwidthGroup=>{:fields=>[], :base=>"Technology"}, :BandwidthGroupTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:bandwidth_groups, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :BaseCustomFieldValue=>{:fields=>[{:name=>:custom_field_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:base_custom_field_value_type, :original_name=>"BaseCustomFieldValue.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :BaseRateError=>{:fields=>[{:name=>:reason, :type=>"BaseRateError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :Browser=>{:fields=>[{:name=>:major_version, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:minor_version, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :BrowserLanguage=>{:fields=>[], :base=>"Technology"}, :BrowserLanguageTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:browser_languages, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :BrowserTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:browsers, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CreativePlaceholder=>{:fields=>[{:name=>:size, :type=>"Size", :min_occurs=>0, :max_occurs=>1}, {:name=>:companions, :type=>"CreativePlaceholder", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:effective_applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:expected_creative_count, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_size_type, :type=>"CreativeSizeType", :min_occurs=>0, :max_occurs=>1}]}, :CustomFieldValue=>{:fields=>[{:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCustomFieldValue"}, :CustomFieldValueError=>{:fields=>[{:name=>:reason, :type=>"CustomFieldValueError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomTargetingError=>{:fields=>[{:name=>:reason, :type=>"CustomTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DeactivateProducts=>{:fields=>[], :base=>"ProductAction"}, :DeviceCapability=>{:fields=>[], :base=>"Technology"}, :DeviceCategory=>{:fields=>[], :base=>"Technology"}, :DeviceManufacturer=>{:fields=>[], :base=>"Technology"}, :DropDownCustomFieldValue=>{:fields=>[{:name=>:custom_field_option_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCustomFieldValue"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :FrequencyCap=>{:fields=>[{:name=>:max_impressions, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:num_time_units, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_unit, :type=>"TimeUnit", :min_occurs=>0, :max_occurs=>1}]}, :GeoTargeting=>{:fields=>[{:name=>:targeted_locations, :type=>"Location", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_locations, :type=>"Location", :min_occurs=>0, :max_occurs=>:unbounded}]}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InventoryTargeting=>{:fields=>[{:name=>:targeted_ad_units, :type=>"AdUnitTargeting", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_ad_units, :type=>"AdUnitTargeting", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted_placement_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}]}, :Location=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:type, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:canonical_parent_id, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:display_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:location_type, :original_name=>"Location.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :MobileCarrier=>{:fields=>[], :base=>"Technology"}, :MobileDevice=>{:fields=>[{:name=>:manufacturer_criterion_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :MobileDeviceSubmodel=>{:fields=>[{:name=>:mobile_device_criterion_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_manufacturer_criterion_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :OperatingSystem=>{:fields=>[], :base=>"Technology"}, :OperatingSystemTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:operating_systems, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :OperatingSystemVersion=>{:fields=>[{:name=>:major_version, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minor_version, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:micro_version, :type=>"int", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ProductAction=>{:fields=>[{:name=>:product_action_type, :original_name=>"ProductAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ProductActionError=>{:fields=>[{:name=>:reason, :type=>"ProductActionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Product=>{:fields=>[{:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"ProductStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:product_type, :type=>"ProductType", :min_occurs=>0, :max_occurs=>1}, {:name=>:product_template_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:notes, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:product_template_description, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:last_modified_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:rate_type, :type=>"RateType", :min_occurs=>0, :max_occurs=>1}, {:name=>:roadblocking_type, :type=>"RoadblockingType", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_placeholders, :type=>"CreativePlaceholder", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:line_item_type, :type=>"LineItemType", :min_occurs=>0, :max_occurs=>1}, {:name=>:priority, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:frequency_caps, :type=>"FrequencyCap", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:allow_frequency_caps_customization, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:targeting, :type=>"ProductTemplateTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:custom_field_values, :type=>"BaseCustomFieldValue", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ProductError=>{:fields=>[{:name=>:reason, :type=>"ProductError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ProductPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"Product", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ProductTemplateTargeting=>{:fields=>[{:name=>:geo_targeting, :type=>"GeoTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:allow_geo_targeting_customization, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:inventory_targeting, :type=>"InventoryTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:allow_ad_unit_targeting_customization, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:allow_placement_targeting_customization, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:customizable_custom_targeting_key_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:user_domain_targeting, :type=>"UserDomainTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:allow_user_domain_targeting_customization, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:bandwidth_group_targeting, :type=>"BandwidthGroupTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:allow_bandwidth_group_targeting_customization, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:browser_targeting, :type=>"BrowserTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:allow_browser_targeting_customization, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:browser_language_targeting, :type=>"BrowserLanguageTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:allow_browser_language_targeting_customization, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:operating_system_targeting, :type=>"OperatingSystemTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:allow_operating_system_targeting_customization, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredCollectionError=>{:fields=>[{:name=>:reason, :type=>"RequiredCollectionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredNumberError=>{:fields=>[{:name=>:reason, :type=>"RequiredNumberError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :Size=>{:fields=>[{:name=>:width, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:height, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_aspect_ratio, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :Technology=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:technology_type, :original_name=>"Technology.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :UserDomainTargeting=>{:fields=>[{:name=>:domains, :type=>"string", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"BaseRateError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :CreativeSizeType=>{:fields=>[]}, :"CustomFieldValueError.Reason"=>{:fields=>[]}, :"CustomTargetingError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :LineItemType=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"ProductActionError.Reason"=>{:fields=>[]}, :"ProductError.Reason"=>{:fields=>[]}, :ProductStatus=>{:fields=>[]}, :ProductType=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RangeError.Reason"=>{:fields=>[]}, :RateType=>{:fields=>[]}, :"RequiredCollectionError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"RequiredNumberError.Reason"=>{:fields=>[]}, :RoadblockingType=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}, :TimeUnit=>{:fields=>[]}} + PRODUCTSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return PRODUCTSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return PRODUCTSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return PRODUCTSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, ProductServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/product_template_service.rb b/dfp_api/lib/dfp_api/v201311/product_template_service.rb new file mode 100644 index 000000000..8526c9d1c --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/product_template_service.rb @@ -0,0 +1,58 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:42. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/product_template_service_registry' + +module DfpApi; module V201311; module ProductTemplateService + class ProductTemplateService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_product_template(*args, &block) + return execute_action('create_product_template', args, &block) + end + + def create_product_templates(*args, &block) + return execute_action('create_product_templates', args, &block) + end + + def get_product_template(*args, &block) + return execute_action('get_product_template', args, &block) + end + + def get_product_templates_by_statement(*args, &block) + return execute_action('get_product_templates_by_statement', args, &block) + end + + def perform_product_template_action(*args, &block) + return execute_action('perform_product_template_action', args, &block) + end + + def update_product_template(*args, &block) + return execute_action('update_product_template', args, &block) + end + + def update_product_templates(*args, &block) + return execute_action('update_product_templates', args, &block) + end + + private + + def get_service_registry() + return ProductTemplateServiceRegistry + end + + def get_module() + return DfpApi::V201311::ProductTemplateService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/product_template_service_registry.rb b/dfp_api/lib/dfp_api/v201311/product_template_service_registry.rb new file mode 100644 index 000000000..92d534619 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/product_template_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:42. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module ProductTemplateService + class ProductTemplateServiceRegistry + PRODUCTTEMPLATESERVICE_METHODS = {:create_product_template=>{:input=>[{:name=>:product_template, :type=>"ProductTemplate", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_product_template_response", :fields=>[{:name=>:rval, :type=>"ProductTemplate", :min_occurs=>0, :max_occurs=>1}]}}, :create_product_templates=>{:input=>[{:name=>:product_templates, :type=>"ProductTemplate", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_product_templates_response", :fields=>[{:name=>:rval, :type=>"ProductTemplate", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_product_template=>{:input=>[{:name=>:product_template_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_product_template_response", :fields=>[{:name=>:rval, :type=>"ProductTemplate", :min_occurs=>0, :max_occurs=>1}]}}, :get_product_templates_by_statement=>{:input=>[{:name=>:statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_product_templates_by_statement_response", :fields=>[{:name=>:rval, :type=>"ProductTemplatePage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_product_template_action=>{:input=>[{:name=>:action, :type=>"ProductTemplateAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_product_template_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_product_template=>{:input=>[{:name=>:product_template, :type=>"ProductTemplate", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_product_template_response", :fields=>[{:name=>:rval, :type=>"ProductTemplate", :min_occurs=>0, :max_occurs=>1}]}}, :update_product_templates=>{:input=>[{:name=>:product_templates, :type=>"ProductTemplate", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_product_templates_response", :fields=>[{:name=>:rval, :type=>"ProductTemplate", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + PRODUCTTEMPLATESERVICE_TYPES = {:ActivateProductTemplates=>{:fields=>[], :base=>"ProductTemplateAction"}, :AdUnitTargeting=>{:fields=>[{:name=>:ad_unit_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:include_descendants, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :AppliedLabel=>{:fields=>[{:name=>:label_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_negated, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :ArchiveProducTemplates=>{:fields=>[], :base=>"ProductTemplateAction"}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BandwidthGroup=>{:fields=>[], :base=>"Technology"}, :BandwidthGroupTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:bandwidth_groups, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :BaseCustomFieldValue=>{:fields=>[{:name=>:custom_field_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:base_custom_field_value_type, :original_name=>"BaseCustomFieldValue.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :BaseRateError=>{:fields=>[{:name=>:reason, :type=>"BaseRateError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :Browser=>{:fields=>[{:name=>:major_version, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:minor_version, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :BrowserLanguage=>{:fields=>[], :base=>"Technology"}, :BrowserLanguageTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:browser_languages, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :BrowserTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:browsers, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CreativePlaceholder=>{:fields=>[{:name=>:size, :type=>"Size", :min_occurs=>0, :max_occurs=>1}, {:name=>:companions, :type=>"CreativePlaceholder", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:effective_applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:expected_creative_count, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_size_type, :type=>"CreativeSizeType", :min_occurs=>0, :max_occurs=>1}]}, :CustomFieldValue=>{:fields=>[{:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCustomFieldValue"}, :CustomFieldValueError=>{:fields=>[{:name=>:reason, :type=>"CustomFieldValueError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomTargetingError=>{:fields=>[{:name=>:reason, :type=>"CustomTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DeactivateProductTemplates=>{:fields=>[], :base=>"ProductTemplateAction"}, :DeviceCapability=>{:fields=>[], :base=>"Technology"}, :DeviceCategory=>{:fields=>[], :base=>"Technology"}, :DeviceManufacturer=>{:fields=>[], :base=>"Technology"}, :DropDownCustomFieldValue=>{:fields=>[{:name=>:custom_field_option_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCustomFieldValue"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :FrequencyCap=>{:fields=>[{:name=>:max_impressions, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:num_time_units, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_unit, :type=>"TimeUnit", :min_occurs=>0, :max_occurs=>1}]}, :FrequencyCapError=>{:fields=>[{:name=>:reason, :type=>"FrequencyCapError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :GenericTargetingError=>{:fields=>[{:name=>:reason, :type=>"GenericTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :GeoTargeting=>{:fields=>[{:name=>:targeted_locations, :type=>"Location", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_locations, :type=>"Location", :min_occurs=>0, :max_occurs=>:unbounded}]}, :GeoTargetingError=>{:fields=>[{:name=>:reason, :type=>"GeoTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InventoryTargeting=>{:fields=>[{:name=>:targeted_ad_units, :type=>"AdUnitTargeting", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_ad_units, :type=>"AdUnitTargeting", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted_placement_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}]}, :InventoryTargetingError=>{:fields=>[{:name=>:reason, :type=>"InventoryTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Location=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:type, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:canonical_parent_id, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:display_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:location_type, :original_name=>"Location.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :MobileCarrier=>{:fields=>[], :base=>"Technology"}, :MobileDevice=>{:fields=>[{:name=>:manufacturer_criterion_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :MobileDeviceSubmodel=>{:fields=>[{:name=>:mobile_device_criterion_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_manufacturer_criterion_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :OperatingSystem=>{:fields=>[], :base=>"Technology"}, :OperatingSystemTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:operating_systems, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :OperatingSystemVersion=>{:fields=>[{:name=>:major_version, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minor_version, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:micro_version, :type=>"int", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PlacementTargeting=>{:fields=>[{:name=>:targeted_placement_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ProductTemplateAction=>{:fields=>[{:name=>:product_template_action_type, :original_name=>"ProductTemplateAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ProductTemplateActionError=>{:fields=>[{:name=>:reason, :type=>"ProductTemplateActionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ProductTemplate=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:creation_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:last_modified_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:description, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:name_macro, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"ProductTemplateStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:product_type, :type=>"ProductType", :min_occurs=>0, :max_occurs=>1}, {:name=>:creator_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:rate_type, :type=>"RateType", :min_occurs=>0, :max_occurs=>1}, {:name=>:roadblocking_type, :type=>"RoadblockingType", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_placeholders, :type=>"CreativePlaceholder", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:line_item_type, :type=>"LineItemType", :min_occurs=>0, :max_occurs=>1}, {:name=>:priority, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:frequency_caps, :type=>"FrequencyCap", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:allow_frequency_caps_customization, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:product_segmentation, :type=>"ProductSegmentation", :min_occurs=>0, :max_occurs=>1}, {:name=>:targeting, :type=>"ProductTemplateTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:custom_field_values, :type=>"BaseCustomFieldValue", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ProductTemplateError=>{:fields=>[{:name=>:reason, :type=>"ProductTemplateError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ProductTemplatePage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"ProductTemplate", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ProductSegmentation=>{:fields=>[{:name=>:geo_segment, :type=>"GeoTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:ad_unit_segments, :type=>"AdUnitTargeting", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:placement_segment, :type=>"PlacementTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:user_domain_segment, :type=>"UserDomainTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:bandwidth_segment, :type=>"BandwidthGroupTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:browser_segment, :type=>"BrowserTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:browser_language_segment, :type=>"BrowserLanguageTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:operating_system_segment, :type=>"OperatingSystemTargeting", :min_occurs=>0, :max_occurs=>1}]}, :ProductTemplateTargeting=>{:fields=>[{:name=>:geo_targeting, :type=>"GeoTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:allow_geo_targeting_customization, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:inventory_targeting, :type=>"InventoryTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:allow_ad_unit_targeting_customization, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:allow_placement_targeting_customization, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:customizable_custom_targeting_key_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:user_domain_targeting, :type=>"UserDomainTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:allow_user_domain_targeting_customization, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:bandwidth_group_targeting, :type=>"BandwidthGroupTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:allow_bandwidth_group_targeting_customization, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:browser_targeting, :type=>"BrowserTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:allow_browser_targeting_customization, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:browser_language_targeting, :type=>"BrowserLanguageTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:allow_browser_language_targeting_customization, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:operating_system_targeting, :type=>"OperatingSystemTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:allow_operating_system_targeting_customization, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredCollectionError=>{:fields=>[{:name=>:reason, :type=>"RequiredCollectionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredNumberError=>{:fields=>[{:name=>:reason, :type=>"RequiredNumberError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :Size=>{:fields=>[{:name=>:width, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:height, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_aspect_ratio, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :Technology=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:technology_type, :original_name=>"Technology.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :UserDomainTargeting=>{:fields=>[{:name=>:domains, :type=>"string", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :UserDomainTargetingError=>{:fields=>[{:name=>:reason, :type=>"UserDomainTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"BaseRateError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :CreativeSizeType=>{:fields=>[]}, :"CustomFieldValueError.Reason"=>{:fields=>[]}, :"CustomTargetingError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"FrequencyCapError.Reason"=>{:fields=>[]}, :"GenericTargetingError.Reason"=>{:fields=>[]}, :"GeoTargetingError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"InventoryTargetingError.Reason"=>{:fields=>[]}, :LineItemType=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"ProductTemplateActionError.Reason"=>{:fields=>[]}, :"ProductTemplateError.Reason"=>{:fields=>[]}, :ProductTemplateStatus=>{:fields=>[]}, :ProductType=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RangeError.Reason"=>{:fields=>[]}, :RateType=>{:fields=>[]}, :"RequiredCollectionError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"RequiredNumberError.Reason"=>{:fields=>[]}, :RoadblockingType=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}, :TimeUnit=>{:fields=>[]}, :"UserDomainTargetingError.Reason"=>{:fields=>[]}} + PRODUCTTEMPLATESERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return PRODUCTTEMPLATESERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return PRODUCTTEMPLATESERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return PRODUCTTEMPLATESERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, ProductTemplateServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/proposal_line_item_service.rb b/dfp_api/lib/dfp_api/v201311/proposal_line_item_service.rb new file mode 100644 index 000000000..54b5790f9 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/proposal_line_item_service.rb @@ -0,0 +1,58 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:45. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/proposal_line_item_service_registry' + +module DfpApi; module V201311; module ProposalLineItemService + class ProposalLineItemService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_proposal_line_item(*args, &block) + return execute_action('create_proposal_line_item', args, &block) + end + + def create_proposal_line_items(*args, &block) + return execute_action('create_proposal_line_items', args, &block) + end + + def get_proposal_line_item(*args, &block) + return execute_action('get_proposal_line_item', args, &block) + end + + def get_proposal_line_items_by_statement(*args, &block) + return execute_action('get_proposal_line_items_by_statement', args, &block) + end + + def perform_proposal_line_item_action(*args, &block) + return execute_action('perform_proposal_line_item_action', args, &block) + end + + def update_proposal_line_item(*args, &block) + return execute_action('update_proposal_line_item', args, &block) + end + + def update_proposal_line_items(*args, &block) + return execute_action('update_proposal_line_items', args, &block) + end + + private + + def get_service_registry() + return ProposalLineItemServiceRegistry + end + + def get_module() + return DfpApi::V201311::ProposalLineItemService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/proposal_line_item_service_registry.rb b/dfp_api/lib/dfp_api/v201311/proposal_line_item_service_registry.rb new file mode 100644 index 000000000..cf586e026 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/proposal_line_item_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:45. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module ProposalLineItemService + class ProposalLineItemServiceRegistry + PROPOSALLINEITEMSERVICE_METHODS = {:create_proposal_line_item=>{:input=>[{:name=>:proposal_line_item, :type=>"ProposalLineItem", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_proposal_line_item_response", :fields=>[{:name=>:rval, :type=>"ProposalLineItem", :min_occurs=>0, :max_occurs=>1}]}}, :create_proposal_line_items=>{:input=>[{:name=>:proposal_line_items, :type=>"ProposalLineItem", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_proposal_line_items_response", :fields=>[{:name=>:rval, :type=>"ProposalLineItem", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_proposal_line_item=>{:input=>[{:name=>:proposal_line_item_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_proposal_line_item_response", :fields=>[{:name=>:rval, :type=>"ProposalLineItem", :min_occurs=>0, :max_occurs=>1}]}}, :get_proposal_line_items_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_proposal_line_items_by_statement_response", :fields=>[{:name=>:rval, :type=>"ProposalLineItemPage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_proposal_line_item_action=>{:input=>[{:name=>:proposal_line_item_action, :type=>"ProposalLineItemAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_proposal_line_item_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_proposal_line_item=>{:input=>[{:name=>:proposal_line_item, :type=>"ProposalLineItem", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_proposal_line_item_response", :fields=>[{:name=>:rval, :type=>"ProposalLineItem", :min_occurs=>0, :max_occurs=>1}]}}, :update_proposal_line_items=>{:input=>[{:name=>:proposal_line_items, :type=>"ProposalLineItem", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_proposal_line_items_response", :fields=>[{:name=>:rval, :type=>"ProposalLineItem", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + PROPOSALLINEITEMSERVICE_TYPES = {:AdUnitTargeting=>{:fields=>[{:name=>:ad_unit_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:include_descendants, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :TechnologyTargeting=>{:fields=>[{:name=>:bandwidth_group_targeting, :type=>"BandwidthGroupTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:browser_targeting, :type=>"BrowserTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:browser_language_targeting, :type=>"BrowserLanguageTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_capability_targeting, :type=>"DeviceCapabilityTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_category_targeting, :type=>"DeviceCategoryTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_manufacturer_targeting, :type=>"DeviceManufacturerTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:mobile_carrier_targeting, :type=>"MobileCarrierTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:mobile_device_targeting, :type=>"MobileDeviceTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:mobile_device_submodel_targeting, :type=>"MobileDeviceSubmodelTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:operating_system_targeting, :type=>"OperatingSystemTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:operating_system_version_targeting, :type=>"OperatingSystemVersionTargeting", :min_occurs=>0, :max_occurs=>1}]}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :AppliedLabel=>{:fields=>[{:name=>:label_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_negated, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :ArchiveProposalLineItems=>{:fields=>[], :base=>"ProposalLineItemAction"}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BandwidthGroup=>{:fields=>[], :base=>"Technology"}, :BandwidthGroupTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:bandwidth_groups, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :BaseCustomFieldValue=>{:fields=>[{:name=>:custom_field_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:base_custom_field_value_type, :original_name=>"BaseCustomFieldValue.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :BillingError=>{:fields=>[{:name=>:reason, :type=>"BillingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :Browser=>{:fields=>[{:name=>:major_version, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:minor_version, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :BrowserLanguage=>{:fields=>[], :base=>"Technology"}, :BrowserLanguageTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:browser_languages, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :BrowserTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:browsers, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ContentMetadataKeyHierarchyTargeting=>{:fields=>[{:name=>:custom_targeting_value_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ContentTargeting=>{:fields=>[{:name=>:targeted_content_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_content_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted_video_category_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_video_category_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted_video_content_bundle_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_video_content_bundle_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted_content_metadata, :type=>"ContentMetadataKeyHierarchyTargeting", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_content_metadata, :type=>"ContentMetadataKeyHierarchyTargeting", :min_occurs=>0, :max_occurs=>:unbounded}]}, :CreativePlaceholder=>{:fields=>[{:name=>:size, :type=>"Size", :min_occurs=>0, :max_occurs=>1}, {:name=>:companions, :type=>"CreativePlaceholder", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:effective_applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:expected_creative_count, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_size_type, :type=>"CreativeSizeType", :min_occurs=>0, :max_occurs=>1}]}, :CustomCriteria=>{:fields=>[{:name=>:key_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:value_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:operator, :type=>"CustomCriteria.ComparisonOperator", :min_occurs=>0, :max_occurs=>1}], :base=>"CustomCriteriaLeaf"}, :CustomCriteriaSet=>{:fields=>[{:name=>:logical_operator, :type=>"CustomCriteriaSet.LogicalOperator", :min_occurs=>0, :max_occurs=>1}, {:name=>:children, :type=>"CustomCriteriaNode", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"CustomCriteriaNode"}, :CustomFieldValue=>{:fields=>[{:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCustomFieldValue"}, :CustomFieldValueError=>{:fields=>[{:name=>:reason, :type=>"CustomFieldValueError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomTargetingError=>{:fields=>[{:name=>:reason, :type=>"CustomTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomCriteriaLeaf=>{:fields=>[], :abstract=>true, :base=>"CustomCriteriaNode"}, :CustomCriteriaNode=>{:fields=>[{:name=>:custom_criteria_node_type, :original_name=>"CustomCriteriaNode.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AudienceSegmentCriteria=>{:fields=>[{:name=>:operator, :type=>"AudienceSegmentCriteria.ComparisonOperator", :min_occurs=>0, :max_occurs=>1}, {:name=>:audience_segment_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"CustomCriteriaLeaf"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DayPart=>{:fields=>[{:name=>:day_of_week, :type=>"DayOfWeek", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_time, :type=>"TimeOfDay", :min_occurs=>0, :max_occurs=>1}, {:name=>:end_time, :type=>"TimeOfDay", :min_occurs=>0, :max_occurs=>1}]}, :DayPartTargeting=>{:fields=>[{:name=>:day_parts, :type=>"DayPart", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:time_zone, :type=>"DeliveryTimeZone", :min_occurs=>0, :max_occurs=>1}]}, :DayPartTargetingError=>{:fields=>[{:name=>:reason, :type=>"DayPartTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :DeliveryData=>{:fields=>[{:name=>:units, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}]}, :DeliveryIndicator=>{:fields=>[{:name=>:expected_delivery_percentage, :type=>"double", :min_occurs=>0, :max_occurs=>1}, {:name=>:actual_delivery_percentage, :type=>"double", :min_occurs=>0, :max_occurs=>1}]}, :DeviceCapability=>{:fields=>[], :base=>"Technology"}, :DeviceCapabilityTargeting=>{:fields=>[{:name=>:targeted_device_capabilities, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_device_capabilities, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :DeviceCategory=>{:fields=>[], :base=>"Technology"}, :DeviceCategoryTargeting=>{:fields=>[{:name=>:targeted_device_categories, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_device_categories, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :DeviceManufacturer=>{:fields=>[], :base=>"Technology"}, :DeviceManufacturerTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_manufacturers, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :DropDownCustomFieldValue=>{:fields=>[{:name=>:custom_field_option_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCustomFieldValue"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :FrequencyCap=>{:fields=>[{:name=>:max_impressions, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:num_time_units, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_unit, :type=>"TimeUnit", :min_occurs=>0, :max_occurs=>1}]}, :FrequencyCapError=>{:fields=>[{:name=>:reason, :type=>"FrequencyCapError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :GenericTargetingError=>{:fields=>[{:name=>:reason, :type=>"GenericTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :GeoTargeting=>{:fields=>[{:name=>:targeted_locations, :type=>"Location", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_locations, :type=>"Location", :min_occurs=>0, :max_occurs=>:unbounded}]}, :GeoTargetingError=>{:fields=>[{:name=>:reason, :type=>"GeoTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InventoryTargeting=>{:fields=>[{:name=>:targeted_ad_units, :type=>"AdUnitTargeting", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_ad_units, :type=>"AdUnitTargeting", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted_placement_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}]}, :InventoryTargetingError=>{:fields=>[{:name=>:reason, :type=>"InventoryTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LabelEntityAssociationError=>{:fields=>[{:name=>:reason, :type=>"LabelEntityAssociationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Location=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:type, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:canonical_parent_id, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:display_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:location_type, :original_name=>"Location.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :MobileCarrier=>{:fields=>[], :base=>"Technology"}, :MobileCarrierTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:mobile_carriers, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :MobileDevice=>{:fields=>[{:name=>:manufacturer_criterion_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :MobileDeviceSubmodel=>{:fields=>[{:name=>:mobile_device_criterion_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:device_manufacturer_criterion_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :MobileDeviceSubmodelTargeting=>{:fields=>[{:name=>:targeted_mobile_device_submodels, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_mobile_device_submodels, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :MobileDeviceTargeting=>{:fields=>[{:name=>:targeted_mobile_devices, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_mobile_devices, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :Money=>{:fields=>[{:name=>:currency_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:micro_amount, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :OperatingSystem=>{:fields=>[], :base=>"Technology"}, :OperatingSystemTargeting=>{:fields=>[{:name=>:is_targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:operating_systems, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :OperatingSystemVersion=>{:fields=>[{:name=>:major_version, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minor_version, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:micro_version, :type=>"int", :min_occurs=>0, :max_occurs=>1}], :base=>"Technology"}, :OperatingSystemVersionTargeting=>{:fields=>[{:name=>:targeted_operating_system_versions, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:excluded_operating_system_versions, :type=>"Technology", :min_occurs=>0, :max_occurs=>:unbounded}]}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PrecisionError=>{:fields=>[{:name=>:reason, :type=>"PrecisionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ProductError=>{:fields=>[{:name=>:reason, :type=>"ProductError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ProposalError=>{:fields=>[{:name=>:reason, :type=>"ProposalError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ProposalLineItemAction=>{:fields=>[{:name=>:proposal_line_item_action_type, :original_name=>"ProposalLineItemAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ProposalLineItemActionError=>{:fields=>[{:name=>:reason, :type=>"ProposalLineItemActionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ProposalLineItem=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:proposal_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:rate_card_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:product_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:end_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:notes, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:cost_adjustment, :type=>"CostAdjustment", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_archived, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:units_bought, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:units_bought_buffer, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:delivery_rate_type, :type=>"DeliveryRateType", :min_occurs=>0, :max_occurs=>1}, {:name=>:roadblocking_type, :type=>"RoadblockingType", :min_occurs=>0, :max_occurs=>1}, {:name=>:companion_delivery_option, :type=>"CompanionDeliveryOption", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_rotation_type, :type=>"CreativeRotationType", :min_occurs=>0, :max_occurs=>1}, {:name=>:frequency_caps, :type=>"FrequencyCap", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:dfp_line_item_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:line_item_type, :type=>"LineItemType", :min_occurs=>0, :max_occurs=>1}, {:name=>:line_item_priority, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:rate_type, :type=>"RateType", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_placeholders, :type=>"CreativePlaceholder", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeting, :type=>"Targeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:custom_field_values, :type=>"BaseCustomFieldValue", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:effective_applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:premiums, :type=>"ProposalLineItemPremium", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:base_rate, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:cost_per_unit, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:cost, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:delivery_indicator, :type=>"DeliveryIndicator", :min_occurs=>0, :max_occurs=>1}, {:name=>:delivery_data, :type=>"DeliveryData", :min_occurs=>0, :max_occurs=>1}, {:name=>:computed_status, :type=>"ComputedStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:billing_cap, :type=>"BillingCap", :min_occurs=>0, :max_occurs=>1}, {:name=>:billing_schedule, :type=>"BillingSchedule", :min_occurs=>0, :max_occurs=>1}, {:name=>:billing_source, :type=>"BillingSource", :min_occurs=>0, :max_occurs=>1}, {:name=>:last_modified_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}]}, :ProposalLineItemError=>{:fields=>[{:name=>:reason, :type=>"ProposalLineItemError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ProposalLineItemPage=>{:fields=>[{:name=>:results, :type=>"ProposalLineItem", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :ProposalLineItemPremium=>{:fields=>[{:name=>:rate_card_customization_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"ProposalLineItemPremiumStatus", :min_occurs=>0, :max_occurs=>1}]}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredNumberError=>{:fields=>[{:name=>:reason, :type=>"RequiredNumberError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ReservationDetailsError=>{:fields=>[{:name=>:reason, :type=>"ReservationDetailsError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :Size=>{:fields=>[{:name=>:width, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:height, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_aspect_ratio, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :Targeting=>{:fields=>[{:name=>:geo_targeting, :type=>"GeoTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:inventory_targeting, :type=>"InventoryTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:day_part_targeting, :type=>"DayPartTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:technology_targeting, :type=>"TechnologyTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:custom_targeting, :type=>"CustomCriteriaSet", :min_occurs=>0, :max_occurs=>1}, {:name=>:user_domain_targeting, :type=>"UserDomainTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:content_targeting, :type=>"ContentTargeting", :min_occurs=>0, :max_occurs=>1}, {:name=>:video_position_targeting, :type=>"VideoPositionTargeting", :min_occurs=>0, :max_occurs=>1}]}, :TeamError=>{:fields=>[{:name=>:reason, :type=>"TeamError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Technology=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:technology_type, :original_name=>"Technology.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :TechnologyTargetingError=>{:fields=>[{:name=>:reason, :type=>"TechnologyTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TimeOfDay=>{:fields=>[{:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"MinuteOfHour", :min_occurs=>0, :max_occurs=>1}]}, :UnarchiveProposalLineItems=>{:fields=>[], :base=>"ProposalLineItemAction"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :UserDomainTargeting=>{:fields=>[{:name=>:domains, :type=>"string", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:targeted, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :UserDomainTargetingError=>{:fields=>[{:name=>:reason, :type=>"UserDomainTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :VideoPosition=>{:fields=>[{:name=>:position_type, :type=>"VideoPosition.Type", :min_occurs=>0, :max_occurs=>1}, {:name=>:midroll_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :VideoPositionTargeting=>{:fields=>[{:name=>:targeted_positions, :type=>"VideoPositionTarget", :min_occurs=>0, :max_occurs=>:unbounded}]}, :VideoPositionWithinPod=>{:fields=>[{:name=>:index, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :VideoPositionTarget=>{:fields=>[{:name=>:video_position, :type=>"VideoPosition", :min_occurs=>0, :max_occurs=>1}, {:name=>:video_bumper_type, :type=>"VideoBumperType", :min_occurs=>0, :max_occurs=>1}, {:name=>:video_position_within_pod, :type=>"VideoPositionWithinPod", :min_occurs=>0, :max_occurs=>1}]}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :BillingCap=>{:fields=>[]}, :"BillingError.Reason"=>{:fields=>[]}, :BillingSchedule=>{:fields=>[]}, :BillingSource=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :CompanionDeliveryOption=>{:fields=>[]}, :ComputedStatus=>{:fields=>[]}, :CostAdjustment=>{:fields=>[]}, :CreativeRotationType=>{:fields=>[]}, :CreativeSizeType=>{:fields=>[]}, :"CustomCriteria.ComparisonOperator"=>{:fields=>[]}, :"CustomCriteriaSet.LogicalOperator"=>{:fields=>[]}, :"CustomFieldValueError.Reason"=>{:fields=>[]}, :"CustomTargetingError.Reason"=>{:fields=>[]}, :"AudienceSegmentCriteria.ComparisonOperator"=>{:fields=>[]}, :DayOfWeek=>{:fields=>[]}, :"DayPartTargetingError.Reason"=>{:fields=>[]}, :DeliveryTimeZone=>{:fields=>[]}, :DeliveryRateType=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"FrequencyCapError.Reason"=>{:fields=>[]}, :"GenericTargetingError.Reason"=>{:fields=>[]}, :"GeoTargetingError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"InventoryTargetingError.Reason"=>{:fields=>[]}, :"LabelEntityAssociationError.Reason"=>{:fields=>[]}, :LineItemType=>{:fields=>[]}, :MinuteOfHour=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PrecisionError.Reason"=>{:fields=>[]}, :"ProductError.Reason"=>{:fields=>[]}, :"ProposalError.Reason"=>{:fields=>[]}, :"ProposalLineItemActionError.Reason"=>{:fields=>[]}, :"ProposalLineItemError.Reason"=>{:fields=>[]}, :ProposalLineItemPremiumStatus=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RangeError.Reason"=>{:fields=>[]}, :RateType=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"RequiredNumberError.Reason"=>{:fields=>[]}, :"ReservationDetailsError.Reason"=>{:fields=>[]}, :RoadblockingType=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}, :"TeamError.Reason"=>{:fields=>[]}, :"TechnologyTargetingError.Reason"=>{:fields=>[]}, :TimeUnit=>{:fields=>[]}, :"UserDomainTargetingError.Reason"=>{:fields=>[]}, :VideoBumperType=>{:fields=>[]}, :"VideoPosition.Type"=>{:fields=>[]}} + PROPOSALLINEITEMSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return PROPOSALLINEITEMSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return PROPOSALLINEITEMSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return PROPOSALLINEITEMSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, ProposalLineItemServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/proposal_service.rb b/dfp_api/lib/dfp_api/v201311/proposal_service.rb new file mode 100644 index 000000000..091124e48 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/proposal_service.rb @@ -0,0 +1,58 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:49. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/proposal_service_registry' + +module DfpApi; module V201311; module ProposalService + class ProposalService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_proposal(*args, &block) + return execute_action('create_proposal', args, &block) + end + + def create_proposals(*args, &block) + return execute_action('create_proposals', args, &block) + end + + def get_proposal(*args, &block) + return execute_action('get_proposal', args, &block) + end + + def get_proposals_by_statement(*args, &block) + return execute_action('get_proposals_by_statement', args, &block) + end + + def perform_proposal_action(*args, &block) + return execute_action('perform_proposal_action', args, &block) + end + + def update_proposal(*args, &block) + return execute_action('update_proposal', args, &block) + end + + def update_proposals(*args, &block) + return execute_action('update_proposals', args, &block) + end + + private + + def get_service_registry() + return ProposalServiceRegistry + end + + def get_module() + return DfpApi::V201311::ProposalService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/proposal_service_registry.rb b/dfp_api/lib/dfp_api/v201311/proposal_service_registry.rb new file mode 100644 index 000000000..648ced71a --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/proposal_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:49. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module ProposalService + class ProposalServiceRegistry + PROPOSALSERVICE_METHODS = {:create_proposal=>{:input=>[{:name=>:proposal, :type=>"Proposal", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_proposal_response", :fields=>[{:name=>:rval, :type=>"Proposal", :min_occurs=>0, :max_occurs=>1}]}}, :create_proposals=>{:input=>[{:name=>:proposals, :type=>"Proposal", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_proposals_response", :fields=>[{:name=>:rval, :type=>"Proposal", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_proposal=>{:input=>[{:name=>:proposal_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_proposal_response", :fields=>[{:name=>:rval, :type=>"Proposal", :min_occurs=>0, :max_occurs=>1}]}}, :get_proposals_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_proposals_by_statement_response", :fields=>[{:name=>:rval, :type=>"ProposalPage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_proposal_action=>{:input=>[{:name=>:proposal_action, :type=>"ProposalAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_proposal_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_proposal=>{:input=>[{:name=>:proposal, :type=>"Proposal", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_proposal_response", :fields=>[{:name=>:rval, :type=>"Proposal", :min_occurs=>0, :max_occurs=>1}]}}, :update_proposals=>{:input=>[{:name=>:proposals, :type=>"Proposal", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_proposals_response", :fields=>[{:name=>:rval, :type=>"Proposal", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + PROPOSALSERVICE_TYPES = {:ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :AppliedLabel=>{:fields=>[{:name=>:label_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_negated, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :ArchiveProposals=>{:fields=>[], :base=>"ProposalAction"}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BaseCustomFieldValue=>{:fields=>[{:name=>:custom_field_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:base_custom_field_value_type, :original_name=>"BaseCustomFieldValue.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :BillingError=>{:fields=>[{:name=>:reason, :type=>"BillingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomFieldValue=>{:fields=>[{:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCustomFieldValue"}, :CustomFieldValueError=>{:fields=>[{:name=>:reason, :type=>"CustomFieldValueError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DropDownCustomFieldValue=>{:fields=>[{:name=>:custom_field_option_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCustomFieldValue"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ForecastError=>{:fields=>[{:name=>:reason, :type=>"ForecastError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InvalidUrlError=>{:fields=>[{:name=>:reason, :type=>"InvalidUrlError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LabelEntityAssociationError=>{:fields=>[{:name=>:reason, :type=>"LabelEntityAssociationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItemOperationError=>{:fields=>[{:name=>:reason, :type=>"LineItemOperationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Money=>{:fields=>[{:name=>:currency_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:micro_amount, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PrecisionError=>{:fields=>[{:name=>:reason, :type=>"PrecisionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ProductError=>{:fields=>[{:name=>:reason, :type=>"ProductError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ProposalAction=>{:fields=>[{:name=>:proposal_action_type, :original_name=>"ProposalAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ProposalActionError=>{:fields=>[{:name=>:reason, :type=>"ProposalActionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ProposalCompanyAssociation=>{:fields=>[{:name=>:company_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:type, :type=>"ProposalCompanyAssociationType", :min_occurs=>0, :max_occurs=>1}, {:name=>:contact_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}]}, :Proposal=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:dfp_order_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:pricing_model, :type=>"PricingModel", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:end_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"ProposalStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_archived, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:advertiser, :type=>"ProposalCompanyAssociation", :min_occurs=>0, :max_occurs=>1}, {:name=>:agencies, :type=>"ProposalCompanyAssociation", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:probability_to_close, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:billing_cap, :type=>"BillingCap", :min_occurs=>0, :max_occurs=>1}, {:name=>:billing_schedule, :type=>"BillingSchedule", :min_occurs=>0, :max_occurs=>1}, {:name=>:billing_source, :type=>"BillingSource", :min_occurs=>0, :max_occurs=>1}, {:name=>:po_number, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:notes, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:budget, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:primary_salesperson, :type=>"SalespersonSplit", :min_occurs=>0, :max_occurs=>1}, {:name=>:secondary_salespeople, :type=>"SalespersonSplit", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:sales_planner_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:primary_trafficker_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:secondary_trafficker_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:applied_team_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:custom_field_values, :type=>"BaseCustomFieldValue", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:effective_applied_labels, :type=>"AppliedLabel", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:advertiser_discount, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:proposal_discount, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:additional_adjustment, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:currency_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:exchange_rate, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:refresh_exchange_rate, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:agency_commission, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:value_added_tax, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:approval_status, :type=>"ProposalApprovalStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:last_modified_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}]}, :ProposalError=>{:fields=>[{:name=>:reason, :type=>"ProposalError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ProposalLineItemError=>{:fields=>[{:name=>:reason, :type=>"ProposalLineItemError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ProposalPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"Proposal", :min_occurs=>0, :max_occurs=>:unbounded}]}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredCollectionError=>{:fields=>[{:name=>:reason, :type=>"RequiredCollectionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredNumberError=>{:fields=>[{:name=>:reason, :type=>"RequiredNumberError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RetractProposals=>{:fields=>[], :base=>"ProposalAction"}, :SalespersonSplit=>{:fields=>[{:name=>:user_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:split, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :SubmitProposalsForApproval=>{:fields=>[], :base=>"ProposalAction"}, :TeamError=>{:fields=>[{:name=>:reason, :type=>"TeamError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UnarchiveProposals=>{:fields=>[], :base=>"ProposalAction"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :WorkflowActionError=>{:fields=>[{:name=>:reason, :type=>"WorkflowActionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :BillingCap=>{:fields=>[]}, :"BillingError.Reason"=>{:fields=>[]}, :BillingSchedule=>{:fields=>[]}, :BillingSource=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"CustomFieldValueError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"ForecastError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"InvalidUrlError.Reason"=>{:fields=>[]}, :"LabelEntityAssociationError.Reason"=>{:fields=>[]}, :"LineItemOperationError.Reason"=>{:fields=>[]}, :ProposalApprovalStatus=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PrecisionError.Reason"=>{:fields=>[]}, :PricingModel=>{:fields=>[]}, :"ProductError.Reason"=>{:fields=>[]}, :"ProposalActionError.Reason"=>{:fields=>[]}, :ProposalCompanyAssociationType=>{:fields=>[]}, :"ProposalError.Reason"=>{:fields=>[]}, :"ProposalLineItemError.Reason"=>{:fields=>[]}, :ProposalStatus=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RangeError.Reason"=>{:fields=>[]}, :"RequiredCollectionError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"RequiredNumberError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}, :"TeamError.Reason"=>{:fields=>[]}, :"WorkflowActionError.Reason"=>{:fields=>[]}} + PROPOSALSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return PROPOSALSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return PROPOSALSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return PROPOSALSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, ProposalServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/publisher_query_language_service.rb b/dfp_api/lib/dfp_api/v201311/publisher_query_language_service.rb new file mode 100644 index 000000000..7bce82ba4 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/publisher_query_language_service.rb @@ -0,0 +1,34 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:51. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/publisher_query_language_service_registry' + +module DfpApi; module V201311; module PublisherQueryLanguageService + class PublisherQueryLanguageService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def select(*args, &block) + return execute_action('select', args, &block) + end + + private + + def get_service_registry() + return PublisherQueryLanguageServiceRegistry + end + + def get_module() + return DfpApi::V201311::PublisherQueryLanguageService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/publisher_query_language_service_registry.rb b/dfp_api/lib/dfp_api/v201311/publisher_query_language_service_registry.rb new file mode 100644 index 000000000..a1e04eed5 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/publisher_query_language_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:51. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module PublisherQueryLanguageService + class PublisherQueryLanguageServiceRegistry + PUBLISHERQUERYLANGUAGESERVICE_METHODS = {:select=>{:input=>[{:name=>:select_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"select_response", :fields=>[{:name=>:rval, :type=>"ResultSet", :min_occurs=>0, :max_occurs=>1}]}}} + PUBLISHERQUERYLANGUAGESERVICE_TYPES = {:AdUnitAfcSizeError=>{:fields=>[{:name=>:reason, :type=>"AdUnitAfcSizeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :AdUnitCodeError=>{:fields=>[{:name=>:reason, :type=>"AdUnitCodeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :AdUnitHierarchyError=>{:fields=>[{:name=>:reason, :type=>"AdUnitHierarchyError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :ColumnType=>{:fields=>[{:name=>:label_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CreativeError=>{:fields=>[{:name=>:reason, :type=>"CreativeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :FileError=>{:fields=>[{:name=>:reason, :type=>"FileError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InvalidEmailError=>{:fields=>[{:name=>:reason, :type=>"InvalidEmailError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InvalidUrlError=>{:fields=>[{:name=>:reason, :type=>"InvalidUrlError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InventoryTargetingError=>{:fields=>[{:name=>:reason, :type=>"InventoryTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InventoryUnitError=>{:fields=>[{:name=>:reason, :type=>"InventoryUnitError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItemFlightDateError=>{:fields=>[{:name=>:reason, :type=>"LineItemFlightDateError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItemOperationError=>{:fields=>[{:name=>:reason, :type=>"LineItemOperationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :OrderActionError=>{:fields=>[{:name=>:reason, :type=>"OrderActionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :OrderError=>{:fields=>[{:name=>:reason, :type=>"OrderError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ParseError=>{:fields=>[{:name=>:reason, :type=>"ParseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RegExError=>{:fields=>[{:name=>:reason, :type=>"RegExError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredCollectionError=>{:fields=>[{:name=>:reason, :type=>"RequiredCollectionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredNumberError=>{:fields=>[{:name=>:reason, :type=>"RequiredNumberError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredSizeError=>{:fields=>[{:name=>:reason, :type=>"RequiredSizeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ReservationDetailsError=>{:fields=>[{:name=>:reason, :type=>"ReservationDetailsError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ResultSet=>{:fields=>[{:name=>:column_types, :type=>"ColumnType", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:rows, :type=>"Row", :min_occurs=>0, :max_occurs=>:unbounded}]}, :Row=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}]}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"AdUnitAfcSizeError.Reason"=>{:fields=>[]}, :"AdUnitCodeError.Reason"=>{:fields=>[]}, :"AdUnitHierarchyError.Reason"=>{:fields=>[]}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"CreativeError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"FileError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"InvalidEmailError.Reason"=>{:fields=>[]}, :"InvalidUrlError.Reason"=>{:fields=>[]}, :"InventoryTargetingError.Reason"=>{:fields=>[]}, :"InventoryUnitError.Reason"=>{:fields=>[]}, :"LineItemFlightDateError.Reason"=>{:fields=>[]}, :"LineItemOperationError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"OrderActionError.Reason"=>{:fields=>[]}, :"OrderError.Reason"=>{:fields=>[]}, :"ParseError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RangeError.Reason"=>{:fields=>[]}, :"RegExError.Reason"=>{:fields=>[]}, :"RequiredCollectionError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"RequiredNumberError.Reason"=>{:fields=>[]}, :"RequiredSizeError.Reason"=>{:fields=>[]}, :"ReservationDetailsError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}} + PUBLISHERQUERYLANGUAGESERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return PUBLISHERQUERYLANGUAGESERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return PUBLISHERQUERYLANGUAGESERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return PUBLISHERQUERYLANGUAGESERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, PublisherQueryLanguageServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/rate_card_customization_service.rb b/dfp_api/lib/dfp_api/v201311/rate_card_customization_service.rb new file mode 100644 index 000000000..a7de5b401 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/rate_card_customization_service.rb @@ -0,0 +1,58 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:52. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/rate_card_customization_service_registry' + +module DfpApi; module V201311; module RateCardCustomizationService + class RateCardCustomizationService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_rate_card_customization(*args, &block) + return execute_action('create_rate_card_customization', args, &block) + end + + def create_rate_card_customizations(*args, &block) + return execute_action('create_rate_card_customizations', args, &block) + end + + def get_rate_card_customization(*args, &block) + return execute_action('get_rate_card_customization', args, &block) + end + + def get_rate_card_customizations_by_statement(*args, &block) + return execute_action('get_rate_card_customizations_by_statement', args, &block) + end + + def perform_rate_card_customization_action(*args, &block) + return execute_action('perform_rate_card_customization_action', args, &block) + end + + def update_rate_card_customization(*args, &block) + return execute_action('update_rate_card_customization', args, &block) + end + + def update_rate_card_customizations(*args, &block) + return execute_action('update_rate_card_customizations', args, &block) + end + + private + + def get_service_registry() + return RateCardCustomizationServiceRegistry + end + + def get_module() + return DfpApi::V201311::RateCardCustomizationService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/rate_card_customization_service_registry.rb b/dfp_api/lib/dfp_api/v201311/rate_card_customization_service_registry.rb new file mode 100644 index 000000000..2c6e064d5 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/rate_card_customization_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:52. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module RateCardCustomizationService + class RateCardCustomizationServiceRegistry + RATECARDCUSTOMIZATIONSERVICE_METHODS = {:create_rate_card_customization=>{:input=>[{:name=>:rate_card_customization, :type=>"RateCardCustomization", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_rate_card_customization_response", :fields=>[{:name=>:rval, :type=>"RateCardCustomization", :min_occurs=>0, :max_occurs=>1}]}}, :create_rate_card_customizations=>{:input=>[{:name=>:rate_card_customizations, :type=>"RateCardCustomization", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_rate_card_customizations_response", :fields=>[{:name=>:rval, :type=>"RateCardCustomization", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_rate_card_customization=>{:input=>[{:name=>:rate_card_customization_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_rate_card_customization_response", :fields=>[{:name=>:rval, :type=>"RateCardCustomization", :min_occurs=>0, :max_occurs=>1}]}}, :get_rate_card_customizations_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_rate_card_customizations_by_statement_response", :fields=>[{:name=>:rval, :type=>"RateCardCustomizationPage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_rate_card_customization_action=>{:input=>[{:name=>:rate_card_customization_action, :type=>"RateCardCustomizationAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_rate_card_customization_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_rate_card_customization=>{:input=>[{:name=>:rate_card_customization, :type=>"RateCardCustomization", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_rate_card_customization_response", :fields=>[{:name=>:rval, :type=>"RateCardCustomization", :min_occurs=>0, :max_occurs=>1}]}}, :update_rate_card_customizations=>{:input=>[{:name=>:rate_card_customizations, :type=>"RateCardCustomization", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_rate_card_customizations_response", :fields=>[{:name=>:rval, :type=>"RateCardCustomization", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + RATECARDCUSTOMIZATIONSERVICE_TYPES = {:ActivateRateCardCustomizations=>{:fields=>[], :base=>"RateCardCustomizationAction"}, :AdUnitRateCardFeature=>{:fields=>[], :base=>"RateCardFeature"}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BandwidthRateCardFeature=>{:fields=>[], :base=>"RateCardFeature"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :BrowserRateCardFeature=>{:fields=>[], :base=>"RateCardFeature"}, :BrowserLanguageRateCardFeature=>{:fields=>[], :base=>"RateCardFeature"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomTargetingRateCardFeature=>{:fields=>[{:name=>:custom_targeting_key_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:custom_targeting_value_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"RateCardFeature"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DeactivateRateCardCustomizations=>{:fields=>[], :base=>"RateCardCustomizationAction"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :FrequencyCapRateCardFeature=>{:fields=>[], :base=>"RateCardFeature"}, :GeographyRateCardFeature=>{:fields=>[], :base=>"RateCardFeature"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :OperatingSystemRateCardFeature=>{:fields=>[], :base=>"RateCardFeature"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PlacementRateCardFeature=>{:fields=>[], :base=>"RateCardFeature"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RateCardCustomizationAction=>{:fields=>[{:name=>:rate_card_customization_action_type, :original_name=>"RateCardCustomizationAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :RateCardCustomization=>{:fields=>[{:name=>:rate_card_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"RateCardCustomizationStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:rate_card_feature, :type=>"RateCardFeature", :min_occurs=>0, :max_occurs=>1}, {:name=>:adjustment_type, :type=>"RateCardCustomizationAdjustmentType", :min_occurs=>0, :max_occurs=>1}, {:name=>:adjustment_size, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:rate_type, :type=>"RateType", :min_occurs=>0, :max_occurs=>1}]}, :RateCardCustomizationError=>{:fields=>[{:name=>:reason, :type=>"RateCardCustomizationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RateCardCustomizationPage=>{:fields=>[{:name=>:results, :type=>"RateCardCustomization", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :RateCardFeature=>{:fields=>[{:name=>:rate_card_feature_type, :original_name=>"RateCardFeature.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :UnknownRateCardFeature=>{:fields=>[], :base=>"RateCardFeature"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :UserDomainRateCardFeature=>{:fields=>[], :base=>"RateCardFeature"}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :RateCardCustomizationAdjustmentType=>{:fields=>[]}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RangeError.Reason"=>{:fields=>[]}, :"RateCardCustomizationError.Reason"=>{:fields=>[]}, :RateCardCustomizationStatus=>{:fields=>[]}, :RateType=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}} + RATECARDCUSTOMIZATIONSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return RATECARDCUSTOMIZATIONSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return RATECARDCUSTOMIZATIONSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return RATECARDCUSTOMIZATIONSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, RateCardCustomizationServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/rate_card_service.rb b/dfp_api/lib/dfp_api/v201311/rate_card_service.rb new file mode 100644 index 000000000..deb78662d --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/rate_card_service.rb @@ -0,0 +1,58 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:54. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/rate_card_service_registry' + +module DfpApi; module V201311; module RateCardService + class RateCardService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_rate_card(*args, &block) + return execute_action('create_rate_card', args, &block) + end + + def create_rate_cards(*args, &block) + return execute_action('create_rate_cards', args, &block) + end + + def get_rate_card(*args, &block) + return execute_action('get_rate_card', args, &block) + end + + def get_rate_cards_by_statement(*args, &block) + return execute_action('get_rate_cards_by_statement', args, &block) + end + + def perform_rate_card_action(*args, &block) + return execute_action('perform_rate_card_action', args, &block) + end + + def update_rate_card(*args, &block) + return execute_action('update_rate_card', args, &block) + end + + def update_rate_cards(*args, &block) + return execute_action('update_rate_cards', args, &block) + end + + private + + def get_service_registry() + return RateCardServiceRegistry + end + + def get_module() + return DfpApi::V201311::RateCardService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/rate_card_service_registry.rb b/dfp_api/lib/dfp_api/v201311/rate_card_service_registry.rb new file mode 100644 index 000000000..8f0c19edb --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/rate_card_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:54. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module RateCardService + class RateCardServiceRegistry + RATECARDSERVICE_METHODS = {:create_rate_card=>{:input=>[{:name=>:rate_card, :type=>"RateCard", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_rate_card_response", :fields=>[{:name=>:rval, :type=>"RateCard", :min_occurs=>0, :max_occurs=>1}]}}, :create_rate_cards=>{:input=>[{:name=>:rate_cards, :type=>"RateCard", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_rate_cards_response", :fields=>[{:name=>:rval, :type=>"RateCard", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_rate_card=>{:input=>[{:name=>:rate_card_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_rate_card_response", :fields=>[{:name=>:rval, :type=>"RateCard", :min_occurs=>0, :max_occurs=>1}]}}, :get_rate_cards_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_rate_cards_by_statement_response", :fields=>[{:name=>:rval, :type=>"RateCardPage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_rate_card_action=>{:input=>[{:name=>:rate_card_action, :type=>"RateCardAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_rate_card_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_rate_card=>{:input=>[{:name=>:rate_card, :type=>"RateCard", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_rate_card_response", :fields=>[{:name=>:rval, :type=>"RateCard", :min_occurs=>0, :max_occurs=>1}]}}, :update_rate_cards=>{:input=>[{:name=>:rate_cards, :type=>"RateCard", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_rate_cards_response", :fields=>[{:name=>:rval, :type=>"RateCard", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + RATECARDSERVICE_TYPES = {:ActivateRateCards=>{:fields=>[], :base=>"RateCardAction"}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BaseRateError=>{:fields=>[{:name=>:reason, :type=>"BaseRateError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomTargetingError=>{:fields=>[{:name=>:reason, :type=>"CustomTargetingError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DeactivateRateCards=>{:fields=>[], :base=>"RateCardAction"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :ParseError=>{:fields=>[{:name=>:reason, :type=>"ParseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ProductError=>{:fields=>[{:name=>:reason, :type=>"ProductError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RateCardAction=>{:fields=>[{:name=>:rate_card_action_type, :original_name=>"RateCardAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :RateCardActionError=>{:fields=>[{:name=>:reason, :type=>"RateCardActionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RateCard=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:currency_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"RateCardStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:applied_team_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:last_modified_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}]}, :RateCardPage=>{:fields=>[{:name=>:results, :type=>"RateCard", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :RequiredCollectionError=>{:fields=>[{:name=>:reason, :type=>"RequiredCollectionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredNumberError=>{:fields=>[{:name=>:reason, :type=>"RequiredNumberError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TeamError=>{:fields=>[{:name=>:reason, :type=>"TeamError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"BaseRateError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"CustomTargetingError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"ParseError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"ProductError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RangeError.Reason"=>{:fields=>[]}, :"RateCardActionError.Reason"=>{:fields=>[]}, :"RequiredCollectionError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"RequiredNumberError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :RateCardStatus=>{:fields=>[]}, :"StringLengthError.Reason"=>{:fields=>[]}, :"TeamError.Reason"=>{:fields=>[]}} + RATECARDSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return RATECARDSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return RATECARDSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return RATECARDSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, RateCardServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/reconciliation_order_report_service.rb b/dfp_api/lib/dfp_api/v201311/reconciliation_order_report_service.rb new file mode 100644 index 000000000..a3dc156ce --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/reconciliation_order_report_service.rb @@ -0,0 +1,42 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:56. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/reconciliation_order_report_service_registry' + +module DfpApi; module V201311; module ReconciliationOrderReportService + class ReconciliationOrderReportService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def get_reconciliation_order_report(*args, &block) + return execute_action('get_reconciliation_order_report', args, &block) + end + + def get_reconciliation_order_reports_by_statement(*args, &block) + return execute_action('get_reconciliation_order_reports_by_statement', args, &block) + end + + def perform_reconciliation_order_report_action(*args, &block) + return execute_action('perform_reconciliation_order_report_action', args, &block) + end + + private + + def get_service_registry() + return ReconciliationOrderReportServiceRegistry + end + + def get_module() + return DfpApi::V201311::ReconciliationOrderReportService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/reconciliation_order_report_service_registry.rb b/dfp_api/lib/dfp_api/v201311/reconciliation_order_report_service_registry.rb new file mode 100644 index 000000000..0a294eab9 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/reconciliation_order_report_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:56. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module ReconciliationOrderReportService + class ReconciliationOrderReportServiceRegistry + RECONCILIATIONORDERREPORTSERVICE_METHODS = {:get_reconciliation_order_report=>{:input=>[{:name=>:reconciliation_order_report_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_reconciliation_order_report_response", :fields=>[{:name=>:rval, :type=>"ReconciliationOrderReport", :min_occurs=>0, :max_occurs=>1}]}}, :get_reconciliation_order_reports_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_reconciliation_order_reports_by_statement_response", :fields=>[{:name=>:rval, :type=>"ReconciliationOrderReportPage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_reconciliation_order_report_action=>{:input=>[{:name=>:reconciliation_order_report_action, :type=>"ReconciliationOrderReportAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_reconciliation_order_report_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}} + RECONCILIATIONORDERREPORTSERVICE_TYPES = {:ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :ReconciliationOrderReportAction=>{:fields=>[{:name=>:reconciliation_order_report_action_type, :original_name=>"ReconciliationOrderReportAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ReconciliationOrderReport=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:reconciliation_report_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:order_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"ReconciliationOrderReportStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:submission_date_time, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}, {:name=>:submitter_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :ReconciliationOrderReportPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"ReconciliationOrderReport", :min_occurs=>0, :max_occurs=>:unbounded}]}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SubmitReconciliationOrderReports=>{:fields=>[], :base=>"ReconciliationOrderReportAction"}, :ReconciliationError=>{:fields=>[{:name=>:reason, :type=>"ReconciliationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RevertReconciliationOrderReports=>{:fields=>[], :base=>"ReconciliationOrderReportAction"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RangeError.Reason"=>{:fields=>[]}, :"ReconciliationError.Reason"=>{:fields=>[]}, :ReconciliationOrderReportStatus=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}} + RECONCILIATIONORDERREPORTSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return RECONCILIATIONORDERREPORTSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return RECONCILIATIONORDERREPORTSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return RECONCILIATIONORDERREPORTSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, ReconciliationOrderReportServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/reconciliation_report_row_service.rb b/dfp_api/lib/dfp_api/v201311/reconciliation_report_row_service.rb new file mode 100644 index 000000000..bdaf8df18 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/reconciliation_report_row_service.rb @@ -0,0 +1,38 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:57. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/reconciliation_report_row_service_registry' + +module DfpApi; module V201311; module ReconciliationReportRowService + class ReconciliationReportRowService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def get_reconciliation_report_rows_by_statement(*args, &block) + return execute_action('get_reconciliation_report_rows_by_statement', args, &block) + end + + def update_reconciliation_report_rows(*args, &block) + return execute_action('update_reconciliation_report_rows', args, &block) + end + + private + + def get_service_registry() + return ReconciliationReportRowServiceRegistry + end + + def get_module() + return DfpApi::V201311::ReconciliationReportRowService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/reconciliation_report_row_service_registry.rb b/dfp_api/lib/dfp_api/v201311/reconciliation_report_row_service_registry.rb new file mode 100644 index 000000000..89d859a71 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/reconciliation_report_row_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:57. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module ReconciliationReportRowService + class ReconciliationReportRowServiceRegistry + RECONCILIATIONREPORTROWSERVICE_METHODS = {:get_reconciliation_report_rows_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_reconciliation_report_rows_by_statement_response", :fields=>[{:name=>:rval, :type=>"ReconciliationReportRowPage", :min_occurs=>0, :max_occurs=>1}]}}, :update_reconciliation_report_rows=>{:input=>[{:name=>:reconciliation_report_rows, :type=>"ReconciliationReportRow", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_reconciliation_report_rows_response", :fields=>[{:name=>:rval, :type=>"ReconciliationReportRow", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + RECONCILIATIONREPORTROWSERVICE_TYPES = {:ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Money=>{:fields=>[{:name=>:currency_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:micro_amount, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ReconciliationError=>{:fields=>[{:name=>:reason, :type=>"ReconciliationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ReconciliationImportError=>{:fields=>[{:name=>:reason, :type=>"ReconciliationImportError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ReconciliationReportRow=>{:fields=>[{:name=>:reconciliation_report_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:line_item_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:creative_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:order_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:advertiser_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:bill_from, :type=>"BillFrom", :min_occurs=>0, :max_occurs=>1}, {:name=>:line_item_cost_type, :type=>"CostType", :min_occurs=>0, :max_occurs=>1}, {:name=>:line_item_cost_per_unit, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:line_item_contracted_units_bought, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:dfp_clicks, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:dfp_impressions, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:dfp_line_item_days, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:third_party_clicks, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:third_party_impressions, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:third_party_line_item_days, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:manual_clicks, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:manual_impressions, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:manual_line_item_days, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:reconciled_clicks, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:reconciled_impressions, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:reconciled_line_item_days, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:contracted_revenue, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:dfp_revenue, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:third_party_revenue, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:manual_revenue, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:reconciled_revenue, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:comments, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :ReconciliationReportRowPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"ReconciliationReportRow", :min_occurs=>0, :max_occurs=>:unbounded}]}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :BillFrom=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :CostType=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RangeError.Reason"=>{:fields=>[]}, :"ReconciliationError.Reason"=>{:fields=>[]}, :"ReconciliationImportError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}} + RECONCILIATIONREPORTROWSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return RECONCILIATIONREPORTROWSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return RECONCILIATIONREPORTROWSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return RECONCILIATIONREPORTROWSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, ReconciliationReportRowServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/reconciliation_report_service.rb b/dfp_api/lib/dfp_api/v201311/reconciliation_report_service.rb new file mode 100644 index 000000000..043d79295 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/reconciliation_report_service.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:58. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/reconciliation_report_service_registry' + +module DfpApi; module V201311; module ReconciliationReportService + class ReconciliationReportService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def get_reconciliation_report(*args, &block) + return execute_action('get_reconciliation_report', args, &block) + end + + def get_reconciliation_reports_by_statement(*args, &block) + return execute_action('get_reconciliation_reports_by_statement', args, &block) + end + + def update_reconciliation_report(*args, &block) + return execute_action('update_reconciliation_report', args, &block) + end + + def update_reconciliation_reports(*args, &block) + return execute_action('update_reconciliation_reports', args, &block) + end + + private + + def get_service_registry() + return ReconciliationReportServiceRegistry + end + + def get_module() + return DfpApi::V201311::ReconciliationReportService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/reconciliation_report_service_registry.rb b/dfp_api/lib/dfp_api/v201311/reconciliation_report_service_registry.rb new file mode 100644 index 000000000..cae07b923 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/reconciliation_report_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:58. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module ReconciliationReportService + class ReconciliationReportServiceRegistry + RECONCILIATIONREPORTSERVICE_METHODS = {:get_reconciliation_report=>{:input=>[{:name=>:reconciliation_report_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_reconciliation_report_response", :fields=>[{:name=>:rval, :type=>"ReconciliationReport", :min_occurs=>0, :max_occurs=>1}]}}, :get_reconciliation_reports_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_reconciliation_reports_by_statement_response", :fields=>[{:name=>:rval, :type=>"ReconciliationReportPage", :min_occurs=>0, :max_occurs=>1}]}}, :update_reconciliation_report=>{:input=>[{:name=>:reconciliation_report, :type=>"ReconciliationReport", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_reconciliation_report_response", :fields=>[{:name=>:rval, :type=>"ReconciliationReport", :min_occurs=>0, :max_occurs=>1}]}}, :update_reconciliation_reports=>{:input=>[{:name=>:reconciliation_reports, :type=>"ReconciliationReport", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_reconciliation_reports_response", :fields=>[{:name=>:rval, :type=>"ReconciliationReport", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + RECONCILIATIONREPORTSERVICE_TYPES = {:ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ReconciliationError=>{:fields=>[{:name=>:reason, :type=>"ReconciliationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ReconciliationImportError=>{:fields=>[{:name=>:reason, :type=>"ReconciliationImportError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ReconciliationReport=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"ReconciliationReportStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:notes, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :ReconciliationReportPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"ReconciliationReport", :min_occurs=>0, :max_occurs=>:unbounded}]}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RangeError.Reason"=>{:fields=>[]}, :"ReconciliationError.Reason"=>{:fields=>[]}, :"ReconciliationImportError.Reason"=>{:fields=>[]}, :ReconciliationReportStatus=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}} + RECONCILIATIONREPORTSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return RECONCILIATIONREPORTSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return RECONCILIATIONREPORTSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return RECONCILIATIONREPORTSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, ReconciliationReportServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/report_service.rb b/dfp_api/lib/dfp_api/v201311/report_service.rb new file mode 100644 index 000000000..ead13e798 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/report_service.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:59. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/report_service_registry' + +module DfpApi; module V201311; module ReportService + class ReportService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def get_report_download_url(*args, &block) + return execute_action('get_report_download_url', args, &block) + end + + def get_report_download_url_with_options(*args, &block) + return execute_action('get_report_download_url_with_options', args, &block) + end + + def get_report_job(*args, &block) + return execute_action('get_report_job', args, &block) + end + + def run_report_job(*args, &block) + return execute_action('run_report_job', args, &block) + end + + private + + def get_service_registry() + return ReportServiceRegistry + end + + def get_module() + return DfpApi::V201311::ReportService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/report_service_registry.rb b/dfp_api/lib/dfp_api/v201311/report_service_registry.rb new file mode 100644 index 000000000..4427f02cd --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/report_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:25:59. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module ReportService + class ReportServiceRegistry + REPORTSERVICE_METHODS = {:get_report_download_url=>{:input=>[{:name=>:report_job_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:export_format, :type=>"ExportFormat", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_report_download_url_response", :fields=>[{:name=>:rval, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :original_name=>"getReportDownloadURL"}, :get_report_download_url_with_options=>{:input=>[{:name=>:report_job_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:report_download_options, :type=>"ReportDownloadOptions", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_report_download_url_with_options_response", :fields=>[{:name=>:rval, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}}, :get_report_job=>{:input=>[{:name=>:report_job_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_report_job_response", :fields=>[{:name=>:rval, :type=>"ReportJob", :min_occurs=>0, :max_occurs=>1}]}}, :run_report_job=>{:input=>[{:name=>:report_job, :type=>"ReportJob", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"run_report_job_response", :fields=>[{:name=>:rval, :type=>"ReportJob", :min_occurs=>0, :max_occurs=>1}]}}} + REPORTSERVICE_TYPES = {:ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :ParseError=>{:fields=>[{:name=>:reason, :type=>"ParseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ReportDownloadOptions=>{:fields=>[{:name=>:export_format, :type=>"ExportFormat", :min_occurs=>0, :max_occurs=>1}, {:name=>:include_report_properties, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:include_totals_row, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:use_gzip_compression, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :ReportError=>{:fields=>[{:name=>:reason, :type=>"ReportError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ReportJob=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:report_query, :type=>"ReportQuery", :min_occurs=>0, :max_occurs=>1}, {:name=>:report_job_status, :type=>"ReportJobStatus", :min_occurs=>0, :max_occurs=>1}]}, :ReportQuery=>{:fields=>[{:name=>:dimensions, :type=>"Dimension", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:ad_unit_view, :type=>"ReportQuery.AdUnitView", :min_occurs=>0, :max_occurs=>1}, {:name=>:columns, :type=>"Column", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:dimension_attributes, :type=>"DimensionAttribute", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:custom_field_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:start_date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:end_date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:date_range_type, :type=>"DateRangeType", :min_occurs=>0, :max_occurs=>1}, {:name=>:dimension_filters, :type=>"DimensionFilter", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ReportQuery.AdUnitView"=>{:fields=>[]}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :Column=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :DateRangeType=>{:fields=>[]}, :Dimension=>{:fields=>[]}, :DimensionAttribute=>{:fields=>[]}, :DimensionFilter=>{:fields=>[]}, :ExportFormat=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"ParseError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"ReportError.Reason"=>{:fields=>[]}, :ReportJobStatus=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}} + REPORTSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return REPORTSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return REPORTSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return REPORTSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, ReportServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/suggested_ad_unit_service.rb b/dfp_api/lib/dfp_api/v201311/suggested_ad_unit_service.rb new file mode 100644 index 000000000..fe4a42e2d --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/suggested_ad_unit_service.rb @@ -0,0 +1,42 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:26:02. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/suggested_ad_unit_service_registry' + +module DfpApi; module V201311; module SuggestedAdUnitService + class SuggestedAdUnitService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def get_suggested_ad_unit(*args, &block) + return execute_action('get_suggested_ad_unit', args, &block) + end + + def get_suggested_ad_units_by_statement(*args, &block) + return execute_action('get_suggested_ad_units_by_statement', args, &block) + end + + def perform_suggested_ad_unit_action(*args, &block) + return execute_action('perform_suggested_ad_unit_action', args, &block) + end + + private + + def get_service_registry() + return SuggestedAdUnitServiceRegistry + end + + def get_module() + return DfpApi::V201311::SuggestedAdUnitService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/suggested_ad_unit_service_registry.rb b/dfp_api/lib/dfp_api/v201311/suggested_ad_unit_service_registry.rb new file mode 100644 index 000000000..6293a1290 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/suggested_ad_unit_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:26:02. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module SuggestedAdUnitService + class SuggestedAdUnitServiceRegistry + SUGGESTEDADUNITSERVICE_METHODS = {:get_suggested_ad_unit=>{:input=>[{:name=>:suggested_ad_unit_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_suggested_ad_unit_response", :fields=>[{:name=>:rval, :type=>"SuggestedAdUnit", :min_occurs=>0, :max_occurs=>1}]}}, :get_suggested_ad_units_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_suggested_ad_units_by_statement_response", :fields=>[{:name=>:rval, :type=>"SuggestedAdUnitPage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_suggested_ad_unit_action=>{:input=>[{:name=>:suggested_ad_unit_action, :type=>"SuggestedAdUnitAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_suggested_ad_unit_action_response", :fields=>[{:name=>:rval, :type=>"SuggestedAdUnitUpdateResult", :min_occurs=>0, :max_occurs=>1}]}}} + SUGGESTEDADUNITSERVICE_TYPES = {:AdUnitParent=>{:fields=>[{:name=>:id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:ad_unit_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :ApproveSuggestedAdUnit=>{:fields=>[], :base=>"SuggestedAdUnitAction"}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :AdUnitSize=>{:fields=>[{:name=>:size, :type=>"Size", :min_occurs=>0, :max_occurs=>1}, {:name=>:environment_type, :type=>"EnvironmentType", :min_occurs=>0, :max_occurs=>1}, {:name=>:companions, :type=>"AdUnitSize", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:full_display_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :LabelEntityAssociationError=>{:fields=>[{:name=>:reason, :type=>"LabelEntityAssociationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :ParseError=>{:fields=>[{:name=>:reason, :type=>"ParseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :Size=>{:fields=>[{:name=>:width, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:height, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_aspect_ratio, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :SuggestedAdUnitAction=>{:fields=>[{:name=>:suggested_ad_unit_action_type, :original_name=>"SuggestedAdUnitAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :SuggestedAdUnit=>{:fields=>[{:name=>:id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:num_requests, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:path, :type=>"string", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:parent_path, :type=>"AdUnitParent", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:target_window, :type=>"AdUnit.TargetWindow", :min_occurs=>0, :max_occurs=>1}, {:name=>:target_platform, :type=>"TargetPlatform", :min_occurs=>0, :max_occurs=>1}, {:name=>:suggested_ad_unit_sizes, :type=>"AdUnitSize", :min_occurs=>0, :max_occurs=>:unbounded}]}, :SuggestedAdUnitPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"SuggestedAdUnit", :min_occurs=>0, :max_occurs=>:unbounded}]}, :SuggestedAdUnitUpdateResult=>{:fields=>[{:name=>:new_ad_unit_ids, :type=>"string", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"AdUnit.TargetWindow"=>{:fields=>[]}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :EnvironmentType=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"LabelEntityAssociationError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"ParseError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :TargetPlatform=>{:fields=>[]}} + SUGGESTEDADUNITSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return SUGGESTEDADUNITSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return SUGGESTEDADUNITSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return SUGGESTEDADUNITSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, SuggestedAdUnitServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/team_service.rb b/dfp_api/lib/dfp_api/v201311/team_service.rb new file mode 100644 index 000000000..a575492e1 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/team_service.rb @@ -0,0 +1,54 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:26:03. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/team_service_registry' + +module DfpApi; module V201311; module TeamService + class TeamService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_team(*args, &block) + return execute_action('create_team', args, &block) + end + + def create_teams(*args, &block) + return execute_action('create_teams', args, &block) + end + + def get_team(*args, &block) + return execute_action('get_team', args, &block) + end + + def get_teams_by_statement(*args, &block) + return execute_action('get_teams_by_statement', args, &block) + end + + def update_team(*args, &block) + return execute_action('update_team', args, &block) + end + + def update_teams(*args, &block) + return execute_action('update_teams', args, &block) + end + + private + + def get_service_registry() + return TeamServiceRegistry + end + + def get_module() + return DfpApi::V201311::TeamService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/team_service_registry.rb b/dfp_api/lib/dfp_api/v201311/team_service_registry.rb new file mode 100644 index 000000000..98db268f6 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/team_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:26:03. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module TeamService + class TeamServiceRegistry + TEAMSERVICE_METHODS = {:create_team=>{:input=>[{:name=>:team, :type=>"Team", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_team_response", :fields=>[{:name=>:rval, :type=>"Team", :min_occurs=>0, :max_occurs=>1}]}}, :create_teams=>{:input=>[{:name=>:teams, :type=>"Team", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_teams_response", :fields=>[{:name=>:rval, :type=>"Team", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_team=>{:input=>[{:name=>:team_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_team_response", :fields=>[{:name=>:rval, :type=>"Team", :min_occurs=>0, :max_occurs=>1}]}}, :get_teams_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_teams_by_statement_response", :fields=>[{:name=>:rval, :type=>"TeamPage", :min_occurs=>0, :max_occurs=>1}]}}, :update_team=>{:input=>[{:name=>:team, :type=>"Team", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_team_response", :fields=>[{:name=>:rval, :type=>"Team", :min_occurs=>0, :max_occurs=>1}]}}, :update_teams=>{:input=>[{:name=>:teams, :type=>"Team", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_teams_response", :fields=>[{:name=>:rval, :type=>"Team", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + TEAMSERVICE_TYPES = {:ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :Team=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:description, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:has_all_companies, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:has_all_inventory, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:team_access_type, :type=>"TeamAccessType", :min_occurs=>0, :max_occurs=>1}, {:name=>:company_ids, :type=>"long", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:ad_unit_ids, :type=>"string", :min_occurs=>0, :max_occurs=>:unbounded}]}, :TeamError=>{:fields=>[{:name=>:reason, :type=>"TeamError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :TeamPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"Team", :min_occurs=>0, :max_occurs=>:unbounded}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :TeamAccessType=>{:fields=>[]}, :"TeamError.Reason"=>{:fields=>[]}} + TEAMSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return TEAMSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return TEAMSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return TEAMSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, TeamServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/user_service.rb b/dfp_api/lib/dfp_api/v201311/user_service.rb new file mode 100644 index 000000000..2162e8b68 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/user_service.rb @@ -0,0 +1,66 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:26:05. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/user_service_registry' + +module DfpApi; module V201311; module UserService + class UserService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_user(*args, &block) + return execute_action('create_user', args, &block) + end + + def create_users(*args, &block) + return execute_action('create_users', args, &block) + end + + def get_all_roles(*args, &block) + return execute_action('get_all_roles', args, &block) + end + + def get_current_user(*args, &block) + return execute_action('get_current_user', args, &block) + end + + def get_user(*args, &block) + return execute_action('get_user', args, &block) + end + + def get_users_by_statement(*args, &block) + return execute_action('get_users_by_statement', args, &block) + end + + def perform_user_action(*args, &block) + return execute_action('perform_user_action', args, &block) + end + + def update_user(*args, &block) + return execute_action('update_user', args, &block) + end + + def update_users(*args, &block) + return execute_action('update_users', args, &block) + end + + private + + def get_service_registry() + return UserServiceRegistry + end + + def get_module() + return DfpApi::V201311::UserService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/user_service_registry.rb b/dfp_api/lib/dfp_api/v201311/user_service_registry.rb new file mode 100644 index 000000000..d1873131a --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/user_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:26:05. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module UserService + class UserServiceRegistry + USERSERVICE_METHODS = {:create_user=>{:input=>[{:name=>:user, :type=>"User", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_user_response", :fields=>[{:name=>:rval, :type=>"User", :min_occurs=>0, :max_occurs=>1}]}}, :create_users=>{:input=>[{:name=>:users, :type=>"User", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_users_response", :fields=>[{:name=>:rval, :type=>"User", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_all_roles=>{:input=>[], :output=>{:name=>"get_all_roles_response", :fields=>[{:name=>:rval, :type=>"Role", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_current_user=>{:input=>[], :output=>{:name=>"get_current_user_response", :fields=>[{:name=>:rval, :type=>"User", :min_occurs=>0, :max_occurs=>1}]}}, :get_user=>{:input=>[{:name=>:user_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_user_response", :fields=>[{:name=>:rval, :type=>"User", :min_occurs=>0, :max_occurs=>1}]}}, :get_users_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_users_by_statement_response", :fields=>[{:name=>:rval, :type=>"UserPage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_user_action=>{:input=>[{:name=>:user_action, :type=>"UserAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_user_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_user=>{:input=>[{:name=>:user, :type=>"User", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_user_response", :fields=>[{:name=>:rval, :type=>"User", :min_occurs=>0, :max_occurs=>1}]}}, :update_users=>{:input=>[{:name=>:users, :type=>"User", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_users_response", :fields=>[{:name=>:rval, :type=>"User", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + USERSERVICE_TYPES = {:ActivateUsers=>{:fields=>[], :base=>"UserAction"}, :ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BaseCustomFieldValue=>{:fields=>[{:name=>:custom_field_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:base_custom_field_value_type, :original_name=>"BaseCustomFieldValue.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :CustomFieldValue=>{:fields=>[{:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCustomFieldValue"}, :CustomFieldValueError=>{:fields=>[{:name=>:reason, :type=>"CustomFieldValueError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DeactivateUsers=>{:fields=>[], :base=>"UserAction"}, :DropDownCustomFieldValue=>{:fields=>[{:name=>:custom_field_option_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"BaseCustomFieldValue"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InvalidEmailError=>{:fields=>[{:name=>:reason, :type=>"InvalidEmailError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :ParseError=>{:fields=>[{:name=>:reason, :type=>"ParseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Role=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:description, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TeamError=>{:fields=>[{:name=>:reason, :type=>"TeamError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :TypeError=>{:fields=>[], :base=>"ApiError"}, :UniqueError=>{:fields=>[], :base=>"ApiError"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :UserAction=>{:fields=>[{:name=>:user_action_type, :original_name=>"UserAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :User=>{:fields=>[{:name=>:is_active, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_email_notification_allowed, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:external_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:orders_ui_local_time_zone_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:custom_field_values, :type=>"BaseCustomFieldValue", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"UserRecord"}, :UserPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"User", :min_occurs=>0, :max_occurs=>:unbounded}]}, :UserRecord=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:email, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:role_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:role_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:preferred_locale, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:user_record_type, :original_name=>"UserRecord.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"CustomFieldValueError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"InvalidEmailError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"ParseError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"RequiredError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :"TeamError.Reason"=>{:fields=>[]}} + USERSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return USERSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return USERSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return USERSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, UserServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/user_team_association_service.rb b/dfp_api/lib/dfp_api/v201311/user_team_association_service.rb new file mode 100644 index 000000000..7e7984951 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/user_team_association_service.rb @@ -0,0 +1,58 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:26:06. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/user_team_association_service_registry' + +module DfpApi; module V201311; module UserTeamAssociationService + class UserTeamAssociationService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def create_user_team_association(*args, &block) + return execute_action('create_user_team_association', args, &block) + end + + def create_user_team_associations(*args, &block) + return execute_action('create_user_team_associations', args, &block) + end + + def get_user_team_association(*args, &block) + return execute_action('get_user_team_association', args, &block) + end + + def get_user_team_associations_by_statement(*args, &block) + return execute_action('get_user_team_associations_by_statement', args, &block) + end + + def perform_user_team_association_action(*args, &block) + return execute_action('perform_user_team_association_action', args, &block) + end + + def update_user_team_association(*args, &block) + return execute_action('update_user_team_association', args, &block) + end + + def update_user_team_associations(*args, &block) + return execute_action('update_user_team_associations', args, &block) + end + + private + + def get_service_registry() + return UserTeamAssociationServiceRegistry + end + + def get_module() + return DfpApi::V201311::UserTeamAssociationService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/user_team_association_service_registry.rb b/dfp_api/lib/dfp_api/v201311/user_team_association_service_registry.rb new file mode 100644 index 000000000..200d32514 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/user_team_association_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:26:06. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module UserTeamAssociationService + class UserTeamAssociationServiceRegistry + USERTEAMASSOCIATIONSERVICE_METHODS = {:create_user_team_association=>{:input=>[{:name=>:user_team_association, :type=>"UserTeamAssociation", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"create_user_team_association_response", :fields=>[{:name=>:rval, :type=>"UserTeamAssociation", :min_occurs=>0, :max_occurs=>1}]}}, :create_user_team_associations=>{:input=>[{:name=>:user_team_associations, :type=>"UserTeamAssociation", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"create_user_team_associations_response", :fields=>[{:name=>:rval, :type=>"UserTeamAssociation", :min_occurs=>0, :max_occurs=>:unbounded}]}}, :get_user_team_association=>{:input=>[{:name=>:team_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:user_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_user_team_association_response", :fields=>[{:name=>:rval, :type=>"UserTeamAssociation", :min_occurs=>0, :max_occurs=>1}]}}, :get_user_team_associations_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_user_team_associations_by_statement_response", :fields=>[{:name=>:rval, :type=>"UserTeamAssociationPage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_user_team_association_action=>{:input=>[{:name=>:user_team_association_action, :type=>"UserTeamAssociationAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_user_team_association_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}, :update_user_team_association=>{:input=>[{:name=>:user_team_association, :type=>"UserTeamAssociation", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"update_user_team_association_response", :fields=>[{:name=>:rval, :type=>"UserTeamAssociation", :min_occurs=>0, :max_occurs=>1}]}}, :update_user_team_associations=>{:input=>[{:name=>:user_team_associations, :type=>"UserTeamAssociation", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"update_user_team_associations_response", :fields=>[{:name=>:rval, :type=>"UserTeamAssociation", :min_occurs=>0, :max_occurs=>:unbounded}]}}} + USERTEAMASSOCIATIONSERVICE_TYPES = {:ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DeleteUserTeamAssociations=>{:fields=>[], :base=>"UserTeamAssociationAction"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :UserRecordTeamAssociation=>{:fields=>[{:name=>:team_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:overridden_team_access_type, :type=>"TeamAccessType", :min_occurs=>0, :max_occurs=>1}, {:name=>:default_team_access_type, :type=>"TeamAccessType", :min_occurs=>0, :max_occurs=>1}, {:name=>:user_record_team_association_type, :original_name=>"UserRecordTeamAssociation.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :UserTeamAssociationAction=>{:fields=>[{:name=>:user_team_association_action_type, :original_name=>"UserTeamAssociationAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :UserTeamAssociation=>{:fields=>[{:name=>:user_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"UserRecordTeamAssociation"}, :UserTeamAssociationPage=>{:fields=>[{:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:results, :type=>"UserTeamAssociation", :min_occurs=>0, :max_occurs=>:unbounded}]}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"NullError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :TeamAccessType=>{:fields=>[]}} + USERTEAMASSOCIATIONSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return USERTEAMASSOCIATIONSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return USERTEAMASSOCIATIONSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return USERTEAMASSOCIATIONSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, UserTeamAssociationServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/workflow_request_service.rb b/dfp_api/lib/dfp_api/v201311/workflow_request_service.rb new file mode 100644 index 000000000..5b90fe91e --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/workflow_request_service.rb @@ -0,0 +1,38 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:26:08. + +require 'ads_common/savon_service' +require 'dfp_api/v201311/workflow_request_service_registry' + +module DfpApi; module V201311; module WorkflowRequestService + class WorkflowRequestService < AdsCommon::SavonService + def initialize(config, endpoint) + namespace = 'https://www.google.com/apis/ads/publisher/v201311' + super(config, endpoint, namespace, :v201311) + end + + def get_workflow_requests_by_statement(*args, &block) + return execute_action('get_workflow_requests_by_statement', args, &block) + end + + def perform_workflow_request_action(*args, &block) + return execute_action('perform_workflow_request_action', args, &block) + end + + private + + def get_service_registry() + return WorkflowRequestServiceRegistry + end + + def get_module() + return DfpApi::V201311::WorkflowRequestService + end + end +end; end; end diff --git a/dfp_api/lib/dfp_api/v201311/workflow_request_service_registry.rb b/dfp_api/lib/dfp_api/v201311/workflow_request_service_registry.rb new file mode 100644 index 000000000..8439b8130 --- /dev/null +++ b/dfp_api/lib/dfp_api/v201311/workflow_request_service_registry.rb @@ -0,0 +1,46 @@ +# Encoding: utf-8 +# +# This is auto-generated code, changes will be overwritten. +# +# Copyright:: Copyright 2013, Google Inc. All Rights Reserved. +# License:: Licensed under the Apache License, Version 2.0. +# +# Code generated by AdsCommon library 0.9.5 on 2013-11-25 14:26:08. + +require 'dfp_api/errors' + +module DfpApi; module V201311; module WorkflowRequestService + class WorkflowRequestServiceRegistry + WORKFLOWREQUESTSERVICE_METHODS = {:get_workflow_requests_by_statement=>{:input=>[{:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_workflow_requests_by_statement_response", :fields=>[{:name=>:rval, :type=>"WorkflowRequestPage", :min_occurs=>0, :max_occurs=>1}]}}, :perform_workflow_request_action=>{:input=>[{:name=>:action, :type=>"WorkflowRequestAction", :min_occurs=>0, :max_occurs=>1}, {:name=>:filter_statement, :type=>"Statement", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"perform_workflow_request_action_response", :fields=>[{:name=>:rval, :type=>"UpdateResult", :min_occurs=>0, :max_occurs=>1}]}}} + WORKFLOWREQUESTSERVICE_TYPES = {:ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:trigger, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:error_string, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:api_error_type, :original_name=>"ApiError.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException"}, :ApiVersionError=>{:fields=>[{:name=>:reason, :type=>"ApiVersionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ApplicationException=>{:fields=>[{:name=>:message, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_exception_type, :original_name=>"ApplicationException.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :ApproveWorkflowApprovalRequests=>{:fields=>[], :base=>"WorkflowRequestAction"}, :Authentication=>{:fields=>[{:name=>:authentication_type, :original_name=>"Authentication.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :WorkflowRequest=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:workflow_rule_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:entity_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:entity_type, :type=>"WorkflowEntityType", :min_occurs=>0, :max_occurs=>1}, {:name=>:workflow_request_type, :original_name=>"WorkflowRequest.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :BooleanValue=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :ClientLogin=>{:fields=>[{:name=>:token, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :CommonError=>{:fields=>[{:name=>:reason, :type=>"CommonError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :Date=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:day, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :DateTime=>{:fields=>[{:name=>:date, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:hour, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:minute, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:second, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:time_zone_id, :original_name=>"timeZoneID", :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :DateTimeValue=>{:fields=>[{:name=>:value, :type=>"DateTime", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :DateValue=>{:fields=>[{:name=>:value, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :FeatureError=>{:fields=>[{:name=>:reason, :type=>"FeatureError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :ForecastError=>{:fields=>[{:name=>:reason, :type=>"ForecastError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :LineItemOperationError=>{:fields=>[{:name=>:reason, :type=>"LineItemOperationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NotNullError=>{:fields=>[{:name=>:reason, :type=>"NotNullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :NumberValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :OAuth=>{:fields=>[{:name=>:parameters, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Authentication"}, :PermissionError=>{:fields=>[{:name=>:reason, :type=>"PermissionError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageContextError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageContextError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :PublisherQueryLanguageSyntaxError=>{:fields=>[{:name=>:reason, :type=>"PublisherQueryLanguageSyntaxError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :QuotaError=>{:fields=>[{:name=>:reason, :type=>"QuotaError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :RejectWorkflowApprovalRequests=>{:fields=>[], :base=>"WorkflowRequestAction"}, :ServerError=>{:fields=>[{:name=>:reason, :type=>"ServerError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :SetValue=>{:fields=>[{:name=>:values, :type=>"Value", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Value"}, :SoapRequestHeader=>{:fields=>[{:name=>:network_code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:application_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:authentication, :type=>"Authentication", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :Statement=>{:fields=>[{:name=>:query, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"String_ValueMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :StatementError=>{:fields=>[{:name=>:reason, :type=>"StatementError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :String_ValueMapEntry=>{:fields=>[{:name=>:key, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Value", :min_occurs=>0, :max_occurs=>1}]}, :TextValue=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Value"}, :UpdateResult=>{:fields=>[{:name=>:num_changes, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :Value=>{:fields=>[{:name=>:value_type, :original_name=>"Value.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :WorkflowApprovalRequest=>{:fields=>[{:name=>:status, :type=>"WorkflowApprovalRequestStatus", :min_occurs=>0, :max_occurs=>1}], :base=>"WorkflowRequest"}, :WorkflowRequestAction=>{:fields=>[{:name=>:workflow_request_action_type, :original_name=>"WorkflowRequestAction.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :WorkflowRequestPage=>{:fields=>[{:name=>:results, :type=>"WorkflowRequest", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:total_result_set_size, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :"ApiVersionError.Reason"=>{:fields=>[]}, :WorkflowApprovalRequestStatus=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.Reason"=>{:fields=>[]}, :"FeatureError.Reason"=>{:fields=>[]}, :"ForecastError.Reason"=>{:fields=>[]}, :"InternalApiError.Reason"=>{:fields=>[]}, :"LineItemOperationError.Reason"=>{:fields=>[]}, :"NotNullError.Reason"=>{:fields=>[]}, :"PermissionError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageContextError.Reason"=>{:fields=>[]}, :"PublisherQueryLanguageSyntaxError.Reason"=>{:fields=>[]}, :"QuotaError.Reason"=>{:fields=>[]}, :"ServerError.Reason"=>{:fields=>[]}, :"StatementError.Reason"=>{:fields=>[]}, :WorkflowEntityType=>{:fields=>[]}} + WORKFLOWREQUESTSERVICE_NAMESPACES = [] + + def self.get_method_signature(method_name) + return WORKFLOWREQUESTSERVICE_METHODS[method_name.to_sym] + end + + def self.get_type_signature(type_name) + return WORKFLOWREQUESTSERVICE_TYPES[type_name.to_sym] + end + + def self.get_namespace(index) + return WORKFLOWREQUESTSERVICE_NAMESPACES[index] + end + end + + # Base class for exceptions. + class ApplicationException < DfpApi::Errors::ApiException + attr_reader :message # string + attr_reader :application_exception_type # string + end + + # Exception class for holding a list of service errors. + class ApiException < ApplicationException + attr_reader :errors # ApiError + def initialize(exception_fault) + @array_fields ||= [] + @array_fields << 'errors' + super(exception_fault, WorkflowRequestServiceRegistry) + end + end +end; end; end diff --git a/dfp_api/test/bugs/test_issue_00000016.rb b/dfp_api/test/bugs/test_issue_00000016.rb index d2238b4d5..f93758855 100755 --- a/dfp_api/test/bugs/test_issue_00000016.rb +++ b/dfp_api/test/bugs/test_issue_00000016.rb @@ -1,4 +1,4 @@ -#!/usr/bin/ruby +#!/usr/bin/env ruby # # Author:: api.dklimkin@gmail.com (Danial Klimkin) # @@ -24,12 +24,12 @@ require 'test/unit' require 'ads_common/results_extractor' -require 'dfp_api/v201308/line_item_service_registry' +require 'dfp_api/v201311/line_item_service_registry' class TestDfpIssue16 < Test::Unit::TestCase def setup() - @registry = DfpApi::V201308::LineItemService::LineItemServiceRegistry + @registry = DfpApi::v201311::LineItemService::LineItemServiceRegistry end def test_issue_16()