google-apis-analyticsdata_v1alpha 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,272 @@
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 AnalyticsdataV1alpha
23
+ # Google Analytics Data API
24
+ #
25
+ # Accesses report data in Google Analytics.
26
+ #
27
+ # @example
28
+ # require 'google/apis/analyticsdata_v1alpha'
29
+ #
30
+ # Analyticsdata = Google::Apis::AnalyticsdataV1alpha # 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_v1alpha',
48
+ client_version: Google::Apis::AnalyticsdataV1alpha::GEM_VERSION)
49
+ @batch_path = 'batch'
50
+ end
51
+
52
+ # Returns metadata for dimensions and metrics available in reporting methods.
53
+ # Used to explore the dimensions and metrics. In this method, a Google Analytics
54
+ # GA4 Property Identifier is specified in the request, and the metadata response
55
+ # includes Custom dimensions and metrics as well as Universal metadata. For
56
+ # example if a custom metric with parameter name `levels_unlocked` is registered
57
+ # to a property, the Metadata response will contain `customEvent:levels_unlocked`
58
+ # . Universal metadata are dimensions and metrics applicable to any property
59
+ # such as `country` and `totalUsers`.
60
+ # @param [String] name
61
+ # Required. The resource name of the metadata to retrieve. This name field is
62
+ # specified in the URL path and not URL parameters. Property is a numeric Google
63
+ # Analytics GA4 Property identifier. To learn more, see [where to find your
64
+ # Property ID](https://developers.google.com/analytics/devguides/reporting/data/
65
+ # v1/property-id). Example: properties/1234/metadata Set the Property ID to 0
66
+ # for dimensions and metrics common to all properties. In this special mode,
67
+ # this method will not return custom dimensions and metrics.
68
+ # @param [String] fields
69
+ # Selector specifying which fields to include in a partial response.
70
+ # @param [String] quota_user
71
+ # Available to use for quota purposes for server-side applications. Can be any
72
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
73
+ # @param [Google::Apis::RequestOptions] options
74
+ # Request-specific options
75
+ #
76
+ # @yield [result, err] Result & error if block supplied
77
+ # @yieldparam result [Google::Apis::AnalyticsdataV1alpha::Metadata] parsed result object
78
+ # @yieldparam err [StandardError] error object if request failed
79
+ #
80
+ # @return [Google::Apis::AnalyticsdataV1alpha::Metadata]
81
+ #
82
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
83
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
84
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
85
+ def get_property_metadata(name, fields: nil, quota_user: nil, options: nil, &block)
86
+ command = make_simple_command(:get, 'v1alpha/{+name}', options)
87
+ command.response_representation = Google::Apis::AnalyticsdataV1alpha::Metadata::Representation
88
+ command.response_class = Google::Apis::AnalyticsdataV1alpha::Metadata
89
+ command.params['name'] = name unless name.nil?
90
+ command.query['fields'] = fields unless fields.nil?
91
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
92
+ execute_or_queue_command(command, &block)
93
+ end
94
+
95
+ # The Google Analytics Realtime API returns a customized report of realtime
96
+ # event data for your property. These reports show events and usage from the
97
+ # last 30 minutes.
98
+ # @param [String] property
99
+ # A Google Analytics GA4 property identifier whose events are tracked. Specified
100
+ # in the URL path and not the body. To learn more, see [where to find your
101
+ # Property ID](https://developers.google.com/analytics/devguides/reporting/data/
102
+ # v1/property-id). Example: properties/1234
103
+ # @param [Google::Apis::AnalyticsdataV1alpha::RunRealtimeReportRequest] run_realtime_report_request_object
104
+ # @param [String] fields
105
+ # Selector specifying which fields to include in a partial response.
106
+ # @param [String] quota_user
107
+ # Available to use for quota purposes for server-side applications. Can be any
108
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
109
+ # @param [Google::Apis::RequestOptions] options
110
+ # Request-specific options
111
+ #
112
+ # @yield [result, err] Result & error if block supplied
113
+ # @yieldparam result [Google::Apis::AnalyticsdataV1alpha::RunRealtimeReportResponse] parsed result object
114
+ # @yieldparam err [StandardError] error object if request failed
115
+ #
116
+ # @return [Google::Apis::AnalyticsdataV1alpha::RunRealtimeReportResponse]
117
+ #
118
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
119
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
120
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
121
+ def run_property_realtime_report(property, run_realtime_report_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
122
+ command = make_simple_command(:post, 'v1alpha/{+property}:runRealtimeReport', options)
123
+ command.request_representation = Google::Apis::AnalyticsdataV1alpha::RunRealtimeReportRequest::Representation
124
+ command.request_object = run_realtime_report_request_object
125
+ command.response_representation = Google::Apis::AnalyticsdataV1alpha::RunRealtimeReportResponse::Representation
126
+ command.response_class = Google::Apis::AnalyticsdataV1alpha::RunRealtimeReportResponse
127
+ command.params['property'] = property unless property.nil?
128
+ command.query['fields'] = fields unless fields.nil?
129
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
130
+ execute_or_queue_command(command, &block)
131
+ end
132
+
133
+ # Returns multiple pivot reports in a batch. All reports must be for the same
134
+ # Entity.
135
+ # @param [Google::Apis::AnalyticsdataV1alpha::BatchRunPivotReportsRequest] batch_run_pivot_reports_request_object
136
+ # @param [String] fields
137
+ # Selector specifying which fields to include in a partial response.
138
+ # @param [String] quota_user
139
+ # Available to use for quota purposes for server-side applications. Can be any
140
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
141
+ # @param [Google::Apis::RequestOptions] options
142
+ # Request-specific options
143
+ #
144
+ # @yield [result, err] Result & error if block supplied
145
+ # @yieldparam result [Google::Apis::AnalyticsdataV1alpha::BatchRunPivotReportsResponse] parsed result object
146
+ # @yieldparam err [StandardError] error object if request failed
147
+ #
148
+ # @return [Google::Apis::AnalyticsdataV1alpha::BatchRunPivotReportsResponse]
149
+ #
150
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
151
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
152
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
153
+ def batch_run_pivot_reports(batch_run_pivot_reports_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
154
+ command = make_simple_command(:post, 'v1alpha:batchRunPivotReports', options)
155
+ command.request_representation = Google::Apis::AnalyticsdataV1alpha::BatchRunPivotReportsRequest::Representation
156
+ command.request_object = batch_run_pivot_reports_request_object
157
+ command.response_representation = Google::Apis::AnalyticsdataV1alpha::BatchRunPivotReportsResponse::Representation
158
+ command.response_class = Google::Apis::AnalyticsdataV1alpha::BatchRunPivotReportsResponse
159
+ command.query['fields'] = fields unless fields.nil?
160
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
161
+ execute_or_queue_command(command, &block)
162
+ end
163
+
164
+ # Returns multiple reports in a batch. All reports must be for the same Entity.
165
+ # @param [Google::Apis::AnalyticsdataV1alpha::BatchRunReportsRequest] batch_run_reports_request_object
166
+ # @param [String] fields
167
+ # Selector specifying which fields to include in a partial response.
168
+ # @param [String] quota_user
169
+ # Available to use for quota purposes for server-side applications. Can be any
170
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
171
+ # @param [Google::Apis::RequestOptions] options
172
+ # Request-specific options
173
+ #
174
+ # @yield [result, err] Result & error if block supplied
175
+ # @yieldparam result [Google::Apis::AnalyticsdataV1alpha::BatchRunReportsResponse] parsed result object
176
+ # @yieldparam err [StandardError] error object if request failed
177
+ #
178
+ # @return [Google::Apis::AnalyticsdataV1alpha::BatchRunReportsResponse]
179
+ #
180
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
181
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
182
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
183
+ def batch_run_reports(batch_run_reports_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
184
+ command = make_simple_command(:post, 'v1alpha:batchRunReports', options)
185
+ command.request_representation = Google::Apis::AnalyticsdataV1alpha::BatchRunReportsRequest::Representation
186
+ command.request_object = batch_run_reports_request_object
187
+ command.response_representation = Google::Apis::AnalyticsdataV1alpha::BatchRunReportsResponse::Representation
188
+ command.response_class = Google::Apis::AnalyticsdataV1alpha::BatchRunReportsResponse
189
+ command.query['fields'] = fields unless fields.nil?
190
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
191
+ execute_or_queue_command(command, &block)
192
+ end
193
+
194
+ # Returns a customized pivot report of your Google Analytics event data. Pivot
195
+ # reports are more advanced and expressive formats than regular reports. In a
196
+ # pivot report, dimensions are only visible if they are included in a pivot.
197
+ # Multiple pivots can be specified to further dissect your data.
198
+ # @param [Google::Apis::AnalyticsdataV1alpha::RunPivotReportRequest] run_pivot_report_request_object
199
+ # @param [String] fields
200
+ # Selector specifying which fields to include in a partial response.
201
+ # @param [String] quota_user
202
+ # Available to use for quota purposes for server-side applications. Can be any
203
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
204
+ # @param [Google::Apis::RequestOptions] options
205
+ # Request-specific options
206
+ #
207
+ # @yield [result, err] Result & error if block supplied
208
+ # @yieldparam result [Google::Apis::AnalyticsdataV1alpha::RunPivotReportResponse] parsed result object
209
+ # @yieldparam err [StandardError] error object if request failed
210
+ #
211
+ # @return [Google::Apis::AnalyticsdataV1alpha::RunPivotReportResponse]
212
+ #
213
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
214
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
215
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
216
+ def run_pivot_report(run_pivot_report_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
217
+ command = make_simple_command(:post, 'v1alpha:runPivotReport', options)
218
+ command.request_representation = Google::Apis::AnalyticsdataV1alpha::RunPivotReportRequest::Representation
219
+ command.request_object = run_pivot_report_request_object
220
+ command.response_representation = Google::Apis::AnalyticsdataV1alpha::RunPivotReportResponse::Representation
221
+ command.response_class = Google::Apis::AnalyticsdataV1alpha::RunPivotReportResponse
222
+ command.query['fields'] = fields unless fields.nil?
223
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
224
+ execute_or_queue_command(command, &block)
225
+ end
226
+
227
+ # Returns a customized report of your Google Analytics event data. Reports
228
+ # contain statistics derived from data collected by the Google Analytics
229
+ # tracking code. The data returned from the API is as a table with columns for
230
+ # the requested dimensions and metrics. Metrics are individual measurements of
231
+ # user activity on your property, such as active users or event count.
232
+ # Dimensions break down metrics across some common criteria, such as country or
233
+ # event name.
234
+ # @param [Google::Apis::AnalyticsdataV1alpha::RunReportRequest] run_report_request_object
235
+ # @param [String] fields
236
+ # Selector specifying which fields to include in a partial response.
237
+ # @param [String] quota_user
238
+ # Available to use for quota purposes for server-side applications. Can be any
239
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
240
+ # @param [Google::Apis::RequestOptions] options
241
+ # Request-specific options
242
+ #
243
+ # @yield [result, err] Result & error if block supplied
244
+ # @yieldparam result [Google::Apis::AnalyticsdataV1alpha::RunReportResponse] parsed result object
245
+ # @yieldparam err [StandardError] error object if request failed
246
+ #
247
+ # @return [Google::Apis::AnalyticsdataV1alpha::RunReportResponse]
248
+ #
249
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
250
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
251
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
252
+ def run_report(run_report_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
253
+ command = make_simple_command(:post, 'v1alpha:runReport', options)
254
+ command.request_representation = Google::Apis::AnalyticsdataV1alpha::RunReportRequest::Representation
255
+ command.request_object = run_report_request_object
256
+ command.response_representation = Google::Apis::AnalyticsdataV1alpha::RunReportResponse::Representation
257
+ command.response_class = Google::Apis::AnalyticsdataV1alpha::RunReportResponse
258
+ command.query['fields'] = fields unless fields.nil?
259
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
260
+ execute_or_queue_command(command, &block)
261
+ end
262
+
263
+ protected
264
+
265
+ def apply_command_defaults(command)
266
+ command.query['key'] = key unless key.nil?
267
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
268
+ end
269
+ end
270
+ end
271
+ end
272
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: google-apis-analyticsdata_v1alpha
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-01-08 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 V1alpha.
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_v1alpha.rb
44
+ - lib/google/apis/analyticsdata_v1alpha.rb
45
+ - lib/google/apis/analyticsdata_v1alpha/classes.rb
46
+ - lib/google/apis/analyticsdata_v1alpha/gem_version.rb
47
+ - lib/google/apis/analyticsdata_v1alpha/representations.rb
48
+ - lib/google/apis/analyticsdata_v1alpha/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_v1alpha/CHANGELOG.md
55
+ documentation_uri: https://googleapis.dev/ruby/google-apis-analyticsdata_v1alpha/v0.1.0
56
+ source_code_uri: https://github.com/googleapis/google-api-ruby-client/tree/master/generated/google-apis-analyticsdata_v1alpha
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.4'
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.1.4
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: Simple REST client for Google Analytics Data API V1alpha
76
+ test_files: []