google-adwords-api 1.5.0 → 1.6.0
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.
- checksums.yaml +4 -4
- data/COPYING +0 -0
- data/ChangeLog +4 -0
- data/README.md +9 -236
- data/lib/adwords_api.rb +2 -234
- metadata +8 -134
- data/adwords_api.yml +0 -53
- data/lib/adwords_api/api_config.rb +0 -221
- data/lib/adwords_api/batch_job_utils.rb +0 -334
- data/lib/adwords_api/credential_handler.rb +0 -96
- data/lib/adwords_api/errors.rb +0 -110
- data/lib/adwords_api/incremental_upload_helper.rb +0 -75
- data/lib/adwords_api/query_utils/query_builder.rb +0 -41
- data/lib/adwords_api/query_utils/report_query.rb +0 -30
- data/lib/adwords_api/query_utils/report_query_builder.rb +0 -82
- data/lib/adwords_api/query_utils/service_query.rb +0 -62
- data/lib/adwords_api/query_utils/service_query_builder.rb +0 -83
- data/lib/adwords_api/query_utils/where_builder.rb +0 -97
- data/lib/adwords_api/report_header_handler.rb +0 -80
- data/lib/adwords_api/report_stream.rb +0 -70
- data/lib/adwords_api/report_utils.rb +0 -383
- data/lib/adwords_api/utils.rb +0 -56
- data/lib/adwords_api/utils_reporter.rb +0 -58
- data/lib/adwords_api/v201809/account_label_service.rb +0 -46
- data/lib/adwords_api/v201809/account_label_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/ad_customizer_feed_service.rb +0 -46
- data/lib/adwords_api/v201809/ad_customizer_feed_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/ad_group_ad_service.rb +0 -62
- data/lib/adwords_api/v201809/ad_group_ad_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/ad_group_bid_modifier_service.rb +0 -54
- data/lib/adwords_api/v201809/ad_group_bid_modifier_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/ad_group_criterion_service.rb +0 -62
- data/lib/adwords_api/v201809/ad_group_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/ad_group_extension_setting_service.rb +0 -54
- data/lib/adwords_api/v201809/ad_group_extension_setting_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/ad_group_feed_service.rb +0 -54
- data/lib/adwords_api/v201809/ad_group_feed_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/ad_group_service.rb +0 -62
- data/lib/adwords_api/v201809/ad_group_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/ad_param_service.rb +0 -46
- data/lib/adwords_api/v201809/ad_param_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/ad_service.rb +0 -46
- data/lib/adwords_api/v201809/ad_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/adwords_user_list_service.rb +0 -62
- data/lib/adwords_api/v201809/adwords_user_list_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/asset_service.rb +0 -46
- data/lib/adwords_api/v201809/asset_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/batch_job_service.rb +0 -54
- data/lib/adwords_api/v201809/batch_job_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/bidding_strategy_service.rb +0 -54
- data/lib/adwords_api/v201809/bidding_strategy_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/budget_order_service.rb +0 -54
- data/lib/adwords_api/v201809/budget_order_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/budget_service.rb +0 -54
- data/lib/adwords_api/v201809/budget_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/campaign_bid_modifier_service.rb +0 -54
- data/lib/adwords_api/v201809/campaign_bid_modifier_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/campaign_criterion_service.rb +0 -54
- data/lib/adwords_api/v201809/campaign_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/campaign_extension_setting_service.rb +0 -54
- data/lib/adwords_api/v201809/campaign_extension_setting_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/campaign_feed_service.rb +0 -54
- data/lib/adwords_api/v201809/campaign_feed_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/campaign_group_performance_target_service.rb +0 -46
- data/lib/adwords_api/v201809/campaign_group_performance_target_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/campaign_group_service.rb +0 -46
- data/lib/adwords_api/v201809/campaign_group_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/campaign_service.rb +0 -62
- data/lib/adwords_api/v201809/campaign_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/campaign_shared_set_service.rb +0 -54
- data/lib/adwords_api/v201809/campaign_shared_set_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/constant_data_service.rb +0 -110
- data/lib/adwords_api/v201809/constant_data_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/conversion_tracker_service.rb +0 -54
- data/lib/adwords_api/v201809/conversion_tracker_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/custom_affinity_service.rb +0 -62
- data/lib/adwords_api/v201809/custom_affinity_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/customer_extension_setting_service.rb +0 -54
- data/lib/adwords_api/v201809/customer_extension_setting_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/customer_feed_service.rb +0 -54
- data/lib/adwords_api/v201809/customer_feed_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/customer_negative_criterion_service.rb +0 -54
- data/lib/adwords_api/v201809/customer_negative_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/customer_service.rb +0 -62
- data/lib/adwords_api/v201809/customer_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/customer_sync_service.rb +0 -38
- data/lib/adwords_api/v201809/customer_sync_service_registry.rb +0 -47
- data/lib/adwords_api/v201809/data_service.rb +0 -94
- data/lib/adwords_api/v201809/data_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/draft_async_error_service.rb +0 -46
- data/lib/adwords_api/v201809/draft_async_error_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/draft_service.rb +0 -54
- data/lib/adwords_api/v201809/draft_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/feed_item_service.rb +0 -54
- data/lib/adwords_api/v201809/feed_item_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/feed_item_target_service.rb +0 -54
- data/lib/adwords_api/v201809/feed_item_target_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/feed_mapping_service.rb +0 -54
- data/lib/adwords_api/v201809/feed_mapping_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/feed_service.rb +0 -54
- data/lib/adwords_api/v201809/feed_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/label_service.rb +0 -54
- data/lib/adwords_api/v201809/label_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/location_criterion_service.rb +0 -46
- data/lib/adwords_api/v201809/location_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/managed_customer_service.rb +0 -78
- data/lib/adwords_api/v201809/managed_customer_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/media_service.rb +0 -54
- data/lib/adwords_api/v201809/media_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/offline_call_conversion_feed_service.rb +0 -38
- data/lib/adwords_api/v201809/offline_call_conversion_feed_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/offline_conversion_adjustment_feed_service.rb +0 -38
- data/lib/adwords_api/v201809/offline_conversion_adjustment_feed_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/offline_conversion_feed_service.rb +0 -38
- data/lib/adwords_api/v201809/offline_conversion_feed_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/offline_data_upload_service.rb +0 -46
- data/lib/adwords_api/v201809/offline_data_upload_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/report_definition_service.rb +0 -38
- data/lib/adwords_api/v201809/report_definition_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/shared_criterion_service.rb +0 -54
- data/lib/adwords_api/v201809/shared_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/shared_set_service.rb +0 -54
- data/lib/adwords_api/v201809/shared_set_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/targeting_idea_service.rb +0 -38
- data/lib/adwords_api/v201809/targeting_idea_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/traffic_estimator_service.rb +0 -38
- data/lib/adwords_api/v201809/traffic_estimator_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/trial_async_error_service.rb +0 -46
- data/lib/adwords_api/v201809/trial_async_error_service_registry.rb +0 -46
- data/lib/adwords_api/v201809/trial_service.rb +0 -54
- data/lib/adwords_api/v201809/trial_service_registry.rb +0 -46
- data/lib/adwords_api/version.rb +0 -24
|
@@ -1,383 +0,0 @@
|
|
|
1
|
-
# Encoding: utf-8
|
|
2
|
-
#
|
|
3
|
-
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
|
|
4
|
-
#
|
|
5
|
-
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
# you may not use this file except in compliance with the License.
|
|
7
|
-
# You may obtain a copy of the License at
|
|
8
|
-
#
|
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
#
|
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
14
|
-
# implied.
|
|
15
|
-
# See the License for the specific language governing permissions and
|
|
16
|
-
# limitations under the License.
|
|
17
|
-
#
|
|
18
|
-
# Contains utility methods specific to reporting.
|
|
19
|
-
|
|
20
|
-
require 'cgi'
|
|
21
|
-
require 'gyoku'
|
|
22
|
-
require 'nori'
|
|
23
|
-
|
|
24
|
-
require 'ads_common/http'
|
|
25
|
-
require 'adwords_api/errors'
|
|
26
|
-
require 'adwords_api/report_header_handler'
|
|
27
|
-
require 'adwords_api/report_stream'
|
|
28
|
-
|
|
29
|
-
module AdwordsApi
|
|
30
|
-
class ReportUtils
|
|
31
|
-
# Default constructor.
|
|
32
|
-
#
|
|
33
|
-
# Args:
|
|
34
|
-
# - api: AdwordsApi object
|
|
35
|
-
# - version: API version to use
|
|
36
|
-
#
|
|
37
|
-
def initialize(api, version)
|
|
38
|
-
@api, @version = api, version
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
# Downloads and returns a report.
|
|
42
|
-
#
|
|
43
|
-
# Args:
|
|
44
|
-
# - report_definition: definition of the report in XML text or hash
|
|
45
|
-
# - cid: optional customer ID to run against
|
|
46
|
-
#
|
|
47
|
-
# Returns:
|
|
48
|
-
# - report body
|
|
49
|
-
#
|
|
50
|
-
# Raises:
|
|
51
|
-
# - AdwordsApi::Errors::InvalidReportDefinitionError if the report
|
|
52
|
-
# definition is invalid
|
|
53
|
-
# - AdwordsApi::Errors::ReportError if server-side error occurred
|
|
54
|
-
#
|
|
55
|
-
def download_report(report_definition, cid = nil)
|
|
56
|
-
return get_report_response(report_definition, cid).body
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
# Downloads a report and saves it to a file.
|
|
60
|
-
#
|
|
61
|
-
# Args:
|
|
62
|
-
# - report_definition: definition of the report in XML text or hash
|
|
63
|
-
# - path: path to save report to
|
|
64
|
-
# - cid: optional customer ID to run against
|
|
65
|
-
#
|
|
66
|
-
# Returns:
|
|
67
|
-
# - nil
|
|
68
|
-
#
|
|
69
|
-
# Raises:
|
|
70
|
-
# - AdwordsApi::Errors::InvalidReportDefinitionError if the report
|
|
71
|
-
# definition is invalid
|
|
72
|
-
# - AdwordsApi::Errors::ReportError if server-side error occurred
|
|
73
|
-
#
|
|
74
|
-
def download_report_as_file(report_definition, path, cid = nil)
|
|
75
|
-
report_body = download_report(report_definition, cid)
|
|
76
|
-
save_to_file(report_body, path)
|
|
77
|
-
return nil
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
# Streams a report as a string to the given block. This method will not do
|
|
81
|
-
# error checking on returned values.
|
|
82
|
-
#
|
|
83
|
-
# Args:
|
|
84
|
-
# - report_definition: definition of the report in XML text or hash
|
|
85
|
-
# - path: path to save report to
|
|
86
|
-
# - cid: optional customer ID to run against
|
|
87
|
-
#
|
|
88
|
-
# Returns:
|
|
89
|
-
# - nil
|
|
90
|
-
#
|
|
91
|
-
# Raises:
|
|
92
|
-
# - AdwordsApi::Errors::InvalidReportDefinitionError if the report
|
|
93
|
-
# definition is invalid
|
|
94
|
-
#
|
|
95
|
-
def download_report_as_stream(report_definition, cid = nil, &block)
|
|
96
|
-
return get_report_response(report_definition, cid, &block)
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
# Returns a helper object that can manage breaking the streamed report
|
|
100
|
-
# results into individual lines.
|
|
101
|
-
#
|
|
102
|
-
# Args:
|
|
103
|
-
# - report_definition: definition of the report in XML text or hash
|
|
104
|
-
# - path: path to save report to
|
|
105
|
-
# - cid: optional customer ID to run against
|
|
106
|
-
#
|
|
107
|
-
# Returns:
|
|
108
|
-
# - ReportStream object initialized to begin streaming.
|
|
109
|
-
#
|
|
110
|
-
# Raises:
|
|
111
|
-
# - AdwordsApi::Errors::InvalidReportDefinitionError if the report
|
|
112
|
-
# definition is invalid
|
|
113
|
-
#
|
|
114
|
-
def get_stream_helper(report_definition, cid = nil)
|
|
115
|
-
return AdwordsApi::ReportStream.set_up(
|
|
116
|
-
self, report_definition, cid)
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
# Downloads and returns a report with AWQL.
|
|
120
|
-
#
|
|
121
|
-
# Args:
|
|
122
|
-
# - report_query: query for the report as string
|
|
123
|
-
# - format: format for the report as string
|
|
124
|
-
# - cid: optional customer ID to run report against
|
|
125
|
-
#
|
|
126
|
-
# Returns:
|
|
127
|
-
# - report body
|
|
128
|
-
#
|
|
129
|
-
# Raises:
|
|
130
|
-
# - AdwordsApi::Errors::ReportError if a server-side error has occurred
|
|
131
|
-
#
|
|
132
|
-
def download_report_with_awql(report_query, format, cid = nil)
|
|
133
|
-
return get_report_response_with_awql(report_query, format, cid).body
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
# Downloads a report with AWQL and saves it to a file.
|
|
137
|
-
#
|
|
138
|
-
# Args:
|
|
139
|
-
# - report_query: query for the report as string
|
|
140
|
-
# - format: format for the report as string
|
|
141
|
-
# - path: path to save report to
|
|
142
|
-
# - cid: optional customer ID to run report against
|
|
143
|
-
#
|
|
144
|
-
# Returns:
|
|
145
|
-
# - nil
|
|
146
|
-
#
|
|
147
|
-
# Raises:
|
|
148
|
-
# - AdwordsApi::Errors::ReportError if server-side error occurred
|
|
149
|
-
#
|
|
150
|
-
def download_report_as_file_with_awql(report_query, format, path, cid = nil)
|
|
151
|
-
report_body = download_report_with_awql(report_query, format, cid)
|
|
152
|
-
save_to_file(report_body, path)
|
|
153
|
-
return nil
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
# Streams a report with AWQL as a string to the given block. This method
|
|
157
|
-
# will not do error checking on returned values.
|
|
158
|
-
#
|
|
159
|
-
# Args:
|
|
160
|
-
# - report_query: query for the report as string
|
|
161
|
-
# - format: format for the report as string
|
|
162
|
-
# - cid: optional customer ID to run report against
|
|
163
|
-
#
|
|
164
|
-
# Returns:
|
|
165
|
-
# - nil
|
|
166
|
-
#
|
|
167
|
-
def download_report_as_stream_with_awql(
|
|
168
|
-
report_query, format, cid = nil, &block)
|
|
169
|
-
return get_report_response_with_awql(report_query, format, cid, &block)
|
|
170
|
-
end
|
|
171
|
-
|
|
172
|
-
# Returns a helper object that can manage breaking the streamed report
|
|
173
|
-
# results into individual lines.
|
|
174
|
-
#
|
|
175
|
-
# Args:
|
|
176
|
-
# - report_query: query for the report as string
|
|
177
|
-
# - format: format for the report as string
|
|
178
|
-
# - cid: optional customer ID to run report against
|
|
179
|
-
#
|
|
180
|
-
# Returns:
|
|
181
|
-
# - ReportStream object initialized to begin streaming.
|
|
182
|
-
#
|
|
183
|
-
def get_stream_helper_with_awql(report_query, format, cid = nil)
|
|
184
|
-
return AdwordsApi::ReportStream.set_up_with_awql(
|
|
185
|
-
self, report_query, format, cid)
|
|
186
|
-
end
|
|
187
|
-
|
|
188
|
-
private
|
|
189
|
-
|
|
190
|
-
# Minimal set of required fields for report definition.
|
|
191
|
-
REQUIRED_FIELDS = [:selector, :report_name, :report_type, :date_range_type]
|
|
192
|
-
|
|
193
|
-
# Definition fields have to be in particular order in the XML. Here is its
|
|
194
|
-
# specification.
|
|
195
|
-
REPORT_DEFINITION_ORDER = {
|
|
196
|
-
:root => [:selector, :report_name, :report_type, :date_range_type,
|
|
197
|
-
:download_format],
|
|
198
|
-
:selector => [:fields, :predicates, :date_range, :ordering, :paging],
|
|
199
|
-
:predicates => [:field, :operator, :values],
|
|
200
|
-
:ordering => [:field, :sort_order],
|
|
201
|
-
:paging => [:start_index, :number_results],
|
|
202
|
-
:date_range => [:min, :max]
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
# Send POST request for a report and returns Response object.
|
|
206
|
-
def get_report_response(report_definition, cid, &block)
|
|
207
|
-
definition_text = get_report_definition_text(report_definition)
|
|
208
|
-
data = '__rdxml=%s' % CGI.escape(definition_text)
|
|
209
|
-
return make_adhoc_request(data, cid, &block)
|
|
210
|
-
end
|
|
211
|
-
|
|
212
|
-
# Send POST request for a report with AWQL and returns Response object.
|
|
213
|
-
def get_report_response_with_awql(report_query, format, cid, &block)
|
|
214
|
-
data = '__rdquery=%s&__fmt=%s' %
|
|
215
|
-
[CGI.escape(report_query), CGI.escape(format)]
|
|
216
|
-
return make_adhoc_request(data, cid, &block)
|
|
217
|
-
end
|
|
218
|
-
|
|
219
|
-
# Makes request and AdHoc service and returns response.
|
|
220
|
-
def make_adhoc_request(data, cid, &block)
|
|
221
|
-
@api.utils_reporter.report_utils_used()
|
|
222
|
-
url = @api.api_config.adhoc_report_download_url(@version)
|
|
223
|
-
headers = get_report_request_headers(url, cid)
|
|
224
|
-
log_request(url, headers, data)
|
|
225
|
-
# A given block indicates that we should make a stream request and yield
|
|
226
|
-
# the results, rather than return a full response.
|
|
227
|
-
if block_given?
|
|
228
|
-
AdsCommon::Http.post_stream(url, data, @api.config, headers, &block)
|
|
229
|
-
return nil
|
|
230
|
-
else
|
|
231
|
-
response = AdsCommon::Http.post_response(
|
|
232
|
-
url, data, @api.config, headers)
|
|
233
|
-
log_headers(response.headers)
|
|
234
|
-
check_for_errors(response)
|
|
235
|
-
return response
|
|
236
|
-
end
|
|
237
|
-
end
|
|
238
|
-
|
|
239
|
-
# Converts passed object to XML text. Currently support String (no changes)
|
|
240
|
-
# and Hash (renders XML).
|
|
241
|
-
def get_report_definition_text(report_definition)
|
|
242
|
-
return case report_definition
|
|
243
|
-
when String then report_definition
|
|
244
|
-
when Hash then report_definition_to_xml(report_definition)
|
|
245
|
-
else
|
|
246
|
-
raise AdwordsApi::Errors::InvalidReportDefinitionError,
|
|
247
|
-
'Unknown object for report definition: %s' %
|
|
248
|
-
report_definition.class
|
|
249
|
-
end
|
|
250
|
-
end
|
|
251
|
-
|
|
252
|
-
# Prepares headers for report request.
|
|
253
|
-
def get_report_request_headers(url, cid)
|
|
254
|
-
@header_handler ||= AdwordsApi::ReportHeaderHandler.new(
|
|
255
|
-
@api.credential_handler, @api.get_auth_handler(), @api.config)
|
|
256
|
-
return @header_handler.headers(url, cid)
|
|
257
|
-
end
|
|
258
|
-
|
|
259
|
-
# Saves raw data to a file.
|
|
260
|
-
def save_to_file(data, path)
|
|
261
|
-
open(path, 'wb') { |file| file.write(data) } if path
|
|
262
|
-
end
|
|
263
|
-
|
|
264
|
-
# Logs the request on debug level.
|
|
265
|
-
def log_request(url, headers, body)
|
|
266
|
-
@api.logger.debug("Report request to: '%s'" % url)
|
|
267
|
-
log_headers(headers)
|
|
268
|
-
@api.logger.debug(body)
|
|
269
|
-
end
|
|
270
|
-
|
|
271
|
-
# Logs HTTP headers on debug level.
|
|
272
|
-
def log_headers(headers)
|
|
273
|
-
@api.logger.debug('HTTP headers: [%s]' %
|
|
274
|
-
(headers.map { |k, v| [k, v].join(': ') }.join(', ')))
|
|
275
|
-
end
|
|
276
|
-
|
|
277
|
-
# Checks downloaded data for error signature. Raises ReportError if it
|
|
278
|
-
# detects an error.
|
|
279
|
-
def check_for_errors(response)
|
|
280
|
-
# Check for error code.
|
|
281
|
-
if response.code != 200
|
|
282
|
-
# Check for error in body.
|
|
283
|
-
report_body = response.body
|
|
284
|
-
check_for_xml_error(report_body, response.code)
|
|
285
|
-
# No XML error found nor raised, falling back to a default message.
|
|
286
|
-
raise AdwordsApi::Errors::ReportError.new(response.code,
|
|
287
|
-
'HTTP code: %d, body: %s' % [response.code, response.body])
|
|
288
|
-
end
|
|
289
|
-
return nil
|
|
290
|
-
end
|
|
291
|
-
|
|
292
|
-
# Checks for an XML error in the response body and raises an exception if
|
|
293
|
-
# it was found.
|
|
294
|
-
def check_for_xml_error(report_body, response_code)
|
|
295
|
-
unless report_body.nil?
|
|
296
|
-
error_response = get_nori().parse(report_body)
|
|
297
|
-
if error_response.include?(:report_download_error) and
|
|
298
|
-
error_response[:report_download_error].include?(:api_error)
|
|
299
|
-
api_error = error_response[:report_download_error][:api_error]
|
|
300
|
-
raise AdwordsApi::Errors::ReportXmlError.new(response_code,
|
|
301
|
-
api_error[:type], api_error[:trigger], api_error[:field_path])
|
|
302
|
-
end
|
|
303
|
-
end
|
|
304
|
-
end
|
|
305
|
-
|
|
306
|
-
# Renders a report definition hash into XML text.
|
|
307
|
-
def report_definition_to_xml(report_definition)
|
|
308
|
-
check_report_definition_hash(report_definition)
|
|
309
|
-
add_report_definition_hash_order(report_definition)
|
|
310
|
-
begin
|
|
311
|
-
return Gyoku.xml({:report_definition => report_definition})
|
|
312
|
-
rescue ArgumentError => e
|
|
313
|
-
if e.message.include?("order!")
|
|
314
|
-
unknown_fields =
|
|
315
|
-
e.message.slice(e.message.index('['), e.message.length)
|
|
316
|
-
raise AdwordsApi::Errors::InvalidReportDefinitionError,
|
|
317
|
-
"Unknown report definition field(s): %s" % unknown_fields
|
|
318
|
-
end
|
|
319
|
-
raise e
|
|
320
|
-
end
|
|
321
|
-
end
|
|
322
|
-
|
|
323
|
-
# Checks if the report definition looks correct.
|
|
324
|
-
def check_report_definition_hash(report_definition)
|
|
325
|
-
# Minimal set of fields required.
|
|
326
|
-
REQUIRED_FIELDS.each do |field|
|
|
327
|
-
unless report_definition.include?(field)
|
|
328
|
-
raise AdwordsApi::Errors::InvalidReportDefinitionError,
|
|
329
|
-
"Required field '%s' is missing in the definition" % field
|
|
330
|
-
end
|
|
331
|
-
end
|
|
332
|
-
# Fields list is also required.
|
|
333
|
-
unless report_definition[:selector].include?(:fields)
|
|
334
|
-
raise AdwordsApi::Errors::InvalidReportDefinitionError,
|
|
335
|
-
'Fields list is required'
|
|
336
|
-
end
|
|
337
|
-
# 'Fields' must be an Array.
|
|
338
|
-
unless report_definition[:selector][:fields].kind_of?(Array)
|
|
339
|
-
raise AdwordsApi::Errors::InvalidReportDefinitionError,
|
|
340
|
-
'Fields list must be an array'
|
|
341
|
-
end
|
|
342
|
-
# We should request at least one field.
|
|
343
|
-
if report_definition[:selector][:fields].empty?
|
|
344
|
-
raise AdwordsApi::Errors::InvalidReportDefinitionError,
|
|
345
|
-
'At least one field needs to be requested'
|
|
346
|
-
end
|
|
347
|
-
end
|
|
348
|
-
|
|
349
|
-
# Adds fields order hint to generator based on specification.
|
|
350
|
-
def add_report_definition_hash_order(node, name = :root)
|
|
351
|
-
def_order = REPORT_DEFINITION_ORDER[name]
|
|
352
|
-
var_order = def_order.reject { |field| !node.include?(field) }
|
|
353
|
-
node.keys.each do |key|
|
|
354
|
-
if REPORT_DEFINITION_ORDER.include?(key)
|
|
355
|
-
case node[key]
|
|
356
|
-
when Hash
|
|
357
|
-
add_report_definition_hash_order(node[key], key)
|
|
358
|
-
when Array
|
|
359
|
-
node[key].each do |item|
|
|
360
|
-
add_report_definition_hash_order(item, key)
|
|
361
|
-
end
|
|
362
|
-
end
|
|
363
|
-
end
|
|
364
|
-
end
|
|
365
|
-
node[:order!] = var_order
|
|
366
|
-
return nil
|
|
367
|
-
end
|
|
368
|
-
|
|
369
|
-
def get_nori()
|
|
370
|
-
return @nori if @nori
|
|
371
|
-
|
|
372
|
-
nori_options = {
|
|
373
|
-
:strip_namespaces => true,
|
|
374
|
-
:convert_tags_to => lambda { |tag| tag.snakecase.to_sym },
|
|
375
|
-
:advanced_typecasting => false
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
@nori = Nori.new(nori_options)
|
|
379
|
-
|
|
380
|
-
return @nori
|
|
381
|
-
end
|
|
382
|
-
end
|
|
383
|
-
end
|
data/lib/adwords_api/utils.rb
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# Encoding: utf-8
|
|
2
|
-
#
|
|
3
|
-
# Copyright:: Copyright 2010, Google Inc. All Rights Reserved.
|
|
4
|
-
#
|
|
5
|
-
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
# you may not use this file except in compliance with the License.
|
|
7
|
-
# You may obtain a copy of the License at
|
|
8
|
-
#
|
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
#
|
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
14
|
-
# implied.
|
|
15
|
-
# See the License for the specific language governing permissions and
|
|
16
|
-
# limitations under the License.
|
|
17
|
-
#
|
|
18
|
-
# Contains global utility methods.
|
|
19
|
-
|
|
20
|
-
module AdwordsApi
|
|
21
|
-
module Utils
|
|
22
|
-
|
|
23
|
-
# Returns the source operation index for an error.
|
|
24
|
-
#
|
|
25
|
-
# Args:
|
|
26
|
-
# - error: the error to be analyzed
|
|
27
|
-
#
|
|
28
|
-
# Returns:
|
|
29
|
-
# - index for the source operation, nil if none
|
|
30
|
-
#
|
|
31
|
-
def self.operation_index_for_error(error)
|
|
32
|
-
if error and error[:field_path] and error[:field_path].kind_of?(String)
|
|
33
|
-
match = error[:field_path].match(/operations\[(\d+)\]/)
|
|
34
|
-
return match ? match[1].to_i : nil
|
|
35
|
-
end
|
|
36
|
-
return nil
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
# Auxiliary method to format an ID to the pattern ###-###-####.
|
|
40
|
-
#
|
|
41
|
-
# Args:
|
|
42
|
-
# - id: ID in unformatted form
|
|
43
|
-
#
|
|
44
|
-
# Returns:
|
|
45
|
-
# - string containing the formatted ID
|
|
46
|
-
#
|
|
47
|
-
def self.format_id(id)
|
|
48
|
-
str_id = id.to_s.gsub(/\D/, '')
|
|
49
|
-
if str_id.size >= 7
|
|
50
|
-
str_array = str_id.scan(/(\d{3})(\d{3})(\d+)/)
|
|
51
|
-
str_id = str_array.join('-') unless str_array.empty?
|
|
52
|
-
end
|
|
53
|
-
return str_id
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# Encoding: utf-8
|
|
2
|
-
#
|
|
3
|
-
# Copyright:: Copyright 2016, Google Inc. All Rights Reserved.
|
|
4
|
-
#
|
|
5
|
-
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
# you may not use this file except in compliance with the License.
|
|
7
|
-
# You may obtain a copy of the License at
|
|
8
|
-
#
|
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
#
|
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
14
|
-
# implied.
|
|
15
|
-
# See the License for the specific language governing permissions and
|
|
16
|
-
# limitations under the License.
|
|
17
|
-
#
|
|
18
|
-
# Contains methods to help configure the user agent string to report on utility
|
|
19
|
-
# usage.
|
|
20
|
-
|
|
21
|
-
require 'adwords_api/credential_handler'
|
|
22
|
-
|
|
23
|
-
module AdwordsApi
|
|
24
|
-
class UtilsReporter
|
|
25
|
-
# Default constructor.
|
|
26
|
-
#
|
|
27
|
-
# Args:
|
|
28
|
-
# - credential_handler: The CredentialHandler being used by the current
|
|
29
|
-
# AdwordsApi instance.
|
|
30
|
-
def initialize(credential_handler)
|
|
31
|
-
@credential_handler = credential_handler
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# A callback method from report utils to indicate that it has been used,
|
|
35
|
-
# and that its usage should be recorded in the next user agent string.
|
|
36
|
-
def report_utils_used()
|
|
37
|
-
@credential_handler.include_in_user_agent("ReportDownloader")
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
# A callback method from batch job utils to indicate that it has been used,
|
|
41
|
-
# and that its usage should be recorded in the next user agent string.
|
|
42
|
-
def batch_job_utils_used()
|
|
43
|
-
@credential_handler.include_in_user_agent("BatchJobHelper")
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
# A callback method from report query builder to indicate that it has been
|
|
47
|
-
# used, and that its usage should be recorded in the next user agent string.
|
|
48
|
-
def report_query_builder_used()
|
|
49
|
-
@credential_handler.include_in_user_agent("ReportQueryBuilder")
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
# A callback method from service query builder to indicate that it has been
|
|
53
|
-
# used, and that its usage should be recorded in the next user agent string.
|
|
54
|
-
def service_query_builder_used()
|
|
55
|
-
@credential_handler.include_in_user_agent("ServiceQueryBuilder")
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Encoding: utf-8
|
|
2
|
-
#
|
|
3
|
-
# This is auto-generated code, changes will be overwritten.
|
|
4
|
-
#
|
|
5
|
-
# Copyright:: Copyright 2018, Google Inc. All Rights Reserved.
|
|
6
|
-
# License:: Licensed under the Apache License, Version 2.0.
|
|
7
|
-
#
|
|
8
|
-
# Code generated by AdsCommon library 1.0.1 on 2018-09-20 09:46:43.
|
|
9
|
-
|
|
10
|
-
require 'ads_common/savon_service'
|
|
11
|
-
require 'adwords_api/v201809/account_label_service_registry'
|
|
12
|
-
|
|
13
|
-
module AdwordsApi; module V201809; module AccountLabelService
|
|
14
|
-
class AccountLabelService < AdsCommon::SavonService
|
|
15
|
-
def initialize(config, endpoint)
|
|
16
|
-
namespace = 'https://adwords.google.com/api/adwords/mcm/v201809'
|
|
17
|
-
super(config, endpoint, namespace, :v201809)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def get(*args, &block)
|
|
21
|
-
return execute_action('get', args, &block)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def get_to_xml(*args)
|
|
25
|
-
return get_soap_xml('get', args)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def mutate(*args, &block)
|
|
29
|
-
return execute_action('mutate', args, &block)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def mutate_to_xml(*args)
|
|
33
|
-
return get_soap_xml('mutate', args)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
private
|
|
37
|
-
|
|
38
|
-
def get_service_registry()
|
|
39
|
-
return AccountLabelServiceRegistry
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def get_module()
|
|
43
|
-
return AdwordsApi::V201809::AccountLabelService
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end; end; end
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Encoding: utf-8
|
|
2
|
-
#
|
|
3
|
-
# This is auto-generated code, changes will be overwritten.
|
|
4
|
-
#
|
|
5
|
-
# Copyright:: Copyright 2018, Google Inc. All Rights Reserved.
|
|
6
|
-
# License:: Licensed under the Apache License, Version 2.0.
|
|
7
|
-
#
|
|
8
|
-
# Code generated by AdsCommon library 1.0.1 on 2018-09-20 09:46:43.
|
|
9
|
-
|
|
10
|
-
require 'adwords_api/errors'
|
|
11
|
-
|
|
12
|
-
module AdwordsApi; module V201809; module AccountLabelService
|
|
13
|
-
class AccountLabelServiceRegistry
|
|
14
|
-
ACCOUNTLABELSERVICE_METHODS = {:get=>{:input=>[{:name=>:selector, :type=>"Selector", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_response", :fields=>[{:name=>:rval, :type=>"AccountLabelPage", :min_occurs=>0, :max_occurs=>1}]}}, :mutate=>{:input=>[{:name=>:operations, :type=>"AccountLabelOperation", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"mutate_response", :fields=>[{:name=>:rval, :type=>"AccountLabelReturnValue", :min_occurs=>0, :max_occurs=>1}]}}}
|
|
15
|
-
ACCOUNTLABELSERVICE_TYPES = {:ApiError=>{:fields=>[{:name=>:field_path, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:field_path_elements, :type=>"FieldPathElement", :min_occurs=>0, :max_occurs=>:unbounded}, {: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, :ns=>0}, :ApiException=>{:fields=>[{:name=>:errors, :type=>"ApiError", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ApplicationException", :ns=>0}, :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}], :ns=>0}, :AuthenticationError=>{:fields=>[{:name=>:reason, :type=>"AuthenticationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :AuthorizationError=>{:fields=>[{:name=>:reason, :type=>"AuthorizationError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :ClientTermsError=>{:fields=>[{:name=>:reason, :type=>"ClientTermsError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :CollectionSizeError=>{:fields=>[{:name=>:reason, :type=>"CollectionSizeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :DatabaseError=>{:fields=>[{:name=>:reason, :type=>"DatabaseError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :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}], :ns=>0}, :DateError=>{:fields=>[{:name=>:reason, :type=>"DateError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :DateRange=>{:fields=>[{:name=>:min, :type=>"Date", :min_occurs=>0, :max_occurs=>1}, {:name=>:max, :type=>"Date", :min_occurs=>0, :max_occurs=>1}], :ns=>0}, :DistinctError=>{:fields=>[{:name=>:reason, :type=>"DistinctError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :FieldPathElement=>{:fields=>[{:name=>:field, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:index, :type=>"int", :min_occurs=>0, :max_occurs=>1}], :ns=>0}, :IdError=>{:fields=>[{:name=>:reason, :type=>"IdError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :InternalApiError=>{:fields=>[{:name=>:reason, :type=>"InternalApiError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :NotEmptyError=>{:fields=>[{:name=>:reason, :type=>"NotEmptyError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :NullError=>{:fields=>[{:name=>:reason, :type=>"NullError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :Operation=>{:fields=>[{:name=>:operator, :type=>"Operator", :min_occurs=>0, :max_occurs=>1}, {:name=>:operation_type, :original_name=>"Operation.Type", :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true, :ns=>0}, :OperationAccessDenied=>{:fields=>[{:name=>:reason, :type=>"OperationAccessDenied.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :OperatorError=>{:fields=>[{:name=>:reason, :type=>"OperatorError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :OrderBy=>{:fields=>[{:name=>:field, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:sort_order, :type=>"SortOrder", :min_occurs=>0, :max_occurs=>1}], :ns=>0}, :Paging=>{:fields=>[{:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:number_results, :type=>"int", :min_occurs=>0, :max_occurs=>1}], :ns=>0}, :Predicate=>{:fields=>[{:name=>:field, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:operator, :type=>"Predicate.Operator", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"string", :min_occurs=>0, :max_occurs=>:unbounded}], :ns=>0}, :QuotaCheckError=>{:fields=>[{:name=>:reason, :type=>"QuotaCheckError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :RangeError=>{:fields=>[{:name=>:reason, :type=>"RangeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :RateExceededError=>{:fields=>[{:name=>:reason, :type=>"RateExceededError.Reason", :min_occurs=>0, :max_occurs=>1}, {:name=>:rate_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:rate_scope, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:retry_after_seconds, :type=>"int", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :ReadOnlyError=>{:fields=>[{:name=>:reason, :type=>"ReadOnlyError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :RegionCodeError=>{:fields=>[{:name=>:reason, :type=>"RegionCodeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :RejectedError=>{:fields=>[{:name=>:reason, :type=>"RejectedError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :RequestError=>{:fields=>[{:name=>:reason, :type=>"RequestError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :RequiredError=>{:fields=>[{:name=>:reason, :type=>"RequiredError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :Selector=>{:fields=>[{:name=>:fields, :type=>"string", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:predicates, :type=>"Predicate", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:date_range, :type=>"DateRange", :min_occurs=>0, :max_occurs=>1}, {:name=>:ordering, :type=>"OrderBy", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:paging, :type=>"Paging", :min_occurs=>0, :max_occurs=>1}], :ns=>0}, :SelectorError=>{:fields=>[{:name=>:reason, :type=>"SelectorError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :SizeLimitError=>{:fields=>[{:name=>:reason, :type=>"SizeLimitError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :SoapHeader=>{:fields=>[{:name=>:client_customer_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:developer_token, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:user_agent, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:validate_only, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:partial_failure, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :ns=>0}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:service_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:method_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:operations, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :ns=>0}, :StringFormatError=>{:fields=>[{:name=>:reason, :type=>"StringFormatError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :StringLengthError=>{:fields=>[{:name=>:reason, :type=>"StringLengthError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :"AuthenticationError.Reason"=>{:fields=>[], :ns=>0}, :"AuthorizationError.Reason"=>{:fields=>[], :ns=>0}, :"ClientTermsError.Reason"=>{:fields=>[], :ns=>0}, :"CollectionSizeError.Reason"=>{:fields=>[], :ns=>0}, :"DatabaseError.Reason"=>{:fields=>[], :ns=>0}, :"DateError.Reason"=>{:fields=>[], :ns=>0}, :"DistinctError.Reason"=>{:fields=>[], :ns=>0}, :"IdError.Reason"=>{:fields=>[], :ns=>0}, :"InternalApiError.Reason"=>{:fields=>[], :ns=>0}, :"NotEmptyError.Reason"=>{:fields=>[], :ns=>0}, :"NullError.Reason"=>{:fields=>[], :ns=>0}, :"OperationAccessDenied.Reason"=>{:fields=>[], :ns=>0}, :Operator=>{:fields=>[], :ns=>0}, :"OperatorError.Reason"=>{:fields=>[], :ns=>0}, :"Predicate.Operator"=>{:fields=>[], :ns=>0}, :"QuotaCheckError.Reason"=>{:fields=>[], :ns=>0}, :"RangeError.Reason"=>{:fields=>[], :ns=>0}, :"RateExceededError.Reason"=>{:fields=>[], :ns=>0}, :"ReadOnlyError.Reason"=>{:fields=>[], :ns=>0}, :"RegionCodeError.Reason"=>{:fields=>[], :ns=>0}, :"RejectedError.Reason"=>{:fields=>[], :ns=>0}, :"RequestError.Reason"=>{:fields=>[], :ns=>0}, :"RequiredError.Reason"=>{:fields=>[], :ns=>0}, :"SelectorError.Reason"=>{:fields=>[], :ns=>0}, :"SizeLimitError.Reason"=>{:fields=>[], :ns=>0}, :SortOrder=>{:fields=>[], :ns=>0}, :"StringFormatError.Reason"=>{:fields=>[], :ns=>0}, :"StringLengthError.Reason"=>{:fields=>[], :ns=>0}, :AccountLabelPage=>{:fields=>[{:name=>:labels, :type=>"AccountLabel", :min_occurs=>0, :max_occurs=>:unbounded}]}, :AccountLabelReturnValue=>{:fields=>[{:name=>:labels, :type=>"AccountLabel", :min_occurs=>0, :max_occurs=>:unbounded}]}, :CurrencyCodeError=>{:fields=>[{:name=>:reason, :type=>"CurrencyCodeError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :AccountLabel=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :LabelServiceError=>{:fields=>[{:name=>:reason, :type=>"LabelServiceError.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :AccountLabelOperation=>{:fields=>[{:name=>:operand, :type=>"AccountLabel", :min_occurs=>0, :max_occurs=>1}], :base=>"Operation"}, :"CurrencyCodeError.Reason"=>{:fields=>[]}, :"LabelServiceError.Reason"=>{:fields=>[]}}
|
|
16
|
-
ACCOUNTLABELSERVICE_NAMESPACES = ["https://adwords.google.com/api/adwords/cm/v201809"]
|
|
17
|
-
|
|
18
|
-
def self.get_method_signature(method_name)
|
|
19
|
-
return ACCOUNTLABELSERVICE_METHODS[method_name.to_sym]
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def self.get_type_signature(type_name)
|
|
23
|
-
return ACCOUNTLABELSERVICE_TYPES[type_name.to_sym]
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def self.get_namespace(index)
|
|
27
|
-
return ACCOUNTLABELSERVICE_NAMESPACES[index]
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# Base class for exceptions.
|
|
32
|
-
class ApplicationException < AdwordsApi::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, AccountLabelServiceRegistry)
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end; end; end
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Encoding: utf-8
|
|
2
|
-
#
|
|
3
|
-
# This is auto-generated code, changes will be overwritten.
|
|
4
|
-
#
|
|
5
|
-
# Copyright:: Copyright 2018, Google Inc. All Rights Reserved.
|
|
6
|
-
# License:: Licensed under the Apache License, Version 2.0.
|
|
7
|
-
#
|
|
8
|
-
# Code generated by AdsCommon library 1.0.1 on 2018-09-20 09:46:43.
|
|
9
|
-
|
|
10
|
-
require 'ads_common/savon_service'
|
|
11
|
-
require 'adwords_api/v201809/ad_customizer_feed_service_registry'
|
|
12
|
-
|
|
13
|
-
module AdwordsApi; module V201809; module AdCustomizerFeedService
|
|
14
|
-
class AdCustomizerFeedService < AdsCommon::SavonService
|
|
15
|
-
def initialize(config, endpoint)
|
|
16
|
-
namespace = 'https://adwords.google.com/api/adwords/cm/v201809'
|
|
17
|
-
super(config, endpoint, namespace, :v201809)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def get(*args, &block)
|
|
21
|
-
return execute_action('get', args, &block)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def get_to_xml(*args)
|
|
25
|
-
return get_soap_xml('get', args)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def mutate(*args, &block)
|
|
29
|
-
return execute_action('mutate', args, &block)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def mutate_to_xml(*args)
|
|
33
|
-
return get_soap_xml('mutate', args)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
private
|
|
37
|
-
|
|
38
|
-
def get_service_registry()
|
|
39
|
-
return AdCustomizerFeedServiceRegistry
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def get_module()
|
|
43
|
-
return AdwordsApi::V201809::AdCustomizerFeedService
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end; end; end
|