lib/google/ads/google_ads/v8/services/video_service/client.rb in google-ads-googleads-13.0.0 vs lib/google/ads/google_ads/v8/services/video_service/client.rb in google-ads-googleads-14.0.0

- old
+ new

@@ -40,18 +40,17 @@ # Configure the VideoService Client class. # # See {::Google::Ads::GoogleAds::V8::Services::VideoService::Client::Configuration} # for a description of the configuration fields. # - # ## Example + # @example # - # To modify the configuration for all VideoService clients: + # # Modify the configuration for all VideoService clients + # ::Google::Ads::GoogleAds::V8::Services::VideoService::Client.configure do |config| + # config.timeout = 10.0 + # end # - # ::Google::Ads::GoogleAds::V8::Services::VideoService::Client.configure do |config| - # config.timeout = 10.0 - # end - # # @yield [config] Configure the Client client. # @yieldparam config [Client::Configuration] # # @return [Client::Configuration] # @@ -59,14 +58,11 @@ @configure ||= begin default_config = Client::Configuration.new default_config.timeout = 3600.0 default_config.retry_policy = { - initial_delay: 5.0, - max_delay: 60.0, - multiplier: 1.3, - retry_codes: [14, 4] + initial_delay: 5.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] } default_config end yield @configure if block_given? @@ -94,24 +90,20 @@ end ## # Create a new VideoService client object. # - # ## Examples + # @example # - # To create a new VideoService client with the default - # configuration: + # # Create a client using the default configuration + # client = ::Google::Ads::GoogleAds::V8::Services::VideoService::Client.new # - # client = ::Google::Ads::GoogleAds::V8::Services::VideoService::Client.new + # # Create a client using a custom configuration + # client = ::Google::Ads::GoogleAds::V8::Services::VideoService::Client.new do |config| + # config.timeout = 10.0 + # end # - # To create a new VideoService client with a custom - # configuration: - # - # client = ::Google::Ads::GoogleAds::V8::Services::VideoService::Client.new do |config| - # config.timeout = 10.0 - # end - # # @yield [config] Configure the VideoService client. # @yieldparam config [Client::Configuration] # def initialize # These require statements are intentionally placed here to initialize @@ -126,18 +118,17 @@ # 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) + if credentials.is_a?(::String) || credentials.is_a?(::Hash) credentials = Credentials.new credentials, scope: @config.scope end @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id @@ -213,11 +204,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_video.timeout, metadata: metadata, retry_policy: @config.rpcs.get_video.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @video_service_stub.call_rpc :get_video, request, options: options do |response, operation| yield response, operation if block_given? return response @@ -237,25 +230,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 get_video - # to 20 seconds, and all remaining timeouts to 10 seconds: + # # Modify the global config, setting the timeout for + # # get_video to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Ads::GoogleAds::V8::Services::VideoService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.get_video.timeout = 20.0 + # end # - # ::Google::Ads::GoogleAds::V8::Services::VideoService::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.get_video.timeout = 20.0 - # end - # - # To apply the above configuration only to a new client: - # - # client = ::Google::Ads::GoogleAds::V8::Services::VideoService::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.get_video.timeout = 20.0 - # end + # # Apply the above configuration only to a new client. + # client = ::Google::Ads::GoogleAds::V8::Services::VideoService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.get_video.timeout = 20.0 + # end # # @!attribute [rw] endpoint # The hostname or hostname:port of the service endpoint. # Defaults to `"googleads.googleapis.com"`. # @return [::String]