diff --git a/google-shopping-merchant-accounts/.repo-metadata.json b/google-shopping-merchant-accounts/.repo-metadata.json index 91c5a1b05f62..0276f641e2d4 100644 --- a/google-shopping-merchant-accounts/.repo-metadata.json +++ b/google-shopping-merchant-accounts/.repo-metadata.json @@ -11,7 +11,7 @@ "release_level": "preview", "repo": "googleapis/google-cloud-ruby", "requires_billing": true, - "ruby-cloud-description": "Programmatically manage your Merchant Center accounts.", + "ruby-cloud-description": "Merchant API consists of multiple Sub-APIs. Accounts Sub-API: Enables you to programmatically manage your accounts. Conversions Sub-API: Enables you to programmatically manage your conversion sources for a merchant account. Datasources Sub-API: Enables you to programmatically manage your datasources. Inventories Sub-API: This bundle enables you to programmatically manage your local and regional inventories. Local Feeds Partnerships Sub-API: This bundle enables LFP partners to submit local inventories for a merchant. Notifications Sub-API: This bundle enables you to programmatically manage your notification subscriptions. Products Sub-API: This bundle enables you to programmatically manage your products. Promotions Sub-API: This bundle enables you to programmatically manage your promotions for products. Quota Sub-API: This bundle enables you to list your quotas for all APIs you are using. Reports Sub-API: This bundle enables you to programmatically retrieve reports and insights about products, their performance and their competitive environment.", "ruby-cloud-product-url": "https://developers.google.com/merchant/api", "library_type": "GAPIC_MANUAL" } diff --git a/google-shopping-merchant-accounts/README.md b/google-shopping-merchant-accounts/README.md index 3b9418805c12..0d2646902b7d 100644 --- a/google-shopping-merchant-accounts/README.md +++ b/google-shopping-merchant-accounts/README.md @@ -1,7 +1,8 @@ # Ruby Client for the Merchant API -Programmatically manage your Merchant Center accounts. +Programmatically manage your Merchant Center Accounts. +Merchant API consists of multiple Sub-APIs. Accounts Sub-API: Enables you to programmatically manage your accounts. Conversions Sub-API: Enables you to programmatically manage your conversion sources for a merchant account. Datasources Sub-API: Enables you to programmatically manage your datasources. Inventories Sub-API: This bundle enables you to programmatically manage your local and regional inventories. Local Feeds Partnerships Sub-API: This bundle enables LFP partners to submit local inventories for a merchant. Notifications Sub-API: This bundle enables you to programmatically manage your notification subscriptions. Products Sub-API: This bundle enables you to programmatically manage your products. Promotions Sub-API: This bundle enables you to programmatically manage your promotions for products. Quota Sub-API: This bundle enables you to list your quotas for all APIs you are using. Reports Sub-API: This bundle enables you to programmatically retrieve reports and insights about products, their performance and their competitive environment. Actual client classes for the various versions of this API are defined in _versioned_ client gems, with names of the form `google-shopping-merchant-accounts-v*`. diff --git a/google-shopping-merchant-accounts/google-shopping-merchant-accounts.gemspec b/google-shopping-merchant-accounts/google-shopping-merchant-accounts.gemspec index c0b5aa35260c..1dd9c8bbce89 100644 --- a/google-shopping-merchant-accounts/google-shopping-merchant-accounts.gemspec +++ b/google-shopping-merchant-accounts/google-shopping-merchant-accounts.gemspec @@ -9,8 +9,8 @@ Gem::Specification.new do |gem| gem.authors = ["Google LLC"] gem.email = "googleapis-packages@google.com" - gem.description = "Programmatically manage your Merchant Center accounts." - gem.summary = "Programmatically manage your Merchant Center accounts." + gem.description = "Merchant API consists of multiple Sub-APIs. Accounts Sub-API: Enables you to programmatically manage your accounts. Conversions Sub-API: Enables you to programmatically manage your conversion sources for a merchant account. Datasources Sub-API: Enables you to programmatically manage your datasources. Inventories Sub-API: This bundle enables you to programmatically manage your local and regional inventories. Local Feeds Partnerships Sub-API: This bundle enables LFP partners to submit local inventories for a merchant. Notifications Sub-API: This bundle enables you to programmatically manage your notification subscriptions. Products Sub-API: This bundle enables you to programmatically manage your products. Promotions Sub-API: This bundle enables you to programmatically manage your promotions for products. Quota Sub-API: This bundle enables you to list your quotas for all APIs you are using. Reports Sub-API: This bundle enables you to programmatically retrieve reports and insights about products, their performance and their competitive environment." + gem.summary = "Programmatically manage your Merchant Center Accounts." gem.homepage = "https://github.com/googleapis/google-cloud-ruby" gem.license = "Apache-2.0" @@ -23,5 +23,5 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.7" gem.add_dependency "google-cloud-core", "~> 1.6" - gem.add_dependency "google-shopping-merchant-accounts-v1beta", ">= 0.0", "< 2.a" + gem.add_dependency "google-shopping-merchant-accounts-v1beta", ">= 0.2", "< 2.a" end diff --git a/google-shopping-merchant-accounts/lib/google/shopping/merchant/accounts.rb b/google-shopping-merchant-accounts/lib/google/shopping/merchant/accounts.rb index 611964e70886..7493b8eb9ce8 100644 --- a/google-shopping-merchant-accounts/lib/google/shopping/merchant/accounts.rb +++ b/google-shopping-merchant-accounts/lib/google/shopping/merchant/accounts.rb @@ -168,6 +168,41 @@ def self.accounts_service version: :v1beta, transport: :grpc, &block service_module.const_get(:Client).new(&block) end + ## + # Create a new client object for AutofeedSettingsService. + # + # By default, this returns an instance of + # [Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettingsService::Client](https://rubydoc.info/gems/google-shopping-merchant-accounts-v1beta/Google/Shopping/Merchant/Accounts/V1beta/AutofeedSettingsService/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 AutofeedSettingsService 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 AutofeedSettingsService + # + # Service to support + # [autofeed](https://support.google.com/merchants/answer/7538732) setting. + # + # @param version [::String, ::Symbol] The API version to connect to. Optional. + # Defaults to `:v1beta`. + # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`. + # @return [::Object] A client object for the specified version. + # + def self.autofeed_settings_service version: :v1beta, transport: :grpc, &block + require "google/shopping/merchant/accounts/#{version.to_s.downcase}" + + package_name = Google::Shopping::Merchant::Accounts + .constants + .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") } + .first + service_module = Google::Shopping::Merchant::Accounts.const_get(package_name).const_get(:AutofeedSettingsService) + service_module = service_module.const_get(:Rest) if transport == :rest + service_module.const_get(:Client).new(&block) + end + ## # Create a new client object for BusinessIdentityService. # diff --git a/google-shopping-merchant-accounts/test/google/shopping/merchant/accounts/client_test.rb b/google-shopping-merchant-accounts/test/google/shopping/merchant/accounts/client_test.rb index 4ca3397c2b10..fe6088a49431 100644 --- a/google-shopping-merchant-accounts/test/google/shopping/merchant/accounts/client_test.rb +++ b/google-shopping-merchant-accounts/test/google/shopping/merchant/accounts/client_test.rb @@ -109,6 +109,25 @@ def test_accounts_service_rest end end + def test_autofeed_settings_service_grpc + Gapic::ServiceStub.stub :new, DummyStub.new do + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + client = Google::Shopping::Merchant::Accounts.autofeed_settings_service transport: :grpc do |config| + config.credentials = grpc_channel + end + assert_kind_of Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettingsService::Client, client + end + end + + def test_autofeed_settings_service_rest + Gapic::Rest::ClientStub.stub :new, DummyStub.new do + client = Google::Shopping::Merchant::Accounts.autofeed_settings_service transport: :rest do |config| + config.credentials = :dummy_credentials + end + assert_kind_of Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettingsService::Rest::Client, client + end + end + def test_business_identity_service_grpc Gapic::ServiceStub.stub :new, DummyStub.new do grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure