google-analytics-data-v1beta 0.13.1 → 0.15.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.
@@ -176,8 +176,19 @@ module Google
176
176
  endpoint: @config.endpoint,
177
177
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
178
178
  universe_domain: @config.universe_domain,
179
- credentials: credentials
179
+ credentials: credentials,
180
+ logger: @config.logger
180
181
  )
182
+
183
+ @analytics_data_stub.logger(stub: true)&.info do |entry|
184
+ entry.set_system_name
185
+ entry.set_service
186
+ entry.message = "Created client for #{entry.service}"
187
+ entry.set_credentials_fields credentials
188
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
189
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
190
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
191
+ end
181
192
  end
182
193
 
183
194
  ##
@@ -187,6 +198,15 @@ module Google
187
198
  #
188
199
  attr_reader :operations_client
189
200
 
201
+ ##
202
+ # The logger used for request/response debug logging.
203
+ #
204
+ # @return [Logger]
205
+ #
206
+ def logger
207
+ @analytics_data_stub.logger
208
+ end
209
+
190
210
  # Service calls
191
211
 
192
212
  ##
@@ -218,7 +238,7 @@ module Google
218
238
  # the default parameter values, pass an empty Hash as a request object (see above).
219
239
  #
220
240
  # @param property [::String]
221
- # A Google Analytics GA4 property identifier whose events are tracked.
241
+ # A Google Analytics property identifier whose events are tracked.
222
242
  # Specified in the URL path and not the body. To learn more, see [where to
223
243
  # find your Property
224
244
  # ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
@@ -270,8 +290,12 @@ module Google
270
290
  # @param metric_aggregations [::Array<::Google::Analytics::Data::V1beta::MetricAggregation>]
271
291
  # Aggregation of metrics. Aggregated metric values will be shown in rows
272
292
  # where the dimension_values are set to "RESERVED_(MetricAggregation)".
293
+ # Aggregates including both comparisons and multiple date ranges will
294
+ # be aggregated based on the date ranges.
273
295
  # @param order_bys [::Array<::Google::Analytics::Data::V1beta::OrderBy, ::Hash>]
274
296
  # Specifies how rows are ordered in the response.
297
+ # Requests including both comparisons and multiple date ranges will
298
+ # have order bys applied on the comparisons.
275
299
  # @param currency_code [::String]
276
300
  # A currency code in ISO4217 format, such as "AED", "USD", "JPY".
277
301
  # If the field is empty, the report uses the property's default currency.
@@ -284,14 +308,14 @@ module Google
284
308
  # removed by a filter.
285
309
  #
286
310
  # Regardless of this `keep_empty_rows` setting, only data recorded by the
287
- # Google Analytics (GA4) property can be displayed in a report.
311
+ # Google Analytics property can be displayed in a report.
288
312
  #
289
313
  # For example if a property never logs a `purchase` event, then a query for
290
314
  # the `eventName` dimension and `eventCount` metric will not have a row
291
315
  # eventName: "purchase" and eventCount: 0.
292
316
  # @param return_property_quota [::Boolean]
293
- # Toggles whether to return the current state of this Analytics Property's
294
- # quota. Quota is returned in [PropertyQuota](#PropertyQuota).
317
+ # Toggles whether to return the current state of this Google Analytics
318
+ # property's quota. Quota is returned in [PropertyQuota](#PropertyQuota).
295
319
  # @param comparisons [::Array<::Google::Analytics::Data::V1beta::Comparison, ::Hash>]
296
320
  # Optional. The configuration of comparisons requested and displayed. The
297
321
  # request only requires a comparisons field in order to receive a comparison
@@ -349,7 +373,6 @@ module Google
349
373
 
350
374
  @analytics_data_stub.run_report request, options do |result, operation|
351
375
  yield result, operation if block_given?
352
- return result
353
376
  end
354
377
  rescue ::Gapic::Rest::Error => e
355
378
  raise ::Google::Cloud::Error.from_error(e)
@@ -378,7 +401,7 @@ module Google
378
401
  # the default parameter values, pass an empty Hash as a request object (see above).
379
402
  #
380
403
  # @param property [::String]
381
- # A Google Analytics GA4 property identifier whose events are tracked.
404
+ # A Google Analytics property identifier whose events are tracked.
382
405
  # Specified in the URL path and not the body. To learn more, see [where to
383
406
  # find your Property
384
407
  # ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
@@ -423,14 +446,14 @@ module Google
423
446
  # removed by a filter.
424
447
  #
425
448
  # Regardless of this `keep_empty_rows` setting, only data recorded by the
426
- # Google Analytics (GA4) property can be displayed in a report.
449
+ # Google Analytics property can be displayed in a report.
427
450
  #
428
451
  # For example if a property never logs a `purchase` event, then a query for
429
452
  # the `eventName` dimension and `eventCount` metric will not have a row
430
453
  # eventName: "purchase" and eventCount: 0.
431
454
  # @param return_property_quota [::Boolean]
432
- # Toggles whether to return the current state of this Analytics Property's
433
- # quota. Quota is returned in [PropertyQuota](#PropertyQuota).
455
+ # Toggles whether to return the current state of this Google Analytics
456
+ # property's quota. Quota is returned in [PropertyQuota](#PropertyQuota).
434
457
  # @param comparisons [::Array<::Google::Analytics::Data::V1beta::Comparison, ::Hash>]
435
458
  # Optional. The configuration of comparisons requested and displayed. The
436
459
  # request requires both a comparisons field and a comparisons dimension to
@@ -488,7 +511,6 @@ module Google
488
511
 
489
512
  @analytics_data_stub.run_pivot_report request, options do |result, operation|
490
513
  yield result, operation if block_given?
491
- return result
492
514
  end
493
515
  rescue ::Gapic::Rest::Error => e
494
516
  raise ::Google::Cloud::Error.from_error(e)
@@ -496,7 +518,7 @@ module Google
496
518
 
497
519
  ##
498
520
  # Returns multiple reports in a batch. All reports must be for the same
499
- # GA4 Property.
521
+ # Google Analytics property.
500
522
  #
501
523
  # @overload batch_run_reports(request, options = nil)
502
524
  # Pass arguments to `batch_run_reports` via a request object, either of type
@@ -514,7 +536,7 @@ module Google
514
536
  # the default parameter values, pass an empty Hash as a request object (see above).
515
537
  #
516
538
  # @param property [::String]
517
- # A Google Analytics GA4 property identifier whose events are tracked.
539
+ # A Google Analytics property identifier whose events are tracked.
518
540
  # Specified in the URL path and not the body. To learn more, see [where to
519
541
  # find your Property
520
542
  # ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
@@ -579,7 +601,6 @@ module Google
579
601
 
580
602
  @analytics_data_stub.batch_run_reports request, options do |result, operation|
581
603
  yield result, operation if block_given?
582
- return result
583
604
  end
584
605
  rescue ::Gapic::Rest::Error => e
585
606
  raise ::Google::Cloud::Error.from_error(e)
@@ -587,7 +608,7 @@ module Google
587
608
 
588
609
  ##
589
610
  # Returns multiple pivot reports in a batch. All reports must be for the same
590
- # GA4 Property.
611
+ # Google Analytics property.
591
612
  #
592
613
  # @overload batch_run_pivot_reports(request, options = nil)
593
614
  # Pass arguments to `batch_run_pivot_reports` via a request object, either of type
@@ -605,7 +626,7 @@ module Google
605
626
  # the default parameter values, pass an empty Hash as a request object (see above).
606
627
  #
607
628
  # @param property [::String]
608
- # A Google Analytics GA4 property identifier whose events are tracked.
629
+ # A Google Analytics property identifier whose events are tracked.
609
630
  # Specified in the URL path and not the body. To learn more, see [where to
610
631
  # find your Property
611
632
  # ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
@@ -670,7 +691,6 @@ module Google
670
691
 
671
692
  @analytics_data_stub.batch_run_pivot_reports request, options do |result, operation|
672
693
  yield result, operation if block_given?
673
- return result
674
694
  end
675
695
  rescue ::Gapic::Rest::Error => e
676
696
  raise ::Google::Cloud::Error.from_error(e)
@@ -679,7 +699,7 @@ module Google
679
699
  ##
680
700
  # Returns metadata for dimensions and metrics available in reporting methods.
681
701
  # Used to explore the dimensions and metrics. In this method, a Google
682
- # Analytics GA4 Property Identifier is specified in the request, and
702
+ # Analytics property identifier is specified in the request, and
683
703
  # the metadata response includes Custom dimensions and metrics as well as
684
704
  # Universal metadata.
685
705
  #
@@ -706,7 +726,7 @@ module Google
706
726
  # @param name [::String]
707
727
  # Required. The resource name of the metadata to retrieve. This name field is
708
728
  # specified in the URL path and not URL parameters. Property is a numeric
709
- # Google Analytics GA4 Property identifier. To learn more, see [where to find
729
+ # Google Analytics property identifier. To learn more, see [where to find
710
730
  # your Property
711
731
  # ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
712
732
  #
@@ -768,7 +788,6 @@ module Google
768
788
 
769
789
  @analytics_data_stub.get_metadata request, options do |result, operation|
770
790
  yield result, operation if block_given?
771
- return result
772
791
  end
773
792
  rescue ::Gapic::Rest::Error => e
774
793
  raise ::Google::Cloud::Error.from_error(e)
@@ -801,7 +820,7 @@ module Google
801
820
  # the default parameter values, pass an empty Hash as a request object (see above).
802
821
  #
803
822
  # @param property [::String]
804
- # A Google Analytics GA4 property identifier whose events are tracked.
823
+ # A Google Analytics property identifier whose events are tracked.
805
824
  # Specified in the URL path and not the body. To learn more, see [where to
806
825
  # find your Property
807
826
  # ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
@@ -832,8 +851,9 @@ module Google
832
851
  # @param order_bys [::Array<::Google::Analytics::Data::V1beta::OrderBy, ::Hash>]
833
852
  # Specifies how rows are ordered in the response.
834
853
  # @param return_property_quota [::Boolean]
835
- # Toggles whether to return the current state of this Analytics Property's
836
- # Realtime quota. Quota is returned in [PropertyQuota](#PropertyQuota).
854
+ # Toggles whether to return the current state of this Google Analytics
855
+ # property's Realtime quota. Quota is returned in
856
+ # [PropertyQuota](#PropertyQuota).
837
857
  # @param minute_ranges [::Array<::Google::Analytics::Data::V1beta::MinuteRange, ::Hash>]
838
858
  # The minute ranges of event data to read. If unspecified, one minute range
839
859
  # for the last 30 minutes will be used. If multiple minute ranges are
@@ -893,7 +913,6 @@ module Google
893
913
 
894
914
  @analytics_data_stub.run_realtime_report request, options do |result, operation|
895
915
  yield result, operation if block_given?
896
- return result
897
916
  end
898
917
  rescue ::Gapic::Rest::Error => e
899
918
  raise ::Google::Cloud::Error.from_error(e)
@@ -927,7 +946,7 @@ module Google
927
946
  # the default parameter values, pass an empty Hash as a request object (see above).
928
947
  #
929
948
  # @param property [::String]
930
- # A Google Analytics GA4 property identifier whose events are tracked. To
949
+ # A Google Analytics property identifier whose events are tracked. To
931
950
  # learn more, see [where to find your Property
932
951
  # ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
933
952
  # `property` should be the same value as in your `runReport` request.
@@ -1002,7 +1021,6 @@ module Google
1002
1021
 
1003
1022
  @analytics_data_stub.check_compatibility request, options do |result, operation|
1004
1023
  yield result, operation if block_given?
1005
- return result
1006
1024
  end
1007
1025
  rescue ::Gapic::Rest::Error => e
1008
1026
  raise ::Google::Cloud::Error.from_error(e)
@@ -1116,7 +1134,7 @@ module Google
1116
1134
  @analytics_data_stub.create_audience_export request, options do |result, operation|
1117
1135
  result = ::Gapic::Operation.new result, @operations_client, options: options
1118
1136
  yield result, operation if block_given?
1119
- return result
1137
+ throw :response, result
1120
1138
  end
1121
1139
  rescue ::Gapic::Rest::Error => e
1122
1140
  raise ::Google::Cloud::Error.from_error(e)
@@ -1235,7 +1253,6 @@ module Google
1235
1253
 
1236
1254
  @analytics_data_stub.query_audience_export request, options do |result, operation|
1237
1255
  yield result, operation if block_given?
1238
- return result
1239
1256
  end
1240
1257
  rescue ::Gapic::Rest::Error => e
1241
1258
  raise ::Google::Cloud::Error.from_error(e)
@@ -1326,7 +1343,6 @@ module Google
1326
1343
 
1327
1344
  @analytics_data_stub.get_audience_export request, options do |result, operation|
1328
1345
  yield result, operation if block_given?
1329
- return result
1330
1346
  end
1331
1347
  rescue ::Gapic::Rest::Error => e
1332
1348
  raise ::Google::Cloud::Error.from_error(e)
@@ -1436,7 +1452,7 @@ module Google
1436
1452
  @analytics_data_stub.list_audience_exports request, options do |result, operation|
1437
1453
  result = ::Gapic::Rest::PagedEnumerable.new @analytics_data_stub, :list_audience_exports, "audience_exports", request, result, options
1438
1454
  yield result, operation if block_given?
1439
- return result
1455
+ throw :response, result
1440
1456
  end
1441
1457
  rescue ::Gapic::Rest::Error => e
1442
1458
  raise ::Google::Cloud::Error.from_error(e)
@@ -1516,6 +1532,11 @@ module Google
1516
1532
  # default endpoint URL. The default value of nil uses the environment
1517
1533
  # universe (usually the default "googleapis.com" universe).
1518
1534
  # @return [::String,nil]
1535
+ # @!attribute [rw] logger
1536
+ # A custom logger to use for request/response debug logging, or the value
1537
+ # `:default` (the default) to construct a default logger, or `nil` to
1538
+ # explicitly disable logging.
1539
+ # @return [::Logger,:default,nil]
1519
1540
  #
1520
1541
  class Configuration
1521
1542
  extend ::Gapic::Config
@@ -1537,6 +1558,7 @@ module Google
1537
1558
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1538
1559
  config_attr :quota_project, nil, ::String, nil
1539
1560
  config_attr :universe_domain, nil, ::String, nil
1561
+ config_attr :logger, :default, ::Logger, nil, :default
1540
1562
 
1541
1563
  # @private
1542
1564
  def initialize parent_config = nil
@@ -115,14 +115,6 @@ module Google
115
115
  # Lists operations that match the specified filter in the request. If the
116
116
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
117
117
  #
118
- # NOTE: the `name` binding allows API services to override the binding
119
- # to use different resource name schemes, such as `users/*/operations`. To
120
- # override the binding, API services can add a binding such as
121
- # `"/v1/{name=users/*}/operations"` to their service configuration.
122
- # For backwards compatibility, the default name includes the operations
123
- # collection id, however overriding users must ensure the name binding
124
- # is the parent resource, without the operations collection id.
125
- #
126
118
  # @overload list_operations(request, options = nil)
127
119
  # Pass arguments to `list_operations` via a request object, either of type
128
120
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -204,7 +196,7 @@ module Google
204
196
  @operations_stub.list_operations request, options do |result, operation|
205
197
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
206
198
  yield result, operation if block_given?
207
- return result
199
+ throw :response, result
208
200
  end
209
201
  rescue ::Gapic::Rest::Error => e
210
202
  raise ::Google::Cloud::Error.from_error(e)
@@ -293,7 +285,7 @@ module Google
293
285
  @operations_stub.get_operation request, options do |result, operation|
294
286
  result = ::Gapic::Operation.new result, @operations_client, options: options
295
287
  yield result, operation if block_given?
296
- return result
288
+ throw :response, result
297
289
  end
298
290
  rescue ::Gapic::Rest::Error => e
299
291
  raise ::Google::Cloud::Error.from_error(e)
@@ -375,7 +367,6 @@ module Google
375
367
 
376
368
  @operations_stub.delete_operation request, options do |result, operation|
377
369
  yield result, operation if block_given?
378
- return result
379
370
  end
380
371
  rescue ::Gapic::Rest::Error => e
381
372
  raise ::Google::Cloud::Error.from_error(e)
@@ -390,8 +381,9 @@ module Google
390
381
  # other methods to check whether the cancellation succeeded or whether the
391
382
  # operation completed despite cancellation. On successful cancellation,
392
383
  # the operation is not deleted; instead, it becomes an operation with
393
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
394
- # corresponding to `Code.CANCELLED`.
384
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
385
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
386
+ # `Code.CANCELLED`.
395
387
  #
396
388
  # @overload cancel_operation(request, options = nil)
397
389
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -463,7 +455,6 @@ module Google
463
455
 
464
456
  @operations_stub.cancel_operation request, options do |result, operation|
465
457
  yield result, operation if block_given?
466
- return result
467
458
  end
468
459
  rescue ::Gapic::Rest::Error => e
469
460
  raise ::Google::Cloud::Error.from_error(e)
@@ -543,6 +534,11 @@ module Google
543
534
  # default endpoint URL. The default value of nil uses the environment
544
535
  # universe (usually the default "googleapis.com" universe).
545
536
  # @return [::String,nil]
537
+ # @!attribute [rw] logger
538
+ # A custom logger to use for request/response debug logging, or the value
539
+ # `:default` (the default) to construct a default logger, or `nil` to
540
+ # explicitly disable logging.
541
+ # @return [::Logger,:default,nil]
546
542
  #
547
543
  class Configuration
548
544
  extend ::Gapic::Config
@@ -564,6 +560,7 @@ module Google
564
560
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
565
561
  config_attr :quota_project, nil, ::String, nil
566
562
  config_attr :universe_domain, nil, ::String, nil
563
+ config_attr :logger, :default, ::Logger, nil, :default
567
564
 
568
565
  # @private
569
566
  def initialize parent_config = nil
@@ -683,16 +680,18 @@ module Google
683
680
 
684
681
  response = @client_stub.make_http_request(
685
682
  verb,
686
- uri: uri,
687
- body: body || "",
688
- params: query_string_params,
683
+ uri: uri,
684
+ body: body || "",
685
+ params: query_string_params,
686
+ method_name: "list_operations",
689
687
  options: options
690
688
  )
691
689
  operation = ::Gapic::Rest::TransportOperation.new response
692
690
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
693
-
694
- yield result, operation if block_given?
695
- result
691
+ catch :response do
692
+ yield result, operation if block_given?
693
+ result
694
+ end
696
695
  end
697
696
 
698
697
  ##
@@ -721,16 +720,18 @@ module Google
721
720
 
722
721
  response = @client_stub.make_http_request(
723
722
  verb,
724
- uri: uri,
725
- body: body || "",
726
- params: query_string_params,
723
+ uri: uri,
724
+ body: body || "",
725
+ params: query_string_params,
726
+ method_name: "get_operation",
727
727
  options: options
728
728
  )
729
729
  operation = ::Gapic::Rest::TransportOperation.new response
730
730
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
731
-
732
- yield result, operation if block_given?
733
- result
731
+ catch :response do
732
+ yield result, operation if block_given?
733
+ result
734
+ end
734
735
  end
735
736
 
736
737
  ##
@@ -759,16 +760,18 @@ module Google
759
760
 
760
761
  response = @client_stub.make_http_request(
761
762
  verb,
762
- uri: uri,
763
- body: body || "",
764
- params: query_string_params,
763
+ uri: uri,
764
+ body: body || "",
765
+ params: query_string_params,
766
+ method_name: "delete_operation",
765
767
  options: options
766
768
  )
767
769
  operation = ::Gapic::Rest::TransportOperation.new response
768
770
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
769
-
770
- yield result, operation if block_given?
771
- result
771
+ catch :response do
772
+ yield result, operation if block_given?
773
+ result
774
+ end
772
775
  end
773
776
 
774
777
  ##
@@ -797,16 +800,18 @@ module Google
797
800
 
798
801
  response = @client_stub.make_http_request(
799
802
  verb,
800
- uri: uri,
801
- body: body || "",
802
- params: query_string_params,
803
+ uri: uri,
804
+ body: body || "",
805
+ params: query_string_params,
806
+ method_name: "cancel_operation",
803
807
  options: options
804
808
  )
805
809
  operation = ::Gapic::Rest::TransportOperation.new response
806
810
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
807
-
808
- yield result, operation if block_given?
809
- result
811
+ catch :response do
812
+ yield result, operation if block_given?
813
+ result
814
+ end
810
815
  end
811
816
 
812
817
  ##