From e4ae16849f9f9b72467c0ece8cc1db2b037fb73e Mon Sep 17 00:00:00 2001 From: yoshi-code-bot <70984784+yoshi-code-bot@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:56:21 -0700 Subject: [PATCH] feat: Initial generation of google-shopping-merchant-lfp-v1beta (#25767) --- .release-please-manifest.json | 2 + .../.OwlBot.yaml | 3 + .../.gitignore | 22 + .../.owlbot-manifest.json | 82 ++ .../.repo-metadata.json | 17 + .../.rubocop.yml | 33 + google-shopping-merchant-lfp-v1beta/.toys.rb | 28 + google-shopping-merchant-lfp-v1beta/.yardopts | 12 + .../AUTHENTICATION.md | 122 +++ .../CHANGELOG.md | 2 + google-shopping-merchant-lfp-v1beta/Gemfile | 11 + .../LICENSE.md | 201 +++++ google-shopping-merchant-lfp-v1beta/README.md | 144 ++++ google-shopping-merchant-lfp-v1beta/Rakefile | 169 ++++ .../gapic_metadata.json | 66 ++ ...oogle-shopping-merchant-lfp-v1beta.gemspec | 29 + .../google-shopping-merchant-lfp-v1beta.rb | 21 + .../google/shopping/merchant/lfp/v1beta.rb | 49 ++ .../lfp/v1beta/lfp_inventory_service.rb | 59 ++ .../v1beta/lfp_inventory_service/client.rb | 435 +++++++++++ .../lfp_inventory_service/credentials.rb | 49 ++ .../lfp/v1beta/lfp_inventory_service/paths.rb | 70 ++ .../lfp/v1beta/lfp_inventory_service/rest.rb | 56 ++ .../lfp_inventory_service/rest/client.rb | 402 ++++++++++ .../rest/service_stub.rb | 131 ++++ .../merchant/lfp/v1beta/lfp_sale_service.rb | 59 ++ .../lfp/v1beta/lfp_sale_service/client.rb | 433 +++++++++++ .../v1beta/lfp_sale_service/credentials.rb | 49 ++ .../lfp/v1beta/lfp_sale_service/paths.rb | 52 ++ .../lfp/v1beta/lfp_sale_service/rest.rb | 56 ++ .../v1beta/lfp_sale_service/rest/client.rb | 400 ++++++++++ .../lfp_sale_service/rest/service_stub.rb | 131 ++++ .../merchant/lfp/v1beta/lfp_store_service.rb | 59 ++ .../lfp/v1beta/lfp_store_service/client.rb | 734 ++++++++++++++++++ .../v1beta/lfp_store_service/credentials.rb | 49 ++ .../lfp/v1beta/lfp_store_service/paths.rb | 68 ++ .../lfp/v1beta/lfp_store_service/rest.rb | 56 ++ .../v1beta/lfp_store_service/rest/client.rb | 680 ++++++++++++++++ .../lfp_store_service/rest/service_stub.rb | 308 ++++++++ .../merchant/lfp/v1beta/lfpinventory_pb.rb | 54 ++ .../lfp/v1beta/lfpinventory_services_pb.rb | 51 ++ .../merchant/lfp/v1beta/lfpsale_pb.rb | 55 ++ .../lfp/v1beta/lfpsale_services_pb.rb | 49 ++ .../merchant/lfp/v1beta/lfpstore_pb.rb | 56 ++ .../lfp/v1beta/lfpstore_services_pb.rb | 57 ++ .../shopping/merchant/lfp/v1beta/rest.rb | 41 + .../shopping/merchant/lfp/v1beta/version.rb | 30 + .../proto_docs/README.md | 4 + .../proto_docs/google/api/client.rb | 399 ++++++++++ .../proto_docs/google/api/field_behavior.rb | 85 ++ .../proto_docs/google/api/field_info.rb | 65 ++ .../proto_docs/google/api/launch_stage.rb | 71 ++ .../proto_docs/google/api/resource.rb | 222 ++++++ .../proto_docs/google/protobuf/duration.rb | 98 +++ .../proto_docs/google/protobuf/empty.rb | 34 + .../proto_docs/google/protobuf/timestamp.rb | 127 +++ .../merchant/lfp/v1beta/lfpinventory.rb | 113 +++ .../shopping/merchant/lfp/v1beta/lfpsale.rb | 96 +++ .../shopping/merchant/lfp/v1beta/lfpstore.rb | 185 +++++ .../proto_docs/google/shopping/type/types.rb | 183 +++++ .../snippets/Gemfile | 32 + .../insert_lfp_inventory.rb | 47 ++ .../lfp_sale_service/insert_lfp_sale.rb | 47 ++ .../lfp_store_service/delete_lfp_store.rb | 47 ++ .../lfp_store_service/get_lfp_store.rb | 47 ++ .../lfp_store_service/insert_lfp_store.rb | 47 ++ .../lfp_store_service/list_lfp_stores.rb | 51 ++ ...a_google.shopping.merchant.lfp.v1beta.json | 255 ++++++ .../lfp_inventory_service_paths_test.rb | 59 ++ .../v1beta/lfp_inventory_service_rest_test.rb | 146 ++++ .../lfp/v1beta/lfp_inventory_service_test.rb | 136 ++++ .../lfp/v1beta/lfp_sale_service_paths_test.rb | 47 ++ .../lfp/v1beta/lfp_sale_service_rest_test.rb | 146 ++++ .../lfp/v1beta/lfp_sale_service_test.rb | 136 ++++ .../v1beta/lfp_store_service_paths_test.rb | 59 ++ .../lfp/v1beta/lfp_store_service_rest_test.rb | 311 ++++++++ .../lfp/v1beta/lfp_store_service_test.rb | 321 ++++++++ .../test/helper.rb | 25 + release-please-config.json | 4 + 79 files changed, 9387 insertions(+) create mode 100644 google-shopping-merchant-lfp-v1beta/.OwlBot.yaml create mode 100644 google-shopping-merchant-lfp-v1beta/.gitignore create mode 100644 google-shopping-merchant-lfp-v1beta/.owlbot-manifest.json create mode 100644 google-shopping-merchant-lfp-v1beta/.repo-metadata.json create mode 100644 google-shopping-merchant-lfp-v1beta/.rubocop.yml create mode 100644 google-shopping-merchant-lfp-v1beta/.toys.rb create mode 100644 google-shopping-merchant-lfp-v1beta/.yardopts create mode 100644 google-shopping-merchant-lfp-v1beta/AUTHENTICATION.md create mode 100644 google-shopping-merchant-lfp-v1beta/CHANGELOG.md create mode 100644 google-shopping-merchant-lfp-v1beta/Gemfile create mode 100644 google-shopping-merchant-lfp-v1beta/LICENSE.md create mode 100644 google-shopping-merchant-lfp-v1beta/README.md create mode 100644 google-shopping-merchant-lfp-v1beta/Rakefile create mode 100644 google-shopping-merchant-lfp-v1beta/gapic_metadata.json create mode 100644 google-shopping-merchant-lfp-v1beta/google-shopping-merchant-lfp-v1beta.gemspec create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google-shopping-merchant-lfp-v1beta.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/client.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/credentials.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/paths.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest/client.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest/service_stub.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/client.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/credentials.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/paths.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest/client.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest/service_stub.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/client.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/credentials.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/paths.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/rest.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/rest/client.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/rest/service_stub.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpinventory_pb.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpinventory_services_pb.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpsale_pb.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpsale_services_pb.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpstore_pb.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpstore_services_pb.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/rest.rb create mode 100644 google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/version.rb create mode 100644 google-shopping-merchant-lfp-v1beta/proto_docs/README.md create mode 100644 google-shopping-merchant-lfp-v1beta/proto_docs/google/api/client.rb create mode 100644 google-shopping-merchant-lfp-v1beta/proto_docs/google/api/field_behavior.rb create mode 100644 google-shopping-merchant-lfp-v1beta/proto_docs/google/api/field_info.rb create mode 100644 google-shopping-merchant-lfp-v1beta/proto_docs/google/api/launch_stage.rb create mode 100644 google-shopping-merchant-lfp-v1beta/proto_docs/google/api/resource.rb create mode 100644 google-shopping-merchant-lfp-v1beta/proto_docs/google/protobuf/duration.rb create mode 100644 google-shopping-merchant-lfp-v1beta/proto_docs/google/protobuf/empty.rb create mode 100644 google-shopping-merchant-lfp-v1beta/proto_docs/google/protobuf/timestamp.rb create mode 100644 google-shopping-merchant-lfp-v1beta/proto_docs/google/shopping/merchant/lfp/v1beta/lfpinventory.rb create mode 100644 google-shopping-merchant-lfp-v1beta/proto_docs/google/shopping/merchant/lfp/v1beta/lfpsale.rb create mode 100644 google-shopping-merchant-lfp-v1beta/proto_docs/google/shopping/merchant/lfp/v1beta/lfpstore.rb create mode 100644 google-shopping-merchant-lfp-v1beta/proto_docs/google/shopping/type/types.rb create mode 100644 google-shopping-merchant-lfp-v1beta/snippets/Gemfile create mode 100644 google-shopping-merchant-lfp-v1beta/snippets/lfp_inventory_service/insert_lfp_inventory.rb create mode 100644 google-shopping-merchant-lfp-v1beta/snippets/lfp_sale_service/insert_lfp_sale.rb create mode 100644 google-shopping-merchant-lfp-v1beta/snippets/lfp_store_service/delete_lfp_store.rb create mode 100644 google-shopping-merchant-lfp-v1beta/snippets/lfp_store_service/get_lfp_store.rb create mode 100644 google-shopping-merchant-lfp-v1beta/snippets/lfp_store_service/insert_lfp_store.rb create mode 100644 google-shopping-merchant-lfp-v1beta/snippets/lfp_store_service/list_lfp_stores.rb create mode 100644 google-shopping-merchant-lfp-v1beta/snippets/snippet_metadata_google.shopping.merchant.lfp.v1beta.json create mode 100644 google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_inventory_service_paths_test.rb create mode 100644 google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_inventory_service_rest_test.rb create mode 100644 google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_inventory_service_test.rb create mode 100644 google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_sale_service_paths_test.rb create mode 100644 google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_sale_service_rest_test.rb create mode 100644 google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_sale_service_test.rb create mode 100644 google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_store_service_paths_test.rb create mode 100644 google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_store_service_rest_test.rb create mode 100644 google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_store_service_test.rb create mode 100644 google-shopping-merchant-lfp-v1beta/test/helper.rb diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 92d328d719c6..1b4d052365c7 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -787,6 +787,8 @@ "google-shopping-merchant-inventories+FILLER": "0.0.0", "google-shopping-merchant-inventories-v1beta": "0.4.0", "google-shopping-merchant-inventories-v1beta+FILLER": "0.0.0", + "google-shopping-merchant-lfp-v1beta": "0.0.1", + "google-shopping-merchant-lfp-v1beta+FILLER": "0.0.0", "google-shopping-merchant-notifications-v1beta": "0.0.1", "google-shopping-merchant-notifications-v1beta+FILLER": "0.0.0", "google-shopping-merchant-quota": "0.1.0", diff --git a/google-shopping-merchant-lfp-v1beta/.OwlBot.yaml b/google-shopping-merchant-lfp-v1beta/.OwlBot.yaml new file mode 100644 index 000000000000..81644f2a0088 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/.OwlBot.yaml @@ -0,0 +1,3 @@ +deep-copy-regex: + - source: /google/shopping/merchant/lfp/v1beta/[^/]+-ruby/(.*) + dest: /owl-bot-staging/google-shopping-merchant-lfp-v1beta/$1 diff --git a/google-shopping-merchant-lfp-v1beta/.gitignore b/google-shopping-merchant-lfp-v1beta/.gitignore new file mode 100644 index 000000000000..0135b6bc6cfc --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/.gitignore @@ -0,0 +1,22 @@ +# Ignore bundler lockfiles +Gemfile.lock +gems.locked + +# Ignore documentation output +doc/* +.yardoc/* + +# Ignore test output +coverage/* + +# Ignore build artifacts +pkg/* + +# Ignore files commonly present in certain dev environments +.vagrant +.DS_STORE +.idea +*.iml + +# Ignore synth output +__pycache__ diff --git a/google-shopping-merchant-lfp-v1beta/.owlbot-manifest.json b/google-shopping-merchant-lfp-v1beta/.owlbot-manifest.json new file mode 100644 index 000000000000..9d30f7b971d9 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/.owlbot-manifest.json @@ -0,0 +1,82 @@ +{ + "generated": [ + ".gitignore", + ".repo-metadata.json", + ".rubocop.yml", + ".toys.rb", + ".yardopts", + "AUTHENTICATION.md", + "CHANGELOG.md", + "Gemfile", + "LICENSE.md", + "README.md", + "Rakefile", + "gapic_metadata.json", + "google-shopping-merchant-lfp-v1beta.gemspec", + "lib/google-shopping-merchant-lfp-v1beta.rb", + "lib/google/shopping/merchant/lfp/v1beta.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/client.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/credentials.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/paths.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest/client.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest/service_stub.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/client.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/credentials.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/paths.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest/client.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest/service_stub.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfp_store_service.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/client.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/credentials.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/paths.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/rest.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/rest/client.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/rest/service_stub.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfpinventory_pb.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfpinventory_services_pb.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfpsale_pb.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfpsale_services_pb.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfpstore_pb.rb", + "lib/google/shopping/merchant/lfp/v1beta/lfpstore_services_pb.rb", + "lib/google/shopping/merchant/lfp/v1beta/rest.rb", + "lib/google/shopping/merchant/lfp/v1beta/version.rb", + "proto_docs/README.md", + "proto_docs/google/api/client.rb", + "proto_docs/google/api/field_behavior.rb", + "proto_docs/google/api/field_info.rb", + "proto_docs/google/api/launch_stage.rb", + "proto_docs/google/api/resource.rb", + "proto_docs/google/protobuf/duration.rb", + "proto_docs/google/protobuf/empty.rb", + "proto_docs/google/protobuf/timestamp.rb", + "proto_docs/google/shopping/merchant/lfp/v1beta/lfpinventory.rb", + "proto_docs/google/shopping/merchant/lfp/v1beta/lfpsale.rb", + "proto_docs/google/shopping/merchant/lfp/v1beta/lfpstore.rb", + "proto_docs/google/shopping/type/types.rb", + "snippets/Gemfile", + "snippets/lfp_inventory_service/insert_lfp_inventory.rb", + "snippets/lfp_sale_service/insert_lfp_sale.rb", + "snippets/lfp_store_service/delete_lfp_store.rb", + "snippets/lfp_store_service/get_lfp_store.rb", + "snippets/lfp_store_service/insert_lfp_store.rb", + "snippets/lfp_store_service/list_lfp_stores.rb", + "snippets/snippet_metadata_google.shopping.merchant.lfp.v1beta.json", + "test/google/shopping/merchant/lfp/v1beta/lfp_inventory_service_paths_test.rb", + "test/google/shopping/merchant/lfp/v1beta/lfp_inventory_service_rest_test.rb", + "test/google/shopping/merchant/lfp/v1beta/lfp_inventory_service_test.rb", + "test/google/shopping/merchant/lfp/v1beta/lfp_sale_service_paths_test.rb", + "test/google/shopping/merchant/lfp/v1beta/lfp_sale_service_rest_test.rb", + "test/google/shopping/merchant/lfp/v1beta/lfp_sale_service_test.rb", + "test/google/shopping/merchant/lfp/v1beta/lfp_store_service_paths_test.rb", + "test/google/shopping/merchant/lfp/v1beta/lfp_store_service_rest_test.rb", + "test/google/shopping/merchant/lfp/v1beta/lfp_store_service_test.rb", + "test/helper.rb" + ], + "static": [ + ".OwlBot.yaml" + ] +} diff --git a/google-shopping-merchant-lfp-v1beta/.repo-metadata.json b/google-shopping-merchant-lfp-v1beta/.repo-metadata.json new file mode 100644 index 000000000000..d1991995c1df --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/.repo-metadata.json @@ -0,0 +1,17 @@ +{ + "api_id": "merchantapi.googleapis.com", + "api_shortname": "merchantapi", + "client_documentation": "https://rubydoc.info/gems/google-shopping-merchant-lfp-v1beta", + "distribution_name": "google-shopping-merchant-lfp-v1beta", + "is_cloud": false, + "language": "ruby", + "name": "merchantapi", + "name_pretty": "Merchant V1BETA API", + "product_documentation": "https://developers.google.com/merchant/api", + "release_level": "unreleased", + "repo": "googleapis/google-cloud-ruby", + "requires_billing": true, + "ruby-cloud-description": "Programmatically manage your Merchant Center accounts. Note that google-shopping-merchant-lfp-v1beta is a version-specific client library. For most uses, we recommend installing the main client library google-shopping-merchant-lfp instead. See the readme for more details.", + "ruby-cloud-product-url": "https://developers.google.com/merchant/api", + "library_type": "GAPIC_AUTO" +} diff --git a/google-shopping-merchant-lfp-v1beta/.rubocop.yml b/google-shopping-merchant-lfp-v1beta/.rubocop.yml new file mode 100644 index 000000000000..5bfed50cae80 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/.rubocop.yml @@ -0,0 +1,33 @@ +inherit_gem: + google-style: google-style.yml + +AllCops: + Exclude: + - "google-shopping-merchant-lfp-v1beta.gemspec" + - "lib/**/*_pb.rb" + - "proto_docs/**/*" + - "test/**/*" + - "acceptance/**/*" + - "samples/acceptance/**/*" + - "Rakefile" + +Layout/LineLength: + Enabled: false +Metrics/AbcSize: + Enabled: false +Metrics/ClassLength: + Enabled: false +Metrics/CyclomaticComplexity: + Enabled: false +Metrics/MethodLength: + Enabled: false +Metrics/ModuleLength: + Enabled: false +Metrics/PerceivedComplexity: + Enabled: false +Naming/AccessorMethodName: + Exclude: + - "snippets/**/*.rb" +Naming/FileName: + Exclude: + - "lib/google-shopping-merchant-lfp-v1beta.rb" diff --git a/google-shopping-merchant-lfp-v1beta/.toys.rb b/google-shopping-merchant-lfp-v1beta/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/.toys.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +toys_version! ">= 0.15.3" + +if ENV["RUBY_COMMON_TOOLS"] + common_tools_dir = File.expand_path ENV["RUBY_COMMON_TOOLS"] + load File.join(common_tools_dir, "toys", "gapic") +else + load_git remote: "https://github.com/googleapis/ruby-common-tools.git", + path: "toys/gapic", + update: true +end diff --git a/google-shopping-merchant-lfp-v1beta/.yardopts b/google-shopping-merchant-lfp-v1beta/.yardopts new file mode 100644 index 000000000000..3ddd15e0cf87 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/.yardopts @@ -0,0 +1,12 @@ +--no-private +--title="Merchant V1BETA API" +--exclude _pb\.rb$ +--markup markdown +--markup-provider redcarpet + +./lib/**/*.rb +./proto_docs/**/*.rb +- +README.md +LICENSE.md +AUTHENTICATION.md diff --git a/google-shopping-merchant-lfp-v1beta/AUTHENTICATION.md b/google-shopping-merchant-lfp-v1beta/AUTHENTICATION.md new file mode 100644 index 000000000000..f2270ceb15f9 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/AUTHENTICATION.md @@ -0,0 +1,122 @@ +# Authentication + +The recommended way to authenticate to the google-shopping-merchant-lfp-v1beta library is to use +[Application Default Credentials (ADC)](https://cloud.google.com/docs/authentication/application-default-credentials). +To review all of your authentication options, see [Credentials lookup](#credential-lookup). + +## Quickstart + +The following example shows how to set up authentication for a local development +environment with your user credentials. + +**NOTE:** This method is _not_ recommended for running in production. User credentials +should be used only during development. + +1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk). +2. Set up a local ADC file with your user credentials: + +```sh +gcloud auth application-default login +``` + +3. Write code as if already authenticated. + +For more information about setting up authentication for a local development environment, see +[Set up Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-dev). + +## Credential Lookup + +The google-shopping-merchant-lfp-v1beta library provides several mechanisms to configure your system. +Generally, using Application Default Credentials to facilitate automatic +credentials discovery is the easist method. But if you need to explicitly specify +credentials, there are several methods available to you. + +Credentials are accepted in the following ways, in the following order or precedence: + +1. Credentials specified in method arguments +2. Credentials specified in configuration +3. Credentials pointed to or included in environment variables +4. Credentials found in local ADC file +5. Credentials returned by the metadata server for the attached service account (GCP) + +### Configuration + +You can configure a path to a JSON credentials file, either for an individual client object or +globally, for all client objects. The JSON file can contain credentials created for +[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation), +[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a +[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key). + +Note: Service account keys are a security risk if not managed correctly. You should +[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree) +whenever possible. + +To configure a credentials file for an individual client initialization: + +```ruby +require "google/shopping/merchant/lfp/v1beta" + +client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client.new do |config| + config.credentials = "path/to/credentialfile.json" +end +``` + +To configure a credentials file globally for all clients: + +```ruby +require "google/shopping/merchant/lfp/v1beta" + +::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client.configure do |config| + config.credentials = "path/to/credentialfile.json" +end + +client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client.new +``` + +### Environment Variables + +You can also use an environment variable to provide a JSON credentials file. +The environment variable can contain a path to the credentials file or, for +environments such as Docker containers where writing files is not encouraged, +you can include the credentials file itself. + +The JSON file can contain credentials created for +[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation), +[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a +[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key). + +Note: Service account keys are a security risk if not managed correctly. You should +[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree) +whenever possible. + +The environment variables that google-shopping-merchant-lfp-v1beta +checks for credentials are: + +* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents +* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file + +```ruby +require "google/shopping/merchant/lfp/v1beta" + +ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json" + +client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client.new +``` + +### Local ADC file + +You can set up a local ADC file with your user credentials for authentication during +development. If credentials are not provided in code or in environment variables, +then the local ADC credentials are discovered. + +Follow the steps in [Quickstart](#quickstart) to set up a local ADC file. + +### Google Cloud Platform environments + +When running on Google Cloud Platform (GCP), including Google Compute Engine +(GCE), Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud +Functions (GCF) and Cloud Run, credentials are retrieved from the attached +service account automatically. Code should be written as if already authenticated. + +For more information, see +[Set up ADC for Google Cloud services](https://cloud.google.com/docs/authentication/provide-credentials-adc#attached-sa). diff --git a/google-shopping-merchant-lfp-v1beta/CHANGELOG.md b/google-shopping-merchant-lfp-v1beta/CHANGELOG.md new file mode 100644 index 000000000000..f88957a62ba2 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/CHANGELOG.md @@ -0,0 +1,2 @@ +# Release History + diff --git a/google-shopping-merchant-lfp-v1beta/Gemfile b/google-shopping-merchant-lfp-v1beta/Gemfile new file mode 100644 index 000000000000..95163a6d11f8 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/Gemfile @@ -0,0 +1,11 @@ +source "https://rubygems.org" + +gemspec + +gem "google-style", "~> 1.27.1" +gem "minitest", "~> 5.22" +gem "minitest-focus", "~> 1.4" +gem "minitest-rg", "~> 5.3" +gem "rake", ">= 13.0" +gem "redcarpet", "~> 3.6" +gem "yard", "~> 0.9" diff --git a/google-shopping-merchant-lfp-v1beta/LICENSE.md b/google-shopping-merchant-lfp-v1beta/LICENSE.md new file mode 100644 index 000000000000..c261857ba6ad --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/LICENSE.md @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/google-shopping-merchant-lfp-v1beta/README.md b/google-shopping-merchant-lfp-v1beta/README.md new file mode 100644 index 000000000000..8faff850de7c --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/README.md @@ -0,0 +1,144 @@ +# Ruby Client for the Merchant V1BETA API + +Programmatically manage your Merchant Center accounts. + +Programmatically manage your Merchant Center accounts. + +https://github.com/googleapis/google-cloud-ruby + +This gem is a _versioned_ client. It provides basic client classes for a +specific version of the Merchant V1BETA API. Most users should consider using +the main client gem, +[google-shopping-merchant-lfp](https://rubygems.org/gems/google-shopping-merchant-lfp). +See the section below titled *Which client should I use?* for more information. + +## Installation + +``` +$ gem install google-shopping-merchant-lfp-v1beta +``` + +## Before You Begin + +In order to use this library, you first need to go through the following steps: + +1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project) +1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project) +1. [Enable the API.](https://console.cloud.google.com/apis/library/merchantapi.googleapis.com) +1. [Set up authentication.](AUTHENTICATION.md) + +## Quick Start + +```ruby +require "google/shopping/merchant/lfp/v1beta" + +client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client.new +request = ::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpInventoryRequest.new # (request fields as keyword arguments...) +response = client.insert_lfp_inventory request +``` + +View the [Client Library Documentation](https://rubydoc.info/gems/google-shopping-merchant-lfp-v1beta) +for class and method documentation. + +See also the [Product Documentation](https://developers.google.com/merchant/api) +for general usage information. + +## Enabling Logging + +To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library. +The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below, +or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest) +that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb) +and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information. + +Configuring a Ruby stdlib logger: + +```ruby +require "logger" + +module MyLogger + LOGGER = Logger.new $stderr, level: Logger::WARN + def logger + LOGGER + end +end + +# Define a gRPC module-level logger method before grpc/logconfig.rb loads. +module GRPC + extend MyLogger +end +``` + + +## Google Cloud Samples + +To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples). + +## Supported Ruby Versions + +This library is supported on Ruby 2.7+. + +Google provides official support for Ruby versions that are actively supported +by Ruby Core—that is, Ruby versions that are either in normal maintenance or +in security maintenance, and not end of life. Older versions of Ruby _may_ +still work, but are unsupported and not recommended. See +https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby +support schedule. + +## Which client should I use? + +Most modern Ruby client libraries for Google APIs come in two flavors: the main +client library with a name such as `google-shopping-merchant-lfp`, +and lower-level _versioned_ client libraries with names such as +`google-shopping-merchant-lfp-v1beta`. +_In most cases, you should install the main client._ + +### What's the difference between the main client and a versioned client? + +A _versioned client_ provides a basic set of data types and client classes for +a _single version_ of a specific service. (That is, for a service with multiple +versions, there might be a separate versioned client for each service version.) +Most versioned clients are written and maintained by a code generator. + +The _main client_ is designed to provide you with the _recommended_ client +interfaces for the service. There will be only one main client for any given +service, even a service with multiple versions. The main client includes +factory methods for constructing the client objects we recommend for most +users. In some cases, those will be classes provided by an underlying versioned +client; in other cases, they will be handwritten higher-level client objects +with additional capabilities, convenience methods, or best practices built in. +Generally, the main client will default to a recommended service version, +although in some cases you can override this if you need to talk to a specific +service version. + +### Why would I want to use the main client? + +We recommend that most users install the main client gem for a service. You can +identify this gem as the one _without_ a version in its name, e.g. +`google-shopping-merchant-lfp`. +The main client is recommended because it will embody the best practices for +accessing the service, and may also provide more convenient interfaces or +tighter integration into frameworks and third-party libraries. In addition, the +documentation and samples published by Google will generally demonstrate use of +the main client. + +### Why would I want to use a versioned client? + +You can use a versioned client if you are content with a possibly lower-level +class interface, you explicitly want to avoid features provided by the main +client, or you want to access a specific service version not be covered by the +main client. You can identify versioned client gems because the service version +is part of the name, e.g. `google-shopping-merchant-lfp-v1beta`. + +### What about the google-apis- clients? + +Client library gems with names that begin with `google-apis-` are based on an +older code generation technology. They talk to a REST/JSON backend (whereas +most modern clients talk to a [gRPC](https://grpc.io/) backend) and they may +not offer the same performance, features, and ease of use provided by more +modern clients. + +The `google-apis-` clients have wide coverage across Google services, so you +might need to use one if there is no modern client available for the service. +However, if a modern client is available, we generally recommend it over the +older `google-apis-` clients. diff --git a/google-shopping-merchant-lfp-v1beta/Rakefile b/google-shopping-merchant-lfp-v1beta/Rakefile new file mode 100644 index 000000000000..566fa6b6b9b2 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/Rakefile @@ -0,0 +1,169 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "bundler/setup" +require "bundler/gem_tasks" + +require "rubocop/rake_task" +RuboCop::RakeTask.new + +require "rake/testtask" +desc "Run tests." +Rake::TestTask.new do |t| + t.libs << "test" + t.test_files = FileList["test/**/*_test.rb"] + t.warning = false +end + +desc "Runs the smoke tests." +Rake::TestTask.new :smoke_test do |t| + t.test_files = FileList["acceptance/**/*smoke_test.rb"] + t.warning = false +end + +# Acceptance tests +desc "Run the google-shopping-merchant-lfp-v1beta acceptance tests." +task :acceptance, :project, :keyfile do |t, args| + project = args[:project] + project ||= + ENV["GOOGLE_CLOUD_TEST_PROJECT"] || + ENV["GCLOUD_TEST_PROJECT"] + keyfile = args[:keyfile] + keyfile ||= + ENV["GOOGLE_CLOUD_TEST_KEYFILE"] || + ENV["GCLOUD_TEST_KEYFILE"] + if keyfile + keyfile = File.read keyfile + else + keyfile ||= + ENV["GOOGLE_CLOUD_TEST_KEYFILE_JSON"] || + ENV["GCLOUD_TEST_KEYFILE_JSON"] + end + if project.nil? || keyfile.nil? + fail "You must provide a project and keyfile. e.g. rake acceptance[test123, /path/to/keyfile.json] or GOOGLE_CLOUD_TEST_PROJECT=test123 GOOGLE_CLOUD_TEST_KEYFILE=/path/to/keyfile.json rake acceptance" + end + require "google/shopping/merchant/lfp/v1beta/lfp_inventory_service/credentials" + ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Credentials.env_vars.each do |path| + ENV[path] = nil + end + ENV["GOOGLE_CLOUD_PROJECT"] = project + ENV["GOOGLE_CLOUD_TEST_PROJECT"] = project + ENV["GOOGLE_CLOUD_KEYFILE_JSON"] = keyfile + + Rake::Task["acceptance:run"].invoke +end + +namespace :acceptance do + task :run do + if File.directory? "acceptance" + Rake::Task[:smoke_test].invoke + else + puts "The google-shopping-merchant-lfp-v1beta gem has no acceptance tests." + end + end + + desc "Run acceptance cleanup." + task :cleanup do + end +end + +task :samples do + Rake::Task["samples:latest"].invoke +end + +namespace :samples do + task :latest do + if File.directory? "samples" + Dir.chdir "samples" do + Bundler.with_clean_env do + ENV["GOOGLE_CLOUD_SAMPLES_TEST"] = "not_master" + sh "bundle update" + sh "bundle exec rake test" + end + end + else + puts "The google-shopping-merchant-lfp-v1beta gem has no samples to test." + end + end + + task :master do + if File.directory? "samples" + Dir.chdir "samples" do + Bundler.with_clean_env do + ENV["GOOGLE_CLOUD_SAMPLES_TEST"] = "master" + sh "bundle update" + sh "bundle exec rake test" + end + end + else + puts "The google-shopping-merchant-lfp-v1beta gem has no samples to test." + end + end +end + +require "yard" +require "yard/rake/yardoc_task" +YARD::Rake::YardocTask.new do |y| + y.options << "--fail-on-warning" +end + +desc "Run yard-doctest example tests." +task :doctest do + puts "The google-shopping-merchant-lfp-v1beta gem does not have doctest tests." +end + +desc "Run the CI build" +task :ci do + header "BUILDING google-shopping-merchant-lfp-v1beta" + header "google-shopping-merchant-lfp-v1beta rubocop", "*" + Rake::Task[:rubocop].invoke + header "google-shopping-merchant-lfp-v1beta yard", "*" + Rake::Task[:yard].invoke + header "google-shopping-merchant-lfp-v1beta test", "*" + Rake::Task[:test].invoke +end + +namespace :ci do + desc "Run the CI build, with smoke tests." + task :smoke_test do + Rake::Task[:ci].invoke + header "google-shopping-merchant-lfp-v1beta smoke_test", "*" + Rake::Task[:smoke_test].invoke + end + desc "Run the CI build, with acceptance tests." + task :acceptance do + Rake::Task[:ci].invoke + header "google-shopping-merchant-lfp-v1beta acceptance", "*" + Rake::Task[:acceptance].invoke + end + task :a do + # This is a handy shortcut to save typing + Rake::Task["ci:acceptance"].invoke + end +end + +task default: :test + +def header str, token = "#" + line_length = str.length + 8 + puts "" + puts token * line_length + puts "#{token * 3} #{str} #{token * 3}" + puts token * line_length + puts "" +end diff --git a/google-shopping-merchant-lfp-v1beta/gapic_metadata.json b/google-shopping-merchant-lfp-v1beta/gapic_metadata.json new file mode 100644 index 000000000000..ea08ef885e20 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/gapic_metadata.json @@ -0,0 +1,66 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "ruby", + "protoPackage": "google.shopping.merchant.lfp.v1beta", + "libraryPackage": "::Google::Shopping::Merchant::Lfp::V1beta", + "services": { + "LfpInventoryService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client", + "rpcs": { + "InsertLfpInventory": { + "methods": [ + "insert_lfp_inventory" + ] + } + } + } + } + }, + "LfpSaleService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Client", + "rpcs": { + "InsertLfpSale": { + "methods": [ + "insert_lfp_sale" + ] + } + } + } + } + }, + "LfpStoreService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client", + "rpcs": { + "GetLfpStore": { + "methods": [ + "get_lfp_store" + ] + }, + "InsertLfpStore": { + "methods": [ + "insert_lfp_store" + ] + }, + "DeleteLfpStore": { + "methods": [ + "delete_lfp_store" + ] + }, + "ListLfpStores": { + "methods": [ + "list_lfp_stores" + ] + } + } + } + } + } + } +} diff --git a/google-shopping-merchant-lfp-v1beta/google-shopping-merchant-lfp-v1beta.gemspec b/google-shopping-merchant-lfp-v1beta/google-shopping-merchant-lfp-v1beta.gemspec new file mode 100644 index 000000000000..9d9056123bfd --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/google-shopping-merchant-lfp-v1beta.gemspec @@ -0,0 +1,29 @@ +# -*- ruby -*- +# encoding: utf-8 + +require File.expand_path("lib/google/shopping/merchant/lfp/v1beta/version", __dir__) + +Gem::Specification.new do |gem| + gem.name = "google-shopping-merchant-lfp-v1beta" + gem.version = Google::Shopping::Merchant::Lfp::V1beta::VERSION + + gem.authors = ["Google LLC"] + gem.email = "googleapis-packages@google.com" + gem.description = "Programmatically manage your Merchant Center accounts. Note that google-shopping-merchant-lfp-v1beta is a version-specific client library. For most uses, we recommend installing the main client library google-shopping-merchant-lfp instead. See the readme for more details." + gem.summary = "Programmatically manage your Merchant Center accounts." + gem.homepage = "https://github.com/googleapis/google-cloud-ruby" + gem.license = "Apache-2.0" + + gem.platform = Gem::Platform::RUBY + + gem.files = `git ls-files -- lib/*`.split("\n") + + `git ls-files -- proto_docs/*`.split("\n") + + ["README.md", "LICENSE.md", "AUTHENTICATION.md", ".yardopts"] + gem.require_paths = ["lib"] + + gem.required_ruby_version = ">= 2.7" + + gem.add_dependency "gapic-common", ">= 0.21.1", "< 2.a" + gem.add_dependency "google-cloud-errors", "~> 1.0" + gem.add_dependency "google-shopping-type", "> 0.0", "< 2.a" +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google-shopping-merchant-lfp-v1beta.rb b/google-shopping-merchant-lfp-v1beta/lib/google-shopping-merchant-lfp-v1beta.rb new file mode 100644 index 000000000000..3f6901699442 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google-shopping-merchant-lfp-v1beta.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# This gem does not autoload during Bundler.require. To load this gem, +# issue explicit require statements for the packages desired, e.g.: +# require "google/shopping/merchant/lfp/v1beta" diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta.rb new file mode 100644 index 000000000000..4a08d15ef8b6 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/shopping/merchant/lfp/v1beta/lfp_inventory_service" +require "google/shopping/merchant/lfp/v1beta/lfp_sale_service" +require "google/shopping/merchant/lfp/v1beta/lfp_store_service" +require "google/shopping/merchant/lfp/v1beta/version" + +module Google + module Shopping + module Merchant + module Lfp + ## + # API client module. + # + # @example Load this package, including all its services, and instantiate a gRPC client + # + # require "google/shopping/merchant/lfp/v1beta" + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client.new + # + # @example Load this package, including all its services, and instantiate a REST client + # + # require "google/shopping/merchant/lfp/v1beta" + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Rest::Client.new + # + module V1beta + end + end + end + end +end + +helper_path = ::File.join __dir__, "v1beta", "_helpers.rb" +require "google/shopping/merchant/lfp/v1beta/_helpers" if ::File.file? helper_path diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service.rb new file mode 100644 index 000000000000..dd19348e914c --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/shopping/merchant/lfp/v1beta/version" + +require "google/shopping/merchant/lfp/v1beta/lfp_inventory_service/credentials" +require "google/shopping/merchant/lfp/v1beta/lfp_inventory_service/paths" +require "google/shopping/merchant/lfp/v1beta/lfp_inventory_service/client" +require "google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest" + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + ## + # Service for a [LFP + # partner](https://support.google.com/merchants/answer/7676652) to submit local + # inventories for a merchant. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/shopping/merchant/lfp/v1beta/lfp_inventory_service" + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest" + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Rest::Client.new + # + module LfpInventoryService + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "lfp_inventory_service", "helpers.rb" +require "google/shopping/merchant/lfp/v1beta/lfp_inventory_service/helpers" if ::File.file? helper_path diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/client.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/client.rb new file mode 100644 index 000000000000..cc172ad2d30e --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/client.rb @@ -0,0 +1,435 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/shopping/merchant/lfp/v1beta/lfpinventory_pb" + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + module LfpInventoryService + ## + # Client for the LfpInventoryService service. + # + # Service for a [LFP + # partner](https://support.google.com/merchants/answer/7676652) to submit local + # inventories for a merchant. + # + class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "merchantapi.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :lfp_inventory_service_stub + + ## + # Configure the LfpInventoryService Client class. + # + # See {::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all LfpInventoryService clients + # ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Shopping", "Merchant", "Lfp", "V1beta"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + default_config.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the LfpInventoryService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @lfp_inventory_service_stub.universe_domain + end + + ## + # Create a new LfpInventoryService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the LfpInventoryService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/shopping/merchant/lfp/v1beta/lfpinventory_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @lfp_inventory_service_stub = ::Gapic::ServiceStub.new( + ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool + ) + end + + # Service calls + + ## + # Inserts a `LfpInventory` resource for the given target merchant account. If + # the resource already exists, it will be replaced. The inventory + # automatically expires after 30 days. + # + # @overload insert_lfp_inventory(request, options = nil) + # Pass arguments to `insert_lfp_inventory` via a request object, either of type + # {::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpInventoryRequest} or an equivalent Hash. + # + # @param request [::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpInventoryRequest, ::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 insert_lfp_inventory(parent: nil, lfp_inventory: nil) + # Pass arguments to `insert_lfp_inventory` 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 parent [::String] + # Required. The LFP provider account. + # Format: `accounts/{account}` + # @param lfp_inventory [::Google::Shopping::Merchant::Lfp::V1beta::LfpInventory, ::Hash] + # Required. The inventory to insert. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Shopping::Merchant::Lfp::V1beta::LfpInventory] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Shopping::Merchant::Lfp::V1beta::LfpInventory] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/shopping/merchant/lfp/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Shopping::Merchant::Lfp::V1beta::InsertLfpInventoryRequest.new + # + # # Call the insert_lfp_inventory method. + # result = client.insert_lfp_inventory request + # + # # The returned object is of type Google::Shopping::Merchant::Lfp::V1beta::LfpInventory. + # p result + # + def insert_lfp_inventory request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpInventoryRequest + + # 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.insert_lfp_inventory.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::Shopping::Merchant::Lfp::V1beta::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + 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.insert_lfp_inventory.timeout, + metadata: metadata, + retry_policy: @config.rpcs.insert_lfp_inventory.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @lfp_inventory_service_stub.call_rpc :insert_lfp_inventory, 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) + end + + ## + # Configuration class for the LfpInventoryService API. + # + # This class represents the configuration for LfpInventoryService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # insert_lfp_inventory to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.insert_lfp_inventory.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.insert_lfp_inventory.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "merchantapi.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the LfpInventoryService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `insert_lfp_inventory` + # @return [::Gapic::Config::Method] + # + attr_reader :insert_lfp_inventory + + # @private + def initialize parent_rpcs = nil + insert_lfp_inventory_config = parent_rpcs.insert_lfp_inventory if parent_rpcs.respond_to? :insert_lfp_inventory + @insert_lfp_inventory = ::Gapic::Config::Method.new insert_lfp_inventory_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/credentials.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/credentials.rb new file mode 100644 index 000000000000..c65dcf4dc629 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/credentials.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + module LfpInventoryService + # Credentials for the LfpInventoryService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/content" + ] + self.env_vars = [ + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/paths.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/paths.rb new file mode 100644 index 000000000000..f76ace026e35 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/paths.rb @@ -0,0 +1,70 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + module LfpInventoryService + # Path helper methods for the LfpInventoryService API. + module Paths + ## + # Create a fully-qualified Account resource string. + # + # The resource will be in the following format: + # + # `accounts/{account}` + # + # @param account [String] + # + # @return [::String] + def account_path account: + "accounts/#{account}" + end + + ## + # Create a fully-qualified LfpInventory resource string. + # + # The resource will be in the following format: + # + # `accounts/{account}/lfpInventories/{target_merchant}~{store_code}~{offer}` + # + # @param account [String] + # @param target_merchant [String] + # @param store_code [String] + # @param offer [String] + # + # @return [::String] + def lfp_inventory_path account:, target_merchant:, store_code:, offer: + raise ::ArgumentError, "account cannot contain /" if account.to_s.include? "/" + raise ::ArgumentError, "target_merchant cannot contain /" if target_merchant.to_s.include? "/" + raise ::ArgumentError, "store_code cannot contain /" if store_code.to_s.include? "/" + + "accounts/#{account}/lfpInventories/#{target_merchant}~#{store_code}~#{offer}" + end + + extend self + end + end + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest.rb new file mode 100644 index 000000000000..1bfbde4d0c29 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/shopping/merchant/lfp/v1beta/version" + +require "google/shopping/merchant/lfp/v1beta/lfp_inventory_service/credentials" +require "google/shopping/merchant/lfp/v1beta/lfp_inventory_service/paths" +require "google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest/client" + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + ## + # Service for a [LFP + # partner](https://support.google.com/merchants/answer/7676652) to submit local + # inventories for a merchant. + # + # To load this service and instantiate a REST client: + # + # require "google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest" + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Rest::Client.new + # + module LfpInventoryService + # Client for the REST transport + module Rest + end + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest/helpers" if ::File.file? helper_path diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest/client.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest/client.rb new file mode 100644 index 000000000000..0aad1bc3692f --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest/client.rb @@ -0,0 +1,402 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/shopping/merchant/lfp/v1beta/lfpinventory_pb" +require "google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest/service_stub" + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + module LfpInventoryService + module Rest + ## + # REST client for the LfpInventoryService service. + # + # Service for a [LFP + # partner](https://support.google.com/merchants/answer/7676652) to submit local + # inventories for a merchant. + # + class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "merchantapi.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :lfp_inventory_service_stub + + ## + # Configure the LfpInventoryService Client class. + # + # See {::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all LfpInventoryService clients + # ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Shopping", "Merchant", "Lfp", "V1beta"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + default_config.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the LfpInventoryService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @lfp_inventory_service_stub.universe_domain + end + + ## + # Create a new LfpInventoryService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the LfpInventoryService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @lfp_inventory_service_stub = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) + end + + # Service calls + + ## + # Inserts a `LfpInventory` resource for the given target merchant account. If + # the resource already exists, it will be replaced. The inventory + # automatically expires after 30 days. + # + # @overload insert_lfp_inventory(request, options = nil) + # Pass arguments to `insert_lfp_inventory` via a request object, either of type + # {::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpInventoryRequest} or an equivalent Hash. + # + # @param request [::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpInventoryRequest, ::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 insert_lfp_inventory(parent: nil, lfp_inventory: nil) + # Pass arguments to `insert_lfp_inventory` 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 parent [::String] + # Required. The LFP provider account. + # Format: `accounts/{account}` + # @param lfp_inventory [::Google::Shopping::Merchant::Lfp::V1beta::LfpInventory, ::Hash] + # Required. The inventory to insert. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Shopping::Merchant::Lfp::V1beta::LfpInventory] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Shopping::Merchant::Lfp::V1beta::LfpInventory] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/shopping/merchant/lfp/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Shopping::Merchant::Lfp::V1beta::InsertLfpInventoryRequest.new + # + # # Call the insert_lfp_inventory method. + # result = client.insert_lfp_inventory request + # + # # The returned object is of type Google::Shopping::Merchant::Lfp::V1beta::LfpInventory. + # p result + # + def insert_lfp_inventory request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpInventoryRequest + + # 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 + call_metadata = @config.rpcs.insert_lfp_inventory.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Shopping::Merchant::Lfp::V1beta::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.insert_lfp_inventory.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.insert_lfp_inventory.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @lfp_inventory_service_stub.insert_lfp_inventory request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the LfpInventoryService REST API. + # + # This class represents the configuration for LfpInventoryService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # insert_lfp_inventory to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.insert_lfp_inventory.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.insert_lfp_inventory.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "merchantapi.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the LfpInventoryService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `insert_lfp_inventory` + # @return [::Gapic::Config::Method] + # + attr_reader :insert_lfp_inventory + + # @private + def initialize parent_rpcs = nil + insert_lfp_inventory_config = parent_rpcs.insert_lfp_inventory if parent_rpcs.respond_to? :insert_lfp_inventory + @insert_lfp_inventory = ::Gapic::Config::Method.new insert_lfp_inventory_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest/service_stub.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest/service_stub.rb new file mode 100644 index 000000000000..1e703ffbd423 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest/service_stub.rb @@ -0,0 +1,131 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/shopping/merchant/lfp/v1beta/lfpinventory_pb" + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + module LfpInventoryService + module Rest + ## + # REST service stub for the LfpInventoryService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + raise_faraday_errors: false + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # Baseline implementation for the insert_lfp_inventory REST call + # + # @param request_pb [::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpInventoryRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Shopping::Merchant::Lfp::V1beta::LfpInventory] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Shopping::Merchant::Lfp::V1beta::LfpInventory] + # A result object deserialized from the server's reply + def insert_lfp_inventory request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_insert_lfp_inventory_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventory.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # @private + # + # GRPC transcoding helper method for the insert_lfp_inventory REST call + # + # @param request_pb [::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpInventoryRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_insert_lfp_inventory_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/lfp/v1beta/{parent}/lfpInventories:insert", + body: "lfp_inventory", + matches: [ + ["parent", %r{^accounts/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service.rb new file mode 100644 index 000000000000..1d564b85fdc3 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/shopping/merchant/lfp/v1beta/version" + +require "google/shopping/merchant/lfp/v1beta/lfp_sale_service/credentials" +require "google/shopping/merchant/lfp/v1beta/lfp_sale_service/paths" +require "google/shopping/merchant/lfp/v1beta/lfp_sale_service/client" +require "google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest" + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + ## + # Service for a [LFP + # partner](https://support.google.com/merchants/answer/7676652) to submit sales + # data for a merchant. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/shopping/merchant/lfp/v1beta/lfp_sale_service" + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest" + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Rest::Client.new + # + module LfpSaleService + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "lfp_sale_service", "helpers.rb" +require "google/shopping/merchant/lfp/v1beta/lfp_sale_service/helpers" if ::File.file? helper_path diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/client.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/client.rb new file mode 100644 index 000000000000..9c6ae01f5695 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/client.rb @@ -0,0 +1,433 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/shopping/merchant/lfp/v1beta/lfpsale_pb" + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + module LfpSaleService + ## + # Client for the LfpSaleService service. + # + # Service for a [LFP + # partner](https://support.google.com/merchants/answer/7676652) to submit sales + # data for a merchant. + # + class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "merchantapi.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :lfp_sale_service_stub + + ## + # Configure the LfpSaleService Client class. + # + # See {::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all LfpSaleService clients + # ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Shopping", "Merchant", "Lfp", "V1beta"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + default_config.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the LfpSaleService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @lfp_sale_service_stub.universe_domain + end + + ## + # Create a new LfpSaleService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the LfpSaleService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/shopping/merchant/lfp/v1beta/lfpsale_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @lfp_sale_service_stub = ::Gapic::ServiceStub.new( + ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool + ) + end + + # Service calls + + ## + # Inserts a `LfpSale` for the given merchant. + # + # @overload insert_lfp_sale(request, options = nil) + # Pass arguments to `insert_lfp_sale` via a request object, either of type + # {::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpSaleRequest} or an equivalent Hash. + # + # @param request [::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpSaleRequest, ::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 insert_lfp_sale(parent: nil, lfp_sale: nil) + # Pass arguments to `insert_lfp_sale` 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 parent [::String] + # Required. The LFP provider account. + # Format: `accounts/{lfp_partner}` + # @param lfp_sale [::Google::Shopping::Merchant::Lfp::V1beta::LfpSale, ::Hash] + # Required. The sale to insert. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Shopping::Merchant::Lfp::V1beta::LfpSale] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Shopping::Merchant::Lfp::V1beta::LfpSale] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/shopping/merchant/lfp/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Shopping::Merchant::Lfp::V1beta::InsertLfpSaleRequest.new + # + # # Call the insert_lfp_sale method. + # result = client.insert_lfp_sale request + # + # # The returned object is of type Google::Shopping::Merchant::Lfp::V1beta::LfpSale. + # p result + # + def insert_lfp_sale request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpSaleRequest + + # 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.insert_lfp_sale.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::Shopping::Merchant::Lfp::V1beta::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + 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.insert_lfp_sale.timeout, + metadata: metadata, + retry_policy: @config.rpcs.insert_lfp_sale.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @lfp_sale_service_stub.call_rpc :insert_lfp_sale, 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) + end + + ## + # Configuration class for the LfpSaleService API. + # + # This class represents the configuration for LfpSaleService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # insert_lfp_sale to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.insert_lfp_sale.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.insert_lfp_sale.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "merchantapi.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the LfpSaleService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `insert_lfp_sale` + # @return [::Gapic::Config::Method] + # + attr_reader :insert_lfp_sale + + # @private + def initialize parent_rpcs = nil + insert_lfp_sale_config = parent_rpcs.insert_lfp_sale if parent_rpcs.respond_to? :insert_lfp_sale + @insert_lfp_sale = ::Gapic::Config::Method.new insert_lfp_sale_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/credentials.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/credentials.rb new file mode 100644 index 000000000000..003e33388e6f --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/credentials.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + module LfpSaleService + # Credentials for the LfpSaleService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/content" + ] + self.env_vars = [ + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/paths.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/paths.rb new file mode 100644 index 000000000000..39dab5a49ede --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/paths.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + module LfpSaleService + # Path helper methods for the LfpSaleService API. + module Paths + ## + # Create a fully-qualified LfpSale resource string. + # + # The resource will be in the following format: + # + # `accounts/{account}/lfpSales/{sale}` + # + # @param account [String] + # @param sale [String] + # + # @return [::String] + def lfp_sale_path account:, sale: + raise ::ArgumentError, "account cannot contain /" if account.to_s.include? "/" + + "accounts/#{account}/lfpSales/#{sale}" + end + + extend self + end + end + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest.rb new file mode 100644 index 000000000000..a951dd3591ee --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/shopping/merchant/lfp/v1beta/version" + +require "google/shopping/merchant/lfp/v1beta/lfp_sale_service/credentials" +require "google/shopping/merchant/lfp/v1beta/lfp_sale_service/paths" +require "google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest/client" + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + ## + # Service for a [LFP + # partner](https://support.google.com/merchants/answer/7676652) to submit sales + # data for a merchant. + # + # To load this service and instantiate a REST client: + # + # require "google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest" + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Rest::Client.new + # + module LfpSaleService + # Client for the REST transport + module Rest + end + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest/helpers" if ::File.file? helper_path diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest/client.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest/client.rb new file mode 100644 index 000000000000..21c3094c13ee --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest/client.rb @@ -0,0 +1,400 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/shopping/merchant/lfp/v1beta/lfpsale_pb" +require "google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest/service_stub" + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + module LfpSaleService + module Rest + ## + # REST client for the LfpSaleService service. + # + # Service for a [LFP + # partner](https://support.google.com/merchants/answer/7676652) to submit sales + # data for a merchant. + # + class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "merchantapi.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :lfp_sale_service_stub + + ## + # Configure the LfpSaleService Client class. + # + # See {::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all LfpSaleService clients + # ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Shopping", "Merchant", "Lfp", "V1beta"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + default_config.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the LfpSaleService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @lfp_sale_service_stub.universe_domain + end + + ## + # Create a new LfpSaleService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the LfpSaleService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @lfp_sale_service_stub = ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) + end + + # Service calls + + ## + # Inserts a `LfpSale` for the given merchant. + # + # @overload insert_lfp_sale(request, options = nil) + # Pass arguments to `insert_lfp_sale` via a request object, either of type + # {::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpSaleRequest} or an equivalent Hash. + # + # @param request [::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpSaleRequest, ::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 insert_lfp_sale(parent: nil, lfp_sale: nil) + # Pass arguments to `insert_lfp_sale` 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 parent [::String] + # Required. The LFP provider account. + # Format: `accounts/{lfp_partner}` + # @param lfp_sale [::Google::Shopping::Merchant::Lfp::V1beta::LfpSale, ::Hash] + # Required. The sale to insert. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Shopping::Merchant::Lfp::V1beta::LfpSale] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Shopping::Merchant::Lfp::V1beta::LfpSale] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/shopping/merchant/lfp/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Shopping::Merchant::Lfp::V1beta::InsertLfpSaleRequest.new + # + # # Call the insert_lfp_sale method. + # result = client.insert_lfp_sale request + # + # # The returned object is of type Google::Shopping::Merchant::Lfp::V1beta::LfpSale. + # p result + # + def insert_lfp_sale request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpSaleRequest + + # 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 + call_metadata = @config.rpcs.insert_lfp_sale.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Shopping::Merchant::Lfp::V1beta::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.insert_lfp_sale.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.insert_lfp_sale.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @lfp_sale_service_stub.insert_lfp_sale request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the LfpSaleService REST API. + # + # This class represents the configuration for LfpSaleService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # insert_lfp_sale to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.insert_lfp_sale.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.insert_lfp_sale.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "merchantapi.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the LfpSaleService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `insert_lfp_sale` + # @return [::Gapic::Config::Method] + # + attr_reader :insert_lfp_sale + + # @private + def initialize parent_rpcs = nil + insert_lfp_sale_config = parent_rpcs.insert_lfp_sale if parent_rpcs.respond_to? :insert_lfp_sale + @insert_lfp_sale = ::Gapic::Config::Method.new insert_lfp_sale_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest/service_stub.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest/service_stub.rb new file mode 100644 index 000000000000..e227102d07a9 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest/service_stub.rb @@ -0,0 +1,131 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/shopping/merchant/lfp/v1beta/lfpsale_pb" + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + module LfpSaleService + module Rest + ## + # REST service stub for the LfpSaleService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + raise_faraday_errors: false + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # Baseline implementation for the insert_lfp_sale REST call + # + # @param request_pb [::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpSaleRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Shopping::Merchant::Lfp::V1beta::LfpSale] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Shopping::Merchant::Lfp::V1beta::LfpSale] + # A result object deserialized from the server's reply + def insert_lfp_sale request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_insert_lfp_sale_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Shopping::Merchant::Lfp::V1beta::LfpSale.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # @private + # + # GRPC transcoding helper method for the insert_lfp_sale REST call + # + # @param request_pb [::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpSaleRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_insert_lfp_sale_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/lfp/v1beta/{parent}/lfpSales:insert", + body: "lfp_sale", + matches: [ + ["parent", %r{^accounts/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service.rb new file mode 100644 index 000000000000..4d063abe878c --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/shopping/merchant/lfp/v1beta/version" + +require "google/shopping/merchant/lfp/v1beta/lfp_store_service/credentials" +require "google/shopping/merchant/lfp/v1beta/lfp_store_service/paths" +require "google/shopping/merchant/lfp/v1beta/lfp_store_service/client" +require "google/shopping/merchant/lfp/v1beta/lfp_store_service/rest" + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + ## + # Service for a [LFP + # partner](https://support.google.com/merchants/answer/7676652) to submit local + # stores for a merchant. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/shopping/merchant/lfp/v1beta/lfp_store_service" + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/shopping/merchant/lfp/v1beta/lfp_store_service/rest" + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::Client.new + # + module LfpStoreService + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "lfp_store_service", "helpers.rb" +require "google/shopping/merchant/lfp/v1beta/lfp_store_service/helpers" if ::File.file? helper_path diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/client.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/client.rb new file mode 100644 index 000000000000..400cd1619540 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/client.rb @@ -0,0 +1,734 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/shopping/merchant/lfp/v1beta/lfpstore_pb" + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + module LfpStoreService + ## + # Client for the LfpStoreService service. + # + # Service for a [LFP + # partner](https://support.google.com/merchants/answer/7676652) to submit local + # stores for a merchant. + # + class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "merchantapi.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :lfp_store_service_stub + + ## + # Configure the LfpStoreService Client class. + # + # See {::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all LfpStoreService clients + # ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Shopping", "Merchant", "Lfp", "V1beta"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + default_config.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the LfpStoreService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @lfp_store_service_stub.universe_domain + end + + ## + # Create a new LfpStoreService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the LfpStoreService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/shopping/merchant/lfp/v1beta/lfpstore_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @lfp_store_service_stub = ::Gapic::ServiceStub.new( + ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool + ) + end + + # Service calls + + ## + # Retrieves information about a store. + # + # @overload get_lfp_store(request, options = nil) + # Pass arguments to `get_lfp_store` via a request object, either of type + # {::Google::Shopping::Merchant::Lfp::V1beta::GetLfpStoreRequest} or an equivalent Hash. + # + # @param request [::Google::Shopping::Merchant::Lfp::V1beta::GetLfpStoreRequest, ::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_lfp_store(name: nil) + # Pass arguments to `get_lfp_store` 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 store to retrieve. + # Format: `accounts/{account}/lfpStores/{target_merchant}~{store_code}` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Shopping::Merchant::Lfp::V1beta::LfpStore] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Shopping::Merchant::Lfp::V1beta::LfpStore] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/shopping/merchant/lfp/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Shopping::Merchant::Lfp::V1beta::GetLfpStoreRequest.new + # + # # Call the get_lfp_store method. + # result = client.get_lfp_store request + # + # # The returned object is of type Google::Shopping::Merchant::Lfp::V1beta::LfpStore. + # p result + # + def get_lfp_store request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Lfp::V1beta::GetLfpStoreRequest + + # 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_lfp_store.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::Shopping::Merchant::Lfp::V1beta::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + 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_lfp_store.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_lfp_store.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @lfp_store_service_stub.call_rpc :get_lfp_store, 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) + end + + ## + # Inserts a store for the target merchant. If the store with the same store + # code already exists, it will be replaced. + # + # @overload insert_lfp_store(request, options = nil) + # Pass arguments to `insert_lfp_store` via a request object, either of type + # {::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpStoreRequest} or an equivalent Hash. + # + # @param request [::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpStoreRequest, ::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 insert_lfp_store(parent: nil, lfp_store: nil) + # Pass arguments to `insert_lfp_store` 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 parent [::String] + # Required. The LFP provider account + # Format: `accounts/{account}` + # @param lfp_store [::Google::Shopping::Merchant::Lfp::V1beta::LfpStore, ::Hash] + # Required. The store to insert. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Shopping::Merchant::Lfp::V1beta::LfpStore] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Shopping::Merchant::Lfp::V1beta::LfpStore] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/shopping/merchant/lfp/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Shopping::Merchant::Lfp::V1beta::InsertLfpStoreRequest.new + # + # # Call the insert_lfp_store method. + # result = client.insert_lfp_store request + # + # # The returned object is of type Google::Shopping::Merchant::Lfp::V1beta::LfpStore. + # p result + # + def insert_lfp_store request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpStoreRequest + + # 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.insert_lfp_store.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::Shopping::Merchant::Lfp::V1beta::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + 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.insert_lfp_store.timeout, + metadata: metadata, + retry_policy: @config.rpcs.insert_lfp_store.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @lfp_store_service_stub.call_rpc :insert_lfp_store, 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) + end + + ## + # Deletes a store for a target merchant. + # + # @overload delete_lfp_store(request, options = nil) + # Pass arguments to `delete_lfp_store` via a request object, either of type + # {::Google::Shopping::Merchant::Lfp::V1beta::DeleteLfpStoreRequest} or an equivalent Hash. + # + # @param request [::Google::Shopping::Merchant::Lfp::V1beta::DeleteLfpStoreRequest, ::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 delete_lfp_store(name: nil) + # Pass arguments to `delete_lfp_store` 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 store to delete for the target merchant account. + # Format: `accounts/{account}/lfpStores/{target_merchant}~{store_code}` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/shopping/merchant/lfp/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Shopping::Merchant::Lfp::V1beta::DeleteLfpStoreRequest.new + # + # # Call the delete_lfp_store method. + # result = client.delete_lfp_store request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_lfp_store request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Lfp::V1beta::DeleteLfpStoreRequest + + # 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.delete_lfp_store.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::Shopping::Merchant::Lfp::V1beta::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + 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.delete_lfp_store.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_lfp_store.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @lfp_store_service_stub.call_rpc :delete_lfp_store, 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) + end + + ## + # Lists the stores of the target merchant, specified by the filter in + # `ListLfpStoresRequest`. + # + # @overload list_lfp_stores(request, options = nil) + # Pass arguments to `list_lfp_stores` via a request object, either of type + # {::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresRequest} or an equivalent Hash. + # + # @param request [::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresRequest, ::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 list_lfp_stores(parent: nil, target_account: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_lfp_stores` 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 parent [::String] + # Required. The LFP partner. + # Format: `accounts/{account}` + # @param target_account [::Integer] + # Required. The Merchant Center id of the merchant to list stores for. + # @param page_size [::Integer] + # Optional. The maximum number of `LfpStore` resources for the given account + # to return. The service returns fewer than this value if the number of + # stores for the given account is less than the `pageSize`. The default value + # is 250. The maximum value is 1000; If a value higher than the maximum is + # specified, then the `pageSize` will default to the maximum. + # @param page_token [::String] + # Optional. A page token, received from a previous `ListLfpStoresRequest` + # call. Provide the page token to retrieve the subsequent page. When + # paginating, all other parameters provided to `ListLfpStoresRequest` must + # match the call that provided the page token. The token returned as + # {::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresResponse#next_page_token nextPageToken} + # in the response to the previous request. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Shopping::Merchant::Lfp::V1beta::LfpStore>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Shopping::Merchant::Lfp::V1beta::LfpStore>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/shopping/merchant/lfp/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresRequest.new + # + # # Call the list_lfp_stores method. + # result = client.list_lfp_stores request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Shopping::Merchant::Lfp::V1beta::LfpStore. + # p item + # end + # + def list_lfp_stores request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresRequest + + # 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.list_lfp_stores.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::Shopping::Merchant::Lfp::V1beta::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + 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.list_lfp_stores.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_lfp_stores.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @lfp_store_service_stub.call_rpc :list_lfp_stores, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @lfp_store_service_stub, :list_lfp_stores, request, response, operation, options + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the LfpStoreService API. + # + # This class represents the configuration for LfpStoreService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # get_lfp_store to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.get_lfp_store.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.get_lfp_store.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "merchantapi.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the LfpStoreService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `get_lfp_store` + # @return [::Gapic::Config::Method] + # + attr_reader :get_lfp_store + ## + # RPC-specific configuration for `insert_lfp_store` + # @return [::Gapic::Config::Method] + # + attr_reader :insert_lfp_store + ## + # RPC-specific configuration for `delete_lfp_store` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_lfp_store + ## + # RPC-specific configuration for `list_lfp_stores` + # @return [::Gapic::Config::Method] + # + attr_reader :list_lfp_stores + + # @private + def initialize parent_rpcs = nil + get_lfp_store_config = parent_rpcs.get_lfp_store if parent_rpcs.respond_to? :get_lfp_store + @get_lfp_store = ::Gapic::Config::Method.new get_lfp_store_config + insert_lfp_store_config = parent_rpcs.insert_lfp_store if parent_rpcs.respond_to? :insert_lfp_store + @insert_lfp_store = ::Gapic::Config::Method.new insert_lfp_store_config + delete_lfp_store_config = parent_rpcs.delete_lfp_store if parent_rpcs.respond_to? :delete_lfp_store + @delete_lfp_store = ::Gapic::Config::Method.new delete_lfp_store_config + list_lfp_stores_config = parent_rpcs.list_lfp_stores if parent_rpcs.respond_to? :list_lfp_stores + @list_lfp_stores = ::Gapic::Config::Method.new list_lfp_stores_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/credentials.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/credentials.rb new file mode 100644 index 000000000000..537bef4e2fa4 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/credentials.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + module LfpStoreService + # Credentials for the LfpStoreService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/content" + ] + self.env_vars = [ + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/paths.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/paths.rb new file mode 100644 index 000000000000..eccaaaef2cbc --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/paths.rb @@ -0,0 +1,68 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + module LfpStoreService + # Path helper methods for the LfpStoreService API. + module Paths + ## + # Create a fully-qualified Account resource string. + # + # The resource will be in the following format: + # + # `accounts/{account}` + # + # @param account [String] + # + # @return [::String] + def account_path account: + "accounts/#{account}" + end + + ## + # Create a fully-qualified LfpStore resource string. + # + # The resource will be in the following format: + # + # `accounts/{account}/lfpStores/{target_merchant}~{store_code}` + # + # @param account [String] + # @param target_merchant [String] + # @param store_code [String] + # + # @return [::String] + def lfp_store_path account:, target_merchant:, store_code: + raise ::ArgumentError, "account cannot contain /" if account.to_s.include? "/" + raise ::ArgumentError, "target_merchant cannot contain /" if target_merchant.to_s.include? "/" + + "accounts/#{account}/lfpStores/#{target_merchant}~#{store_code}" + end + + extend self + end + end + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/rest.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/rest.rb new file mode 100644 index 000000000000..53a918964596 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/rest.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/shopping/merchant/lfp/v1beta/version" + +require "google/shopping/merchant/lfp/v1beta/lfp_store_service/credentials" +require "google/shopping/merchant/lfp/v1beta/lfp_store_service/paths" +require "google/shopping/merchant/lfp/v1beta/lfp_store_service/rest/client" + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + ## + # Service for a [LFP + # partner](https://support.google.com/merchants/answer/7676652) to submit local + # stores for a merchant. + # + # To load this service and instantiate a REST client: + # + # require "google/shopping/merchant/lfp/v1beta/lfp_store_service/rest" + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::Client.new + # + module LfpStoreService + # Client for the REST transport + module Rest + end + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/shopping/merchant/lfp/v1beta/lfp_store_service/rest/helpers" if ::File.file? helper_path diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/rest/client.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/rest/client.rb new file mode 100644 index 000000000000..923596721814 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/rest/client.rb @@ -0,0 +1,680 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/shopping/merchant/lfp/v1beta/lfpstore_pb" +require "google/shopping/merchant/lfp/v1beta/lfp_store_service/rest/service_stub" + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + module LfpStoreService + module Rest + ## + # REST client for the LfpStoreService service. + # + # Service for a [LFP + # partner](https://support.google.com/merchants/answer/7676652) to submit local + # stores for a merchant. + # + class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "merchantapi.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :lfp_store_service_stub + + ## + # Configure the LfpStoreService Client class. + # + # See {::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all LfpStoreService clients + # ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Shopping", "Merchant", "Lfp", "V1beta"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + default_config.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the LfpStoreService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @lfp_store_service_stub.universe_domain + end + + ## + # Create a new LfpStoreService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the LfpStoreService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @lfp_store_service_stub = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) + end + + # Service calls + + ## + # Retrieves information about a store. + # + # @overload get_lfp_store(request, options = nil) + # Pass arguments to `get_lfp_store` via a request object, either of type + # {::Google::Shopping::Merchant::Lfp::V1beta::GetLfpStoreRequest} or an equivalent Hash. + # + # @param request [::Google::Shopping::Merchant::Lfp::V1beta::GetLfpStoreRequest, ::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_lfp_store(name: nil) + # Pass arguments to `get_lfp_store` 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 store to retrieve. + # Format: `accounts/{account}/lfpStores/{target_merchant}~{store_code}` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Shopping::Merchant::Lfp::V1beta::LfpStore] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Shopping::Merchant::Lfp::V1beta::LfpStore] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/shopping/merchant/lfp/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Shopping::Merchant::Lfp::V1beta::GetLfpStoreRequest.new + # + # # Call the get_lfp_store method. + # result = client.get_lfp_store request + # + # # The returned object is of type Google::Shopping::Merchant::Lfp::V1beta::LfpStore. + # p result + # + def get_lfp_store request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Lfp::V1beta::GetLfpStoreRequest + + # 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 + call_metadata = @config.rpcs.get_lfp_store.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Shopping::Merchant::Lfp::V1beta::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_lfp_store.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_lfp_store.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @lfp_store_service_stub.get_lfp_store request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Inserts a store for the target merchant. If the store with the same store + # code already exists, it will be replaced. + # + # @overload insert_lfp_store(request, options = nil) + # Pass arguments to `insert_lfp_store` via a request object, either of type + # {::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpStoreRequest} or an equivalent Hash. + # + # @param request [::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpStoreRequest, ::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 insert_lfp_store(parent: nil, lfp_store: nil) + # Pass arguments to `insert_lfp_store` 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 parent [::String] + # Required. The LFP provider account + # Format: `accounts/{account}` + # @param lfp_store [::Google::Shopping::Merchant::Lfp::V1beta::LfpStore, ::Hash] + # Required. The store to insert. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Shopping::Merchant::Lfp::V1beta::LfpStore] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Shopping::Merchant::Lfp::V1beta::LfpStore] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/shopping/merchant/lfp/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Shopping::Merchant::Lfp::V1beta::InsertLfpStoreRequest.new + # + # # Call the insert_lfp_store method. + # result = client.insert_lfp_store request + # + # # The returned object is of type Google::Shopping::Merchant::Lfp::V1beta::LfpStore. + # p result + # + def insert_lfp_store request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpStoreRequest + + # 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 + call_metadata = @config.rpcs.insert_lfp_store.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Shopping::Merchant::Lfp::V1beta::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.insert_lfp_store.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.insert_lfp_store.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @lfp_store_service_stub.insert_lfp_store request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a store for a target merchant. + # + # @overload delete_lfp_store(request, options = nil) + # Pass arguments to `delete_lfp_store` via a request object, either of type + # {::Google::Shopping::Merchant::Lfp::V1beta::DeleteLfpStoreRequest} or an equivalent Hash. + # + # @param request [::Google::Shopping::Merchant::Lfp::V1beta::DeleteLfpStoreRequest, ::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 delete_lfp_store(name: nil) + # Pass arguments to `delete_lfp_store` 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 store to delete for the target merchant account. + # Format: `accounts/{account}/lfpStores/{target_merchant}~{store_code}` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/shopping/merchant/lfp/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Shopping::Merchant::Lfp::V1beta::DeleteLfpStoreRequest.new + # + # # Call the delete_lfp_store method. + # result = client.delete_lfp_store request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_lfp_store request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Lfp::V1beta::DeleteLfpStoreRequest + + # 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 + call_metadata = @config.rpcs.delete_lfp_store.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Shopping::Merchant::Lfp::V1beta::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_lfp_store.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_lfp_store.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @lfp_store_service_stub.delete_lfp_store request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists the stores of the target merchant, specified by the filter in + # `ListLfpStoresRequest`. + # + # @overload list_lfp_stores(request, options = nil) + # Pass arguments to `list_lfp_stores` via a request object, either of type + # {::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresRequest} or an equivalent Hash. + # + # @param request [::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresRequest, ::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 list_lfp_stores(parent: nil, target_account: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_lfp_stores` 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 parent [::String] + # Required. The LFP partner. + # Format: `accounts/{account}` + # @param target_account [::Integer] + # Required. The Merchant Center id of the merchant to list stores for. + # @param page_size [::Integer] + # Optional. The maximum number of `LfpStore` resources for the given account + # to return. The service returns fewer than this value if the number of + # stores for the given account is less than the `pageSize`. The default value + # is 250. The maximum value is 1000; If a value higher than the maximum is + # specified, then the `pageSize` will default to the maximum. + # @param page_token [::String] + # Optional. A page token, received from a previous `ListLfpStoresRequest` + # call. Provide the page token to retrieve the subsequent page. When + # paginating, all other parameters provided to `ListLfpStoresRequest` must + # match the call that provided the page token. The token returned as + # {::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresResponse#next_page_token nextPageToken} + # in the response to the previous request. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Lfp::V1beta::LfpStore>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Lfp::V1beta::LfpStore>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/shopping/merchant/lfp/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresRequest.new + # + # # Call the list_lfp_stores method. + # result = client.list_lfp_stores request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Shopping::Merchant::Lfp::V1beta::LfpStore. + # p item + # end + # + def list_lfp_stores request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresRequest + + # 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 + call_metadata = @config.rpcs.list_lfp_stores.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Shopping::Merchant::Lfp::V1beta::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_lfp_stores.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_lfp_stores.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @lfp_store_service_stub.list_lfp_stores request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @lfp_store_service_stub, :list_lfp_stores, "lfp_stores", request, result, options + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the LfpStoreService REST API. + # + # This class represents the configuration for LfpStoreService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # get_lfp_store to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.get_lfp_store.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.get_lfp_store.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "merchantapi.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the LfpStoreService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `get_lfp_store` + # @return [::Gapic::Config::Method] + # + attr_reader :get_lfp_store + ## + # RPC-specific configuration for `insert_lfp_store` + # @return [::Gapic::Config::Method] + # + attr_reader :insert_lfp_store + ## + # RPC-specific configuration for `delete_lfp_store` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_lfp_store + ## + # RPC-specific configuration for `list_lfp_stores` + # @return [::Gapic::Config::Method] + # + attr_reader :list_lfp_stores + + # @private + def initialize parent_rpcs = nil + get_lfp_store_config = parent_rpcs.get_lfp_store if parent_rpcs.respond_to? :get_lfp_store + @get_lfp_store = ::Gapic::Config::Method.new get_lfp_store_config + insert_lfp_store_config = parent_rpcs.insert_lfp_store if parent_rpcs.respond_to? :insert_lfp_store + @insert_lfp_store = ::Gapic::Config::Method.new insert_lfp_store_config + delete_lfp_store_config = parent_rpcs.delete_lfp_store if parent_rpcs.respond_to? :delete_lfp_store + @delete_lfp_store = ::Gapic::Config::Method.new delete_lfp_store_config + list_lfp_stores_config = parent_rpcs.list_lfp_stores if parent_rpcs.respond_to? :list_lfp_stores + @list_lfp_stores = ::Gapic::Config::Method.new list_lfp_stores_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/rest/service_stub.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/rest/service_stub.rb new file mode 100644 index 000000000000..ae689af6b895 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfp_store_service/rest/service_stub.rb @@ -0,0 +1,308 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/shopping/merchant/lfp/v1beta/lfpstore_pb" + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + module LfpStoreService + module Rest + ## + # REST service stub for the LfpStoreService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + raise_faraday_errors: false + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # Baseline implementation for the get_lfp_store REST call + # + # @param request_pb [::Google::Shopping::Merchant::Lfp::V1beta::GetLfpStoreRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Shopping::Merchant::Lfp::V1beta::LfpStore] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Shopping::Merchant::Lfp::V1beta::LfpStore] + # A result object deserialized from the server's reply + def get_lfp_store request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_lfp_store_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStore.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the insert_lfp_store REST call + # + # @param request_pb [::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpStoreRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Shopping::Merchant::Lfp::V1beta::LfpStore] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Shopping::Merchant::Lfp::V1beta::LfpStore] + # A result object deserialized from the server's reply + def insert_lfp_store request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_insert_lfp_store_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStore.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the delete_lfp_store REST call + # + # @param request_pb [::Google::Shopping::Merchant::Lfp::V1beta::DeleteLfpStoreRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def delete_lfp_store request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_lfp_store_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the list_lfp_stores REST call + # + # @param request_pb [::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresResponse] + # A result object deserialized from the server's reply + def list_lfp_stores request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_lfp_stores_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresResponse.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # @private + # + # GRPC transcoding helper method for the get_lfp_store REST call + # + # @param request_pb [::Google::Shopping::Merchant::Lfp::V1beta::GetLfpStoreRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_lfp_store_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/lfp/v1beta/{name}", + matches: [ + ["name", %r{^accounts/[^/]+/lfpStores/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the insert_lfp_store REST call + # + # @param request_pb [::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpStoreRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_insert_lfp_store_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/lfp/v1beta/{parent}/lfpStores:insert", + body: "lfp_store", + matches: [ + ["parent", %r{^accounts/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_lfp_store REST call + # + # @param request_pb [::Google::Shopping::Merchant::Lfp::V1beta::DeleteLfpStoreRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_lfp_store_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/lfp/v1beta/{name}", + matches: [ + ["name", %r{^accounts/[^/]+/lfpStores/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_lfp_stores REST call + # + # @param request_pb [::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_lfp_stores_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/lfp/v1beta/{parent}/lfpStores", + matches: [ + ["parent", %r{^accounts/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpinventory_pb.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpinventory_pb.rb new file mode 100644 index 000000000000..5d95749dccc4 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpinventory_pb.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/shopping/merchant/lfp/v1beta/lfpinventory.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/protobuf/timestamp_pb' +require 'google/shopping/type/types_pb' + + +descriptor_data = "\n6google/shopping/merchant/lfp/v1beta/lfpinventory.proto\x12#google.shopping.merchant.lfp.v1beta\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a google/shopping/type/types.proto\"\xa2\x05\n\x0cLfpInventory\x12\x14\n\x04name\x18\x01 \x01(\tB\x06\xe0\x41\x03\xe0\x41\x08\x12\x1b\n\x0etarget_account\x18\x02 \x01(\x03\x42\x03\xe0\x41\x02\x12\x17\n\nstore_code\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12\x18\n\x08offer_id\x18\x04 \x01(\tB\x06\xe0\x41\x02\xe0\x41\x05\x12\x18\n\x0bregion_code\x18\x05 \x01(\tB\x03\xe0\x41\x02\x12\x1d\n\x10\x63ontent_language\x18\x06 \x01(\tB\x03\xe0\x41\x02\x12\x16\n\x04gtin\x18\x07 \x01(\tB\x03\xe0\x41\x01H\x00\x88\x01\x01\x12/\n\x05price\x18\x08 \x01(\x0b\x32\x1b.google.shopping.type.PriceB\x03\xe0\x41\x01\x12\x19\n\x0c\x61vailability\x18\t \x01(\tB\x03\xe0\x41\x02\x12\x1a\n\x08quantity\x18\n \x01(\x03\x42\x03\xe0\x41\x01H\x01\x88\x01\x01\x12\x38\n\x0f\x63ollection_time\x18\x0b \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x01\x12\x1f\n\rpickup_method\x18\x0c \x01(\tB\x03\xe0\x41\x01H\x02\x88\x01\x01\x12\x1c\n\npickup_sla\x18\r \x01(\tB\x03\xe0\x41\x01H\x03\x88\x01\x01\x12\x1c\n\nfeed_label\x18\x0e \x01(\tB\x03\xe0\x41\x01H\x04\x88\x01\x01:\x95\x01\xea\x41\x91\x01\n\'merchantapi.googleapis.com/LfpInventory\x12Haccounts/{account}/lfpInventories/{target_merchant}~{store_code}~{offer}*\x0elfpInventories2\x0clfpInventoryB\x07\n\x05_gtinB\x0b\n\t_quantityB\x10\n\x0e_pickup_methodB\r\n\x0b_pickup_slaB\r\n\x0b_feed_label\"\xab\x01\n\x19InsertLfpInventoryRequest\x12?\n\x06parent\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\x12\'merchantapi.googleapis.com/LfpInventory\x12M\n\rlfp_inventory\x18\x02 \x01(\x0b\x32\x31.google.shopping.merchant.lfp.v1beta.LfpInventoryB\x03\xe0\x41\x02\x32\xb6\x02\n\x13LfpInventoryService\x12\xd5\x01\n\x12InsertLfpInventory\x12>.google.shopping.merchant.lfp.v1beta.InsertLfpInventoryRequest\x1a\x31.google.shopping.merchant.lfp.v1beta.LfpInventory\"L\x82\xd3\xe4\x93\x02\x46\"5/lfp/v1beta/{parent=accounts/*}/lfpInventories:insert:\rlfp_inventory\x1aG\xca\x41\x1amerchantapi.googleapis.com\xd2\x41\'https://www.googleapis.com/auth/contentB\xba\x01\n\'com.google.shopping.merchant.lfp.v1betaB\x11LfpInventoryProtoP\x01Z?cloud.google.com/go/shopping/merchant/lfp/apiv1beta/lfppb;lfppb\xea\x41\x38\n\"merchantapi.googleapis.com/Account\x12\x12\x61\x63\x63ounts/{account}b\x06proto3" + +pool = Google::Protobuf::DescriptorPool.generated_pool + +begin + pool.add_serialized_file(descriptor_data) +rescue TypeError + # Compatibility code: will be removed in the next major version. + require 'google/protobuf/descriptor_pb' + parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data) + parsed.clear_dependency + serialized = parsed.class.encode(parsed) + file = pool.add_serialized_file(serialized) + warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}" + imports = [ + ["google.shopping.type.Price", "google/shopping/type/types.proto"], + ["google.protobuf.Timestamp", "google/protobuf/timestamp.proto"], + ] + imports.each do |type_name, expected_filename| + import_file = pool.lookup(type_name).file_descriptor + if import_file.name != expected_filename + warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}" + end + end + warn "Each proto file must use a consistent fully-qualified name." + warn "This will become an error in the next major version." +end + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + LfpInventory = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.shopping.merchant.lfp.v1beta.LfpInventory").msgclass + InsertLfpInventoryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.shopping.merchant.lfp.v1beta.InsertLfpInventoryRequest").msgclass + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpinventory_services_pb.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpinventory_services_pb.rb new file mode 100644 index 000000000000..8140d248b8ce --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpinventory_services_pb.rb @@ -0,0 +1,51 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/shopping/merchant/lfp/v1beta/lfpinventory.proto for package 'google.shopping.merchant.lfp.v1beta' +# Original file comments: +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'grpc' +require 'google/shopping/merchant/lfp/v1beta/lfpinventory_pb' + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + module LfpInventoryService + # Service for a [LFP + # partner](https://support.google.com/merchants/answer/7676652) to submit local + # inventories for a merchant. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.shopping.merchant.lfp.v1beta.LfpInventoryService' + + # Inserts a `LfpInventory` resource for the given target merchant account. If + # the resource already exists, it will be replaced. The inventory + # automatically expires after 30 days. + rpc :InsertLfpInventory, ::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpInventoryRequest, ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventory + end + + Stub = Service.rpc_stub_class + end + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpsale_pb.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpsale_pb.rb new file mode 100644 index 000000000000..775eb3d1da5b --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpsale_pb.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/shopping/merchant/lfp/v1beta/lfpsale.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/field_info_pb' +require 'google/api/resource_pb' +require 'google/protobuf/timestamp_pb' +require 'google/shopping/type/types_pb' + + +descriptor_data = "\n1google/shopping/merchant/lfp/v1beta/lfpsale.proto\x12#google.shopping.merchant.lfp.v1beta\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1bgoogle/api/field_info.proto\x1a\x19google/api/resource.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a google/shopping/type/types.proto\"\xe8\x03\n\x07LfpSale\x12\x14\n\x04name\x18\x01 \x01(\tB\x06\xe0\x41\x03\xe0\x41\x08\x12\x1b\n\x0etarget_account\x18\x02 \x01(\x03\x42\x03\xe0\x41\x02\x12\x17\n\nstore_code\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12\x15\n\x08offer_id\x18\x04 \x01(\tB\x03\xe0\x41\x02\x12\x18\n\x0bregion_code\x18\x05 \x01(\tB\x03\xe0\x41\x02\x12\x1d\n\x10\x63ontent_language\x18\x06 \x01(\tB\x03\xe0\x41\x02\x12\x11\n\x04gtin\x18\x07 \x01(\tB\x03\xe0\x41\x02\x12/\n\x05price\x18\x08 \x01(\x0b\x32\x1b.google.shopping.type.PriceB\x03\xe0\x41\x02\x12\x15\n\x08quantity\x18\t \x01(\x03\x42\x03\xe0\x41\x02\x12\x32\n\tsale_time\x18\n \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x02\x12\x1d\n\x03uid\x18\x0b \x01(\tB\x0b\xe0\x41\x03\xe2\x8c\xcf\xd7\x08\x02\x08\x01H\x00\x88\x01\x01\x12\x1c\n\nfeed_label\x18\x0c \x01(\tB\x03\xe0\x41\x01H\x01\x88\x01\x01:^\xea\x41[\n\"merchantapi.googleapis.com/LfpSale\x12\"accounts/{account}/lfpSales/{sale}*\x08lfpSales2\x07lfpSaleB\x06\n\x04_uidB\r\n\x0b_feed_label\"p\n\x14InsertLfpSaleRequest\x12\x13\n\x06parent\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x43\n\x08lfp_sale\x18\x02 \x01(\x0b\x32,.google.shopping.merchant.lfp.v1beta.LfpSaleB\x03\xe0\x41\x02\x32\x97\x02\n\x0eLfpSaleService\x12\xbb\x01\n\rInsertLfpSale\x12\x39.google.shopping.merchant.lfp.v1beta.InsertLfpSaleRequest\x1a,.google.shopping.merchant.lfp.v1beta.LfpSale\"A\x82\xd3\xe4\x93\x02;\"//lfp/v1beta/{parent=accounts/*}/lfpSales:insert:\x08lfp_sale\x1aG\xca\x41\x1amerchantapi.googleapis.com\xd2\x41\'https://www.googleapis.com/auth/contentBz\n\'com.google.shopping.merchant.lfp.v1betaB\x0cLfpSaleProtoP\x01Z?cloud.google.com/go/shopping/merchant/lfp/apiv1beta/lfppb;lfppbb\x06proto3" + +pool = Google::Protobuf::DescriptorPool.generated_pool + +begin + pool.add_serialized_file(descriptor_data) +rescue TypeError + # Compatibility code: will be removed in the next major version. + require 'google/protobuf/descriptor_pb' + parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data) + parsed.clear_dependency + serialized = parsed.class.encode(parsed) + file = pool.add_serialized_file(serialized) + warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}" + imports = [ + ["google.shopping.type.Price", "google/shopping/type/types.proto"], + ["google.protobuf.Timestamp", "google/protobuf/timestamp.proto"], + ] + imports.each do |type_name, expected_filename| + import_file = pool.lookup(type_name).file_descriptor + if import_file.name != expected_filename + warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}" + end + end + warn "Each proto file must use a consistent fully-qualified name." + warn "This will become an error in the next major version." +end + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + LfpSale = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.shopping.merchant.lfp.v1beta.LfpSale").msgclass + InsertLfpSaleRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.shopping.merchant.lfp.v1beta.InsertLfpSaleRequest").msgclass + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpsale_services_pb.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpsale_services_pb.rb new file mode 100644 index 000000000000..b14032abc2ca --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpsale_services_pb.rb @@ -0,0 +1,49 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/shopping/merchant/lfp/v1beta/lfpsale.proto for package 'google.shopping.merchant.lfp.v1beta' +# Original file comments: +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'grpc' +require 'google/shopping/merchant/lfp/v1beta/lfpsale_pb' + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + module LfpSaleService + # Service for a [LFP + # partner](https://support.google.com/merchants/answer/7676652) to submit sales + # data for a merchant. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.shopping.merchant.lfp.v1beta.LfpSaleService' + + # Inserts a `LfpSale` for the given merchant. + rpc :InsertLfpSale, ::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpSaleRequest, ::Google::Shopping::Merchant::Lfp::V1beta::LfpSale + end + + Stub = Service.rpc_stub_class + end + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpstore_pb.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpstore_pb.rb new file mode 100644 index 000000000000..36683530fca2 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpstore_pb.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/shopping/merchant/lfp/v1beta/lfpstore.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/protobuf/empty_pb' + + +descriptor_data = "\n2google/shopping/merchant/lfp/v1beta/lfpstore.proto\x12#google.shopping.merchant.lfp.v1beta\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\"\xe6\x05\n\x08LfpStore\x12\x14\n\x04name\x18\x01 \x01(\tB\x06\xe0\x41\x03\xe0\x41\x08\x12\x1b\n\x0etarget_account\x18\x02 \x01(\x03\x42\x03\xe0\x41\x02\x12\x1a\n\nstore_code\x18\x03 \x01(\tB\x06\xe0\x41\x02\xe0\x41\x05\x12\x1a\n\rstore_address\x18\x04 \x01(\tB\x03\xe0\x41\x02\x12\x1c\n\nstore_name\x18\x05 \x01(\tB\x03\xe0\x41\x01H\x00\x88\x01\x01\x12\x1e\n\x0cphone_number\x18\x06 \x01(\tB\x03\xe0\x41\x01H\x01\x88\x01\x01\x12\x1d\n\x0bwebsite_uri\x18\x07 \x01(\tB\x03\xe0\x41\x01H\x02\x88\x01\x01\x12\x1a\n\rgcid_category\x18\x08 \x03(\tB\x03\xe0\x41\x01\x12\x1a\n\x08place_id\x18\t \x01(\tB\x03\xe0\x41\x01H\x03\x88\x01\x01\x12`\n\x0ematching_state\x18\n \x01(\x0e\x32@.google.shopping.merchant.lfp.v1beta.LfpStore.StoreMatchingStateB\x06\xe0\x41\x01\xe0\x41\x03\x12(\n\x13matching_state_hint\x18\x0b \x01(\tB\x06\xe0\x41\x01\xe0\x41\x03H\x04\x88\x01\x01\"}\n\x12StoreMatchingState\x12$\n STORE_MATCHING_STATE_UNSPECIFIED\x10\x00\x12 \n\x1cSTORE_MATCHING_STATE_MATCHED\x10\x01\x12\x1f\n\x1bSTORE_MATCHING_STATE_FAILED\x10\x02:z\xea\x41w\n#merchantapi.googleapis.com/LfpStore\x12;accounts/{account}/lfpStores/{target_merchant}~{store_code}*\tlfpStores2\x08lfpStoreB\r\n\x0b_store_nameB\x0f\n\r_phone_numberB\x0e\n\x0c_website_uriB\x0b\n\t_place_idB\x16\n\x14_matching_state_hint\"O\n\x12GetLfpStoreRequest\x12\x39\n\x04name\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\n#merchantapi.googleapis.com/LfpStore\"\x9b\x01\n\x15InsertLfpStoreRequest\x12;\n\x06parent\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\x12#merchantapi.googleapis.com/LfpStore\x12\x45\n\tlfp_store\x18\x02 \x01(\x0b\x32-.google.shopping.merchant.lfp.v1beta.LfpStoreB\x03\xe0\x41\x02\"R\n\x15\x44\x65leteLfpStoreRequest\x12\x39\n\x04name\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\n#merchantapi.googleapis.com/LfpStore\"\xa1\x01\n\x14ListLfpStoresRequest\x12;\n\x06parent\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\x12#merchantapi.googleapis.com/LfpStore\x12\x1b\n\x0etarget_account\x18\x02 \x01(\x03\x42\x03\xe0\x41\x02\x12\x16\n\tpage_size\x18\x03 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x04 \x01(\tB\x03\xe0\x41\x01\"s\n\x15ListLfpStoresResponse\x12\x41\n\nlfp_stores\x18\x01 \x03(\x0b\x32-.google.shopping.merchant.lfp.v1beta.LfpStore\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t2\xc8\x06\n\x0fLfpStoreService\x12\xaf\x01\n\x0bGetLfpStore\x12\x37.google.shopping.merchant.lfp.v1beta.GetLfpStoreRequest\x1a-.google.shopping.merchant.lfp.v1beta.LfpStore\"8\xda\x41\x04name\x82\xd3\xe4\x93\x02+\x12)/lfp/v1beta/{name=accounts/*/lfpStores/*}\x12\xd3\x01\n\x0eInsertLfpStore\x12:.google.shopping.merchant.lfp.v1beta.InsertLfpStoreRequest\x1a-.google.shopping.merchant.lfp.v1beta.LfpStore\"V\xda\x41\x10parent,lfp_store\x82\xd3\xe4\x93\x02=\"0/lfp/v1beta/{parent=accounts/*}/lfpStores:insert:\tlfp_store\x12\x9e\x01\n\x0e\x44\x65leteLfpStore\x12:.google.shopping.merchant.lfp.v1beta.DeleteLfpStoreRequest\x1a\x16.google.protobuf.Empty\"8\xda\x41\x04name\x82\xd3\xe4\x93\x02+*)/lfp/v1beta/{name=accounts/*/lfpStores/*}\x12\xc2\x01\n\rListLfpStores\x12\x39.google.shopping.merchant.lfp.v1beta.ListLfpStoresRequest\x1a:.google.shopping.merchant.lfp.v1beta.ListLfpStoresResponse\":\xda\x41\x06parent\x82\xd3\xe4\x93\x02+\x12)/lfp/v1beta/{parent=accounts/*}/lfpStores\x1aG\xca\x41\x1amerchantapi.googleapis.com\xd2\x41\'https://www.googleapis.com/auth/contentB{\n\'com.google.shopping.merchant.lfp.v1betaB\rLfpStoreProtoP\x01Z?cloud.google.com/go/shopping/merchant/lfp/apiv1beta/lfppb;lfppbb\x06proto3" + +pool = Google::Protobuf::DescriptorPool.generated_pool + +begin + pool.add_serialized_file(descriptor_data) +rescue TypeError + # Compatibility code: will be removed in the next major version. + require 'google/protobuf/descriptor_pb' + parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data) + parsed.clear_dependency + serialized = parsed.class.encode(parsed) + file = pool.add_serialized_file(serialized) + warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}" + imports = [ + ] + imports.each do |type_name, expected_filename| + import_file = pool.lookup(type_name).file_descriptor + if import_file.name != expected_filename + warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}" + end + end + warn "Each proto file must use a consistent fully-qualified name." + warn "This will become an error in the next major version." +end + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + LfpStore = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.shopping.merchant.lfp.v1beta.LfpStore").msgclass + LfpStore::StoreMatchingState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.shopping.merchant.lfp.v1beta.LfpStore.StoreMatchingState").enummodule + GetLfpStoreRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.shopping.merchant.lfp.v1beta.GetLfpStoreRequest").msgclass + InsertLfpStoreRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.shopping.merchant.lfp.v1beta.InsertLfpStoreRequest").msgclass + DeleteLfpStoreRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.shopping.merchant.lfp.v1beta.DeleteLfpStoreRequest").msgclass + ListLfpStoresRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.shopping.merchant.lfp.v1beta.ListLfpStoresRequest").msgclass + ListLfpStoresResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.shopping.merchant.lfp.v1beta.ListLfpStoresResponse").msgclass + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpstore_services_pb.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpstore_services_pb.rb new file mode 100644 index 000000000000..c292700d21d4 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/lfpstore_services_pb.rb @@ -0,0 +1,57 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/shopping/merchant/lfp/v1beta/lfpstore.proto for package 'google.shopping.merchant.lfp.v1beta' +# Original file comments: +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'grpc' +require 'google/shopping/merchant/lfp/v1beta/lfpstore_pb' + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + module LfpStoreService + # Service for a [LFP + # partner](https://support.google.com/merchants/answer/7676652) to submit local + # stores for a merchant. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.shopping.merchant.lfp.v1beta.LfpStoreService' + + # Retrieves information about a store. + rpc :GetLfpStore, ::Google::Shopping::Merchant::Lfp::V1beta::GetLfpStoreRequest, ::Google::Shopping::Merchant::Lfp::V1beta::LfpStore + # Inserts a store for the target merchant. If the store with the same store + # code already exists, it will be replaced. + rpc :InsertLfpStore, ::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpStoreRequest, ::Google::Shopping::Merchant::Lfp::V1beta::LfpStore + # Deletes a store for a target merchant. + rpc :DeleteLfpStore, ::Google::Shopping::Merchant::Lfp::V1beta::DeleteLfpStoreRequest, ::Google::Protobuf::Empty + # Lists the stores of the target merchant, specified by the filter in + # `ListLfpStoresRequest`. + rpc :ListLfpStores, ::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresRequest, ::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresResponse + end + + Stub = Service.rpc_stub_class + end + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/rest.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/rest.rb new file mode 100644 index 000000000000..c092e4264418 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/rest.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest" +require "google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest" +require "google/shopping/merchant/lfp/v1beta/lfp_store_service/rest" +require "google/shopping/merchant/lfp/v1beta/version" + +module Google + module Shopping + module Merchant + module Lfp + ## + # To load just the REST part of this package, including all its services, and instantiate a REST client: + # + # @example + # + # require "google/shopping/merchant/lfp/v1beta/rest" + # client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Rest::Client.new + # + module V1beta + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/version.rb b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/version.rb new file mode 100644 index 000000000000..7b4a98b85f6f --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/lib/google/shopping/merchant/lfp/v1beta/version.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + VERSION = "0.0.1" + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/proto_docs/README.md b/google-shopping-merchant-lfp-v1beta/proto_docs/README.md new file mode 100644 index 000000000000..03467a3756be --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/proto_docs/README.md @@ -0,0 +1,4 @@ +# Merchant V1BETA Protocol Buffer Documentation + +These files are for the YARD documentation of the generated protobuf files. +They are not intended to be required or loaded at runtime. diff --git a/google-shopping-merchant-lfp-v1beta/proto_docs/google/api/client.rb b/google-shopping-merchant-lfp-v1beta/proto_docs/google/api/client.rb new file mode 100644 index 000000000000..934c39849a6a --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/proto_docs/google/api/client.rb @@ -0,0 +1,399 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # Required information for every language. + # @!attribute [rw] reference_docs_uri + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::String] + # Link to automatically generated reference documentation. Example: + # https://cloud.google.com/nodejs/docs/reference/asset/latest + # @!attribute [rw] destinations + # @return [::Array<::Google::Api::ClientLibraryDestination>] + # The destination where API teams want this client library to be published. + class CommonLanguageSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Details about how and where to publish client libraries. + # @!attribute [rw] version + # @return [::String] + # Version of the API to apply these settings to. This is the full protobuf + # package for the API, ending in the version element. + # Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1". + # @!attribute [rw] launch_stage + # @return [::Google::Api::LaunchStage] + # Launch stage of this version of the API. + # @!attribute [rw] rest_numeric_enums + # @return [::Boolean] + # When using transport=rest, the client request will encode enums as + # numbers rather than strings. + # @!attribute [rw] java_settings + # @return [::Google::Api::JavaSettings] + # Settings for legacy Java features, supported in the Service YAML. + # @!attribute [rw] cpp_settings + # @return [::Google::Api::CppSettings] + # Settings for C++ client libraries. + # @!attribute [rw] php_settings + # @return [::Google::Api::PhpSettings] + # Settings for PHP client libraries. + # @!attribute [rw] python_settings + # @return [::Google::Api::PythonSettings] + # Settings for Python client libraries. + # @!attribute [rw] node_settings + # @return [::Google::Api::NodeSettings] + # Settings for Node client libraries. + # @!attribute [rw] dotnet_settings + # @return [::Google::Api::DotnetSettings] + # Settings for .NET client libraries. + # @!attribute [rw] ruby_settings + # @return [::Google::Api::RubySettings] + # Settings for Ruby client libraries. + # @!attribute [rw] go_settings + # @return [::Google::Api::GoSettings] + # Settings for Go client libraries. + class ClientLibrarySettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # This message configures the settings for publishing [Google Cloud Client + # libraries](https://cloud.google.com/apis/docs/cloud-client-libraries) + # generated from the service config. + # @!attribute [rw] method_settings + # @return [::Array<::Google::Api::MethodSettings>] + # A list of API method settings, e.g. the behavior for methods that use the + # long-running operation pattern. + # @!attribute [rw] new_issue_uri + # @return [::String] + # Link to a *public* URI where users can report issues. Example: + # https://issuetracker.google.com/issues/new?component=190865&template=1161103 + # @!attribute [rw] documentation_uri + # @return [::String] + # Link to product home page. Example: + # https://cloud.google.com/asset-inventory/docs/overview + # @!attribute [rw] api_short_name + # @return [::String] + # Used as a tracking tag when collecting data about the APIs developer + # relations artifacts like docs, packages delivered to package managers, + # etc. Example: "speech". + # @!attribute [rw] github_label + # @return [::String] + # GitHub label to apply to issues and pull requests opened for this API. + # @!attribute [rw] codeowner_github_teams + # @return [::Array<::String>] + # GitHub teams to be added to CODEOWNERS in the directory in GitHub + # containing source code for the client libraries for this API. + # @!attribute [rw] doc_tag_prefix + # @return [::String] + # A prefix used in sample code when demarking regions to be included in + # documentation. + # @!attribute [rw] organization + # @return [::Google::Api::ClientLibraryOrganization] + # For whom the client library is being published. + # @!attribute [rw] library_settings + # @return [::Array<::Google::Api::ClientLibrarySettings>] + # Client library settings. If the same version string appears multiple + # times in this list, then the last one wins. Settings from earlier + # settings with the same version string are discarded. + # @!attribute [rw] proto_reference_documentation_uri + # @return [::String] + # Optional link to proto reference documentation. Example: + # https://cloud.google.com/pubsub/lite/docs/reference/rpc + # @!attribute [rw] rest_reference_documentation_uri + # @return [::String] + # Optional link to REST reference documentation. Example: + # https://cloud.google.com/pubsub/lite/docs/reference/rest + class Publishing + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Java client libraries. + # @!attribute [rw] library_package + # @return [::String] + # The package name to use in Java. Clobbers the java_package option + # set in the protobuf. This should be used **only** by APIs + # who have already set the language_settings.java.package_name" field + # in gapic.yaml. API teams should use the protobuf java_package option + # where possible. + # + # Example of a YAML configuration:: + # + # publishing: + # java_settings: + # library_package: com.google.cloud.pubsub.v1 + # @!attribute [rw] service_class_names + # @return [::Google::Protobuf::Map{::String => ::String}] + # Configure the Java class name to use instead of the service's for its + # corresponding generated GAPIC client. Keys are fully-qualified + # service names as they appear in the protobuf (including the full + # the language_settings.java.interface_names" field in gapic.yaml. API + # teams should otherwise use the service name as it appears in the + # protobuf. + # + # Example of a YAML configuration:: + # + # publishing: + # java_settings: + # service_class_names: + # - google.pubsub.v1.Publisher: TopicAdmin + # - google.pubsub.v1.Subscriber: SubscriptionAdmin + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class JavaSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class ServiceClassNamesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Settings for C++ client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class CppSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Php client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class PhpSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Python client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class PythonSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Node client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class NodeSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Dotnet client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + # @!attribute [rw] renamed_services + # @return [::Google::Protobuf::Map{::String => ::String}] + # Map from original service names to renamed versions. + # This is used when the default generated types + # would cause a naming conflict. (Neither name is + # fully-qualified.) + # Example: Subscriber to SubscriberServiceApi. + # @!attribute [rw] renamed_resources + # @return [::Google::Protobuf::Map{::String => ::String}] + # Map from full resource types to the effective short name + # for the resource. This is used when otherwise resource + # named from different services would cause naming collisions. + # Example entry: + # "datalabeling.googleapis.com/Dataset": "DataLabelingDataset" + # @!attribute [rw] ignored_resources + # @return [::Array<::String>] + # List of full resource types to ignore during generation. + # This is typically used for API-specific Location resources, + # which should be handled by the generator as if they were actually + # the common Location resources. + # Example entry: "documentai.googleapis.com/Location" + # @!attribute [rw] forced_namespace_aliases + # @return [::Array<::String>] + # Namespaces which must be aliased in snippets due to + # a known (but non-generator-predictable) naming collision + # @!attribute [rw] handwritten_signatures + # @return [::Array<::String>] + # Method signatures (in the form "service.method(signature)") + # which are provided separately, so shouldn't be generated. + # Snippets *calling* these methods are still generated, however. + class DotnetSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class RenamedServicesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class RenamedResourcesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Settings for Ruby client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class RubySettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Go client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class GoSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Describes the generator configuration for a method. + # @!attribute [rw] selector + # @return [::String] + # The fully qualified name of the method, for which the options below apply. + # This is used to find the method to apply the options. + # @!attribute [rw] long_running + # @return [::Google::Api::MethodSettings::LongRunning] + # Describes settings to use for long-running operations when generating + # API methods for RPCs. Complements RPCs that use the annotations in + # google/longrunning/operations.proto. + # + # Example of a YAML configuration:: + # + # publishing: + # method_settings: + # - selector: google.cloud.speech.v2.Speech.BatchRecognize + # long_running: + # initial_poll_delay: + # seconds: 60 # 1 minute + # poll_delay_multiplier: 1.5 + # max_poll_delay: + # seconds: 360 # 6 minutes + # total_poll_timeout: + # seconds: 54000 # 90 minutes + # @!attribute [rw] auto_populated_fields + # @return [::Array<::String>] + # List of top-level fields of the request message, that should be + # automatically populated by the client libraries based on their + # (google.api.field_info).format. Currently supported format: UUID4. + # + # Example of a YAML configuration: + # + # publishing: + # method_settings: + # - selector: google.example.v1.ExampleService.CreateExample + # auto_populated_fields: + # - request_id + class MethodSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Describes settings to use when generating API methods that use the + # long-running operation pattern. + # All default values below are from those used in the client library + # generators (e.g. + # [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)). + # @!attribute [rw] initial_poll_delay + # @return [::Google::Protobuf::Duration] + # Initial delay after which the first poll request will be made. + # Default value: 5 seconds. + # @!attribute [rw] poll_delay_multiplier + # @return [::Float] + # Multiplier to gradually increase delay between subsequent polls until it + # reaches max_poll_delay. + # Default value: 1.5. + # @!attribute [rw] max_poll_delay + # @return [::Google::Protobuf::Duration] + # Maximum time between two subsequent poll requests. + # Default value: 45 seconds. + # @!attribute [rw] total_poll_timeout + # @return [::Google::Protobuf::Duration] + # Total polling timeout. + # Default value: 5 minutes. + class LongRunning + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # The organization for which the client libraries are being published. + # Affects the url where generated docs are published, etc. + module ClientLibraryOrganization + # Not useful. + CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = 0 + + # Google Cloud Platform Org. + CLOUD = 1 + + # Ads (Advertising) Org. + ADS = 2 + + # Photos Org. + PHOTOS = 3 + + # Street View Org. + STREET_VIEW = 4 + + # Shopping Org. + SHOPPING = 5 + + # Geo Org. + GEO = 6 + + # Generative AI - https://developers.generativeai.google + GENERATIVE_AI = 7 + end + + # To where should client libraries be published? + module ClientLibraryDestination + # Client libraries will neither be generated nor published to package + # managers. + CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = 0 + + # Generate the client library in a repo under github.com/googleapis, + # but don't publish it to package managers. + GITHUB = 10 + + # Publish the library to package managers like nuget.org and npmjs.com. + PACKAGE_MANAGER = 20 + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/proto_docs/google/api/field_behavior.rb b/google-shopping-merchant-lfp-v1beta/proto_docs/google/api/field_behavior.rb new file mode 100644 index 000000000000..b03587481349 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/proto_docs/google/api/field_behavior.rb @@ -0,0 +1,85 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # An indicator of the behavior of a given field (for example, that a field + # is required in requests, or given as output but ignored as input). + # This **does not** change the behavior in protocol buffers itself; it only + # denotes the behavior and may affect how API tooling handles the field. + # + # Note: This enum **may** receive new values in the future. + module FieldBehavior + # Conventional default for enums. Do not use this. + FIELD_BEHAVIOR_UNSPECIFIED = 0 + + # Specifically denotes a field as optional. + # While all fields in protocol buffers are optional, this may be specified + # for emphasis if appropriate. + OPTIONAL = 1 + + # Denotes a field as required. + # This indicates that the field **must** be provided as part of the request, + # and failure to do so will cause an error (usually `INVALID_ARGUMENT`). + REQUIRED = 2 + + # Denotes a field as output only. + # This indicates that the field is provided in responses, but including the + # field in a request does nothing (the server *must* ignore it and + # *must not* throw an error as a result of the field's presence). + OUTPUT_ONLY = 3 + + # Denotes a field as input only. + # This indicates that the field is provided in requests, and the + # corresponding field is not included in output. + INPUT_ONLY = 4 + + # Denotes a field as immutable. + # This indicates that the field may be set once in a request to create a + # resource, but may not be changed thereafter. + IMMUTABLE = 5 + + # Denotes that a (repeated) field is an unordered list. + # This indicates that the service may provide the elements of the list + # in any arbitrary order, rather than the order the user originally + # provided. Additionally, the list's order may or may not be stable. + UNORDERED_LIST = 6 + + # Denotes that this field returns a non-empty default value if not set. + # This indicates that if the user provides the empty value in a request, + # a non-empty value will be returned. The user will not be aware of what + # non-empty value to expect. + NON_EMPTY_DEFAULT = 7 + + # Denotes that the field in a resource (a message annotated with + # google.api.resource) is used in the resource name to uniquely identify the + # resource. For AIP-compliant APIs, this should only be applied to the + # `name` field on the resource. + # + # This behavior should not be applied to references to other resources within + # the message. + # + # The identifier field of resources often have different field behavior + # depending on the request it is embedded in (e.g. for Create methods name + # is optional and unused, while for Update methods it is required). Instead + # of method-specific annotations, only `IDENTIFIER` is required. + IDENTIFIER = 8 + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/proto_docs/google/api/field_info.rb b/google-shopping-merchant-lfp-v1beta/proto_docs/google/api/field_info.rb new file mode 100644 index 000000000000..84d6de0d67a7 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/proto_docs/google/api/field_info.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # Rich semantic information of an API field beyond basic typing. + # @!attribute [rw] format + # @return [::Google::Api::FieldInfo::Format] + # The standard format of a field value. This does not explicitly configure + # any API consumer, just documents the API's format for the field it is + # applied to. + class FieldInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The standard format of a field value. The supported formats are all backed + # by either an RFC defined by the IETF or a Google-defined AIP. + module Format + # Default, unspecified value. + FORMAT_UNSPECIFIED = 0 + + # Universally Unique Identifier, version 4, value as defined by + # https://datatracker.ietf.org/doc/html/rfc4122. The value may be + # normalized to entirely lowercase letters. For example, the value + # `F47AC10B-58CC-0372-8567-0E02B2C3D479` would be normalized to + # `f47ac10b-58cc-0372-8567-0e02b2c3d479`. + UUID4 = 1 + + # Internet Protocol v4 value as defined by [RFC + # 791](https://datatracker.ietf.org/doc/html/rfc791). The value may be + # condensed, with leading zeros in each octet stripped. For example, + # `001.022.233.040` would be condensed to `1.22.233.40`. + IPV4 = 2 + + # Internet Protocol v6 value as defined by [RFC + # 2460](https://datatracker.ietf.org/doc/html/rfc2460). The value may be + # normalized to entirely lowercase letters with zeros compressed, following + # [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952). For example, + # the value `2001:0DB8:0::0` would be normalized to `2001:db8::`. + IPV6 = 3 + + # An IP address in either v4 or v6 format as described by the individual + # values defined herein. See the comments on the IPV4 and IPV6 types for + # allowed normalizations of each. + IPV4_OR_IPV6 = 4 + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/proto_docs/google/api/launch_stage.rb b/google-shopping-merchant-lfp-v1beta/proto_docs/google/api/launch_stage.rb new file mode 100644 index 000000000000..38b4b61e6061 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/proto_docs/google/api/launch_stage.rb @@ -0,0 +1,71 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # The launch stage as defined by [Google Cloud Platform + # Launch Stages](https://cloud.google.com/terms/launch-stages). + module LaunchStage + # Do not use this default value. + LAUNCH_STAGE_UNSPECIFIED = 0 + + # The feature is not yet implemented. Users can not use it. + UNIMPLEMENTED = 6 + + # Prelaunch features are hidden from users and are only visible internally. + PRELAUNCH = 7 + + # Early Access features are limited to a closed group of testers. To use + # these features, you must sign up in advance and sign a Trusted Tester + # agreement (which includes confidentiality provisions). These features may + # be unstable, changed in backward-incompatible ways, and are not + # guaranteed to be released. + EARLY_ACCESS = 1 + + # Alpha is a limited availability test for releases before they are cleared + # for widespread use. By Alpha, all significant design issues are resolved + # and we are in the process of verifying functionality. Alpha customers + # need to apply for access, agree to applicable terms, and have their + # projects allowlisted. Alpha releases don't have to be feature complete, + # no SLAs are provided, and there are no technical support obligations, but + # they will be far enough along that customers can actually use them in + # test environments or for limited-use tests -- just like they would in + # normal production cases. + ALPHA = 2 + + # Beta is the point at which we are ready to open a release for any + # customer to use. There are no SLA or technical support obligations in a + # Beta release. Products will be complete from a feature perspective, but + # may have some open outstanding issues. Beta releases are suitable for + # limited production use cases. + BETA = 3 + + # GA features are open to all developers and are considered stable and + # fully qualified for production use. + GA = 4 + + # Deprecated features are scheduled to be shut down and removed. For more + # information, see the "Deprecation Policy" section of our [Terms of + # Service](https://cloud.google.com/terms/) + # and the [Google Cloud Platform Subject to the Deprecation + # Policy](https://cloud.google.com/terms/deprecation) documentation. + DEPRECATED = 5 + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/proto_docs/google/api/resource.rb b/google-shopping-merchant-lfp-v1beta/proto_docs/google/api/resource.rb new file mode 100644 index 000000000000..6497ebc78dc1 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/proto_docs/google/api/resource.rb @@ -0,0 +1,222 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # A simple descriptor of a resource type. + # + # ResourceDescriptor annotates a resource message (either by means of a + # protobuf annotation or use in the service config), and associates the + # resource's schema, the resource type, and the pattern of the resource name. + # + # Example: + # + # message Topic { + # // Indicates this message defines a resource schema. + # // Declares the resource type in the format of {service}/{kind}. + # // For Kubernetes resources, the format is {api group}/{kind}. + # option (google.api.resource) = { + # type: "pubsub.googleapis.com/Topic" + # pattern: "projects/{project}/topics/{topic}" + # }; + # } + # + # The ResourceDescriptor Yaml config will look like: + # + # resources: + # - type: "pubsub.googleapis.com/Topic" + # pattern: "projects/{project}/topics/{topic}" + # + # Sometimes, resources have multiple patterns, typically because they can + # live under multiple parents. + # + # Example: + # + # message LogEntry { + # option (google.api.resource) = { + # type: "logging.googleapis.com/LogEntry" + # pattern: "projects/{project}/logs/{log}" + # pattern: "folders/{folder}/logs/{log}" + # pattern: "organizations/{organization}/logs/{log}" + # pattern: "billingAccounts/{billing_account}/logs/{log}" + # }; + # } + # + # The ResourceDescriptor Yaml config will look like: + # + # resources: + # - type: 'logging.googleapis.com/LogEntry' + # pattern: "projects/{project}/logs/{log}" + # pattern: "folders/{folder}/logs/{log}" + # pattern: "organizations/{organization}/logs/{log}" + # pattern: "billingAccounts/{billing_account}/logs/{log}" + # @!attribute [rw] type + # @return [::String] + # The resource type. It must be in the format of + # \\{service_name}/\\{resource_type_kind}. The `resource_type_kind` must be + # singular and must not include version numbers. + # + # Example: `storage.googleapis.com/Bucket` + # + # The value of the resource_type_kind must follow the regular expression + # /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and + # should use PascalCase (UpperCamelCase). The maximum number of + # characters allowed for the `resource_type_kind` is 100. + # @!attribute [rw] pattern + # @return [::Array<::String>] + # Optional. The relative resource name pattern associated with this resource + # type. The DNS prefix of the full resource name shouldn't be specified here. + # + # The path pattern must follow the syntax, which aligns with HTTP binding + # syntax: + # + # Template = Segment { "/" Segment } ; + # Segment = LITERAL | Variable ; + # Variable = "{" LITERAL "}" ; + # + # Examples: + # + # - "projects/\\{project}/topics/\\{topic}" + # - "projects/\\{project}/knowledgeBases/\\{knowledge_base}" + # + # The components in braces correspond to the IDs for each resource in the + # hierarchy. It is expected that, if multiple patterns are provided, + # the same component name (e.g. "project") refers to IDs of the same + # type of resource. + # @!attribute [rw] name_field + # @return [::String] + # Optional. The field on the resource that designates the resource name + # field. If omitted, this is assumed to be "name". + # @!attribute [rw] history + # @return [::Google::Api::ResourceDescriptor::History] + # Optional. The historical or future-looking state of the resource pattern. + # + # Example: + # + # // The InspectTemplate message originally only supported resource + # // names with organization, and project was added later. + # message InspectTemplate { + # option (google.api.resource) = { + # type: "dlp.googleapis.com/InspectTemplate" + # pattern: + # "organizations/{organization}/inspectTemplates/{inspect_template}" + # pattern: "projects/{project}/inspectTemplates/{inspect_template}" + # history: ORIGINALLY_SINGLE_PATTERN + # }; + # } + # @!attribute [rw] plural + # @return [::String] + # The plural name used in the resource name and permission names, such as + # 'projects' for the resource name of 'projects/\\{project}' and the permission + # name of 'cloudresourcemanager.googleapis.com/projects.get'. It is the same + # concept of the `plural` field in k8s CRD spec + # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + # + # Note: The plural form is required even for singleton resources. See + # https://aip.dev/156 + # @!attribute [rw] singular + # @return [::String] + # The same concept of the `singular` field in k8s CRD spec + # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + # Such as "project" for the `resourcemanager.googleapis.com/Project` type. + # @!attribute [rw] style + # @return [::Array<::Google::Api::ResourceDescriptor::Style>] + # Style flag(s) for this resource. + # These indicate that a resource is expected to conform to a given + # style. See the specific style flags for additional information. + class ResourceDescriptor + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # A description of the historical or future-looking state of the + # resource pattern. + module History + # The "unset" value. + HISTORY_UNSPECIFIED = 0 + + # The resource originally had one pattern and launched as such, and + # additional patterns were added later. + ORIGINALLY_SINGLE_PATTERN = 1 + + # The resource has one pattern, but the API owner expects to add more + # later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents + # that from being necessary once there are multiple patterns.) + FUTURE_MULTI_PATTERN = 2 + end + + # A flag representing a specific style that a resource claims to conform to. + module Style + # The unspecified value. Do not use. + STYLE_UNSPECIFIED = 0 + + # This resource is intended to be "declarative-friendly". + # + # Declarative-friendly resources must be more strictly consistent, and + # setting this to true communicates to tools that this resource should + # adhere to declarative-friendly expectations. + # + # Note: This is used by the API linter (linter.aip.dev) to enable + # additional checks. + DECLARATIVE_FRIENDLY = 1 + end + end + + # Defines a proto annotation that describes a string field that refers to + # an API resource. + # @!attribute [rw] type + # @return [::String] + # The resource type that the annotated field references. + # + # Example: + # + # message Subscription { + # string topic = 2 [(google.api.resource_reference) = { + # type: "pubsub.googleapis.com/Topic" + # }]; + # } + # + # Occasionally, a field may reference an arbitrary resource. In this case, + # APIs use the special value * in their resource reference. + # + # Example: + # + # message GetIamPolicyRequest { + # string resource = 2 [(google.api.resource_reference) = { + # type: "*" + # }]; + # } + # @!attribute [rw] child_type + # @return [::String] + # The resource type of a child collection that the annotated field + # references. This is useful for annotating the `parent` field that + # doesn't have a fixed resource type. + # + # Example: + # + # message ListLogEntriesRequest { + # string parent = 1 [(google.api.resource_reference) = { + # child_type: "logging.googleapis.com/LogEntry" + # }; + # } + class ResourceReference + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/proto_docs/google/protobuf/duration.rb b/google-shopping-merchant-lfp-v1beta/proto_docs/google/protobuf/duration.rb new file mode 100644 index 000000000000..b5731a824060 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/proto_docs/google/protobuf/duration.rb @@ -0,0 +1,98 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # A Duration represents a signed, fixed-length span of time represented + # as a count of seconds and fractions of seconds at nanosecond + # resolution. It is independent of any calendar and concepts like "day" + # or "month". It is related to Timestamp in that the difference between + # two Timestamp values is a Duration and it can be added or subtracted + # from a Timestamp. Range is approximately +-10,000 years. + # + # # Examples + # + # Example 1: Compute Duration from two Timestamps in pseudo code. + # + # Timestamp start = ...; + # Timestamp end = ...; + # Duration duration = ...; + # + # duration.seconds = end.seconds - start.seconds; + # duration.nanos = end.nanos - start.nanos; + # + # if (duration.seconds < 0 && duration.nanos > 0) { + # duration.seconds += 1; + # duration.nanos -= 1000000000; + # } else if (duration.seconds > 0 && duration.nanos < 0) { + # duration.seconds -= 1; + # duration.nanos += 1000000000; + # } + # + # Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + # + # Timestamp start = ...; + # Duration duration = ...; + # Timestamp end = ...; + # + # end.seconds = start.seconds + duration.seconds; + # end.nanos = start.nanos + duration.nanos; + # + # if (end.nanos < 0) { + # end.seconds -= 1; + # end.nanos += 1000000000; + # } else if (end.nanos >= 1000000000) { + # end.seconds += 1; + # end.nanos -= 1000000000; + # } + # + # Example 3: Compute Duration from datetime.timedelta in Python. + # + # td = datetime.timedelta(days=3, minutes=10) + # duration = Duration() + # duration.FromTimedelta(td) + # + # # JSON Mapping + # + # In JSON format, the Duration type is encoded as a string rather than an + # object, where the string ends in the suffix "s" (indicating seconds) and + # is preceded by the number of seconds, with nanoseconds expressed as + # fractional seconds. For example, 3 seconds with 0 nanoseconds should be + # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + # be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + # microsecond should be expressed in JSON format as "3.000001s". + # @!attribute [rw] seconds + # @return [::Integer] + # Signed seconds of the span of time. Must be from -315,576,000,000 + # to +315,576,000,000 inclusive. Note: these bounds are computed from: + # 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + # @!attribute [rw] nanos + # @return [::Integer] + # Signed fractions of a second at nanosecond resolution of the span + # of time. Durations less than one second are represented with a 0 + # `seconds` field and a positive or negative `nanos` field. For durations + # of one second or more, a non-zero value for the `nanos` field must be + # of the same sign as the `seconds` field. Must be from -999,999,999 + # to +999,999,999 inclusive. + class Duration + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/proto_docs/google/protobuf/empty.rb b/google-shopping-merchant-lfp-v1beta/proto_docs/google/protobuf/empty.rb new file mode 100644 index 000000000000..8c6b19d52e3d --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/proto_docs/google/protobuf/empty.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # A generic empty message that you can re-use to avoid defining duplicated + # empty messages in your APIs. A typical example is to use it as the request + # or the response type of an API method. For instance: + # + # service Foo { + # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + # } + class Empty + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/proto_docs/google/protobuf/timestamp.rb b/google-shopping-merchant-lfp-v1beta/proto_docs/google/protobuf/timestamp.rb new file mode 100644 index 000000000000..4ac9c4801a3f --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/proto_docs/google/protobuf/timestamp.rb @@ -0,0 +1,127 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # A Timestamp represents a point in time independent of any time zone or local + # calendar, encoded as a count of seconds and fractions of seconds at + # nanosecond resolution. The count is relative to an epoch at UTC midnight on + # January 1, 1970, in the proleptic Gregorian calendar which extends the + # Gregorian calendar backwards to year one. + # + # All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + # second table is needed for interpretation, using a [24-hour linear + # smear](https://developers.google.com/time/smear). + # + # The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + # restricting to that range, we ensure that we can convert to and from [RFC + # 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + # + # # Examples + # + # Example 1: Compute Timestamp from POSIX `time()`. + # + # Timestamp timestamp; + # timestamp.set_seconds(time(NULL)); + # timestamp.set_nanos(0); + # + # Example 2: Compute Timestamp from POSIX `gettimeofday()`. + # + # struct timeval tv; + # gettimeofday(&tv, NULL); + # + # Timestamp timestamp; + # timestamp.set_seconds(tv.tv_sec); + # timestamp.set_nanos(tv.tv_usec * 1000); + # + # Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + # + # FILETIME ft; + # GetSystemTimeAsFileTime(&ft); + # UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + # + # // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + # // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + # Timestamp timestamp; + # timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + # timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + # + # Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + # + # long millis = System.currentTimeMillis(); + # + # Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + # .setNanos((int) ((millis % 1000) * 1000000)).build(); + # + # Example 5: Compute Timestamp from Java `Instant.now()`. + # + # Instant now = Instant.now(); + # + # Timestamp timestamp = + # Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + # .setNanos(now.getNano()).build(); + # + # Example 6: Compute Timestamp from current time in Python. + # + # timestamp = Timestamp() + # timestamp.GetCurrentTime() + # + # # JSON Mapping + # + # In JSON format, the Timestamp type is encoded as a string in the + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + # format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z" + # where \\{year} is always expressed using four digits while \\{month}, \\{day}, + # \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional + # seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + # are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + # is required. A proto3 JSON serializer should always use UTC (as indicated by + # "Z") when printing the Timestamp type and a proto3 JSON parser should be + # able to accept both UTC and other timezones (as indicated by an offset). + # + # For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + # 01:30 UTC on January 15, 2017. + # + # In JavaScript, one can convert a Date object to this format using the + # standard + # [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + # method. In Python, a standard `datetime.datetime` object can be converted + # to this format using + # [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + # the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + # the Joda Time's [`ISODateTimeFormat.dateTime()`]( + # http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() + # ) to obtain a formatter capable of generating timestamps in this format. + # @!attribute [rw] seconds + # @return [::Integer] + # Represents seconds of UTC time since Unix epoch + # 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + # 9999-12-31T23:59:59Z inclusive. + # @!attribute [rw] nanos + # @return [::Integer] + # Non-negative fractions of a second at nanosecond resolution. Negative + # second values with fractions must still have non-negative nanos values + # that count forward in time. Must be from 0 to 999,999,999 + # inclusive. + class Timestamp + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/proto_docs/google/shopping/merchant/lfp/v1beta/lfpinventory.rb b/google-shopping-merchant-lfp-v1beta/proto_docs/google/shopping/merchant/lfp/v1beta/lfpinventory.rb new file mode 100644 index 000000000000..11f266b4824d --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/proto_docs/google/shopping/merchant/lfp/v1beta/lfpinventory.rb @@ -0,0 +1,113 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + # Local Inventory for the merchant. + # @!attribute [r] name + # @return [::String] + # Output only. Identifier. The name for the `LfpInventory` resource. + # Format: + # `accounts/{account}/lfpInventories/{target_merchant}~{store_code}~{offer}` + # @!attribute [rw] target_account + # @return [::Integer] + # Required. The Merchant Center ID of the merchant to submit the inventory + # for. + # @!attribute [rw] store_code + # @return [::String] + # Required. The identifier of the merchant's store. Either the store code + # inserted through `InsertLfpStore` or the store code in the Business + # Profile. + # @!attribute [rw] offer_id + # @return [::String] + # Required. Immutable. A unique identifier for the product. If both + # inventories and sales are submitted for a merchant, this id should match + # for the same product. + # + # **Note**: if the merchant sells the same product new and used, they should + # have different IDs. + # @!attribute [rw] region_code + # @return [::String] + # Required. The [CLDR territory + # code](https://github.com/unicode-org/cldr/blob/latest/common/main/en.xml) + # for the country where the product is sold. + # @!attribute [rw] content_language + # @return [::String] + # Required. The two-letter ISO 639-1 language code for the item. + # @!attribute [rw] gtin + # @return [::String] + # Optional. The Global Trade Item Number of the product. + # @!attribute [rw] price + # @return [::Google::Shopping::Type::Price] + # Optional. The current price of the product. + # @!attribute [rw] availability + # @return [::String] + # Required. Availability of the product at this store. + # For accepted attribute values, see the [local product inventory feed + # specification](https://support.google.com/merchants/answer/3061342) + # @!attribute [rw] quantity + # @return [::Integer] + # Optional. Quantity of the product available at this store. Must be greater + # than or equal to zero. + # @!attribute [rw] collection_time + # @return [::Google::Protobuf::Timestamp] + # Optional. The time when the inventory is collected. If not set, it will be + # set to the time when the inventory is submitted. + # @!attribute [rw] pickup_method + # @return [::String] + # Optional. Supported pickup method for this offer. Unless the value is "not + # supported", this field must be submitted together with `pickupSla`. For + # accepted attribute values, see the [local product inventory feed + # specification](https://support.google.com/merchants/answer/3061342). + # @!attribute [rw] pickup_sla + # @return [::String] + # Optional. Expected date that an order will be ready for pickup relative to + # the order date. Must be submitted together with `pickupMethod`. For + # accepted attribute values, see the [local product inventory feed + # specification](https://support.google.com/merchants/answer/3061342). + # @!attribute [rw] feed_label + # @return [::String] + # Optional. The [feed + # label](https://developers.google.com/shopping-content/guides/products/feed-labels) + # for the product. If this is not set, it will default to `regionCode`. + class LfpInventory + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for the `InsertLfpInventory` method. + # @!attribute [rw] parent + # @return [::String] + # Required. The LFP provider account. + # Format: `accounts/{account}` + # @!attribute [rw] lfp_inventory + # @return [::Google::Shopping::Merchant::Lfp::V1beta::LfpInventory] + # Required. The inventory to insert. + class InsertLfpInventoryRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/proto_docs/google/shopping/merchant/lfp/v1beta/lfpsale.rb b/google-shopping-merchant-lfp-v1beta/proto_docs/google/shopping/merchant/lfp/v1beta/lfpsale.rb new file mode 100644 index 000000000000..e6c00478c936 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/proto_docs/google/shopping/merchant/lfp/v1beta/lfpsale.rb @@ -0,0 +1,96 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + # A sale for the merchant. + # @!attribute [r] name + # @return [::String] + # Output only. Identifier. The name of the `LfpSale` resource. + # Format: + # `accounts/{account}/lfpSales/{sale}` + # @!attribute [rw] target_account + # @return [::Integer] + # Required. The Merchant Center ID of the merchant to submit the sale for. + # @!attribute [rw] store_code + # @return [::String] + # Required. The identifier of the merchant's store. Either a `storeCode` + # inserted through the API or the code of the store in the Business Profile. + # @!attribute [rw] offer_id + # @return [::String] + # Required. A unique identifier for the product. If both inventories and + # sales are submitted for a merchant, this id should match for the same + # product. + # + # **Note**: if the merchant sells the same product new and used, they should + # have different IDs. + # @!attribute [rw] region_code + # @return [::String] + # Required. The [CLDR territory + # code](https://github.com/unicode-org/cldr/blob/latest/common/main/en.xml) + # for the country where the product is sold. + # @!attribute [rw] content_language + # @return [::String] + # Required. The two-letter ISO 639-1 language code for the item. + # @!attribute [rw] gtin + # @return [::String] + # Required. The Global Trade Item Number of the sold product. + # @!attribute [rw] price + # @return [::Google::Shopping::Type::Price] + # Required. The unit price of the product. + # @!attribute [rw] quantity + # @return [::Integer] + # Required. The relative change of the available quantity. Negative for items + # returned. + # @!attribute [rw] sale_time + # @return [::Google::Protobuf::Timestamp] + # Required. The timestamp for the sale. + # @!attribute [r] uid + # @return [::String] + # Output only. System generated globally unique ID for the `LfpSale`. + # @!attribute [rw] feed_label + # @return [::String] + # Optional. The [feed + # label](https://developers.google.com/shopping-content/guides/products/feed-labels) + # for the product. If this is not set, it will default to `regionCode`. + class LfpSale + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for the InsertLfpSale method. + # @!attribute [rw] parent + # @return [::String] + # Required. The LFP provider account. + # Format: `accounts/{lfp_partner}` + # @!attribute [rw] lfp_sale + # @return [::Google::Shopping::Merchant::Lfp::V1beta::LfpSale] + # Required. The sale to insert. + class InsertLfpSaleRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/proto_docs/google/shopping/merchant/lfp/v1beta/lfpstore.rb b/google-shopping-merchant-lfp-v1beta/proto_docs/google/shopping/merchant/lfp/v1beta/lfpstore.rb new file mode 100644 index 000000000000..a57151ec0536 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/proto_docs/google/shopping/merchant/lfp/v1beta/lfpstore.rb @@ -0,0 +1,185 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Shopping + module Merchant + module Lfp + module V1beta + # A store for the merchant. This will be used to match to a Google Business + # Profile listing for the target merchant. If a matching listing can't be + # found, the inventories or sales submitted with the store code will not be + # used. + # @!attribute [r] name + # @return [::String] + # Output only. Identifier. The name of the `LfpStore` resource. + # Format: `accounts/{account}/lfpStores/{target_merchant}~{store_code}` + # @!attribute [rw] target_account + # @return [::Integer] + # Required. The Merchant Center id of the merchant to submit the store for. + # @!attribute [rw] store_code + # @return [::String] + # Required. Immutable. A store identifier that is unique for the target + # merchant. + # @!attribute [rw] store_address + # @return [::String] + # Required. The street address of the store. + # Example: 1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA. + # @!attribute [rw] store_name + # @return [::String] + # Optional. The merchant or store name. + # @!attribute [rw] phone_number + # @return [::String] + # Optional. The store phone number in + # [E.164](https://en.wikipedia.org/wiki/E.164) format. Example: + # `+15556767888` + # @!attribute [rw] website_uri + # @return [::String] + # Optional. The website URL for the store or merchant. + # @!attribute [rw] gcid_category + # @return [::Array<::String>] + # Optional. [Google My Business category + # id](https://gcid-explorer.corp.google.com/static/gcid.html). + # @!attribute [rw] place_id + # @return [::String] + # Optional. The [Google Place + # Id](https://developers.google.com/maps/documentation/places/web-service/place-id#id-overview) + # of the store location. + # @!attribute [r] matching_state + # @return [::Google::Shopping::Merchant::Lfp::V1beta::LfpStore::StoreMatchingState] + # Optional. Output only. The state of matching to a Google Business Profile + # listing. See + # {::Google::Shopping::Merchant::Lfp::V1beta::LfpStore#matching_state_hint matchingStateHint} + # for further details if no match is found. + # @!attribute [r] matching_state_hint + # @return [::String] + # Optional. Output only. The hint of why the matching has failed. This is + # only set when + # {::Google::Shopping::Merchant::Lfp::V1beta::LfpStore#matching_state matchingState}=`STORE_MATCHING_STATE_FAILED`. + # + # Possible values are: + # + # - "`linked-store-not-found`": There aren't any Google Business + # Profile stores available for matching. + # - "`store-match-not-found`": The provided `LfpStore` couldn't be matched to + # any of the connected Google Business Profile stores. Merchant Center + # account is connected correctly and stores are available on Google Business + # Profile, but the `LfpStore` location address does not match with Google + # Business Profile stores' addresses. Update the `LfpStore` address or Google + # Business Profile store address to match correctly. + # - "`store-match-unverified`": The provided `LfpStore` couldn't be matched + # to any of the connected Google Business Profile stores, as the matched + # Google Business Profile store is unverified. Go through the Google Business + # Profile verification process to match correctly. + class LfpStore + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The state of matching `LfpStore` to a Google Business Profile listing. + module StoreMatchingState + # Store matching state unspecified. + STORE_MATCHING_STATE_UNSPECIFIED = 0 + + # The `LfpStore` is successfully matched with a Google Business Profile + # store. + STORE_MATCHING_STATE_MATCHED = 1 + + # The `LfpStore` is not matched with a Google Business Profile store. + STORE_MATCHING_STATE_FAILED = 2 + end + end + + # Request message for the `GetLfpStore` method. + # @!attribute [rw] name + # @return [::String] + # Required. The name of the store to retrieve. + # Format: `accounts/{account}/lfpStores/{target_merchant}~{store_code}` + class GetLfpStoreRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for the InsertLfpStore method. + # @!attribute [rw] parent + # @return [::String] + # Required. The LFP provider account + # Format: `accounts/{account}` + # @!attribute [rw] lfp_store + # @return [::Google::Shopping::Merchant::Lfp::V1beta::LfpStore] + # Required. The store to insert. + class InsertLfpStoreRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for the DeleteLfpStore method. + # @!attribute [rw] name + # @return [::String] + # Required. The name of the store to delete for the target merchant account. + # Format: `accounts/{account}/lfpStores/{target_merchant}~{store_code}` + class DeleteLfpStoreRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for the ListLfpStores method. + # @!attribute [rw] parent + # @return [::String] + # Required. The LFP partner. + # Format: `accounts/{account}` + # @!attribute [rw] target_account + # @return [::Integer] + # Required. The Merchant Center id of the merchant to list stores for. + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. The maximum number of `LfpStore` resources for the given account + # to return. The service returns fewer than this value if the number of + # stores for the given account is less than the `pageSize`. The default value + # is 250. The maximum value is 1000; If a value higher than the maximum is + # specified, then the `pageSize` will default to the maximum. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A page token, received from a previous `ListLfpStoresRequest` + # call. Provide the page token to retrieve the subsequent page. When + # paginating, all other parameters provided to `ListLfpStoresRequest` must + # match the call that provided the page token. The token returned as + # {::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresResponse#next_page_token nextPageToken} + # in the response to the previous request. + class ListLfpStoresRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response message for the ListLfpStores method. + # @!attribute [rw] lfp_stores + # @return [::Array<::Google::Shopping::Merchant::Lfp::V1beta::LfpStore>] + # The stores from the specified merchant. + # @!attribute [rw] next_page_token + # @return [::String] + # A token, which can be sent as `pageToken` to retrieve the next page. + # If this field is omitted, there are no subsequent pages. + class ListLfpStoresResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/proto_docs/google/shopping/type/types.rb b/google-shopping-merchant-lfp-v1beta/proto_docs/google/shopping/type/types.rb new file mode 100644 index 000000000000..555f5228c7c6 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/proto_docs/google/shopping/type/types.rb @@ -0,0 +1,183 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Shopping + module Type + # The price represented as a number and currency. + # @!attribute [rw] amount_micros + # @return [::Integer] + # The price represented as a number in micros (1 million micros is an + # equivalent to one's currency standard unit, for example, 1 USD = 1000000 + # micros). + # This field can also be set as infinity by setting to -1. + # This field only support -1 and positive value. + # @!attribute [rw] currency_code + # @return [::String] + # The currency of the price using three-letter acronyms according to [ISO + # 4217](http://en.wikipedia.org/wiki/ISO_4217). + class Price + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A message that represents custom attributes. Exactly one of `value` or + # `group_values` must not be empty. + # @!attribute [rw] name + # @return [::String] + # The name of the attribute. + # @!attribute [rw] value + # @return [::String] + # The value of the attribute. If `value` is not empty, `group_values` must be + # empty. + # @!attribute [rw] group_values + # @return [::Array<::Google::Shopping::Type::CustomAttribute>] + # Subattributes within this attribute group. If + # `group_values` is not empty, `value` must be empty. + class CustomAttribute + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Destinations available for a product. + # + # Destinations are used in Merchant Center to allow you to control where the + # products from your data feed should be displayed. + class Destination + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Destination values. + module DestinationEnum + # Not specified. + DESTINATION_ENUM_UNSPECIFIED = 0 + + # [Shopping ads](https://support.google.com/google-ads/answer/2454022). + SHOPPING_ADS = 1 + + # [Display ads](https://support.google.com/merchants/answer/6069387). + DISPLAY_ADS = 2 + + # [Local inventory + # ads](https://support.google.com/merchants/answer/3057972). + LOCAL_INVENTORY_ADS = 3 + + # [Free listings](https://support.google.com/merchants/answer/9199328). + FREE_LISTINGS = 4 + + # [Free local product + # listings](https://support.google.com/merchants/answer/9825611). + FREE_LOCAL_LISTINGS = 5 + + # [YouTube Shopping](https://support.google.com/merchants/answer/12362804). + YOUTUBE_SHOPPING = 6 + end + end + + # Reporting contexts that your account and product issues apply to. + # + # Reporting contexts are groups of surfaces and formats for product results on + # Google. They can represent the entire destination (for example, [Shopping + # ads](https://support.google.com/merchants/answer/6149970)) or a subset of + # formats within a destination (for example, [Demand Gen + # ads](https://support.google.com/merchants/answer/13389785)). + class ReportingContext + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Reporting context values. + module ReportingContextEnum + # Not specified. + REPORTING_CONTEXT_ENUM_UNSPECIFIED = 0 + + # [Shopping ads](https://support.google.com/merchants/answer/6149970). + SHOPPING_ADS = 1 + + # Deprecated: Use `DEMAND_GEN_ADS` instead. + # [Discovery and Demand Gen + # ads](https://support.google.com/merchants/answer/13389785). + DISCOVERY_ADS = 2 + + # [Demand Gen ads](https://support.google.com/merchants/answer/13389785). + DEMAND_GEN_ADS = 13 + + # [Demand Gen ads on Discover + # surface](https://support.google.com/merchants/answer/13389785). + DEMAND_GEN_ADS_DISCOVER_SURFACE = 14 + + # [Video ads](https://support.google.com/google-ads/answer/6340491). + VIDEO_ADS = 3 + + # [Display ads](https://support.google.com/merchants/answer/6069387). + DISPLAY_ADS = 4 + + # [Local inventory + # ads](https://support.google.com/merchants/answer/3271956). + LOCAL_INVENTORY_ADS = 5 + + # [Vehicle inventory + # ads](https://support.google.com/merchants/answer/11544533). + VEHICLE_INVENTORY_ADS = 6 + + # [Free product + # listings](https://support.google.com/merchants/answer/9199328). + FREE_LISTINGS = 7 + + # [Free local product + # listings](https://support.google.com/merchants/answer/9825611). + FREE_LOCAL_LISTINGS = 8 + + # [Free local vehicle + # listings](https://support.google.com/merchants/answer/11544533). + FREE_LOCAL_VEHICLE_LISTINGS = 9 + + # [YouTube + # Shopping](https://support.google.com/merchants/answer/13478370). + YOUTUBE_SHOPPING = 10 + + # [Cloud retail](https://cloud.google.com/solutions/retail). + CLOUD_RETAIL = 11 + + # [Local cloud retail](https://cloud.google.com/solutions/retail). + LOCAL_CLOUD_RETAIL = 12 + end + end + + # [Channel](https://support.google.com/merchants/answer/7361332) of a product. + # + # Channel is used to distinguish between online and local products. + class Channel + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Channel values. + module ChannelEnum + # Not specified. + CHANNEL_ENUM_UNSPECIFIED = 0 + + # Online product. + ONLINE = 1 + + # Local product. + LOCAL = 2 + end + end + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/snippets/Gemfile b/google-shopping-merchant-lfp-v1beta/snippets/Gemfile new file mode 100644 index 000000000000..59691d8f906c --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/snippets/Gemfile @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +source "https://rubygems.org" + +if ENV["GOOGLE_CLOUD_SAMPLES_TEST"] == "master" + gem "google-shopping-merchant-lfp-v1beta", path: "../" +else + gem "google-shopping-merchant-lfp-v1beta" +end + +group :test do + gem "google-style", "~> 1.26.1" + gem "minitest", "~> 5.16" + gem "minitest-focus", "~> 1.1" + gem "minitest-hooks", "~> 1.5" +end diff --git a/google-shopping-merchant-lfp-v1beta/snippets/lfp_inventory_service/insert_lfp_inventory.rb b/google-shopping-merchant-lfp-v1beta/snippets/lfp_inventory_service/insert_lfp_inventory.rb new file mode 100644 index 000000000000..46400ecc1e72 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/snippets/lfp_inventory_service/insert_lfp_inventory.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START merchantapi_v1beta_generated_LfpInventoryService_InsertLfpInventory_sync] +require "google/shopping/merchant/lfp/v1beta" + +## +# Snippet for the insert_lfp_inventory call in the LfpInventoryService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client#insert_lfp_inventory. +# +def insert_lfp_inventory + # Create a client object. The client can be reused for multiple calls. + client = Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Shopping::Merchant::Lfp::V1beta::InsertLfpInventoryRequest.new + + # Call the insert_lfp_inventory method. + result = client.insert_lfp_inventory request + + # The returned object is of type Google::Shopping::Merchant::Lfp::V1beta::LfpInventory. + p result +end +# [END merchantapi_v1beta_generated_LfpInventoryService_InsertLfpInventory_sync] diff --git a/google-shopping-merchant-lfp-v1beta/snippets/lfp_sale_service/insert_lfp_sale.rb b/google-shopping-merchant-lfp-v1beta/snippets/lfp_sale_service/insert_lfp_sale.rb new file mode 100644 index 000000000000..3ba60858f37a --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/snippets/lfp_sale_service/insert_lfp_sale.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START merchantapi_v1beta_generated_LfpSaleService_InsertLfpSale_sync] +require "google/shopping/merchant/lfp/v1beta" + +## +# Snippet for the insert_lfp_sale call in the LfpSaleService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Client#insert_lfp_sale. +# +def insert_lfp_sale + # Create a client object. The client can be reused for multiple calls. + client = Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Shopping::Merchant::Lfp::V1beta::InsertLfpSaleRequest.new + + # Call the insert_lfp_sale method. + result = client.insert_lfp_sale request + + # The returned object is of type Google::Shopping::Merchant::Lfp::V1beta::LfpSale. + p result +end +# [END merchantapi_v1beta_generated_LfpSaleService_InsertLfpSale_sync] diff --git a/google-shopping-merchant-lfp-v1beta/snippets/lfp_store_service/delete_lfp_store.rb b/google-shopping-merchant-lfp-v1beta/snippets/lfp_store_service/delete_lfp_store.rb new file mode 100644 index 000000000000..cb33a80b368a --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/snippets/lfp_store_service/delete_lfp_store.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START merchantapi_v1beta_generated_LfpStoreService_DeleteLfpStore_sync] +require "google/shopping/merchant/lfp/v1beta" + +## +# Snippet for the delete_lfp_store call in the LfpStoreService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client#delete_lfp_store. +# +def delete_lfp_store + # Create a client object. The client can be reused for multiple calls. + client = Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Shopping::Merchant::Lfp::V1beta::DeleteLfpStoreRequest.new + + # Call the delete_lfp_store method. + result = client.delete_lfp_store request + + # The returned object is of type Google::Protobuf::Empty. + p result +end +# [END merchantapi_v1beta_generated_LfpStoreService_DeleteLfpStore_sync] diff --git a/google-shopping-merchant-lfp-v1beta/snippets/lfp_store_service/get_lfp_store.rb b/google-shopping-merchant-lfp-v1beta/snippets/lfp_store_service/get_lfp_store.rb new file mode 100644 index 000000000000..f0397620d007 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/snippets/lfp_store_service/get_lfp_store.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START merchantapi_v1beta_generated_LfpStoreService_GetLfpStore_sync] +require "google/shopping/merchant/lfp/v1beta" + +## +# Snippet for the get_lfp_store call in the LfpStoreService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client#get_lfp_store. +# +def get_lfp_store + # Create a client object. The client can be reused for multiple calls. + client = Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Shopping::Merchant::Lfp::V1beta::GetLfpStoreRequest.new + + # Call the get_lfp_store method. + result = client.get_lfp_store request + + # The returned object is of type Google::Shopping::Merchant::Lfp::V1beta::LfpStore. + p result +end +# [END merchantapi_v1beta_generated_LfpStoreService_GetLfpStore_sync] diff --git a/google-shopping-merchant-lfp-v1beta/snippets/lfp_store_service/insert_lfp_store.rb b/google-shopping-merchant-lfp-v1beta/snippets/lfp_store_service/insert_lfp_store.rb new file mode 100644 index 000000000000..f5170c9aeb4f --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/snippets/lfp_store_service/insert_lfp_store.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START merchantapi_v1beta_generated_LfpStoreService_InsertLfpStore_sync] +require "google/shopping/merchant/lfp/v1beta" + +## +# Snippet for the insert_lfp_store call in the LfpStoreService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client#insert_lfp_store. +# +def insert_lfp_store + # Create a client object. The client can be reused for multiple calls. + client = Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Shopping::Merchant::Lfp::V1beta::InsertLfpStoreRequest.new + + # Call the insert_lfp_store method. + result = client.insert_lfp_store request + + # The returned object is of type Google::Shopping::Merchant::Lfp::V1beta::LfpStore. + p result +end +# [END merchantapi_v1beta_generated_LfpStoreService_InsertLfpStore_sync] diff --git a/google-shopping-merchant-lfp-v1beta/snippets/lfp_store_service/list_lfp_stores.rb b/google-shopping-merchant-lfp-v1beta/snippets/lfp_store_service/list_lfp_stores.rb new file mode 100644 index 000000000000..614c32536657 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/snippets/lfp_store_service/list_lfp_stores.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START merchantapi_v1beta_generated_LfpStoreService_ListLfpStores_sync] +require "google/shopping/merchant/lfp/v1beta" + +## +# Snippet for the list_lfp_stores call in the LfpStoreService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client#list_lfp_stores. +# +def list_lfp_stores + # Create a client object. The client can be reused for multiple calls. + client = Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresRequest.new + + # Call the list_lfp_stores method. + result = client.list_lfp_stores request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Shopping::Merchant::Lfp::V1beta::LfpStore. + p item + end +end +# [END merchantapi_v1beta_generated_LfpStoreService_ListLfpStores_sync] diff --git a/google-shopping-merchant-lfp-v1beta/snippets/snippet_metadata_google.shopping.merchant.lfp.v1beta.json b/google-shopping-merchant-lfp-v1beta/snippets/snippet_metadata_google.shopping.merchant.lfp.v1beta.json new file mode 100644 index 000000000000..81867a4ac716 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/snippets/snippet_metadata_google.shopping.merchant.lfp.v1beta.json @@ -0,0 +1,255 @@ +{ + "client_library": { + "name": "google-shopping-merchant-lfp-v1beta", + "version": "", + "language": "RUBY", + "apis": [ + { + "id": "google.shopping.merchant.lfp.v1beta", + "version": "v1beta" + } + ] + }, + "snippets": [ + { + "region_tag": "merchantapi_v1beta_generated_LfpInventoryService_InsertLfpInventory_sync", + "title": "Snippet for the insert_lfp_inventory call in the LfpInventoryService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client#insert_lfp_inventory.", + "file": "lfp_inventory_service/insert_lfp_inventory.rb", + "language": "RUBY", + "client_method": { + "short_name": "insert_lfp_inventory", + "full_name": "::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client#insert_lfp_inventory", + "async": false, + "parameters": [ + { + "type": "::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpInventoryRequest", + "name": "request" + } + ], + "result_type": "::Google::Shopping::Merchant::Lfp::V1beta::LfpInventory", + "client": { + "short_name": "LfpInventoryService::Client", + "full_name": "::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client" + }, + "method": { + "short_name": "InsertLfpInventory", + "full_name": "google.shopping.merchant.lfp.v1beta.LfpInventoryService.InsertLfpInventory", + "service": { + "short_name": "LfpInventoryService", + "full_name": "google.shopping.merchant.lfp.v1beta.LfpInventoryService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "merchantapi_v1beta_generated_LfpSaleService_InsertLfpSale_sync", + "title": "Snippet for the insert_lfp_sale call in the LfpSaleService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Client#insert_lfp_sale.", + "file": "lfp_sale_service/insert_lfp_sale.rb", + "language": "RUBY", + "client_method": { + "short_name": "insert_lfp_sale", + "full_name": "::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Client#insert_lfp_sale", + "async": false, + "parameters": [ + { + "type": "::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpSaleRequest", + "name": "request" + } + ], + "result_type": "::Google::Shopping::Merchant::Lfp::V1beta::LfpSale", + "client": { + "short_name": "LfpSaleService::Client", + "full_name": "::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Client" + }, + "method": { + "short_name": "InsertLfpSale", + "full_name": "google.shopping.merchant.lfp.v1beta.LfpSaleService.InsertLfpSale", + "service": { + "short_name": "LfpSaleService", + "full_name": "google.shopping.merchant.lfp.v1beta.LfpSaleService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "merchantapi_v1beta_generated_LfpStoreService_GetLfpStore_sync", + "title": "Snippet for the get_lfp_store call in the LfpStoreService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client#get_lfp_store.", + "file": "lfp_store_service/get_lfp_store.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_lfp_store", + "full_name": "::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client#get_lfp_store", + "async": false, + "parameters": [ + { + "type": "::Google::Shopping::Merchant::Lfp::V1beta::GetLfpStoreRequest", + "name": "request" + } + ], + "result_type": "::Google::Shopping::Merchant::Lfp::V1beta::LfpStore", + "client": { + "short_name": "LfpStoreService::Client", + "full_name": "::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client" + }, + "method": { + "short_name": "GetLfpStore", + "full_name": "google.shopping.merchant.lfp.v1beta.LfpStoreService.GetLfpStore", + "service": { + "short_name": "LfpStoreService", + "full_name": "google.shopping.merchant.lfp.v1beta.LfpStoreService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "merchantapi_v1beta_generated_LfpStoreService_InsertLfpStore_sync", + "title": "Snippet for the insert_lfp_store call in the LfpStoreService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client#insert_lfp_store.", + "file": "lfp_store_service/insert_lfp_store.rb", + "language": "RUBY", + "client_method": { + "short_name": "insert_lfp_store", + "full_name": "::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client#insert_lfp_store", + "async": false, + "parameters": [ + { + "type": "::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpStoreRequest", + "name": "request" + } + ], + "result_type": "::Google::Shopping::Merchant::Lfp::V1beta::LfpStore", + "client": { + "short_name": "LfpStoreService::Client", + "full_name": "::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client" + }, + "method": { + "short_name": "InsertLfpStore", + "full_name": "google.shopping.merchant.lfp.v1beta.LfpStoreService.InsertLfpStore", + "service": { + "short_name": "LfpStoreService", + "full_name": "google.shopping.merchant.lfp.v1beta.LfpStoreService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "merchantapi_v1beta_generated_LfpStoreService_DeleteLfpStore_sync", + "title": "Snippet for the delete_lfp_store call in the LfpStoreService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client#delete_lfp_store.", + "file": "lfp_store_service/delete_lfp_store.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete_lfp_store", + "full_name": "::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client#delete_lfp_store", + "async": false, + "parameters": [ + { + "type": "::Google::Shopping::Merchant::Lfp::V1beta::DeleteLfpStoreRequest", + "name": "request" + } + ], + "result_type": "::Google::Protobuf::Empty", + "client": { + "short_name": "LfpStoreService::Client", + "full_name": "::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client" + }, + "method": { + "short_name": "DeleteLfpStore", + "full_name": "google.shopping.merchant.lfp.v1beta.LfpStoreService.DeleteLfpStore", + "service": { + "short_name": "LfpStoreService", + "full_name": "google.shopping.merchant.lfp.v1beta.LfpStoreService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "merchantapi_v1beta_generated_LfpStoreService_ListLfpStores_sync", + "title": "Snippet for the list_lfp_stores call in the LfpStoreService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client#list_lfp_stores.", + "file": "lfp_store_service/list_lfp_stores.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_lfp_stores", + "full_name": "::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client#list_lfp_stores", + "async": false, + "parameters": [ + { + "type": "::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresRequest", + "name": "request" + } + ], + "result_type": "::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresResponse", + "client": { + "short_name": "LfpStoreService::Client", + "full_name": "::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client" + }, + "method": { + "short_name": "ListLfpStores", + "full_name": "google.shopping.merchant.lfp.v1beta.LfpStoreService.ListLfpStores", + "service": { + "short_name": "LfpStoreService", + "full_name": "google.shopping.merchant.lfp.v1beta.LfpStoreService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + } + ] +} \ No newline at end of file diff --git a/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_inventory_service_paths_test.rb b/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_inventory_service_paths_test.rb new file mode 100644 index 000000000000..546a67b3338b --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_inventory_service_paths_test.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/shopping/merchant/lfp/v1beta/lfp_inventory_service" + +class ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + end + + def test_account_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.account_path account: "value0" + assert_equal "accounts/value0", path + end + end + + def test_lfp_inventory_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.lfp_inventory_path account: "value0", target_merchant: "value1", store_code: "value2", offer: "value3" + assert_equal "accounts/value0/lfpInventories/value1~value2~value3", path + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_inventory_service_rest_test.rb b/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_inventory_service_rest_test.rb new file mode 100644 index 000000000000..2b509848be47 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_inventory_service_rest_test.rb @@ -0,0 +1,146 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/shopping/merchant/lfp/v1beta/lfpinventory_pb" +require "google/shopping/merchant/lfp/v1beta/lfp_inventory_service/rest" + + +class ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {} + make_http_request :get, uri: uri, body: nil, params: params, options: options + end + + def make_delete_request uri:, params: {}, options: {} + make_http_request :delete, uri: uri, body: nil, params: params, options: options + end + + def make_post_request uri:, body: nil, params: {}, options: {} + make_http_request :post, uri: uri, body: body, params: params, options: options + end + + def make_patch_request uri:, body:, params: {}, options: {} + make_http_request :patch, uri: uri, body: body, params: params, options: options + end + + def make_put_request uri:, body:, params: {}, options: {} + make_http_request :put, uri: uri, body: body, params: params, options: options + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + end + + def test_insert_lfp_inventory + # Create test objects. + client_result = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventory.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + lfp_inventory = {} + + insert_lfp_inventory_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Rest::ServiceStub.stub :transcode_insert_lfp_inventory_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, insert_lfp_inventory_client_stub do + # Create client + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.insert_lfp_inventory({ parent: parent, lfp_inventory: lfp_inventory }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.insert_lfp_inventory parent: parent, lfp_inventory: lfp_inventory do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.insert_lfp_inventory ::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpInventoryRequest.new(parent: parent, lfp_inventory: lfp_inventory) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.insert_lfp_inventory({ parent: parent, lfp_inventory: lfp_inventory }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.insert_lfp_inventory(::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpInventoryRequest.new(parent: parent, lfp_inventory: lfp_inventory), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, insert_lfp_inventory_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Rest::Client::Configuration, config + end +end diff --git a/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_inventory_service_test.rb b/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_inventory_service_test.rb new file mode 100644 index 000000000000..959e64306b92 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_inventory_service_test.rb @@ -0,0 +1,136 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/shopping/merchant/lfp/v1beta/lfpinventory_pb" +require "google/shopping/merchant/lfp/v1beta/lfpinventory_services_pb" +require "google/shopping/merchant/lfp/v1beta/lfp_inventory_service" + +class ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + yield @response, @operation if block_given? + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + end + + def test_insert_lfp_inventory + # Create GRPC objects. + grpc_response = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventory.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + lfp_inventory = {} + + insert_lfp_inventory_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :insert_lfp_inventory, name + assert_kind_of ::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpInventoryRequest, request + assert_equal "hello world", request["parent"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventory), request["lfp_inventory"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, insert_lfp_inventory_client_stub do + # Create client + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.insert_lfp_inventory({ parent: parent, lfp_inventory: lfp_inventory }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.insert_lfp_inventory parent: parent, lfp_inventory: lfp_inventory do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.insert_lfp_inventory ::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpInventoryRequest.new(parent: parent, lfp_inventory: lfp_inventory) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.insert_lfp_inventory({ parent: parent, lfp_inventory: lfp_inventory }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.insert_lfp_inventory(::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpInventoryRequest.new(parent: parent, lfp_inventory: lfp_inventory), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, insert_lfp_inventory_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Shopping::Merchant::Lfp::V1beta::LfpInventoryService::Client::Configuration, config + end +end diff --git a/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_sale_service_paths_test.rb b/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_sale_service_paths_test.rb new file mode 100644 index 000000000000..adf95b8edb6b --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_sale_service_paths_test.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/shopping/merchant/lfp/v1beta/lfp_sale_service" + +class ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + end + + def test_lfp_sale_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.lfp_sale_path account: "value0", sale: "value1" + assert_equal "accounts/value0/lfpSales/value1", path + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_sale_service_rest_test.rb b/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_sale_service_rest_test.rb new file mode 100644 index 000000000000..05340ee25079 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_sale_service_rest_test.rb @@ -0,0 +1,146 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/shopping/merchant/lfp/v1beta/lfpsale_pb" +require "google/shopping/merchant/lfp/v1beta/lfp_sale_service/rest" + + +class ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {} + make_http_request :get, uri: uri, body: nil, params: params, options: options + end + + def make_delete_request uri:, params: {}, options: {} + make_http_request :delete, uri: uri, body: nil, params: params, options: options + end + + def make_post_request uri:, body: nil, params: {}, options: {} + make_http_request :post, uri: uri, body: body, params: params, options: options + end + + def make_patch_request uri:, body:, params: {}, options: {} + make_http_request :patch, uri: uri, body: body, params: params, options: options + end + + def make_put_request uri:, body:, params: {}, options: {} + make_http_request :put, uri: uri, body: body, params: params, options: options + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + end + + def test_insert_lfp_sale + # Create test objects. + client_result = ::Google::Shopping::Merchant::Lfp::V1beta::LfpSale.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + lfp_sale = {} + + insert_lfp_sale_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Rest::ServiceStub.stub :transcode_insert_lfp_sale_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, insert_lfp_sale_client_stub do + # Create client + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.insert_lfp_sale({ parent: parent, lfp_sale: lfp_sale }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.insert_lfp_sale parent: parent, lfp_sale: lfp_sale do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.insert_lfp_sale ::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpSaleRequest.new(parent: parent, lfp_sale: lfp_sale) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.insert_lfp_sale({ parent: parent, lfp_sale: lfp_sale }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.insert_lfp_sale(::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpSaleRequest.new(parent: parent, lfp_sale: lfp_sale), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, insert_lfp_sale_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Rest::Client::Configuration, config + end +end diff --git a/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_sale_service_test.rb b/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_sale_service_test.rb new file mode 100644 index 000000000000..d213abb9b87f --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_sale_service_test.rb @@ -0,0 +1,136 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/shopping/merchant/lfp/v1beta/lfpsale_pb" +require "google/shopping/merchant/lfp/v1beta/lfpsale_services_pb" +require "google/shopping/merchant/lfp/v1beta/lfp_sale_service" + +class ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + yield @response, @operation if block_given? + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + end + + def test_insert_lfp_sale + # Create GRPC objects. + grpc_response = ::Google::Shopping::Merchant::Lfp::V1beta::LfpSale.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + lfp_sale = {} + + insert_lfp_sale_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :insert_lfp_sale, name + assert_kind_of ::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpSaleRequest, request + assert_equal "hello world", request["parent"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Shopping::Merchant::Lfp::V1beta::LfpSale), request["lfp_sale"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, insert_lfp_sale_client_stub do + # Create client + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.insert_lfp_sale({ parent: parent, lfp_sale: lfp_sale }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.insert_lfp_sale parent: parent, lfp_sale: lfp_sale do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.insert_lfp_sale ::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpSaleRequest.new(parent: parent, lfp_sale: lfp_sale) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.insert_lfp_sale({ parent: parent, lfp_sale: lfp_sale }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.insert_lfp_sale(::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpSaleRequest.new(parent: parent, lfp_sale: lfp_sale), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, insert_lfp_sale_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Shopping::Merchant::Lfp::V1beta::LfpSaleService::Client::Configuration, config + end +end diff --git a/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_store_service_paths_test.rb b/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_store_service_paths_test.rb new file mode 100644 index 000000000000..734121ff45ee --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_store_service_paths_test.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/shopping/merchant/lfp/v1beta/lfp_store_service" + +class ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + end + + def test_account_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.account_path account: "value0" + assert_equal "accounts/value0", path + end + end + + def test_lfp_store_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.lfp_store_path account: "value0", target_merchant: "value1", store_code: "value2" + assert_equal "accounts/value0/lfpStores/value1~value2", path + end + end +end diff --git a/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_store_service_rest_test.rb b/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_store_service_rest_test.rb new file mode 100644 index 000000000000..69be3efc6f75 --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_store_service_rest_test.rb @@ -0,0 +1,311 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/shopping/merchant/lfp/v1beta/lfpstore_pb" +require "google/shopping/merchant/lfp/v1beta/lfp_store_service/rest" + + +class ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {} + make_http_request :get, uri: uri, body: nil, params: params, options: options + end + + def make_delete_request uri:, params: {}, options: {} + make_http_request :delete, uri: uri, body: nil, params: params, options: options + end + + def make_post_request uri:, body: nil, params: {}, options: {} + make_http_request :post, uri: uri, body: body, params: params, options: options + end + + def make_patch_request uri:, body:, params: {}, options: {} + make_http_request :patch, uri: uri, body: body, params: params, options: options + end + + def make_put_request uri:, body:, params: {}, options: {} + make_http_request :put, uri: uri, body: body, params: params, options: options + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + end + + def test_get_lfp_store + # Create test objects. + client_result = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStore.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_lfp_store_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::ServiceStub.stub :transcode_get_lfp_store_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_lfp_store_client_stub do + # Create client + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_lfp_store({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_lfp_store name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_lfp_store ::Google::Shopping::Merchant::Lfp::V1beta::GetLfpStoreRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_lfp_store({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_lfp_store(::Google::Shopping::Merchant::Lfp::V1beta::GetLfpStoreRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_lfp_store_client_stub.call_count + end + end + end + + def test_insert_lfp_store + # Create test objects. + client_result = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStore.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + lfp_store = {} + + insert_lfp_store_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::ServiceStub.stub :transcode_insert_lfp_store_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, insert_lfp_store_client_stub do + # Create client + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.insert_lfp_store({ parent: parent, lfp_store: lfp_store }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.insert_lfp_store parent: parent, lfp_store: lfp_store do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.insert_lfp_store ::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpStoreRequest.new(parent: parent, lfp_store: lfp_store) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.insert_lfp_store({ parent: parent, lfp_store: lfp_store }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.insert_lfp_store(::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpStoreRequest.new(parent: parent, lfp_store: lfp_store), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, insert_lfp_store_client_stub.call_count + end + end + end + + def test_delete_lfp_store + # Create test objects. + client_result = ::Google::Protobuf::Empty.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_lfp_store_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::ServiceStub.stub :transcode_delete_lfp_store_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_lfp_store_client_stub do + # Create client + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.delete_lfp_store({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.delete_lfp_store name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.delete_lfp_store ::Google::Shopping::Merchant::Lfp::V1beta::DeleteLfpStoreRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.delete_lfp_store({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.delete_lfp_store(::Google::Shopping::Merchant::Lfp::V1beta::DeleteLfpStoreRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_lfp_store_client_stub.call_count + end + end + end + + def test_list_lfp_stores + # Create test objects. + client_result = ::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + target_account = 42 + page_size = 42 + page_token = "hello world" + + list_lfp_stores_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::ServiceStub.stub :transcode_list_lfp_stores_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_lfp_stores_client_stub do + # Create client + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_lfp_stores({ parent: parent, target_account: target_account, page_size: page_size, page_token: page_token }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_lfp_stores parent: parent, target_account: target_account, page_size: page_size, page_token: page_token do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_lfp_stores ::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresRequest.new(parent: parent, target_account: target_account, page_size: page_size, page_token: page_token) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_lfp_stores({ parent: parent, target_account: target_account, page_size: page_size, page_token: page_token }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_lfp_stores(::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresRequest.new(parent: parent, target_account: target_account, page_size: page_size, page_token: page_token), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_lfp_stores_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Rest::Client::Configuration, config + end +end diff --git a/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_store_service_test.rb b/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_store_service_test.rb new file mode 100644 index 000000000000..d18056af085b --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/test/google/shopping/merchant/lfp/v1beta/lfp_store_service_test.rb @@ -0,0 +1,321 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/shopping/merchant/lfp/v1beta/lfpstore_pb" +require "google/shopping/merchant/lfp/v1beta/lfpstore_services_pb" +require "google/shopping/merchant/lfp/v1beta/lfp_store_service" + +class ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + yield @response, @operation if block_given? + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + end + + def test_get_lfp_store + # Create GRPC objects. + grpc_response = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStore.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_lfp_store_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_lfp_store, name + assert_kind_of ::Google::Shopping::Merchant::Lfp::V1beta::GetLfpStoreRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_lfp_store_client_stub do + # Create client + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_lfp_store({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_lfp_store name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_lfp_store ::Google::Shopping::Merchant::Lfp::V1beta::GetLfpStoreRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_lfp_store({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_lfp_store(::Google::Shopping::Merchant::Lfp::V1beta::GetLfpStoreRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_lfp_store_client_stub.call_rpc_count + end + end + + def test_insert_lfp_store + # Create GRPC objects. + grpc_response = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStore.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + lfp_store = {} + + insert_lfp_store_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :insert_lfp_store, name + assert_kind_of ::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpStoreRequest, request + assert_equal "hello world", request["parent"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Shopping::Merchant::Lfp::V1beta::LfpStore), request["lfp_store"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, insert_lfp_store_client_stub do + # Create client + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.insert_lfp_store({ parent: parent, lfp_store: lfp_store }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.insert_lfp_store parent: parent, lfp_store: lfp_store do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.insert_lfp_store ::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpStoreRequest.new(parent: parent, lfp_store: lfp_store) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.insert_lfp_store({ parent: parent, lfp_store: lfp_store }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.insert_lfp_store(::Google::Shopping::Merchant::Lfp::V1beta::InsertLfpStoreRequest.new(parent: parent, lfp_store: lfp_store), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, insert_lfp_store_client_stub.call_rpc_count + end + end + + def test_delete_lfp_store + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_lfp_store_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_lfp_store, name + assert_kind_of ::Google::Shopping::Merchant::Lfp::V1beta::DeleteLfpStoreRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_lfp_store_client_stub do + # Create client + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.delete_lfp_store({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.delete_lfp_store name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.delete_lfp_store ::Google::Shopping::Merchant::Lfp::V1beta::DeleteLfpStoreRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.delete_lfp_store({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.delete_lfp_store(::Google::Shopping::Merchant::Lfp::V1beta::DeleteLfpStoreRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_lfp_store_client_stub.call_rpc_count + end + end + + def test_list_lfp_stores + # Create GRPC objects. + grpc_response = ::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + target_account = 42 + page_size = 42 + page_token = "hello world" + + list_lfp_stores_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_lfp_stores, name + assert_kind_of ::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["target_account"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_lfp_stores_client_stub do + # Create client + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_lfp_stores({ parent: parent, target_account: target_account, page_size: page_size, page_token: page_token }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.list_lfp_stores parent: parent, target_account: target_account, page_size: page_size, page_token: page_token do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.list_lfp_stores ::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresRequest.new(parent: parent, target_account: target_account, page_size: page_size, page_token: page_token) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.list_lfp_stores({ parent: parent, target_account: target_account, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.list_lfp_stores(::Google::Shopping::Merchant::Lfp::V1beta::ListLfpStoresRequest.new(parent: parent, target_account: target_account, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_lfp_stores_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Shopping::Merchant::Lfp::V1beta::LfpStoreService::Client::Configuration, config + end +end diff --git a/google-shopping-merchant-lfp-v1beta/test/helper.rb b/google-shopping-merchant-lfp-v1beta/test/helper.rb new file mode 100644 index 000000000000..48407bca7edb --- /dev/null +++ b/google-shopping-merchant-lfp-v1beta/test/helper.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "minitest/autorun" +require "minitest/focus" +require "minitest/rg" + +require "grpc" + +require "ostruct" diff --git a/release-please-config.json b/release-please-config.json index 343d2285dd29..21496ea91d87 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -1587,6 +1587,10 @@ "component": "google-shopping-merchant-inventories-v1beta", "version_file": "lib/google/shopping/merchant/inventories/v1beta/version.rb" }, + "google-shopping-merchant-lfp-v1beta": { + "component": "google-shopping-merchant-lfp-v1beta", + "version_file": "lib/google/shopping/merchant/lfp/v1beta/version.rb" + }, "google-shopping-merchant-notifications-v1beta": { "component": "google-shopping-merchant-notifications-v1beta", "version_file": "lib/google/shopping/merchant/notifications/v1beta/version.rb"