lib/google/analytics/data/v1alpha/analytics_data/client.rb in google-analytics-data-v1alpha-0.8.2 vs lib/google/analytics/data/v1alpha/analytics_data/client.rb in google-analytics-data-v1alpha-0.8.3
- old
+ new
@@ -39,18 +39,17 @@
# Configure the AnalyticsData Client class.
#
# See {::Google::Analytics::Data::V1alpha::AnalyticsData::Client::Configuration}
# for a description of the configuration fields.
#
- # ## Example
+ # @example
#
- # To modify the configuration for all AnalyticsData clients:
+ # # Modify the configuration for all AnalyticsData clients
+ # ::Google::Analytics::Data::V1alpha::AnalyticsData::Client.configure do |config|
+ # config.timeout = 10.0
+ # end
#
- # ::Google::Analytics::Data::V1alpha::AnalyticsData::Client.configure do |config|
- # config.timeout = 10.0
- # end
- #
# @yield [config] Configure the Client client.
# @yieldparam config [Client::Configuration]
#
# @return [Client::Configuration]
#
@@ -105,24 +104,20 @@
end
##
# Create a new AnalyticsData client object.
#
- # ## Examples
+ # @example
#
- # To create a new AnalyticsData client with the default
- # configuration:
+ # # Create a client using the default configuration
+ # client = ::Google::Analytics::Data::V1alpha::AnalyticsData::Client.new
#
- # client = ::Google::Analytics::Data::V1alpha::AnalyticsData::Client.new
+ # # Create a client using a custom configuration
+ # client = ::Google::Analytics::Data::V1alpha::AnalyticsData::Client.new do |config|
+ # config.timeout = 10.0
+ # end
#
- # To create a new AnalyticsData client with a custom
- # configuration:
- #
- # client = ::Google::Analytics::Data::V1alpha::AnalyticsData::Client.new do |config|
- # config.timeout = 10.0
- # end
- #
# @yield [config] Configure the AnalyticsData client.
# @yieldparam config [Client::Configuration]
#
def initialize
# These require statements are intentionally placed here to initialize
@@ -137,14 +132,13 @@
# Yield the configuration if needed
yield @config if block_given?
# Create credentials
credentials = @config.credentials
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
+ # Use self-signed JWT if the endpoint is unchanged from default,
# but only if the default endpoint does not have a region prefix.
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
- @config.endpoint == Client.configure.endpoint &&
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
!@config.endpoint.split(".").first.include?("-")
credentials ||= Credentials.default scope: @config.scope,
enable_self_signed_jwt: enable_self_signed_jwt
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
credentials = Credentials.new credentials, scope: @config.scope
@@ -263,11 +257,13 @@
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
options.apply_defaults timeout: @config.rpcs.run_report.timeout,
metadata: metadata,
retry_policy: @config.rpcs.run_report.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@analytics_data_stub.call_rpc :run_report, request, options: options do |response, operation|
yield response, operation if block_given?
return response
@@ -366,11 +362,13 @@
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
options.apply_defaults timeout: @config.rpcs.run_pivot_report.timeout,
metadata: metadata,
retry_policy: @config.rpcs.run_pivot_report.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@analytics_data_stub.call_rpc :run_pivot_report, request, options: options do |response, operation|
yield response, operation if block_given?
return response
@@ -432,11 +430,13 @@
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
options.apply_defaults timeout: @config.rpcs.batch_run_reports.timeout,
metadata: metadata,
retry_policy: @config.rpcs.batch_run_reports.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@analytics_data_stub.call_rpc :batch_run_reports, request, options: options do |response, operation|
yield response, operation if block_given?
return response
@@ -498,11 +498,13 @@
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
options.apply_defaults timeout: @config.rpcs.batch_run_pivot_reports.timeout,
metadata: metadata,
retry_policy: @config.rpcs.batch_run_pivot_reports.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@analytics_data_stub.call_rpc :batch_run_pivot_reports, request, options: options do |response, operation|
yield response, operation if block_given?
return response
@@ -583,11 +585,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.get_metadata.timeout,
metadata: metadata,
retry_policy: @config.rpcs.get_metadata.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@analytics_data_stub.call_rpc :get_metadata, request, options: options do |response, operation|
yield response, operation if block_given?
return response
@@ -678,11 +682,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.run_realtime_report.timeout,
metadata: metadata,
retry_policy: @config.rpcs.run_realtime_report.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@analytics_data_stub.call_rpc :run_realtime_report, request, options: options do |response, operation|
yield response, operation if block_given?
return response
@@ -702,25 +708,24 @@
# for a list of RPCs that can be configured independently.
#
# Configuration can be applied globally to all clients, or to a single client
# on construction.
#
- # # Examples
+ # @example
#
- # To modify the global config, setting the timeout for run_report
- # to 20 seconds, and all remaining timeouts to 10 seconds:
+ # # Modify the global config, setting the timeout for
+ # # run_report to 20 seconds,
+ # # and all remaining timeouts to 10 seconds.
+ # ::Google::Analytics::Data::V1alpha::AnalyticsData::Client.configure do |config|
+ # config.timeout = 10.0
+ # config.rpcs.run_report.timeout = 20.0
+ # end
#
- # ::Google::Analytics::Data::V1alpha::AnalyticsData::Client.configure do |config|
- # config.timeout = 10.0
- # config.rpcs.run_report.timeout = 20.0
- # end
- #
- # To apply the above configuration only to a new client:
- #
- # client = ::Google::Analytics::Data::V1alpha::AnalyticsData::Client.new do |config|
- # config.timeout = 10.0
- # config.rpcs.run_report.timeout = 20.0
- # end
+ # # Apply the above configuration only to a new client.
+ # client = ::Google::Analytics::Data::V1alpha::AnalyticsData::Client.new do |config|
+ # config.timeout = 10.0
+ # config.rpcs.run_report.timeout = 20.0
+ # end
#
# @!attribute [rw] endpoint
# The hostname or hostname:port of the service endpoint.
# Defaults to `"analyticsdata.googleapis.com"`.
# @return [::String]