module Google::Analytics::Admin

Constants

VERSION

Public Class Methods

analytics_admin_service(version: :v1alpha, &block) click to toggle source

Create a new client object for AnalyticsAdminService.

By default, this returns an instance of [Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client](googleapis.dev/ruby/google-analytics-admin-v1alpha/latest/Google/Analytics/Admin/V1alpha/AnalyticsAdminService/Client.html) for version V1alpha of the API. However, you can specify specify a different API version by passing it in the `version` parameter. If the AnalyticsAdminService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned.

## About AnalyticsAdminService

Service Interface for the Analytics Admin API (GA4).

@param version [::String, ::Symbol] The API version to connect to. Optional.

Defaults to `:v1alpha`.

@return [AnalyticsAdminService::Client] A client object for the specified version.

# File lib/google/analytics/admin.rb, line 49
def self.analytics_admin_service version: :v1alpha, &block
  require "google/analytics/admin/#{version.to_s.downcase}"

  package_name = Google::Analytics::Admin
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  package_module = Google::Analytics::Admin.const_get package_name
  package_module.const_get(:AnalyticsAdminService).const_get(:Client).new(&block)
end