diff --git a/google-shopping-merchant-data_sources/.repo-metadata.json b/google-shopping-merchant-data_sources/.repo-metadata.json index 21e1753c4b54..285f7550c6fa 100644 --- a/google-shopping-merchant-data_sources/.repo-metadata.json +++ b/google-shopping-merchant-data_sources/.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-data_sources/README.md b/google-shopping-merchant-data_sources/README.md index afb6af9b2339..3fd0ef66cbe0 100644 --- a/google-shopping-merchant-data_sources/README.md +++ b/google-shopping-merchant-data_sources/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-data_sources-v*`. diff --git a/google-shopping-merchant-data_sources/google-shopping-merchant-data_sources.gemspec b/google-shopping-merchant-data_sources/google-shopping-merchant-data_sources.gemspec index 300fade8f992..3d82a7d46546 100644 --- a/google-shopping-merchant-data_sources/google-shopping-merchant-data_sources.gemspec +++ b/google-shopping-merchant-data_sources/google-shopping-merchant-data_sources.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-data_sources-v1beta", ">= 0.0", "< 2.a" + gem.add_dependency "google-shopping-merchant-data_sources-v1beta", ">= 0.2", "< 2.a" end diff --git a/google-shopping-merchant-data_sources/lib/google/shopping/merchant/data_sources.rb b/google-shopping-merchant-data_sources/lib/google/shopping/merchant/data_sources.rb index d86c42c714ab..9571f625f8d6 100644 --- a/google-shopping-merchant-data_sources/lib/google/shopping/merchant/data_sources.rb +++ b/google-shopping-merchant-data_sources/lib/google/shopping/merchant/data_sources.rb @@ -63,6 +63,40 @@ def self.data_sources_service version: :v1beta, transport: :grpc, &block service_module = service_module.const_get(:Rest) if transport == :rest service_module.const_get(:Client).new(&block) end + + ## + # Create a new client object for FileUploadsService. + # + # By default, this returns an instance of + # [Google::Shopping::Merchant::DataSources::V1beta::FileUploadsService::Client](https://rubydoc.info/gems/google-shopping-merchant-data_sources-v1beta/Google/Shopping/Merchant/DataSources/V1beta/FileUploadsService/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 FileUploadsService 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 FileUploadsService + # + # Service to manage data source file uploads. + # + # @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.file_uploads_service version: :v1beta, transport: :grpc, &block + require "google/shopping/merchant/data_sources/#{version.to_s.downcase}" + + package_name = Google::Shopping::Merchant::DataSources + .constants + .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") } + .first + service_module = Google::Shopping::Merchant::DataSources.const_get(package_name).const_get(:FileUploadsService) + service_module = service_module.const_get(:Rest) if transport == :rest + service_module.const_get(:Client).new(&block) + end end end end diff --git a/google-shopping-merchant-data_sources/test/google/shopping/merchant/data_sources/client_test.rb b/google-shopping-merchant-data_sources/test/google/shopping/merchant/data_sources/client_test.rb index a49bd85f8b19..d2a601523ca4 100644 --- a/google-shopping-merchant-data_sources/test/google/shopping/merchant/data_sources/client_test.rb +++ b/google-shopping-merchant-data_sources/test/google/shopping/merchant/data_sources/client_test.rb @@ -51,4 +51,23 @@ def test_data_sources_service_rest assert_kind_of Google::Shopping::Merchant::DataSources::V1beta::DataSourcesService::Rest::Client, client end end + + def test_file_uploads_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::DataSources.file_uploads_service transport: :grpc do |config| + config.credentials = grpc_channel + end + assert_kind_of Google::Shopping::Merchant::DataSources::V1beta::FileUploadsService::Client, client + end + end + + def test_file_uploads_service_rest + Gapic::Rest::ClientStub.stub :new, DummyStub.new do + client = Google::Shopping::Merchant::DataSources.file_uploads_service transport: :rest do |config| + config.credentials = :dummy_credentials + end + assert_kind_of Google::Shopping::Merchant::DataSources::V1beta::FileUploadsService::Rest::Client, client + end + end end