lib/google/analytics/data/v1alpha/analytics_data/client.rb in google-analytics-data-v1alpha-0.1.0 vs lib/google/analytics/data/v1alpha/analytics_data/client.rb in google-analytics-data-v1alpha-0.2.0

- old
+ new

@@ -28,12 +28,10 @@ # Client for the AnalyticsData service. # # Google Analytics reporting data service. # class Client - include Paths - # @private attr_reader :analytics_data_stub ## # Configure the AnalyticsData Client class. @@ -505,69 +503,55 @@ ## # Returns metadata for dimensions and metrics available in reporting methods. # Used to explore the dimensions and metrics. Dimensions and metrics will be # mostly added over time, but renames and deletions may occur. # - # @overload get_metadata(request, options = nil) - # Pass arguments to `get_metadata` via a request object, either of type - # {::Google::Analytics::Data::V1alpha::GetMetadataRequest} or an equivalent Hash. + # This method returns Universal Metadata. Universal Metadata are dimensions + # and metrics applicable to any property such as `country` and `totalUsers`. # - # @param request [::Google::Analytics::Data::V1alpha::GetMetadataRequest, ::Hash] + # @overload get_universal_metadata(request, options = nil) + # Pass arguments to `get_universal_metadata` via a request object, either of type + # {::Google::Analytics::Data::V1alpha::GetUniversalMetadataRequest} or an equivalent Hash. + # + # @param request [::Google::Analytics::Data::V1alpha::GetUniversalMetadataRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # - # @overload get_metadata(name: nil) - # Pass arguments to `get_metadata` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The name of the metadata to retrieve. Either has the form - # 'metadata' or 'properties/\\{property}/metadata'. This name field is - # specified in the URL path and not URL parameters. Property is a numeric - # Google Analytics App + Web Property Id. - # # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Analytics::Data::V1alpha::Metadata] + # @yieldparam response [::Google::Analytics::Data::V1alpha::UniversalMetadata] # @yieldparam operation [::GRPC::ActiveCall::Operation] # - # @return [::Google::Analytics::Data::V1alpha::Metadata] + # @return [::Google::Analytics::Data::V1alpha::UniversalMetadata] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # - def get_metadata request, options = nil + def get_universal_metadata request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? - request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1alpha::GetMetadataRequest + request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1alpha::GetUniversalMetadataRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults - metadata = @config.rpcs.get_metadata.metadata.to_h + metadata = @config.rpcs.get_universal_metadata.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Analytics::Data::V1alpha::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - header_params = { - "name" => request.name - } - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_metadata.timeout, + options.apply_defaults timeout: @config.rpcs.get_universal_metadata.timeout, metadata: metadata, - retry_policy: @config.rpcs.get_metadata.retry_policy + retry_policy: @config.rpcs.get_universal_metadata.retry_policy options.apply_defaults metadata: @config.metadata, retry_policy: @config.retry_policy - @analytics_data_stub.call_rpc :get_metadata, request, options: options do |response, operation| + @analytics_data_stub.call_rpc :get_universal_metadata, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) @@ -728,14 +712,14 @@ # RPC-specific configuration for `batch_run_pivot_reports` # @return [::Gapic::Config::Method] # attr_reader :batch_run_pivot_reports ## - # RPC-specific configuration for `get_metadata` + # RPC-specific configuration for `get_universal_metadata` # @return [::Gapic::Config::Method] # - attr_reader :get_metadata + attr_reader :get_universal_metadata # @private def initialize parent_rpcs = nil run_report_config = parent_rpcs&.run_report if parent_rpcs&.respond_to? :run_report @run_report = ::Gapic::Config::Method.new run_report_config @@ -743,11 +727,11 @@ @run_pivot_report = ::Gapic::Config::Method.new run_pivot_report_config batch_run_reports_config = parent_rpcs&.batch_run_reports if parent_rpcs&.respond_to? :batch_run_reports @batch_run_reports = ::Gapic::Config::Method.new batch_run_reports_config batch_run_pivot_reports_config = parent_rpcs&.batch_run_pivot_reports if parent_rpcs&.respond_to? :batch_run_pivot_reports @batch_run_pivot_reports = ::Gapic::Config::Method.new batch_run_pivot_reports_config - get_metadata_config = parent_rpcs&.get_metadata if parent_rpcs&.respond_to? :get_metadata - @get_metadata = ::Gapic::Config::Method.new get_metadata_config + get_universal_metadata_config = parent_rpcs&.get_universal_metadata if parent_rpcs&.respond_to? :get_universal_metadata + @get_universal_metadata = ::Gapic::Config::Method.new get_universal_metadata_config yield self if block_given? end end end