Module: Google::Shopping::Merchant::Notifications

Defined in:
lib/google/shopping/merchant/notifications.rb,
lib/google/shopping/merchant/notifications/version.rb

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.notifications_api_service(version: :v1beta, transport: :grpc, &block) ⇒ ::Object

Create a new client object for NotificationsApiService.

By default, this returns an instance of Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Client for a gRPC client for version V1beta of the API. However, you can specify a different API version by passing it in the version parameter. If the NotificationsApiService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

About NotificationsApiService

Service to manage notification subscriptions for merchants

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1beta)

    The API version to connect to. Optional. Defaults to :v1beta.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



53
54
55
56
57
58
59
60
61
62
63
# File 'lib/google/shopping/merchant/notifications.rb', line 53

def self.notifications_api_service version: :v1beta, transport: :grpc, &block
  require "google/shopping/merchant/notifications/#{version.to_s.downcase}"

  package_name = Google::Shopping::Merchant::Notifications
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Shopping::Merchant::Notifications.const_get(package_name).const_get(:NotificationsApiService)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end