google-apis-analyticsdata_v1beta 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,305 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module AnalyticsdataV1beta
23
+ # Google Analytics Data API
24
+ #
25
+ # Accesses report data in Google Analytics.
26
+ #
27
+ # @example
28
+ # require 'google/apis/analyticsdata_v1beta'
29
+ #
30
+ # Analyticsdata = Google::Apis::AnalyticsdataV1beta # Alias the module
31
+ # service = Analyticsdata::AnalyticsDataService.new
32
+ #
33
+ # @see https://developers.google.com/analytics/devguides/reporting/data/v1/
34
+ class AnalyticsDataService < Google::Apis::Core::BaseService
35
+ # @return [String]
36
+ # API key. Your API key identifies your project and provides you with API access,
37
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
38
+ attr_accessor :key
39
+
40
+ # @return [String]
41
+ # Available to use for quota purposes for server-side applications. Can be any
42
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
43
+ attr_accessor :quota_user
44
+
45
+ def initialize
46
+ super('https://analyticsdata.googleapis.com/', '',
47
+ client_name: 'google-apis-analyticsdata_v1beta',
48
+ client_version: Google::Apis::AnalyticsdataV1beta::GEM_VERSION)
49
+ @batch_path = 'batch'
50
+ end
51
+
52
+ # Returns multiple pivot reports in a batch. All reports must be for the same
53
+ # GA4 Property.
54
+ # @param [String] property
55
+ # A Google Analytics GA4 property identifier whose events are tracked. Specified
56
+ # in the URL path and not the body. To learn more, see [where to find your
57
+ # Property ID](https://developers.google.com/analytics/devguides/reporting/data/
58
+ # v1/property-id). This property must be specified for the batch. The property
59
+ # within RunPivotReportRequest may either be unspecified or consistent with this
60
+ # property. Example: properties/1234
61
+ # @param [Google::Apis::AnalyticsdataV1beta::BatchRunPivotReportsRequest] batch_run_pivot_reports_request_object
62
+ # @param [String] fields
63
+ # Selector specifying which fields to include in a partial response.
64
+ # @param [String] quota_user
65
+ # Available to use for quota purposes for server-side applications. Can be any
66
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
67
+ # @param [Google::Apis::RequestOptions] options
68
+ # Request-specific options
69
+ #
70
+ # @yield [result, err] Result & error if block supplied
71
+ # @yieldparam result [Google::Apis::AnalyticsdataV1beta::BatchRunPivotReportsResponse] parsed result object
72
+ # @yieldparam err [StandardError] error object if request failed
73
+ #
74
+ # @return [Google::Apis::AnalyticsdataV1beta::BatchRunPivotReportsResponse]
75
+ #
76
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
77
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
78
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
79
+ def batch_property_run_pivot_reports(property, batch_run_pivot_reports_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
80
+ command = make_simple_command(:post, 'v1beta/{+property}:batchRunPivotReports', options)
81
+ command.request_representation = Google::Apis::AnalyticsdataV1beta::BatchRunPivotReportsRequest::Representation
82
+ command.request_object = batch_run_pivot_reports_request_object
83
+ command.response_representation = Google::Apis::AnalyticsdataV1beta::BatchRunPivotReportsResponse::Representation
84
+ command.response_class = Google::Apis::AnalyticsdataV1beta::BatchRunPivotReportsResponse
85
+ command.params['property'] = property unless property.nil?
86
+ command.query['fields'] = fields unless fields.nil?
87
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
88
+ execute_or_queue_command(command, &block)
89
+ end
90
+
91
+ # Returns multiple reports in a batch. All reports must be for the same GA4
92
+ # Property.
93
+ # @param [String] property
94
+ # A Google Analytics GA4 property identifier whose events are tracked. Specified
95
+ # in the URL path and not the body. To learn more, see [where to find your
96
+ # Property ID](https://developers.google.com/analytics/devguides/reporting/data/
97
+ # v1/property-id). This property must be specified for the batch. The property
98
+ # within RunReportRequest may either be unspecified or consistent with this
99
+ # property. Example: properties/1234
100
+ # @param [Google::Apis::AnalyticsdataV1beta::BatchRunReportsRequest] batch_run_reports_request_object
101
+ # @param [String] fields
102
+ # Selector specifying which fields to include in a partial response.
103
+ # @param [String] quota_user
104
+ # Available to use for quota purposes for server-side applications. Can be any
105
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
106
+ # @param [Google::Apis::RequestOptions] options
107
+ # Request-specific options
108
+ #
109
+ # @yield [result, err] Result & error if block supplied
110
+ # @yieldparam result [Google::Apis::AnalyticsdataV1beta::BatchRunReportsResponse] parsed result object
111
+ # @yieldparam err [StandardError] error object if request failed
112
+ #
113
+ # @return [Google::Apis::AnalyticsdataV1beta::BatchRunReportsResponse]
114
+ #
115
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
116
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
117
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
118
+ def batch_property_run_reports(property, batch_run_reports_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
119
+ command = make_simple_command(:post, 'v1beta/{+property}:batchRunReports', options)
120
+ command.request_representation = Google::Apis::AnalyticsdataV1beta::BatchRunReportsRequest::Representation
121
+ command.request_object = batch_run_reports_request_object
122
+ command.response_representation = Google::Apis::AnalyticsdataV1beta::BatchRunReportsResponse::Representation
123
+ command.response_class = Google::Apis::AnalyticsdataV1beta::BatchRunReportsResponse
124
+ command.params['property'] = property unless property.nil?
125
+ command.query['fields'] = fields unless fields.nil?
126
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
127
+ execute_or_queue_command(command, &block)
128
+ end
129
+
130
+ # Returns metadata for dimensions and metrics available in reporting methods.
131
+ # Used to explore the dimensions and metrics. In this method, a Google Analytics
132
+ # GA4 Property Identifier is specified in the request, and the metadata response
133
+ # includes Custom dimensions and metrics as well as Universal metadata. For
134
+ # example if a custom metric with parameter name `levels_unlocked` is registered
135
+ # to a property, the Metadata response will contain `customEvent:levels_unlocked`
136
+ # . Universal metadata are dimensions and metrics applicable to any property
137
+ # such as `country` and `totalUsers`.
138
+ # @param [String] name
139
+ # Required. The resource name of the metadata to retrieve. This name field is
140
+ # specified in the URL path and not URL parameters. Property is a numeric Google
141
+ # Analytics GA4 Property identifier. To learn more, see [where to find your
142
+ # Property ID](https://developers.google.com/analytics/devguides/reporting/data/
143
+ # v1/property-id). Example: properties/1234/metadata Set the Property ID to 0
144
+ # for dimensions and metrics common to all properties. In this special mode,
145
+ # this method will not return custom dimensions and metrics.
146
+ # @param [String] fields
147
+ # Selector specifying which fields to include in a partial response.
148
+ # @param [String] quota_user
149
+ # Available to use for quota purposes for server-side applications. Can be any
150
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
151
+ # @param [Google::Apis::RequestOptions] options
152
+ # Request-specific options
153
+ #
154
+ # @yield [result, err] Result & error if block supplied
155
+ # @yieldparam result [Google::Apis::AnalyticsdataV1beta::Metadata] parsed result object
156
+ # @yieldparam err [StandardError] error object if request failed
157
+ #
158
+ # @return [Google::Apis::AnalyticsdataV1beta::Metadata]
159
+ #
160
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
161
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
162
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
163
+ def get_property_metadata(name, fields: nil, quota_user: nil, options: nil, &block)
164
+ command = make_simple_command(:get, 'v1beta/{+name}', options)
165
+ command.response_representation = Google::Apis::AnalyticsdataV1beta::Metadata::Representation
166
+ command.response_class = Google::Apis::AnalyticsdataV1beta::Metadata
167
+ command.params['name'] = name unless name.nil?
168
+ command.query['fields'] = fields unless fields.nil?
169
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
170
+ execute_or_queue_command(command, &block)
171
+ end
172
+
173
+ # Returns a customized pivot report of your Google Analytics event data. Pivot
174
+ # reports are more advanced and expressive formats than regular reports. In a
175
+ # pivot report, dimensions are only visible if they are included in a pivot.
176
+ # Multiple pivots can be specified to further dissect your data.
177
+ # @param [String] property
178
+ # A Google Analytics GA4 property identifier whose events are tracked. Specified
179
+ # in the URL path and not the body. To learn more, see [where to find your
180
+ # Property ID](https://developers.google.com/analytics/devguides/reporting/data/
181
+ # v1/property-id). Within a batch request, this property should either be
182
+ # unspecified or consistent with the batch-level property. Example: properties/
183
+ # 1234
184
+ # @param [Google::Apis::AnalyticsdataV1beta::RunPivotReportRequest] run_pivot_report_request_object
185
+ # @param [String] fields
186
+ # Selector specifying which fields to include in a partial response.
187
+ # @param [String] quota_user
188
+ # Available to use for quota purposes for server-side applications. Can be any
189
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
190
+ # @param [Google::Apis::RequestOptions] options
191
+ # Request-specific options
192
+ #
193
+ # @yield [result, err] Result & error if block supplied
194
+ # @yieldparam result [Google::Apis::AnalyticsdataV1beta::RunPivotReportResponse] parsed result object
195
+ # @yieldparam err [StandardError] error object if request failed
196
+ #
197
+ # @return [Google::Apis::AnalyticsdataV1beta::RunPivotReportResponse]
198
+ #
199
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
200
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
201
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
202
+ def run_property_pivot_report(property, run_pivot_report_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
203
+ command = make_simple_command(:post, 'v1beta/{+property}:runPivotReport', options)
204
+ command.request_representation = Google::Apis::AnalyticsdataV1beta::RunPivotReportRequest::Representation
205
+ command.request_object = run_pivot_report_request_object
206
+ command.response_representation = Google::Apis::AnalyticsdataV1beta::RunPivotReportResponse::Representation
207
+ command.response_class = Google::Apis::AnalyticsdataV1beta::RunPivotReportResponse
208
+ command.params['property'] = property unless property.nil?
209
+ command.query['fields'] = fields unless fields.nil?
210
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
211
+ execute_or_queue_command(command, &block)
212
+ end
213
+
214
+ # The Google Analytics Realtime API returns a customized report of realtime
215
+ # event data for your property. These reports show events and usage from the
216
+ # last 30 minutes.
217
+ # @param [String] property
218
+ # A Google Analytics GA4 property identifier whose events are tracked. Specified
219
+ # in the URL path and not the body. To learn more, see [where to find your
220
+ # Property ID](https://developers.google.com/analytics/devguides/reporting/data/
221
+ # v1/property-id). Example: properties/1234
222
+ # @param [Google::Apis::AnalyticsdataV1beta::RunRealtimeReportRequest] run_realtime_report_request_object
223
+ # @param [String] fields
224
+ # Selector specifying which fields to include in a partial response.
225
+ # @param [String] quota_user
226
+ # Available to use for quota purposes for server-side applications. Can be any
227
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
228
+ # @param [Google::Apis::RequestOptions] options
229
+ # Request-specific options
230
+ #
231
+ # @yield [result, err] Result & error if block supplied
232
+ # @yieldparam result [Google::Apis::AnalyticsdataV1beta::RunRealtimeReportResponse] parsed result object
233
+ # @yieldparam err [StandardError] error object if request failed
234
+ #
235
+ # @return [Google::Apis::AnalyticsdataV1beta::RunRealtimeReportResponse]
236
+ #
237
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
238
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
239
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
240
+ def run_property_realtime_report(property, run_realtime_report_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
241
+ command = make_simple_command(:post, 'v1beta/{+property}:runRealtimeReport', options)
242
+ command.request_representation = Google::Apis::AnalyticsdataV1beta::RunRealtimeReportRequest::Representation
243
+ command.request_object = run_realtime_report_request_object
244
+ command.response_representation = Google::Apis::AnalyticsdataV1beta::RunRealtimeReportResponse::Representation
245
+ command.response_class = Google::Apis::AnalyticsdataV1beta::RunRealtimeReportResponse
246
+ command.params['property'] = property unless property.nil?
247
+ command.query['fields'] = fields unless fields.nil?
248
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
249
+ execute_or_queue_command(command, &block)
250
+ end
251
+
252
+ # Returns a customized report of your Google Analytics event data. Reports
253
+ # contain statistics derived from data collected by the Google Analytics
254
+ # tracking code. The data returned from the API is as a table with columns for
255
+ # the requested dimensions and metrics. Metrics are individual measurements of
256
+ # user activity on your property, such as active users or event count.
257
+ # Dimensions break down metrics across some common criteria, such as country or
258
+ # event name.
259
+ # @param [String] property
260
+ # A Google Analytics GA4 property identifier whose events are tracked. Specified
261
+ # in the URL path and not the body. To learn more, see [where to find your
262
+ # Property ID](https://developers.google.com/analytics/devguides/reporting/data/
263
+ # v1/property-id). Within a batch request, this property should either be
264
+ # unspecified or consistent with the batch-level property. Example: properties/
265
+ # 1234
266
+ # @param [Google::Apis::AnalyticsdataV1beta::RunReportRequest] run_report_request_object
267
+ # @param [String] fields
268
+ # Selector specifying which fields to include in a partial response.
269
+ # @param [String] quota_user
270
+ # Available to use for quota purposes for server-side applications. Can be any
271
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
272
+ # @param [Google::Apis::RequestOptions] options
273
+ # Request-specific options
274
+ #
275
+ # @yield [result, err] Result & error if block supplied
276
+ # @yieldparam result [Google::Apis::AnalyticsdataV1beta::RunReportResponse] parsed result object
277
+ # @yieldparam err [StandardError] error object if request failed
278
+ #
279
+ # @return [Google::Apis::AnalyticsdataV1beta::RunReportResponse]
280
+ #
281
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
282
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
283
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
284
+ def run_property_report(property, run_report_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
285
+ command = make_simple_command(:post, 'v1beta/{+property}:runReport', options)
286
+ command.request_representation = Google::Apis::AnalyticsdataV1beta::RunReportRequest::Representation
287
+ command.request_object = run_report_request_object
288
+ command.response_representation = Google::Apis::AnalyticsdataV1beta::RunReportResponse::Representation
289
+ command.response_class = Google::Apis::AnalyticsdataV1beta::RunReportResponse
290
+ command.params['property'] = property unless property.nil?
291
+ command.query['fields'] = fields unless fields.nil?
292
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
293
+ execute_or_queue_command(command, &block)
294
+ end
295
+
296
+ protected
297
+
298
+ def apply_command_defaults(command)
299
+ command.query['key'] = key unless key.nil?
300
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
301
+ end
302
+ end
303
+ end
304
+ end
305
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: google-apis-analyticsdata_v1beta
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Google LLC
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-03-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: google-apis-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.1'
27
+ description: This is the simple REST client for Google Analytics Data API V1beta.
28
+ Simple REST clients are Ruby client libraries that provide access to Google services
29
+ via their HTTP REST API endpoints. These libraries are generated and updated automatically
30
+ based on the discovery documents published by the service, and they handle most
31
+ concerns such as authentication, pagination, retry, timeouts, and logging. You can
32
+ use this client to access the Google Analytics Data API, but note that some services
33
+ may provide a separate modern client that is easier to use.
34
+ email: googleapis-packages@google.com
35
+ executables: []
36
+ extensions: []
37
+ extra_rdoc_files: []
38
+ files:
39
+ - ".yardopts"
40
+ - CHANGELOG.md
41
+ - LICENSE.md
42
+ - OVERVIEW.md
43
+ - lib/google-apis-analyticsdata_v1beta.rb
44
+ - lib/google/apis/analyticsdata_v1beta.rb
45
+ - lib/google/apis/analyticsdata_v1beta/classes.rb
46
+ - lib/google/apis/analyticsdata_v1beta/gem_version.rb
47
+ - lib/google/apis/analyticsdata_v1beta/representations.rb
48
+ - lib/google/apis/analyticsdata_v1beta/service.rb
49
+ homepage: https://github.com/google/google-api-ruby-client
50
+ licenses:
51
+ - Apache-2.0
52
+ metadata:
53
+ bug_tracker_uri: https://github.com/googleapis/google-api-ruby-client/issues
54
+ changelog_uri: https://github.com/googleapis/google-api-ruby-client/tree/master/generated/google-apis-analyticsdata_v1beta/CHANGELOG.md
55
+ documentation_uri: https://googleapis.dev/ruby/google-apis-analyticsdata_v1beta/v0.1.0
56
+ source_code_uri: https://github.com/googleapis/google-api-ruby-client/tree/master/generated/google-apis-analyticsdata_v1beta
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '2.5'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubygems_version: 3.2.13
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: Simple REST client for Google Analytics Data API V1beta
76
+ test_files: []