google-dfp-api 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +3 -0
- data/examples/v201302/activity_group_service/create_activity_groups.rb +94 -0
- data/examples/v201302/activity_group_service/get_active_activity_groups.rb +100 -0
- data/examples/v201302/activity_group_service/get_all_activity_groups.rb +95 -0
- data/examples/v201302/activity_group_service/update_activity_groups.rb +87 -0
- data/examples/v201302/activity_service/create_activities.rb +91 -0
- data/examples/v201302/activity_service/get_active_activities.rb +107 -0
- data/examples/v201302/activity_service/get_all_activities.rb +144 -0
- data/examples/v201302/activity_service/update_activities.rb +85 -0
- data/examples/v201302/audience_segment_service/get_all_audience_segments.rb +93 -0
- data/examples/v201302/common/error_handling.rb +76 -0
- data/examples/v201302/common/oauth2_handling.rb +128 -0
- data/examples/v201302/common/oauth2_jwt_handling.rb +107 -0
- data/examples/v201302/company_service/create_companies.rb +81 -0
- data/examples/v201302/company_service/get_all_companies.rb +92 -0
- data/examples/v201302/company_service/get_companies_by_statement.rb +88 -0
- data/examples/v201302/company_service/get_company.rb +72 -0
- data/examples/v201302/company_service/update_companies.rb +102 -0
- data/examples/v201302/contact_service/create_contacts.rb +95 -0
- data/examples/v201302/contact_service/get_all_contacts.rb +92 -0
- data/examples/v201302/contact_service/get_uninvited_contacts.rb +102 -0
- data/examples/v201302/contact_service/update_contacts.rb +84 -0
- data/examples/v201302/content_service/get_all_content.rb +94 -0
- data/examples/v201302/content_service/get_content_by_category.rb +143 -0
- data/examples/v201302/creative_service/copy_image_creatives.rb +115 -0
- data/examples/v201302/creative_service/create_creative_from_template.rb +139 -0
- data/examples/v201302/creative_service/create_creatives.rb +112 -0
- data/examples/v201302/creative_service/create_custom_creative.rb +104 -0
- data/examples/v201302/creative_service/get_all_creatives.rb +93 -0
- data/examples/v201302/creative_service/get_creative.rb +72 -0
- data/examples/v201302/creative_service/get_creatives_by_statement.rb +87 -0
- data/examples/v201302/creative_service/update_creatives.rb +96 -0
- data/examples/v201302/creative_set_service/associate_creative_set_to_line_item.rb +77 -0
- data/examples/v201302/creative_set_service/create_creative_set.rb +83 -0
- data/examples/v201302/creative_set_service/get_all_creative_sets.rb +94 -0
- data/examples/v201302/creative_set_service/get_creative_sets_by_statement.rb +90 -0
- data/examples/v201302/creative_set_service/update_creative_sets.rb +85 -0
- data/examples/v201302/creative_template_service/get_all_creative_templates.rb +94 -0
- data/examples/v201302/creative_template_service/get_creative_template.rb +74 -0
- data/examples/v201302/creative_template_service/get_creative_templates_by_statement.rb +80 -0
- data/examples/v201302/creative_wrapper_service/create_creative_wrappers.rb +89 -0
- data/examples/v201302/creative_wrapper_service/deactivate_creative_wrapper.rb +102 -0
- data/examples/v201302/creative_wrapper_service/get_all_creative_wrappers.rb +94 -0
- data/examples/v201302/creative_wrapper_service/get_creative_wrappers_by_statement.rb +88 -0
- data/examples/v201302/creative_wrapper_service/update_creative_wrappers.rb +86 -0
- data/examples/v201302/custom_field_service/create_custom_field_options.rb +87 -0
- data/examples/v201302/custom_field_service/create_custom_fields.rb +86 -0
- data/examples/v201302/custom_field_service/deactivate_all_line_item_custom_fields.rb +112 -0
- data/examples/v201302/custom_field_service/get_all_custom_fields.rb +102 -0
- data/examples/v201302/custom_field_service/get_all_line_item_custom_fields.rb +86 -0
- data/examples/v201302/custom_field_service/set_line_item_custom_field_value.rb +135 -0
- data/examples/v201302/custom_field_service/update_custom_fields.rb +84 -0
- data/examples/v201302/custom_targeting_service/create_custom_targeting_keys_and_values.rb +140 -0
- data/examples/v201302/custom_targeting_service/delete_custom_targeting_keys.rb +121 -0
- data/examples/v201302/custom_targeting_service/delete_custom_targeting_values.rb +125 -0
- data/examples/v201302/custom_targeting_service/get_all_custom_targeting_keys_and_values.rb +148 -0
- data/examples/v201302/custom_targeting_service/get_custom_targeting_keys_by_statement.rb +92 -0
- data/examples/v201302/custom_targeting_service/get_custom_targeting_values_by_statement.rb +98 -0
- data/examples/v201302/custom_targeting_service/update_custom_targeting_keys.rb +94 -0
- data/examples/v201302/custom_targeting_service/update_custom_targeting_values.rb +106 -0
- data/examples/v201302/forecast_service/get_forecast.rb +107 -0
- data/examples/v201302/forecast_service/get_forecast_by_id.rb +80 -0
- data/examples/v201302/inventory_service/create_ad_units.rb +101 -0
- data/examples/v201302/inventory_service/create_mobile_ad_unit.rb +101 -0
- data/examples/v201302/inventory_service/create_video_ad_unit.rb +108 -0
- data/examples/v201302/inventory_service/deactivate_ad_units.rb +119 -0
- data/examples/v201302/inventory_service/get_ad_unit.rb +72 -0
- data/examples/v201302/inventory_service/get_ad_unit_sizes.rb +85 -0
- data/examples/v201302/inventory_service/get_ad_units_by_statement.rb +96 -0
- data/examples/v201302/inventory_service/get_all_ad_units.rb +93 -0
- data/examples/v201302/inventory_service/update_ad_units.rb +96 -0
- data/examples/v201302/label_service/create_labels.rb +83 -0
- data/examples/v201302/label_service/deactivate_labels.rb +118 -0
- data/examples/v201302/label_service/get_all_labels.rb +95 -0
- data/examples/v201302/label_service/get_label.rb +76 -0
- data/examples/v201302/label_service/get_labels_by_statement.rb +81 -0
- data/examples/v201302/label_service/update_labels.rb +102 -0
- data/examples/v201302/line_item_creative_association_service/create_licas.rb +94 -0
- data/examples/v201302/line_item_creative_association_service/deactivate_licas.rb +127 -0
- data/examples/v201302/line_item_creative_association_service/get_all_licas.rb +98 -0
- data/examples/v201302/line_item_creative_association_service/get_lica.rb +77 -0
- data/examples/v201302/line_item_creative_association_service/get_licas_by_statement.rb +91 -0
- data/examples/v201302/line_item_creative_association_service/update_licas.rb +91 -0
- data/examples/v201302/line_item_service/activate_line_items.rb +131 -0
- data/examples/v201302/line_item_service/create_line_items.rb +177 -0
- data/examples/v201302/line_item_service/create_mobile_line_item.rb +135 -0
- data/examples/v201302/line_item_service/create_video_line_item.rb +158 -0
- data/examples/v201302/line_item_service/get_all_line_items.rb +94 -0
- data/examples/v201302/line_item_service/get_line_item.rb +74 -0
- data/examples/v201302/line_item_service/get_line_items_by_statement.rb +93 -0
- data/examples/v201302/line_item_service/get_recently_updated_line_items.rb +98 -0
- data/examples/v201302/line_item_service/target_custom_criteria.rb +129 -0
- data/examples/v201302/line_item_service/update_line_items.rb +109 -0
- data/examples/v201302/network_service/get_all_networks.rb +74 -0
- data/examples/v201302/network_service/get_current_network.rb +66 -0
- data/examples/v201302/network_service/make_test_network.rb +79 -0
- data/examples/v201302/order_service/approve_orders.rb +122 -0
- data/examples/v201302/order_service/create_orders.rb +92 -0
- data/examples/v201302/order_service/get_all_orders.rb +93 -0
- data/examples/v201302/order_service/get_order.rb +74 -0
- data/examples/v201302/order_service/get_orders_by_statement.rb +90 -0
- data/examples/v201302/order_service/update_orders.rb +97 -0
- data/examples/v201302/placement_service/create_placements.rb +131 -0
- data/examples/v201302/placement_service/deactivate_placements.rb +118 -0
- data/examples/v201302/placement_service/get_all_placements.rb +93 -0
- data/examples/v201302/placement_service/get_placement.rb +74 -0
- data/examples/v201302/placement_service/get_placements_by_statement.rb +86 -0
- data/examples/v201302/placement_service/update_placements.rb +97 -0
- data/examples/v201302/publisher_query_language_service/get_all_cities.rb +104 -0
- data/examples/v201302/report_service/display_report.rb +81 -0
- data/examples/v201302/report_service/download_report.rb +81 -0
- data/examples/v201302/report_service/run_delivery_report.rb +103 -0
- data/examples/v201302/report_service/run_inventory_report.rb +96 -0
- data/examples/v201302/report_service/run_merged_delivery_report.rb +94 -0
- data/examples/v201302/report_service/run_reach_report.rb +87 -0
- data/examples/v201302/report_service/run_report_with_custom_fields.rb +135 -0
- data/examples/v201302/report_service/run_sales_report.rb +92 -0
- data/examples/v201302/suggested_ad_unit_service/approve_all_suggested_ad_units.rb +109 -0
- data/examples/v201302/suggested_ad_unit_service/get_all_suggested_ad_units.rb +96 -0
- data/examples/v201302/suggested_ad_unit_service/get_suggested_ad_unit.rb +75 -0
- data/examples/v201302/suggested_ad_unit_service/get_suggested_ad_units_by_statement.rb +92 -0
- data/examples/v201302/team_service/create_teams.rb +83 -0
- data/examples/v201302/team_service/get_all_teams.rb +92 -0
- data/examples/v201302/team_service/get_team.rb +74 -0
- data/examples/v201302/team_service/get_teams_by_statement.rb +78 -0
- data/examples/v201302/team_service/update_teams.rb +97 -0
- data/examples/v201302/third_party_slot_service/archive_third_party_slots.rb +125 -0
- data/examples/v201302/third_party_slot_service/create_third_party_slot.rb +91 -0
- data/examples/v201302/third_party_slot_service/get_all_third_party_slots.rb +93 -0
- data/examples/v201302/third_party_slot_service/get_third_party_slot_by_statement.rb +86 -0
- data/examples/v201302/third_party_slot_service/update_third_party_slots.rb +95 -0
- data/examples/v201302/user_service/create_users.rb +89 -0
- data/examples/v201302/user_service/deactivate_users.rb +97 -0
- data/examples/v201302/user_service/get_all_roles.rb +73 -0
- data/examples/v201302/user_service/get_all_users.rb +93 -0
- data/examples/v201302/user_service/get_current_user.rb +66 -0
- data/examples/v201302/user_service/get_user.rb +73 -0
- data/examples/v201302/user_service/get_users_by_statement.rb +79 -0
- data/examples/v201302/user_service/update_users.rb +89 -0
- data/examples/v201302/user_team_association_service/create_user_team_associations.rb +86 -0
- data/examples/v201302/user_team_association_service/delete_user_team_associations.rb +111 -0
- data/examples/v201302/user_team_association_service/get_all_user_team_associations.rb +94 -0
- data/examples/v201302/user_team_association_service/get_user_team_association.rb +76 -0
- data/examples/v201302/user_team_association_service/get_user_team_associations_by_statement.rb +94 -0
- data/examples/v201302/user_team_association_service/update_user_team_associations.rb +102 -0
- data/lib/dfp_api/api_config.rb +17 -4
- data/lib/dfp_api/v201302/activity_group_service.rb +54 -0
- data/lib/dfp_api/v201302/activity_group_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/activity_service.rb +54 -0
- data/lib/dfp_api/v201302/activity_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/ad_rule_service.rb +58 -0
- data/lib/dfp_api/v201302/ad_rule_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/audience_segment_service.rb +34 -0
- data/lib/dfp_api/v201302/audience_segment_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/company_service.rb +54 -0
- data/lib/dfp_api/v201302/company_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/contact_service.rb +54 -0
- data/lib/dfp_api/v201302/contact_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/content_bundle_service.rb +58 -0
- data/lib/dfp_api/v201302/content_bundle_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/content_service.rb +38 -0
- data/lib/dfp_api/v201302/content_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/creative_service.rb +54 -0
- data/lib/dfp_api/v201302/creative_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/creative_set_service.rb +46 -0
- data/lib/dfp_api/v201302/creative_set_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/creative_template_service.rb +38 -0
- data/lib/dfp_api/v201302/creative_template_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/creative_wrapper_service.rb +58 -0
- data/lib/dfp_api/v201302/creative_wrapper_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/custom_field_service.rb +78 -0
- data/lib/dfp_api/v201302/custom_field_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/custom_targeting_service.rb +62 -0
- data/lib/dfp_api/v201302/custom_targeting_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/forecast_service.rb +38 -0
- data/lib/dfp_api/v201302/forecast_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/inventory_service.rb +62 -0
- data/lib/dfp_api/v201302/inventory_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/label_service.rb +58 -0
- data/lib/dfp_api/v201302/label_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/line_item_creative_association_service.rb +62 -0
- data/lib/dfp_api/v201302/line_item_creative_association_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/line_item_service.rb +58 -0
- data/lib/dfp_api/v201302/line_item_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/network_service.rb +46 -0
- data/lib/dfp_api/v201302/network_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/order_service.rb +58 -0
- data/lib/dfp_api/v201302/order_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/placement_service.rb +58 -0
- data/lib/dfp_api/v201302/placement_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/publisher_query_language_service.rb +34 -0
- data/lib/dfp_api/v201302/publisher_query_language_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/report_service.rb +46 -0
- data/lib/dfp_api/v201302/report_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/suggested_ad_unit_service.rb +42 -0
- data/lib/dfp_api/v201302/suggested_ad_unit_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/team_service.rb +54 -0
- data/lib/dfp_api/v201302/team_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/third_party_slot_service.rb +46 -0
- data/lib/dfp_api/v201302/third_party_slot_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/user_service.rb +66 -0
- data/lib/dfp_api/v201302/user_service_registry.rb +46 -0
- data/lib/dfp_api/v201302/user_team_association_service.rb +58 -0
- data/lib/dfp_api/v201302/user_team_association_service_registry.rb +46 -0
- data/lib/dfp_api/version.rb +1 -1
- metadata +988 -786
data/examples/v201302/user_team_association_service/get_user_team_associations_by_statement.rb
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# Encoding: utf-8
|
|
3
|
+
#
|
|
4
|
+
# Author:: api.dklimkin@gmail.com (Danial Klimkin)
|
|
5
|
+
#
|
|
6
|
+
# Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
|
|
7
|
+
#
|
|
8
|
+
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
# you may not use this file except in compliance with the License.
|
|
10
|
+
# You may obtain a copy of the License at
|
|
11
|
+
#
|
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
#
|
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
17
|
+
# implied.
|
|
18
|
+
# See the License for the specific language governing permissions and
|
|
19
|
+
# limitations under the License.
|
|
20
|
+
#
|
|
21
|
+
# This example gets all teams that the current user belongs to. The statement
|
|
22
|
+
# retrieves up to the maximum page size limit of 500. To create teams, run
|
|
23
|
+
# create_user_team_associations.rb.
|
|
24
|
+
#
|
|
25
|
+
# Tags: UserTeamAssociationService.getUserTeamAssociationsByStatement
|
|
26
|
+
# Tags: UserService.getCurrentUser
|
|
27
|
+
|
|
28
|
+
require 'dfp_api'
|
|
29
|
+
|
|
30
|
+
API_VERSION = :v201302
|
|
31
|
+
PAGE_SIZE = 500
|
|
32
|
+
|
|
33
|
+
def get_user_team_associations_by_statement()
|
|
34
|
+
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
|
35
|
+
dfp = DfpApi::Api.new
|
|
36
|
+
|
|
37
|
+
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
|
38
|
+
# the configuration file or provide your own logger:
|
|
39
|
+
# dfp.logger = Logger.new('dfp_xml.log')
|
|
40
|
+
|
|
41
|
+
# Get the UserTeamAssociationService.
|
|
42
|
+
uta_service = dfp.service(:UserTeamAssociationService, API_VERSION)
|
|
43
|
+
|
|
44
|
+
# Get the UserService.
|
|
45
|
+
user_service = dfp.service(:UserService, API_VERSION)
|
|
46
|
+
|
|
47
|
+
# Get the current user.
|
|
48
|
+
user = user_service.get_current_user()
|
|
49
|
+
|
|
50
|
+
# Create filter text to select user team associations by the user ID.
|
|
51
|
+
statement = {
|
|
52
|
+
:query => "WHERE userId = :user_id LIMIT %s" % PAGE_SIZE,
|
|
53
|
+
:values => [
|
|
54
|
+
{:key => 'user_id',
|
|
55
|
+
:value => {:value => user[:id], :xsi_type => 'NumberValue'}},
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
# Get user team associations by statement.
|
|
60
|
+
page = uta_service.get_user_team_associations_by_statement(statement)
|
|
61
|
+
|
|
62
|
+
if page and page[:results]
|
|
63
|
+
page[:results].each_with_index do |association, index|
|
|
64
|
+
puts "%d) Team user association between team ID %d and user ID %d." %
|
|
65
|
+
[index, association[:team_id], association[:user_id]]
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Print a footer.
|
|
70
|
+
if page.include?(:total_result_set_size)
|
|
71
|
+
puts "Number of results found: %d" % page[:total_result_set_size]
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
if __FILE__ == $0
|
|
76
|
+
begin
|
|
77
|
+
get_user_team_associations_by_statement()
|
|
78
|
+
|
|
79
|
+
# HTTP errors.
|
|
80
|
+
rescue AdsCommon::Errors::HttpError => e
|
|
81
|
+
puts "HTTP Error: %s" % e
|
|
82
|
+
|
|
83
|
+
# API errors.
|
|
84
|
+
rescue DfpApi::Errors::ApiException => e
|
|
85
|
+
puts "Message: %s" % e.message
|
|
86
|
+
puts 'Errors:'
|
|
87
|
+
e.errors.each_with_index do |error, index|
|
|
88
|
+
puts "\tError [%d]:" % (index + 1)
|
|
89
|
+
error.each do |field, value|
|
|
90
|
+
puts "\t\t%s: %s" % [field, value]
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# Encoding: utf-8
|
|
3
|
+
#
|
|
4
|
+
# Author:: api.dklimkin@gmail.com (Danial Klimkin)
|
|
5
|
+
#
|
|
6
|
+
# Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
|
|
7
|
+
#
|
|
8
|
+
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
# you may not use this file except in compliance with the License.
|
|
10
|
+
# You may obtain a copy of the License at
|
|
11
|
+
#
|
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
#
|
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
17
|
+
# implied.
|
|
18
|
+
# See the License for the specific language governing permissions and
|
|
19
|
+
# limitations under the License.
|
|
20
|
+
#
|
|
21
|
+
# This example updates user team associations. It updates a user team
|
|
22
|
+
# association by setting the overridden access type to read only for the first
|
|
23
|
+
# 500 teams that the user belongs to. To determine which users exists, run
|
|
24
|
+
# get_all_users.rb.
|
|
25
|
+
#
|
|
26
|
+
# Tags: UserTeamAssociationService.getUserTeamAssociationsByStatement
|
|
27
|
+
# Tags: UserTeamAssociationService.updateUserTeamAssociations
|
|
28
|
+
|
|
29
|
+
require 'dfp_api'
|
|
30
|
+
|
|
31
|
+
API_VERSION = :v201302
|
|
32
|
+
PAGE_SIZE = 500
|
|
33
|
+
|
|
34
|
+
def update_user_team_associations()
|
|
35
|
+
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
|
36
|
+
dfp = DfpApi::Api.new
|
|
37
|
+
|
|
38
|
+
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
|
39
|
+
# the configuration file or provide your own logger:
|
|
40
|
+
# dfp.logger = Logger.new('dfp_xml.log')
|
|
41
|
+
|
|
42
|
+
# Get the UserTeamAssociationService.
|
|
43
|
+
uta_service = dfp.service(:UserTeamAssociationService, API_VERSION)
|
|
44
|
+
|
|
45
|
+
# Set the user to set to read only access within its teams.
|
|
46
|
+
user_id = 'INSERT_USER_ID_HERE'.to_i
|
|
47
|
+
|
|
48
|
+
# Create filter text to select user team associations by the user ID.
|
|
49
|
+
statement = {
|
|
50
|
+
:query => "WHERE userId = :user_id LIMIT %s" % PAGE_SIZE,
|
|
51
|
+
:values => [
|
|
52
|
+
{:key => 'user_id',
|
|
53
|
+
:value => {:value => user_id, :xsi_type => 'NumberValue'}},
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
# Get user team associations by statement.
|
|
58
|
+
page = uta_service.get_user_team_associations_by_statement(statement)
|
|
59
|
+
|
|
60
|
+
if page[:results] and !page[:results].empty?
|
|
61
|
+
associations = page[:results]
|
|
62
|
+
associations.each do |association|
|
|
63
|
+
# Update local user team association to read-only access.
|
|
64
|
+
association[:overridden_team_access_type] = 'READ_ONLY'
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Update the user team association on the server.
|
|
68
|
+
return_associations =
|
|
69
|
+
uta_service.update_user_team_associations(associations)
|
|
70
|
+
|
|
71
|
+
# Display results.
|
|
72
|
+
return_associations.each do |association|
|
|
73
|
+
puts ("User team association between user ID %d and team ID %d was " +
|
|
74
|
+
"updated with access type '%s'") %
|
|
75
|
+
[association[:user_id], association[:team_id],
|
|
76
|
+
association[:overridden_team_access_type]]
|
|
77
|
+
end
|
|
78
|
+
else
|
|
79
|
+
puts 'No user team associations were updated.'
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
if __FILE__ == $0
|
|
84
|
+
begin
|
|
85
|
+
update_user_team_associations()
|
|
86
|
+
|
|
87
|
+
# HTTP errors.
|
|
88
|
+
rescue AdsCommon::Errors::HttpError => e
|
|
89
|
+
puts "HTTP Error: %s" % e
|
|
90
|
+
|
|
91
|
+
# API errors.
|
|
92
|
+
rescue DfpApi::Errors::ApiException => e
|
|
93
|
+
puts "Message: %s" % e.message
|
|
94
|
+
puts 'Errors:'
|
|
95
|
+
e.errors.each_with_index do |error, index|
|
|
96
|
+
puts "\tError [%d]:" % (index + 1)
|
|
97
|
+
error.each do |field, value|
|
|
98
|
+
puts "\t\t%s: %s" % [field, value]
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
data/lib/dfp_api/api_config.rb
CHANGED
|
@@ -35,9 +35,9 @@ module DfpApi
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
# Set defaults
|
|
38
|
-
DEFAULT_VERSION = :
|
|
38
|
+
DEFAULT_VERSION = :v201302
|
|
39
39
|
DEFAULT_ENVIRONMENT = :PRODUCTION
|
|
40
|
-
LATEST_VERSION = :
|
|
40
|
+
LATEST_VERSION = :v201302
|
|
41
41
|
|
|
42
42
|
# Set other constants
|
|
43
43
|
API_NAME = 'DfpApi'
|
|
@@ -89,7 +89,19 @@ module DfpApi
|
|
|
89
89
|
:SuggestedAdUnitService, :CreativeTemplateService,
|
|
90
90
|
:TeamService, :AudienceSegmentService, :CustomFieldService,
|
|
91
91
|
:UserTeamAssociationService, :CreativeSetService,
|
|
92
|
-
:CreativeWrapperService]
|
|
92
|
+
:CreativeWrapperService],
|
|
93
|
+
:v201302 => [:CompanyService, :CreativeService, :ForecastService,
|
|
94
|
+
:InventoryService, :LineItemCreativeAssociationService,
|
|
95
|
+
:LineItemService, :NetworkService, :OrderService,
|
|
96
|
+
:PlacementService, :ReportService, :UserService,
|
|
97
|
+
:CustomTargetingService, :PublisherQueryLanguageService,
|
|
98
|
+
:LabelService, :ThirdPartySlotService, :ContentService,
|
|
99
|
+
:SuggestedAdUnitService, :CreativeTemplateService,
|
|
100
|
+
:TeamService, :AudienceSegmentService, :CustomFieldService,
|
|
101
|
+
:UserTeamAssociationService, :CreativeSetService,
|
|
102
|
+
:CreativeWrapperService, :ActivityGroupService,
|
|
103
|
+
:ActivityService, :AdRuleService, :ContactService,
|
|
104
|
+
:ContentBundleService]
|
|
93
105
|
}
|
|
94
106
|
|
|
95
107
|
# Configure the different environments, with the base URL for each one
|
|
@@ -101,7 +113,8 @@ module DfpApi
|
|
|
101
113
|
:v201204 => 'https://www.google.com/apis/ads/publisher/',
|
|
102
114
|
:v201206 => 'https://www.google.com/apis/ads/publisher/',
|
|
103
115
|
:v201208 => 'https://www.google.com/apis/ads/publisher/',
|
|
104
|
-
:v201211 => 'https://www.google.com/apis/ads/publisher/'
|
|
116
|
+
:v201211 => 'https://www.google.com/apis/ads/publisher/',
|
|
117
|
+
:v201302 => 'https://www.google.com/apis/ads/publisher/'
|
|
105
118
|
}
|
|
106
119
|
}
|
|
107
120
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Encoding: utf-8
|
|
2
|
+
#
|
|
3
|
+
# This is auto-generated code, changes will be overwritten.
|
|
4
|
+
#
|
|
5
|
+
# Copyright:: Copyright 2013, Google Inc. All Rights Reserved.
|
|
6
|
+
# License:: Licensed under the Apache License, Version 2.0.
|
|
7
|
+
#
|
|
8
|
+
# Code generated by AdsCommon library 0.9.3 on 2013-03-13 15:21:10.
|
|
9
|
+
|
|
10
|
+
require 'ads_common/savon_service'
|
|
11
|
+
require 'dfp_api/v201302/activity_group_service_registry'
|
|
12
|
+
|
|
13
|
+
module DfpApi; module V201302; module ActivityGroupService
|
|
14
|
+
class ActivityGroupService < AdsCommon::SavonService
|
|
15
|
+
def initialize(config, endpoint)
|
|
16
|
+
namespace = 'https://www.google.com/apis/ads/publisher/v201302'
|
|
17
|
+
super(config, endpoint, namespace, :v201302)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def create_activity_group(*args, &block)
|
|
21
|
+
return execute_action('create_activity_group', args, &block)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def create_activity_groups(*args, &block)
|
|
25
|
+
return execute_action('create_activity_groups', args, &block)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def get_activity_group(*args, &block)
|
|
29
|
+
return execute_action('get_activity_group', args, &block)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def get_activity_groups_by_statement(*args, &block)
|
|
33
|
+
return execute_action('get_activity_groups_by_statement', args, &block)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def update_activity_group(*args, &block)
|
|
37
|
+
return execute_action('update_activity_group', args, &block)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def update_activity_groups(*args, &block)
|
|
41
|
+
return execute_action('update_activity_groups', args, &block)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
def get_service_registry()
|
|
47
|
+
return ActivityGroupServiceRegistry
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def get_module()
|
|
51
|
+
return DfpApi::V201302::ActivityGroupService
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end; end; end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Encoding: utf-8
|
|
2
|
+
#
|
|
3
|
+
# This is auto-generated code, changes will be overwritten.
|
|
4
|
+
#
|
|
5
|
+
# Copyright:: Copyright 2013, Google Inc. All Rights Reserved.
|
|
6
|
+
# License:: Licensed under the Apache License, Version 2.0.
|
|
7
|
+
#
|
|
8
|
+
# Code generated by AdsCommon library 0.9.3 on 2013-03-13 15:21:10.
|
|
9
|
+
|
|
10
|
+
require 'dfp_api/errors'
|
|
11
|
+
|
|
12
|
+
module DfpApi; module V201302; module ActivityGroupService
|
|
13
|
+
class ActivityGroupServiceRegistry
|
|
14
|
+
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}]}}}
|
|
15
|
+
ACTIVITYGROUPSERVICE_TYPES = {: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"}, :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"}, :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}, :"ActivityGroup.Status"=>{:fields=>[]}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.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=>[]}}
|
|
16
|
+
ACTIVITYGROUPSERVICE_NAMESPACES = []
|
|
17
|
+
|
|
18
|
+
def self.get_method_signature(method_name)
|
|
19
|
+
return ACTIVITYGROUPSERVICE_METHODS[method_name.to_sym]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.get_type_signature(type_name)
|
|
23
|
+
return ACTIVITYGROUPSERVICE_TYPES[type_name.to_sym]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.get_namespace(index)
|
|
27
|
+
return ACTIVITYGROUPSERVICE_NAMESPACES[index]
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Base class for exceptions.
|
|
32
|
+
class ApplicationException < DfpApi::Errors::ApiException
|
|
33
|
+
attr_reader :message # string
|
|
34
|
+
attr_reader :application_exception_type # string
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Exception class for holding a list of service errors.
|
|
38
|
+
class ApiException < ApplicationException
|
|
39
|
+
attr_reader :errors # ApiError
|
|
40
|
+
def initialize(exception_fault)
|
|
41
|
+
@array_fields ||= []
|
|
42
|
+
@array_fields << 'errors'
|
|
43
|
+
super(exception_fault, ActivityGroupServiceRegistry)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end; end; end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Encoding: utf-8
|
|
2
|
+
#
|
|
3
|
+
# This is auto-generated code, changes will be overwritten.
|
|
4
|
+
#
|
|
5
|
+
# Copyright:: Copyright 2013, Google Inc. All Rights Reserved.
|
|
6
|
+
# License:: Licensed under the Apache License, Version 2.0.
|
|
7
|
+
#
|
|
8
|
+
# Code generated by AdsCommon library 0.9.3 on 2013-03-13 15:21:09.
|
|
9
|
+
|
|
10
|
+
require 'ads_common/savon_service'
|
|
11
|
+
require 'dfp_api/v201302/activity_service_registry'
|
|
12
|
+
|
|
13
|
+
module DfpApi; module V201302; module ActivityService
|
|
14
|
+
class ActivityService < AdsCommon::SavonService
|
|
15
|
+
def initialize(config, endpoint)
|
|
16
|
+
namespace = 'https://www.google.com/apis/ads/publisher/v201302'
|
|
17
|
+
super(config, endpoint, namespace, :v201302)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def create_activities(*args, &block)
|
|
21
|
+
return execute_action('create_activities', args, &block)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def create_activity(*args, &block)
|
|
25
|
+
return execute_action('create_activity', args, &block)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def get_activities_by_statement(*args, &block)
|
|
29
|
+
return execute_action('get_activities_by_statement', args, &block)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def get_activity(*args, &block)
|
|
33
|
+
return execute_action('get_activity', args, &block)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def update_activities(*args, &block)
|
|
37
|
+
return execute_action('update_activities', args, &block)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def update_activity(*args, &block)
|
|
41
|
+
return execute_action('update_activity', args, &block)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
def get_service_registry()
|
|
47
|
+
return ActivityServiceRegistry
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def get_module()
|
|
51
|
+
return DfpApi::V201302::ActivityService
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end; end; end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Encoding: utf-8
|
|
2
|
+
#
|
|
3
|
+
# This is auto-generated code, changes will be overwritten.
|
|
4
|
+
#
|
|
5
|
+
# Copyright:: Copyright 2013, Google Inc. All Rights Reserved.
|
|
6
|
+
# License:: Licensed under the Apache License, Version 2.0.
|
|
7
|
+
#
|
|
8
|
+
# Code generated by AdsCommon library 0.9.3 on 2013-03-13 15:21:09.
|
|
9
|
+
|
|
10
|
+
require 'dfp_api/errors'
|
|
11
|
+
|
|
12
|
+
module DfpApi; module V201302; module ActivityService
|
|
13
|
+
class ActivityServiceRegistry
|
|
14
|
+
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}]}}}
|
|
15
|
+
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}]}, :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"}, :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"}, :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=>[]}, :"ApiVersionError.Reason"=>{:fields=>[]}, :"AuthenticationError.Reason"=>{:fields=>[]}, :"CommonError.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=>[]}}
|
|
16
|
+
ACTIVITYSERVICE_NAMESPACES = []
|
|
17
|
+
|
|
18
|
+
def self.get_method_signature(method_name)
|
|
19
|
+
return ACTIVITYSERVICE_METHODS[method_name.to_sym]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.get_type_signature(type_name)
|
|
23
|
+
return ACTIVITYSERVICE_TYPES[type_name.to_sym]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.get_namespace(index)
|
|
27
|
+
return ACTIVITYSERVICE_NAMESPACES[index]
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Base class for exceptions.
|
|
32
|
+
class ApplicationException < DfpApi::Errors::ApiException
|
|
33
|
+
attr_reader :message # string
|
|
34
|
+
attr_reader :application_exception_type # string
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Exception class for holding a list of service errors.
|
|
38
|
+
class ApiException < ApplicationException
|
|
39
|
+
attr_reader :errors # ApiError
|
|
40
|
+
def initialize(exception_fault)
|
|
41
|
+
@array_fields ||= []
|
|
42
|
+
@array_fields << 'errors'
|
|
43
|
+
super(exception_fault, ActivityServiceRegistry)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end; end; end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Encoding: utf-8
|
|
2
|
+
#
|
|
3
|
+
# This is auto-generated code, changes will be overwritten.
|
|
4
|
+
#
|
|
5
|
+
# Copyright:: Copyright 2013, Google Inc. All Rights Reserved.
|
|
6
|
+
# License:: Licensed under the Apache License, Version 2.0.
|
|
7
|
+
#
|
|
8
|
+
# Code generated by AdsCommon library 0.9.3 on 2013-03-13 15:21:11.
|
|
9
|
+
|
|
10
|
+
require 'ads_common/savon_service'
|
|
11
|
+
require 'dfp_api/v201302/ad_rule_service_registry'
|
|
12
|
+
|
|
13
|
+
module DfpApi; module V201302; module AdRuleService
|
|
14
|
+
class AdRuleService < AdsCommon::SavonService
|
|
15
|
+
def initialize(config, endpoint)
|
|
16
|
+
namespace = 'https://www.google.com/apis/ads/publisher/v201302'
|
|
17
|
+
super(config, endpoint, namespace, :v201302)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def create_ad_rule(*args, &block)
|
|
21
|
+
return execute_action('create_ad_rule', args, &block)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def create_ad_rules(*args, &block)
|
|
25
|
+
return execute_action('create_ad_rules', args, &block)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def get_ad_rule(*args, &block)
|
|
29
|
+
return execute_action('get_ad_rule', args, &block)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def get_ad_rules_by_statement(*args, &block)
|
|
33
|
+
return execute_action('get_ad_rules_by_statement', args, &block)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def perform_ad_rule_action(*args, &block)
|
|
37
|
+
return execute_action('perform_ad_rule_action', args, &block)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def update_ad_rule(*args, &block)
|
|
41
|
+
return execute_action('update_ad_rule', args, &block)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def update_ad_rules(*args, &block)
|
|
45
|
+
return execute_action('update_ad_rules', args, &block)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
private
|
|
49
|
+
|
|
50
|
+
def get_service_registry()
|
|
51
|
+
return AdRuleServiceRegistry
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def get_module()
|
|
55
|
+
return DfpApi::V201302::AdRuleService
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end; end; end
|