google-analytics-data-v1beta 0.6.0 → 0.7.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/README.md +2 -2
- data/lib/google/analytics/data/v1beta/analytics_data/rest/client.rb +1025 -0
- data/lib/google/analytics/data/v1beta/analytics_data/rest/service_stub.rb +467 -0
- data/lib/google/analytics/data/v1beta/analytics_data/rest.rb +52 -0
- data/lib/google/analytics/data/v1beta/analytics_data.rb +7 -1
- data/lib/google/analytics/data/v1beta/rest.rb +37 -0
- data/lib/google/analytics/data/v1beta/version.rb +1 -1
- data/lib/google/analytics/data/v1beta.rb +7 -2
- data/proto_docs/google/api/client.rb +318 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- metadata +15 -8
@@ -0,0 +1,1025 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 Google LLC
|
4
|
+
#
|
5
|
+
# 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
|
+
# https://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 implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/analytics/data/v1beta/analytics_data_api_pb"
|
21
|
+
require "google/analytics/data/v1beta/analytics_data/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Analytics
|
25
|
+
module Data
|
26
|
+
module V1beta
|
27
|
+
module AnalyticsData
|
28
|
+
module Rest
|
29
|
+
##
|
30
|
+
# REST client for the AnalyticsData service.
|
31
|
+
#
|
32
|
+
# Google Analytics reporting data service.
|
33
|
+
#
|
34
|
+
class Client
|
35
|
+
include Paths
|
36
|
+
|
37
|
+
# @private
|
38
|
+
attr_reader :analytics_data_stub
|
39
|
+
|
40
|
+
##
|
41
|
+
# Configure the AnalyticsData Client class.
|
42
|
+
#
|
43
|
+
# See {::Google::Analytics::Data::V1beta::AnalyticsData::Rest::Client::Configuration}
|
44
|
+
# for a description of the configuration fields.
|
45
|
+
#
|
46
|
+
# @example
|
47
|
+
#
|
48
|
+
# # Modify the configuration for all AnalyticsData clients
|
49
|
+
# ::Google::Analytics::Data::V1beta::AnalyticsData::Rest::Client.configure do |config|
|
50
|
+
# config.timeout = 10.0
|
51
|
+
# end
|
52
|
+
#
|
53
|
+
# @yield [config] Configure the Client client.
|
54
|
+
# @yieldparam config [Client::Configuration]
|
55
|
+
#
|
56
|
+
# @return [Client::Configuration]
|
57
|
+
#
|
58
|
+
def self.configure
|
59
|
+
@configure ||= begin
|
60
|
+
namespace = ["Google", "Analytics", "Data", "V1beta"]
|
61
|
+
parent_config = while namespace.any?
|
62
|
+
parent_name = namespace.join "::"
|
63
|
+
parent_const = const_get parent_name
|
64
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
65
|
+
namespace.pop
|
66
|
+
end
|
67
|
+
default_config = Client::Configuration.new parent_config
|
68
|
+
|
69
|
+
default_config.timeout = 60.0
|
70
|
+
default_config.retry_policy = {
|
71
|
+
initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [2]
|
72
|
+
}
|
73
|
+
|
74
|
+
default_config.rpcs.run_report.timeout = 60.0
|
75
|
+
|
76
|
+
default_config.rpcs.run_pivot_report.timeout = 60.0
|
77
|
+
|
78
|
+
default_config.rpcs.batch_run_reports.timeout = 60.0
|
79
|
+
|
80
|
+
default_config.rpcs.batch_run_pivot_reports.timeout = 60.0
|
81
|
+
|
82
|
+
default_config.rpcs.get_metadata.timeout = 60.0
|
83
|
+
|
84
|
+
default_config.rpcs.run_realtime_report.timeout = 60.0
|
85
|
+
|
86
|
+
default_config.rpcs.check_compatibility.timeout = 60.0
|
87
|
+
|
88
|
+
default_config
|
89
|
+
end
|
90
|
+
yield @configure if block_given?
|
91
|
+
@configure
|
92
|
+
end
|
93
|
+
|
94
|
+
##
|
95
|
+
# Configure the AnalyticsData Client instance.
|
96
|
+
#
|
97
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
98
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
99
|
+
# should be made on {Client.configure}.
|
100
|
+
#
|
101
|
+
# See {::Google::Analytics::Data::V1beta::AnalyticsData::Rest::Client::Configuration}
|
102
|
+
# for a description of the configuration fields.
|
103
|
+
#
|
104
|
+
# @yield [config] Configure the Client client.
|
105
|
+
# @yieldparam config [Client::Configuration]
|
106
|
+
#
|
107
|
+
# @return [Client::Configuration]
|
108
|
+
#
|
109
|
+
def configure
|
110
|
+
yield @config if block_given?
|
111
|
+
@config
|
112
|
+
end
|
113
|
+
|
114
|
+
##
|
115
|
+
# Create a new AnalyticsData REST client object.
|
116
|
+
#
|
117
|
+
# @example
|
118
|
+
#
|
119
|
+
# # Create a client using the default configuration
|
120
|
+
# client = ::Google::Analytics::Data::V1beta::AnalyticsData::Rest::Client.new
|
121
|
+
#
|
122
|
+
# # Create a client using a custom configuration
|
123
|
+
# client = ::Google::Analytics::Data::V1beta::AnalyticsData::Rest::Client.new do |config|
|
124
|
+
# config.timeout = 10.0
|
125
|
+
# end
|
126
|
+
#
|
127
|
+
# @yield [config] Configure the AnalyticsData client.
|
128
|
+
# @yieldparam config [Client::Configuration]
|
129
|
+
#
|
130
|
+
def initialize
|
131
|
+
# Create the configuration object
|
132
|
+
@config = Configuration.new Client.configure
|
133
|
+
|
134
|
+
# Yield the configuration if needed
|
135
|
+
yield @config if block_given?
|
136
|
+
|
137
|
+
# Create credentials
|
138
|
+
credentials = @config.credentials
|
139
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
140
|
+
# but only if the default endpoint does not have a region prefix.
|
141
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
142
|
+
!@config.endpoint.split(".").first.include?("-")
|
143
|
+
credentials ||= Credentials.default scope: @config.scope,
|
144
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
145
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
146
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
147
|
+
end
|
148
|
+
|
149
|
+
@quota_project_id = @config.quota_project
|
150
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
151
|
+
|
152
|
+
@analytics_data_stub = ::Google::Analytics::Data::V1beta::AnalyticsData::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
153
|
+
end
|
154
|
+
|
155
|
+
# Service calls
|
156
|
+
|
157
|
+
##
|
158
|
+
# Returns a customized report of your Google Analytics event data. Reports
|
159
|
+
# contain statistics derived from data collected by the Google Analytics
|
160
|
+
# tracking code. The data returned from the API is as a table with columns
|
161
|
+
# for the requested dimensions and metrics. Metrics are individual
|
162
|
+
# measurements of user activity on your property, such as active users or
|
163
|
+
# event count. Dimensions break down metrics across some common criteria,
|
164
|
+
# such as country or event name.
|
165
|
+
#
|
166
|
+
# For a guide to constructing requests & understanding responses, see
|
167
|
+
# [Creating a
|
168
|
+
# Report](https://developers.google.com/analytics/devguides/reporting/data/v1/basics).
|
169
|
+
#
|
170
|
+
# @overload run_report(request, options = nil)
|
171
|
+
# Pass arguments to `run_report` via a request object, either of type
|
172
|
+
# {::Google::Analytics::Data::V1beta::RunReportRequest} or an equivalent Hash.
|
173
|
+
#
|
174
|
+
# @param request [::Google::Analytics::Data::V1beta::RunReportRequest, ::Hash]
|
175
|
+
# A request object representing the call parameters. Required. To specify no
|
176
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
177
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
178
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
179
|
+
#
|
180
|
+
# @overload run_report(property: nil, dimensions: nil, metrics: nil, date_ranges: nil, dimension_filter: nil, metric_filter: nil, offset: nil, limit: nil, metric_aggregations: nil, order_bys: nil, currency_code: nil, cohort_spec: nil, keep_empty_rows: nil, return_property_quota: nil)
|
181
|
+
# Pass arguments to `run_report` via keyword arguments. Note that at
|
182
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
183
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
184
|
+
#
|
185
|
+
# @param property [::String]
|
186
|
+
# A Google Analytics GA4 property identifier whose events are tracked.
|
187
|
+
# Specified in the URL path and not the body. To learn more, see [where to
|
188
|
+
# find your Property
|
189
|
+
# ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
|
190
|
+
# Within a batch request, this property should either be unspecified or
|
191
|
+
# consistent with the batch-level property.
|
192
|
+
#
|
193
|
+
# Example: properties/1234
|
194
|
+
# @param dimensions [::Array<::Google::Analytics::Data::V1beta::Dimension, ::Hash>]
|
195
|
+
# The dimensions requested and displayed.
|
196
|
+
# @param metrics [::Array<::Google::Analytics::Data::V1beta::Metric, ::Hash>]
|
197
|
+
# The metrics requested and displayed.
|
198
|
+
# @param date_ranges [::Array<::Google::Analytics::Data::V1beta::DateRange, ::Hash>]
|
199
|
+
# Date ranges of data to read. If multiple date ranges are requested, each
|
200
|
+
# response row will contain a zero based date range index. If two date
|
201
|
+
# ranges overlap, the event data for the overlapping days is included in the
|
202
|
+
# response rows for both date ranges. In a cohort request, this `dateRanges`
|
203
|
+
# must be unspecified.
|
204
|
+
# @param dimension_filter [::Google::Analytics::Data::V1beta::FilterExpression, ::Hash]
|
205
|
+
# Dimension filters allow you to ask for only specific dimension values in
|
206
|
+
# the report. To learn more, see [Fundamentals of Dimension
|
207
|
+
# Filters](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#dimension_filters)
|
208
|
+
# for examples. Metrics cannot be used in this filter.
|
209
|
+
# @param metric_filter [::Google::Analytics::Data::V1beta::FilterExpression, ::Hash]
|
210
|
+
# The filter clause of metrics. Applied after aggregating the report's rows,
|
211
|
+
# similar to SQL having-clause. Dimensions cannot be used in this filter.
|
212
|
+
# @param offset [::Integer]
|
213
|
+
# The row count of the start row. The first row is counted as row 0.
|
214
|
+
#
|
215
|
+
# When paging, the first request does not specify offset; or equivalently,
|
216
|
+
# sets offset to 0; the first request returns the first `limit` of rows. The
|
217
|
+
# second request sets offset to the `limit` of the first request; the second
|
218
|
+
# request returns the second `limit` of rows.
|
219
|
+
#
|
220
|
+
# To learn more about this pagination parameter, see
|
221
|
+
# [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
|
222
|
+
# @param limit [::Integer]
|
223
|
+
# The number of rows to return. If unspecified, 10,000 rows are returned. The
|
224
|
+
# API returns a maximum of 100,000 rows per request, no matter how many you
|
225
|
+
# ask for. `limit` must be positive.
|
226
|
+
#
|
227
|
+
# The API can also return fewer rows than the requested `limit`, if there
|
228
|
+
# aren't as many dimension values as the `limit`. For instance, there are
|
229
|
+
# fewer than 300 possible values for the dimension `country`, so when
|
230
|
+
# reporting on only `country`, you can't get more than 300 rows, even if you
|
231
|
+
# set `limit` to a higher value.
|
232
|
+
#
|
233
|
+
# To learn more about this pagination parameter, see
|
234
|
+
# [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
|
235
|
+
# @param metric_aggregations [::Array<::Google::Analytics::Data::V1beta::MetricAggregation>]
|
236
|
+
# Aggregation of metrics. Aggregated metric values will be shown in rows
|
237
|
+
# where the dimension_values are set to "RESERVED_(MetricAggregation)".
|
238
|
+
# @param order_bys [::Array<::Google::Analytics::Data::V1beta::OrderBy, ::Hash>]
|
239
|
+
# Specifies how rows are ordered in the response.
|
240
|
+
# @param currency_code [::String]
|
241
|
+
# A currency code in ISO4217 format, such as "AED", "USD", "JPY".
|
242
|
+
# If the field is empty, the report uses the property's default currency.
|
243
|
+
# @param cohort_spec [::Google::Analytics::Data::V1beta::CohortSpec, ::Hash]
|
244
|
+
# Cohort group associated with this request. If there is a cohort group
|
245
|
+
# in the request the 'cohort' dimension must be present.
|
246
|
+
# @param keep_empty_rows [::Boolean]
|
247
|
+
# If false or unspecified, each row with all metrics equal to 0 will not be
|
248
|
+
# returned. If true, these rows will be returned if they are not separately
|
249
|
+
# removed by a filter.
|
250
|
+
# @param return_property_quota [::Boolean]
|
251
|
+
# Toggles whether to return the current state of this Analytics Property's
|
252
|
+
# quota. Quota is returned in [PropertyQuota](#PropertyQuota).
|
253
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
254
|
+
# @yieldparam result [::Google::Analytics::Data::V1beta::RunReportResponse]
|
255
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
256
|
+
#
|
257
|
+
# @return [::Google::Analytics::Data::V1beta::RunReportResponse]
|
258
|
+
#
|
259
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
260
|
+
def run_report request, options = nil
|
261
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
262
|
+
|
263
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::RunReportRequest
|
264
|
+
|
265
|
+
# Converts hash and nil to an options object
|
266
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
267
|
+
|
268
|
+
# Customize the options with defaults
|
269
|
+
call_metadata = @config.rpcs.run_report.metadata.to_h
|
270
|
+
|
271
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
272
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
273
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
274
|
+
gapic_version: ::Google::Analytics::Data::V1beta::VERSION,
|
275
|
+
transports_version_send: [:rest]
|
276
|
+
|
277
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
278
|
+
|
279
|
+
options.apply_defaults timeout: @config.rpcs.run_report.timeout,
|
280
|
+
metadata: call_metadata,
|
281
|
+
retry_policy: @config.rpcs.run_report.retry_policy
|
282
|
+
|
283
|
+
options.apply_defaults timeout: @config.timeout,
|
284
|
+
metadata: @config.metadata,
|
285
|
+
retry_policy: @config.retry_policy
|
286
|
+
|
287
|
+
@analytics_data_stub.run_report request, options do |result, operation|
|
288
|
+
yield result, operation if block_given?
|
289
|
+
return result
|
290
|
+
end
|
291
|
+
rescue ::Gapic::Rest::Error => e
|
292
|
+
raise ::Google::Cloud::Error.from_error(e)
|
293
|
+
end
|
294
|
+
|
295
|
+
##
|
296
|
+
# Returns a customized pivot report of your Google Analytics event data.
|
297
|
+
# Pivot reports are more advanced and expressive formats than regular
|
298
|
+
# reports. In a pivot report, dimensions are only visible if they are
|
299
|
+
# included in a pivot. Multiple pivots can be specified to further dissect
|
300
|
+
# your data.
|
301
|
+
#
|
302
|
+
# @overload run_pivot_report(request, options = nil)
|
303
|
+
# Pass arguments to `run_pivot_report` via a request object, either of type
|
304
|
+
# {::Google::Analytics::Data::V1beta::RunPivotReportRequest} or an equivalent Hash.
|
305
|
+
#
|
306
|
+
# @param request [::Google::Analytics::Data::V1beta::RunPivotReportRequest, ::Hash]
|
307
|
+
# A request object representing the call parameters. Required. To specify no
|
308
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
309
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
310
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
311
|
+
#
|
312
|
+
# @overload run_pivot_report(property: nil, dimensions: nil, metrics: nil, date_ranges: nil, pivots: nil, dimension_filter: nil, metric_filter: nil, currency_code: nil, cohort_spec: nil, keep_empty_rows: nil, return_property_quota: nil)
|
313
|
+
# Pass arguments to `run_pivot_report` via keyword arguments. Note that at
|
314
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
315
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
316
|
+
#
|
317
|
+
# @param property [::String]
|
318
|
+
# A Google Analytics GA4 property identifier whose events are tracked.
|
319
|
+
# Specified in the URL path and not the body. To learn more, see [where to
|
320
|
+
# find your Property
|
321
|
+
# ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
|
322
|
+
# Within a batch request, this property should either be unspecified or
|
323
|
+
# consistent with the batch-level property.
|
324
|
+
#
|
325
|
+
# Example: properties/1234
|
326
|
+
# @param dimensions [::Array<::Google::Analytics::Data::V1beta::Dimension, ::Hash>]
|
327
|
+
# The dimensions requested. All defined dimensions must be used by one of the
|
328
|
+
# following: dimension_expression, dimension_filter, pivots, order_bys.
|
329
|
+
# @param metrics [::Array<::Google::Analytics::Data::V1beta::Metric, ::Hash>]
|
330
|
+
# The metrics requested, at least one metric needs to be specified. All
|
331
|
+
# defined metrics must be used by one of the following: metric_expression,
|
332
|
+
# metric_filter, order_bys.
|
333
|
+
# @param date_ranges [::Array<::Google::Analytics::Data::V1beta::DateRange, ::Hash>]
|
334
|
+
# The date range to retrieve event data for the report. If multiple date
|
335
|
+
# ranges are specified, event data from each date range is used in the
|
336
|
+
# report. A special dimension with field name "dateRange" can be included in
|
337
|
+
# a Pivot's field names; if included, the report compares between date
|
338
|
+
# ranges. In a cohort request, this `dateRanges` must be unspecified.
|
339
|
+
# @param pivots [::Array<::Google::Analytics::Data::V1beta::Pivot, ::Hash>]
|
340
|
+
# Describes the visual format of the report's dimensions in columns or rows.
|
341
|
+
# The union of the fieldNames (dimension names) in all pivots must be a
|
342
|
+
# subset of dimension names defined in Dimensions. No two pivots can share a
|
343
|
+
# dimension. A dimension is only visible if it appears in a pivot.
|
344
|
+
# @param dimension_filter [::Google::Analytics::Data::V1beta::FilterExpression, ::Hash]
|
345
|
+
# The filter clause of dimensions. Dimensions must be requested to be used in
|
346
|
+
# this filter. Metrics cannot be used in this filter.
|
347
|
+
# @param metric_filter [::Google::Analytics::Data::V1beta::FilterExpression, ::Hash]
|
348
|
+
# The filter clause of metrics. Applied at post aggregation phase, similar to
|
349
|
+
# SQL having-clause. Metrics must be requested to be used in this filter.
|
350
|
+
# Dimensions cannot be used in this filter.
|
351
|
+
# @param currency_code [::String]
|
352
|
+
# A currency code in ISO4217 format, such as "AED", "USD", "JPY".
|
353
|
+
# If the field is empty, the report uses the property's default currency.
|
354
|
+
# @param cohort_spec [::Google::Analytics::Data::V1beta::CohortSpec, ::Hash]
|
355
|
+
# Cohort group associated with this request. If there is a cohort group
|
356
|
+
# in the request the 'cohort' dimension must be present.
|
357
|
+
# @param keep_empty_rows [::Boolean]
|
358
|
+
# If false or unspecified, each row with all metrics equal to 0 will not be
|
359
|
+
# returned. If true, these rows will be returned if they are not separately
|
360
|
+
# removed by a filter.
|
361
|
+
# @param return_property_quota [::Boolean]
|
362
|
+
# Toggles whether to return the current state of this Analytics Property's
|
363
|
+
# quota. Quota is returned in [PropertyQuota](#PropertyQuota).
|
364
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
365
|
+
# @yieldparam result [::Google::Analytics::Data::V1beta::RunPivotReportResponse]
|
366
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
367
|
+
#
|
368
|
+
# @return [::Google::Analytics::Data::V1beta::RunPivotReportResponse]
|
369
|
+
#
|
370
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
371
|
+
def run_pivot_report request, options = nil
|
372
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
373
|
+
|
374
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::RunPivotReportRequest
|
375
|
+
|
376
|
+
# Converts hash and nil to an options object
|
377
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
378
|
+
|
379
|
+
# Customize the options with defaults
|
380
|
+
call_metadata = @config.rpcs.run_pivot_report.metadata.to_h
|
381
|
+
|
382
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
383
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
384
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
385
|
+
gapic_version: ::Google::Analytics::Data::V1beta::VERSION,
|
386
|
+
transports_version_send: [:rest]
|
387
|
+
|
388
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
389
|
+
|
390
|
+
options.apply_defaults timeout: @config.rpcs.run_pivot_report.timeout,
|
391
|
+
metadata: call_metadata,
|
392
|
+
retry_policy: @config.rpcs.run_pivot_report.retry_policy
|
393
|
+
|
394
|
+
options.apply_defaults timeout: @config.timeout,
|
395
|
+
metadata: @config.metadata,
|
396
|
+
retry_policy: @config.retry_policy
|
397
|
+
|
398
|
+
@analytics_data_stub.run_pivot_report request, options do |result, operation|
|
399
|
+
yield result, operation if block_given?
|
400
|
+
return result
|
401
|
+
end
|
402
|
+
rescue ::Gapic::Rest::Error => e
|
403
|
+
raise ::Google::Cloud::Error.from_error(e)
|
404
|
+
end
|
405
|
+
|
406
|
+
##
|
407
|
+
# Returns multiple reports in a batch. All reports must be for the same
|
408
|
+
# GA4 Property.
|
409
|
+
#
|
410
|
+
# @overload batch_run_reports(request, options = nil)
|
411
|
+
# Pass arguments to `batch_run_reports` via a request object, either of type
|
412
|
+
# {::Google::Analytics::Data::V1beta::BatchRunReportsRequest} or an equivalent Hash.
|
413
|
+
#
|
414
|
+
# @param request [::Google::Analytics::Data::V1beta::BatchRunReportsRequest, ::Hash]
|
415
|
+
# A request object representing the call parameters. Required. To specify no
|
416
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
417
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
418
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
419
|
+
#
|
420
|
+
# @overload batch_run_reports(property: nil, requests: nil)
|
421
|
+
# Pass arguments to `batch_run_reports` via keyword arguments. Note that at
|
422
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
423
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
424
|
+
#
|
425
|
+
# @param property [::String]
|
426
|
+
# A Google Analytics GA4 property identifier whose events are tracked.
|
427
|
+
# Specified in the URL path and not the body. To learn more, see [where to
|
428
|
+
# find your Property
|
429
|
+
# ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
|
430
|
+
# This property must be specified for the batch. The property within
|
431
|
+
# RunReportRequest may either be unspecified or consistent with this
|
432
|
+
# property.
|
433
|
+
#
|
434
|
+
# Example: properties/1234
|
435
|
+
# @param requests [::Array<::Google::Analytics::Data::V1beta::RunReportRequest, ::Hash>]
|
436
|
+
# Individual requests. Each request has a separate report response. Each
|
437
|
+
# batch request is allowed up to 5 requests.
|
438
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
439
|
+
# @yieldparam result [::Google::Analytics::Data::V1beta::BatchRunReportsResponse]
|
440
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
441
|
+
#
|
442
|
+
# @return [::Google::Analytics::Data::V1beta::BatchRunReportsResponse]
|
443
|
+
#
|
444
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
445
|
+
def batch_run_reports request, options = nil
|
446
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
447
|
+
|
448
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::BatchRunReportsRequest
|
449
|
+
|
450
|
+
# Converts hash and nil to an options object
|
451
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
452
|
+
|
453
|
+
# Customize the options with defaults
|
454
|
+
call_metadata = @config.rpcs.batch_run_reports.metadata.to_h
|
455
|
+
|
456
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
457
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
458
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
459
|
+
gapic_version: ::Google::Analytics::Data::V1beta::VERSION,
|
460
|
+
transports_version_send: [:rest]
|
461
|
+
|
462
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
463
|
+
|
464
|
+
options.apply_defaults timeout: @config.rpcs.batch_run_reports.timeout,
|
465
|
+
metadata: call_metadata,
|
466
|
+
retry_policy: @config.rpcs.batch_run_reports.retry_policy
|
467
|
+
|
468
|
+
options.apply_defaults timeout: @config.timeout,
|
469
|
+
metadata: @config.metadata,
|
470
|
+
retry_policy: @config.retry_policy
|
471
|
+
|
472
|
+
@analytics_data_stub.batch_run_reports request, options do |result, operation|
|
473
|
+
yield result, operation if block_given?
|
474
|
+
return result
|
475
|
+
end
|
476
|
+
rescue ::Gapic::Rest::Error => e
|
477
|
+
raise ::Google::Cloud::Error.from_error(e)
|
478
|
+
end
|
479
|
+
|
480
|
+
##
|
481
|
+
# Returns multiple pivot reports in a batch. All reports must be for the same
|
482
|
+
# GA4 Property.
|
483
|
+
#
|
484
|
+
# @overload batch_run_pivot_reports(request, options = nil)
|
485
|
+
# Pass arguments to `batch_run_pivot_reports` via a request object, either of type
|
486
|
+
# {::Google::Analytics::Data::V1beta::BatchRunPivotReportsRequest} or an equivalent Hash.
|
487
|
+
#
|
488
|
+
# @param request [::Google::Analytics::Data::V1beta::BatchRunPivotReportsRequest, ::Hash]
|
489
|
+
# A request object representing the call parameters. Required. To specify no
|
490
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
491
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
492
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
493
|
+
#
|
494
|
+
# @overload batch_run_pivot_reports(property: nil, requests: nil)
|
495
|
+
# Pass arguments to `batch_run_pivot_reports` via keyword arguments. Note that at
|
496
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
497
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
498
|
+
#
|
499
|
+
# @param property [::String]
|
500
|
+
# A Google Analytics GA4 property identifier whose events are tracked.
|
501
|
+
# Specified in the URL path and not the body. To learn more, see [where to
|
502
|
+
# find your Property
|
503
|
+
# ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
|
504
|
+
# This property must be specified for the batch. The property within
|
505
|
+
# RunPivotReportRequest may either be unspecified or consistent with this
|
506
|
+
# property.
|
507
|
+
#
|
508
|
+
# Example: properties/1234
|
509
|
+
# @param requests [::Array<::Google::Analytics::Data::V1beta::RunPivotReportRequest, ::Hash>]
|
510
|
+
# Individual requests. Each request has a separate pivot report response.
|
511
|
+
# Each batch request is allowed up to 5 requests.
|
512
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
513
|
+
# @yieldparam result [::Google::Analytics::Data::V1beta::BatchRunPivotReportsResponse]
|
514
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
515
|
+
#
|
516
|
+
# @return [::Google::Analytics::Data::V1beta::BatchRunPivotReportsResponse]
|
517
|
+
#
|
518
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
519
|
+
def batch_run_pivot_reports request, options = nil
|
520
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
521
|
+
|
522
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::BatchRunPivotReportsRequest
|
523
|
+
|
524
|
+
# Converts hash and nil to an options object
|
525
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
526
|
+
|
527
|
+
# Customize the options with defaults
|
528
|
+
call_metadata = @config.rpcs.batch_run_pivot_reports.metadata.to_h
|
529
|
+
|
530
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
531
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
532
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
533
|
+
gapic_version: ::Google::Analytics::Data::V1beta::VERSION,
|
534
|
+
transports_version_send: [:rest]
|
535
|
+
|
536
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
537
|
+
|
538
|
+
options.apply_defaults timeout: @config.rpcs.batch_run_pivot_reports.timeout,
|
539
|
+
metadata: call_metadata,
|
540
|
+
retry_policy: @config.rpcs.batch_run_pivot_reports.retry_policy
|
541
|
+
|
542
|
+
options.apply_defaults timeout: @config.timeout,
|
543
|
+
metadata: @config.metadata,
|
544
|
+
retry_policy: @config.retry_policy
|
545
|
+
|
546
|
+
@analytics_data_stub.batch_run_pivot_reports request, options do |result, operation|
|
547
|
+
yield result, operation if block_given?
|
548
|
+
return result
|
549
|
+
end
|
550
|
+
rescue ::Gapic::Rest::Error => e
|
551
|
+
raise ::Google::Cloud::Error.from_error(e)
|
552
|
+
end
|
553
|
+
|
554
|
+
##
|
555
|
+
# Returns metadata for dimensions and metrics available in reporting methods.
|
556
|
+
# Used to explore the dimensions and metrics. In this method, a Google
|
557
|
+
# Analytics GA4 Property Identifier is specified in the request, and
|
558
|
+
# the metadata response includes Custom dimensions and metrics as well as
|
559
|
+
# Universal metadata.
|
560
|
+
#
|
561
|
+
# For example if a custom metric with parameter name `levels_unlocked` is
|
562
|
+
# registered to a property, the Metadata response will contain
|
563
|
+
# `customEvent:levels_unlocked`. Universal metadata are dimensions and
|
564
|
+
# metrics applicable to any property such as `country` and `totalUsers`.
|
565
|
+
#
|
566
|
+
# @overload get_metadata(request, options = nil)
|
567
|
+
# Pass arguments to `get_metadata` via a request object, either of type
|
568
|
+
# {::Google::Analytics::Data::V1beta::GetMetadataRequest} or an equivalent Hash.
|
569
|
+
#
|
570
|
+
# @param request [::Google::Analytics::Data::V1beta::GetMetadataRequest, ::Hash]
|
571
|
+
# A request object representing the call parameters. Required. To specify no
|
572
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
573
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
574
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
575
|
+
#
|
576
|
+
# @overload get_metadata(name: nil)
|
577
|
+
# Pass arguments to `get_metadata` via keyword arguments. Note that at
|
578
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
579
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
580
|
+
#
|
581
|
+
# @param name [::String]
|
582
|
+
# Required. The resource name of the metadata to retrieve. This name field is
|
583
|
+
# specified in the URL path and not URL parameters. Property is a numeric
|
584
|
+
# Google Analytics GA4 Property identifier. To learn more, see [where to find
|
585
|
+
# your Property
|
586
|
+
# ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
|
587
|
+
#
|
588
|
+
# Example: properties/1234/metadata
|
589
|
+
#
|
590
|
+
# Set the Property ID to 0 for dimensions and metrics common to all
|
591
|
+
# properties. In this special mode, this method will not return custom
|
592
|
+
# dimensions and metrics.
|
593
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
594
|
+
# @yieldparam result [::Google::Analytics::Data::V1beta::Metadata]
|
595
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
596
|
+
#
|
597
|
+
# @return [::Google::Analytics::Data::V1beta::Metadata]
|
598
|
+
#
|
599
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
600
|
+
def get_metadata request, options = nil
|
601
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
602
|
+
|
603
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::GetMetadataRequest
|
604
|
+
|
605
|
+
# Converts hash and nil to an options object
|
606
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
607
|
+
|
608
|
+
# Customize the options with defaults
|
609
|
+
call_metadata = @config.rpcs.get_metadata.metadata.to_h
|
610
|
+
|
611
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
612
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
613
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
614
|
+
gapic_version: ::Google::Analytics::Data::V1beta::VERSION,
|
615
|
+
transports_version_send: [:rest]
|
616
|
+
|
617
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
618
|
+
|
619
|
+
options.apply_defaults timeout: @config.rpcs.get_metadata.timeout,
|
620
|
+
metadata: call_metadata,
|
621
|
+
retry_policy: @config.rpcs.get_metadata.retry_policy
|
622
|
+
|
623
|
+
options.apply_defaults timeout: @config.timeout,
|
624
|
+
metadata: @config.metadata,
|
625
|
+
retry_policy: @config.retry_policy
|
626
|
+
|
627
|
+
@analytics_data_stub.get_metadata request, options do |result, operation|
|
628
|
+
yield result, operation if block_given?
|
629
|
+
return result
|
630
|
+
end
|
631
|
+
rescue ::Gapic::Rest::Error => e
|
632
|
+
raise ::Google::Cloud::Error.from_error(e)
|
633
|
+
end
|
634
|
+
|
635
|
+
##
|
636
|
+
# Returns a customized report of realtime event data for your property.
|
637
|
+
# Events appear in realtime reports seconds after they have been sent to
|
638
|
+
# the Google Analytics. Realtime reports show events and usage data for the
|
639
|
+
# periods of time ranging from the present moment to 30 minutes ago (up to
|
640
|
+
# 60 minutes for Google Analytics 360 properties).
|
641
|
+
#
|
642
|
+
# For a guide to constructing realtime requests & understanding responses,
|
643
|
+
# see [Creating a Realtime
|
644
|
+
# Report](https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-basics).
|
645
|
+
#
|
646
|
+
# @overload run_realtime_report(request, options = nil)
|
647
|
+
# Pass arguments to `run_realtime_report` via a request object, either of type
|
648
|
+
# {::Google::Analytics::Data::V1beta::RunRealtimeReportRequest} or an equivalent Hash.
|
649
|
+
#
|
650
|
+
# @param request [::Google::Analytics::Data::V1beta::RunRealtimeReportRequest, ::Hash]
|
651
|
+
# A request object representing the call parameters. Required. To specify no
|
652
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
653
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
654
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
655
|
+
#
|
656
|
+
# @overload run_realtime_report(property: nil, dimensions: nil, metrics: nil, dimension_filter: nil, metric_filter: nil, limit: nil, metric_aggregations: nil, order_bys: nil, return_property_quota: nil, minute_ranges: nil)
|
657
|
+
# Pass arguments to `run_realtime_report` via keyword arguments. Note that at
|
658
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
659
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
660
|
+
#
|
661
|
+
# @param property [::String]
|
662
|
+
# A Google Analytics GA4 property identifier whose events are tracked.
|
663
|
+
# Specified in the URL path and not the body. To learn more, see [where to
|
664
|
+
# find your Property
|
665
|
+
# ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
|
666
|
+
#
|
667
|
+
# Example: properties/1234
|
668
|
+
# @param dimensions [::Array<::Google::Analytics::Data::V1beta::Dimension, ::Hash>]
|
669
|
+
# The dimensions requested and displayed.
|
670
|
+
# @param metrics [::Array<::Google::Analytics::Data::V1beta::Metric, ::Hash>]
|
671
|
+
# The metrics requested and displayed.
|
672
|
+
# @param dimension_filter [::Google::Analytics::Data::V1beta::FilterExpression, ::Hash]
|
673
|
+
# The filter clause of dimensions. Metrics cannot be used in this filter.
|
674
|
+
# @param metric_filter [::Google::Analytics::Data::V1beta::FilterExpression, ::Hash]
|
675
|
+
# The filter clause of metrics. Applied at post aggregation phase, similar to
|
676
|
+
# SQL having-clause. Dimensions cannot be used in this filter.
|
677
|
+
# @param limit [::Integer]
|
678
|
+
# The number of rows to return. If unspecified, 10,000 rows are returned. The
|
679
|
+
# API returns a maximum of 100,000 rows per request, no matter how many you
|
680
|
+
# ask for. `limit` must be positive.
|
681
|
+
#
|
682
|
+
# The API can also return fewer rows than the requested `limit`, if there
|
683
|
+
# aren't as many dimension values as the `limit`. For instance, there are
|
684
|
+
# fewer than 300 possible values for the dimension `country`, so when
|
685
|
+
# reporting on only `country`, you can't get more than 300 rows, even if you
|
686
|
+
# set `limit` to a higher value.
|
687
|
+
# @param metric_aggregations [::Array<::Google::Analytics::Data::V1beta::MetricAggregation>]
|
688
|
+
# Aggregation of metrics. Aggregated metric values will be shown in rows
|
689
|
+
# where the dimension_values are set to "RESERVED_(MetricAggregation)".
|
690
|
+
# @param order_bys [::Array<::Google::Analytics::Data::V1beta::OrderBy, ::Hash>]
|
691
|
+
# Specifies how rows are ordered in the response.
|
692
|
+
# @param return_property_quota [::Boolean]
|
693
|
+
# Toggles whether to return the current state of this Analytics Property's
|
694
|
+
# Realtime quota. Quota is returned in [PropertyQuota](#PropertyQuota).
|
695
|
+
# @param minute_ranges [::Array<::Google::Analytics::Data::V1beta::MinuteRange, ::Hash>]
|
696
|
+
# The minute ranges of event data to read. If unspecified, one minute range
|
697
|
+
# for the last 30 minutes will be used. If multiple minute ranges are
|
698
|
+
# requested, each response row will contain a zero based minute range index.
|
699
|
+
# If two minute ranges overlap, the event data for the overlapping minutes is
|
700
|
+
# included in the response rows for both minute ranges.
|
701
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
702
|
+
# @yieldparam result [::Google::Analytics::Data::V1beta::RunRealtimeReportResponse]
|
703
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
704
|
+
#
|
705
|
+
# @return [::Google::Analytics::Data::V1beta::RunRealtimeReportResponse]
|
706
|
+
#
|
707
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
708
|
+
def run_realtime_report request, options = nil
|
709
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
710
|
+
|
711
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::RunRealtimeReportRequest
|
712
|
+
|
713
|
+
# Converts hash and nil to an options object
|
714
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
715
|
+
|
716
|
+
# Customize the options with defaults
|
717
|
+
call_metadata = @config.rpcs.run_realtime_report.metadata.to_h
|
718
|
+
|
719
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
720
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
721
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
722
|
+
gapic_version: ::Google::Analytics::Data::V1beta::VERSION,
|
723
|
+
transports_version_send: [:rest]
|
724
|
+
|
725
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
726
|
+
|
727
|
+
options.apply_defaults timeout: @config.rpcs.run_realtime_report.timeout,
|
728
|
+
metadata: call_metadata,
|
729
|
+
retry_policy: @config.rpcs.run_realtime_report.retry_policy
|
730
|
+
|
731
|
+
options.apply_defaults timeout: @config.timeout,
|
732
|
+
metadata: @config.metadata,
|
733
|
+
retry_policy: @config.retry_policy
|
734
|
+
|
735
|
+
@analytics_data_stub.run_realtime_report request, options do |result, operation|
|
736
|
+
yield result, operation if block_given?
|
737
|
+
return result
|
738
|
+
end
|
739
|
+
rescue ::Gapic::Rest::Error => e
|
740
|
+
raise ::Google::Cloud::Error.from_error(e)
|
741
|
+
end
|
742
|
+
|
743
|
+
##
|
744
|
+
# This compatibility method lists dimensions and metrics that can be added to
|
745
|
+
# a report request and maintain compatibility. This method fails if the
|
746
|
+
# request's dimensions and metrics are incompatible.
|
747
|
+
#
|
748
|
+
# In Google Analytics, reports fail if they request incompatible dimensions
|
749
|
+
# and/or metrics; in that case, you will need to remove dimensions and/or
|
750
|
+
# metrics from the incompatible report until the report is compatible.
|
751
|
+
#
|
752
|
+
# The Realtime and Core reports have different compatibility rules. This
|
753
|
+
# method checks compatibility for Core reports.
|
754
|
+
#
|
755
|
+
# @overload check_compatibility(request, options = nil)
|
756
|
+
# Pass arguments to `check_compatibility` via a request object, either of type
|
757
|
+
# {::Google::Analytics::Data::V1beta::CheckCompatibilityRequest} or an equivalent Hash.
|
758
|
+
#
|
759
|
+
# @param request [::Google::Analytics::Data::V1beta::CheckCompatibilityRequest, ::Hash]
|
760
|
+
# A request object representing the call parameters. Required. To specify no
|
761
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
762
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
763
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
764
|
+
#
|
765
|
+
# @overload check_compatibility(property: nil, dimensions: nil, metrics: nil, dimension_filter: nil, metric_filter: nil, compatibility_filter: nil)
|
766
|
+
# Pass arguments to `check_compatibility` via keyword arguments. Note that at
|
767
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
768
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
769
|
+
#
|
770
|
+
# @param property [::String]
|
771
|
+
# A Google Analytics GA4 property identifier whose events are tracked. To
|
772
|
+
# learn more, see [where to find your Property
|
773
|
+
# ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
|
774
|
+
# `property` should be the same value as in your `runReport` request.
|
775
|
+
#
|
776
|
+
# Example: properties/1234
|
777
|
+
#
|
778
|
+
# Set the Property ID to 0 for compatibility checking on dimensions and
|
779
|
+
# metrics common to all properties. In this special mode, this method will
|
780
|
+
# not return custom dimensions and metrics.
|
781
|
+
# @param dimensions [::Array<::Google::Analytics::Data::V1beta::Dimension, ::Hash>]
|
782
|
+
# The dimensions in this report. `dimensions` should be the same value as in
|
783
|
+
# your `runReport` request.
|
784
|
+
# @param metrics [::Array<::Google::Analytics::Data::V1beta::Metric, ::Hash>]
|
785
|
+
# The metrics in this report. `metrics` should be the same value as in your
|
786
|
+
# `runReport` request.
|
787
|
+
# @param dimension_filter [::Google::Analytics::Data::V1beta::FilterExpression, ::Hash]
|
788
|
+
# The filter clause of dimensions. `dimensionFilter` should be the same value
|
789
|
+
# as in your `runReport` request.
|
790
|
+
# @param metric_filter [::Google::Analytics::Data::V1beta::FilterExpression, ::Hash]
|
791
|
+
# The filter clause of metrics. `metricFilter` should be the same value as in
|
792
|
+
# your `runReport` request
|
793
|
+
# @param compatibility_filter [::Google::Analytics::Data::V1beta::Compatibility]
|
794
|
+
# Filters the dimensions and metrics in the response to just this
|
795
|
+
# compatibility. Commonly used as `”compatibilityFilter”: “COMPATIBLE”`
|
796
|
+
# to only return compatible dimensions & metrics.
|
797
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
798
|
+
# @yieldparam result [::Google::Analytics::Data::V1beta::CheckCompatibilityResponse]
|
799
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
800
|
+
#
|
801
|
+
# @return [::Google::Analytics::Data::V1beta::CheckCompatibilityResponse]
|
802
|
+
#
|
803
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
804
|
+
def check_compatibility request, options = nil
|
805
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
806
|
+
|
807
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::CheckCompatibilityRequest
|
808
|
+
|
809
|
+
# Converts hash and nil to an options object
|
810
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
811
|
+
|
812
|
+
# Customize the options with defaults
|
813
|
+
call_metadata = @config.rpcs.check_compatibility.metadata.to_h
|
814
|
+
|
815
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
816
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
817
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
818
|
+
gapic_version: ::Google::Analytics::Data::V1beta::VERSION,
|
819
|
+
transports_version_send: [:rest]
|
820
|
+
|
821
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
822
|
+
|
823
|
+
options.apply_defaults timeout: @config.rpcs.check_compatibility.timeout,
|
824
|
+
metadata: call_metadata,
|
825
|
+
retry_policy: @config.rpcs.check_compatibility.retry_policy
|
826
|
+
|
827
|
+
options.apply_defaults timeout: @config.timeout,
|
828
|
+
metadata: @config.metadata,
|
829
|
+
retry_policy: @config.retry_policy
|
830
|
+
|
831
|
+
@analytics_data_stub.check_compatibility request, options do |result, operation|
|
832
|
+
yield result, operation if block_given?
|
833
|
+
return result
|
834
|
+
end
|
835
|
+
rescue ::Gapic::Rest::Error => e
|
836
|
+
raise ::Google::Cloud::Error.from_error(e)
|
837
|
+
end
|
838
|
+
|
839
|
+
##
|
840
|
+
# Configuration class for the AnalyticsData REST API.
|
841
|
+
#
|
842
|
+
# This class represents the configuration for AnalyticsData REST,
|
843
|
+
# providing control over timeouts, retry behavior, logging, transport
|
844
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
845
|
+
# applied individually to specific RPCs. See
|
846
|
+
# {::Google::Analytics::Data::V1beta::AnalyticsData::Rest::Client::Configuration::Rpcs}
|
847
|
+
# for a list of RPCs that can be configured independently.
|
848
|
+
#
|
849
|
+
# Configuration can be applied globally to all clients, or to a single client
|
850
|
+
# on construction.
|
851
|
+
#
|
852
|
+
# @example
|
853
|
+
#
|
854
|
+
# # Modify the global config, setting the timeout for
|
855
|
+
# # run_report to 20 seconds,
|
856
|
+
# # and all remaining timeouts to 10 seconds.
|
857
|
+
# ::Google::Analytics::Data::V1beta::AnalyticsData::Rest::Client.configure do |config|
|
858
|
+
# config.timeout = 10.0
|
859
|
+
# config.rpcs.run_report.timeout = 20.0
|
860
|
+
# end
|
861
|
+
#
|
862
|
+
# # Apply the above configuration only to a new client.
|
863
|
+
# client = ::Google::Analytics::Data::V1beta::AnalyticsData::Rest::Client.new do |config|
|
864
|
+
# config.timeout = 10.0
|
865
|
+
# config.rpcs.run_report.timeout = 20.0
|
866
|
+
# end
|
867
|
+
#
|
868
|
+
# @!attribute [rw] endpoint
|
869
|
+
# The hostname or hostname:port of the service endpoint.
|
870
|
+
# Defaults to `"analyticsdata.googleapis.com"`.
|
871
|
+
# @return [::String]
|
872
|
+
# @!attribute [rw] credentials
|
873
|
+
# Credentials to send with calls. You may provide any of the following types:
|
874
|
+
# * (`String`) The path to a service account key file in JSON format
|
875
|
+
# * (`Hash`) A service account key as a Hash
|
876
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
877
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
878
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
879
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
880
|
+
# * (`nil`) indicating no credentials
|
881
|
+
# @return [::Object]
|
882
|
+
# @!attribute [rw] scope
|
883
|
+
# The OAuth scopes
|
884
|
+
# @return [::Array<::String>]
|
885
|
+
# @!attribute [rw] lib_name
|
886
|
+
# The library name as recorded in instrumentation and logging
|
887
|
+
# @return [::String]
|
888
|
+
# @!attribute [rw] lib_version
|
889
|
+
# The library version as recorded in instrumentation and logging
|
890
|
+
# @return [::String]
|
891
|
+
# @!attribute [rw] timeout
|
892
|
+
# The call timeout in seconds.
|
893
|
+
# @return [::Numeric]
|
894
|
+
# @!attribute [rw] metadata
|
895
|
+
# Additional headers to be sent with the call.
|
896
|
+
# @return [::Hash{::Symbol=>::String}]
|
897
|
+
# @!attribute [rw] retry_policy
|
898
|
+
# The retry policy. The value is a hash with the following keys:
|
899
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
900
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
901
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
902
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
903
|
+
# trigger a retry.
|
904
|
+
# @return [::Hash]
|
905
|
+
# @!attribute [rw] quota_project
|
906
|
+
# A separate project against which to charge quota.
|
907
|
+
# @return [::String]
|
908
|
+
#
|
909
|
+
class Configuration
|
910
|
+
extend ::Gapic::Config
|
911
|
+
|
912
|
+
config_attr :endpoint, "analyticsdata.googleapis.com", ::String
|
913
|
+
config_attr :credentials, nil do |value|
|
914
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
915
|
+
allowed.any? { |klass| klass === value }
|
916
|
+
end
|
917
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
918
|
+
config_attr :lib_name, nil, ::String, nil
|
919
|
+
config_attr :lib_version, nil, ::String, nil
|
920
|
+
config_attr :timeout, nil, ::Numeric, nil
|
921
|
+
config_attr :metadata, nil, ::Hash, nil
|
922
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
923
|
+
config_attr :quota_project, nil, ::String, nil
|
924
|
+
|
925
|
+
# @private
|
926
|
+
def initialize parent_config = nil
|
927
|
+
@parent_config = parent_config unless parent_config.nil?
|
928
|
+
|
929
|
+
yield self if block_given?
|
930
|
+
end
|
931
|
+
|
932
|
+
##
|
933
|
+
# Configurations for individual RPCs
|
934
|
+
# @return [Rpcs]
|
935
|
+
#
|
936
|
+
def rpcs
|
937
|
+
@rpcs ||= begin
|
938
|
+
parent_rpcs = nil
|
939
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
940
|
+
Rpcs.new parent_rpcs
|
941
|
+
end
|
942
|
+
end
|
943
|
+
|
944
|
+
##
|
945
|
+
# Configuration RPC class for the AnalyticsData API.
|
946
|
+
#
|
947
|
+
# Includes fields providing the configuration for each RPC in this service.
|
948
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
949
|
+
# the following configuration fields:
|
950
|
+
#
|
951
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
952
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
953
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
954
|
+
# include the following keys:
|
955
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
956
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
957
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
958
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
959
|
+
# trigger a retry.
|
960
|
+
#
|
961
|
+
class Rpcs
|
962
|
+
##
|
963
|
+
# RPC-specific configuration for `run_report`
|
964
|
+
# @return [::Gapic::Config::Method]
|
965
|
+
#
|
966
|
+
attr_reader :run_report
|
967
|
+
##
|
968
|
+
# RPC-specific configuration for `run_pivot_report`
|
969
|
+
# @return [::Gapic::Config::Method]
|
970
|
+
#
|
971
|
+
attr_reader :run_pivot_report
|
972
|
+
##
|
973
|
+
# RPC-specific configuration for `batch_run_reports`
|
974
|
+
# @return [::Gapic::Config::Method]
|
975
|
+
#
|
976
|
+
attr_reader :batch_run_reports
|
977
|
+
##
|
978
|
+
# RPC-specific configuration for `batch_run_pivot_reports`
|
979
|
+
# @return [::Gapic::Config::Method]
|
980
|
+
#
|
981
|
+
attr_reader :batch_run_pivot_reports
|
982
|
+
##
|
983
|
+
# RPC-specific configuration for `get_metadata`
|
984
|
+
# @return [::Gapic::Config::Method]
|
985
|
+
#
|
986
|
+
attr_reader :get_metadata
|
987
|
+
##
|
988
|
+
# RPC-specific configuration for `run_realtime_report`
|
989
|
+
# @return [::Gapic::Config::Method]
|
990
|
+
#
|
991
|
+
attr_reader :run_realtime_report
|
992
|
+
##
|
993
|
+
# RPC-specific configuration for `check_compatibility`
|
994
|
+
# @return [::Gapic::Config::Method]
|
995
|
+
#
|
996
|
+
attr_reader :check_compatibility
|
997
|
+
|
998
|
+
# @private
|
999
|
+
def initialize parent_rpcs = nil
|
1000
|
+
run_report_config = parent_rpcs.run_report if parent_rpcs.respond_to? :run_report
|
1001
|
+
@run_report = ::Gapic::Config::Method.new run_report_config
|
1002
|
+
run_pivot_report_config = parent_rpcs.run_pivot_report if parent_rpcs.respond_to? :run_pivot_report
|
1003
|
+
@run_pivot_report = ::Gapic::Config::Method.new run_pivot_report_config
|
1004
|
+
batch_run_reports_config = parent_rpcs.batch_run_reports if parent_rpcs.respond_to? :batch_run_reports
|
1005
|
+
@batch_run_reports = ::Gapic::Config::Method.new batch_run_reports_config
|
1006
|
+
batch_run_pivot_reports_config = parent_rpcs.batch_run_pivot_reports if parent_rpcs.respond_to? :batch_run_pivot_reports
|
1007
|
+
@batch_run_pivot_reports = ::Gapic::Config::Method.new batch_run_pivot_reports_config
|
1008
|
+
get_metadata_config = parent_rpcs.get_metadata if parent_rpcs.respond_to? :get_metadata
|
1009
|
+
@get_metadata = ::Gapic::Config::Method.new get_metadata_config
|
1010
|
+
run_realtime_report_config = parent_rpcs.run_realtime_report if parent_rpcs.respond_to? :run_realtime_report
|
1011
|
+
@run_realtime_report = ::Gapic::Config::Method.new run_realtime_report_config
|
1012
|
+
check_compatibility_config = parent_rpcs.check_compatibility if parent_rpcs.respond_to? :check_compatibility
|
1013
|
+
@check_compatibility = ::Gapic::Config::Method.new check_compatibility_config
|
1014
|
+
|
1015
|
+
yield self if block_given?
|
1016
|
+
end
|
1017
|
+
end
|
1018
|
+
end
|
1019
|
+
end
|
1020
|
+
end
|
1021
|
+
end
|
1022
|
+
end
|
1023
|
+
end
|
1024
|
+
end
|
1025
|
+
end
|