From c8d25f30749f3281646d9d98fc6d0c7f1416be2f Mon Sep 17 00:00:00 2001 From: yoshi-code-bot <70984784+yoshi-code-bot@users.noreply.github.com> Date: Thu, 2 May 2024 16:50:13 -0700 Subject: [PATCH] feat: Initial generation of google-maps-fleet_engine-delivery-v1 (#25840) --- .release-please-manifest.json | 2 + .../.OwlBot.yaml | 3 + .../.gitignore | 22 + .../.owlbot-manifest.json | 73 + .../.repo-metadata.json | 17 + .../.rubocop.yml | 33 + google-maps-fleet_engine-delivery-v1/.toys.rb | 28 + .../.yardopts | 12 + .../AUTHENTICATION.md | 122 ++ .../CHANGELOG.md | 2 + google-maps-fleet_engine-delivery-v1/Gemfile | 11 + .../LICENSE.md | 201 ++ .../README.md | 144 ++ google-maps-fleet_engine-delivery-v1/Rakefile | 169 ++ .../gapic_metadata.json | 73 + ...ogle-maps-fleet_engine-delivery-v1.gemspec | 29 + .../google-maps-fleet_engine-delivery-v1.rb | 21 + .../google/maps/fleet_engine/delivery/v1.rb | 47 + .../delivery/v1/delivery_service.rb | 57 + .../delivery/v1/delivery_service/client.rb | 1621 +++++++++++++++++ .../v1/delivery_service/credentials.rb | 49 + .../delivery/v1/delivery_service/paths.rb | 100 + .../delivery/v1/delivery_service/rest.rb | 54 + .../v1/delivery_service/rest/client.rb | 1505 +++++++++++++++ .../v1/delivery_service/rest/service_stub.rb | 725 ++++++++ .../maps/fleet_engine/delivery/v1/rest.rb | 39 + .../maps/fleet_engine/delivery/v1/version.rb | 30 + .../maps/fleetengine/delivery/v1/common_pb.rb | 57 + .../delivery/v1/delivery_api_pb.rb | 75 + .../delivery/v1/delivery_api_services_pb.rb | 73 + .../delivery/v1/delivery_vehicles_pb.rb | 61 + .../maps/fleetengine/delivery/v1/header_pb.rb | 48 + .../delivery/v1/task_tracking_info_pb.rb | 58 + .../maps/fleetengine/delivery/v1/tasks_pb.rb | 62 + .../proto_docs/README.md | 4 + .../proto_docs/google/api/client.rb | 399 ++++ .../proto_docs/google/api/field_behavior.rb | 85 + .../proto_docs/google/api/launch_stage.rb | 71 + .../proto_docs/google/api/resource.rb | 222 +++ .../proto_docs/google/api/routing.rb | 459 +++++ .../proto_docs/google/geo/type/viewport.rb | 70 + .../maps/fleetengine/delivery/v1/common.rb | 251 +++ .../fleetengine/delivery/v1/delivery_api.rb | 416 +++++ .../delivery/v1/delivery_vehicles.rb | 271 +++ .../maps/fleetengine/delivery/v1/header.rb | 113 ++ .../delivery/v1/task_tracking_info.rb | 91 + .../maps/fleetengine/delivery/v1/tasks.rb | 281 +++ .../proto_docs/google/protobuf/duration.rb | 98 + .../proto_docs/google/protobuf/field_mask.rb | 229 +++ .../proto_docs/google/protobuf/timestamp.rb | 127 ++ .../proto_docs/google/protobuf/wrappers.rb | 121 ++ .../proto_docs/google/type/latlng.rb | 38 + .../snippets/Gemfile | 32 + .../delivery_service/batch_create_tasks.rb | 47 + .../create_delivery_vehicle.rb | 47 + .../snippets/delivery_service/create_task.rb | 47 + .../delivery_service/get_delivery_vehicle.rb | 47 + .../snippets/delivery_service/get_task.rb | 47 + .../get_task_tracking_info.rb | 47 + .../list_delivery_vehicles.rb | 51 + .../snippets/delivery_service/list_tasks.rb | 51 + .../snippets/delivery_service/search_tasks.rb | 51 + .../update_delivery_vehicle.rb | 47 + .../snippets/delivery_service/update_task.rb | 47 + ...metadata_maps.fleetengine.delivery.v1.json | 455 +++++ .../v1/delivery_service_paths_test.rb | 83 + .../delivery/v1/delivery_service_rest_test.rb | 713 ++++++++ .../delivery/v1/delivery_service_test.rb | 785 ++++++++ .../test/helper.rb | 25 + release-please-config.json | 4 + 70 files changed, 11595 insertions(+) create mode 100644 google-maps-fleet_engine-delivery-v1/.OwlBot.yaml create mode 100644 google-maps-fleet_engine-delivery-v1/.gitignore create mode 100644 google-maps-fleet_engine-delivery-v1/.owlbot-manifest.json create mode 100644 google-maps-fleet_engine-delivery-v1/.repo-metadata.json create mode 100644 google-maps-fleet_engine-delivery-v1/.rubocop.yml create mode 100644 google-maps-fleet_engine-delivery-v1/.toys.rb create mode 100644 google-maps-fleet_engine-delivery-v1/.yardopts create mode 100644 google-maps-fleet_engine-delivery-v1/AUTHENTICATION.md create mode 100644 google-maps-fleet_engine-delivery-v1/CHANGELOG.md create mode 100644 google-maps-fleet_engine-delivery-v1/Gemfile create mode 100644 google-maps-fleet_engine-delivery-v1/LICENSE.md create mode 100644 google-maps-fleet_engine-delivery-v1/README.md create mode 100644 google-maps-fleet_engine-delivery-v1/Rakefile create mode 100644 google-maps-fleet_engine-delivery-v1/gapic_metadata.json create mode 100644 google-maps-fleet_engine-delivery-v1/google-maps-fleet_engine-delivery-v1.gemspec create mode 100644 google-maps-fleet_engine-delivery-v1/lib/google-maps-fleet_engine-delivery-v1.rb create mode 100644 google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1.rb create mode 100644 google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service.rb create mode 100644 google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/client.rb create mode 100644 google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/credentials.rb create mode 100644 google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/paths.rb create mode 100644 google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/rest.rb create mode 100644 google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/rest/client.rb create mode 100644 google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/rest/service_stub.rb create mode 100644 google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/rest.rb create mode 100644 google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/version.rb create mode 100644 google-maps-fleet_engine-delivery-v1/lib/google/maps/fleetengine/delivery/v1/common_pb.rb create mode 100644 google-maps-fleet_engine-delivery-v1/lib/google/maps/fleetengine/delivery/v1/delivery_api_pb.rb create mode 100644 google-maps-fleet_engine-delivery-v1/lib/google/maps/fleetengine/delivery/v1/delivery_api_services_pb.rb create mode 100644 google-maps-fleet_engine-delivery-v1/lib/google/maps/fleetengine/delivery/v1/delivery_vehicles_pb.rb create mode 100644 google-maps-fleet_engine-delivery-v1/lib/google/maps/fleetengine/delivery/v1/header_pb.rb create mode 100644 google-maps-fleet_engine-delivery-v1/lib/google/maps/fleetengine/delivery/v1/task_tracking_info_pb.rb create mode 100644 google-maps-fleet_engine-delivery-v1/lib/google/maps/fleetengine/delivery/v1/tasks_pb.rb create mode 100644 google-maps-fleet_engine-delivery-v1/proto_docs/README.md create mode 100644 google-maps-fleet_engine-delivery-v1/proto_docs/google/api/client.rb create mode 100644 google-maps-fleet_engine-delivery-v1/proto_docs/google/api/field_behavior.rb create mode 100644 google-maps-fleet_engine-delivery-v1/proto_docs/google/api/launch_stage.rb create mode 100644 google-maps-fleet_engine-delivery-v1/proto_docs/google/api/resource.rb create mode 100644 google-maps-fleet_engine-delivery-v1/proto_docs/google/api/routing.rb create mode 100644 google-maps-fleet_engine-delivery-v1/proto_docs/google/geo/type/viewport.rb create mode 100644 google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/common.rb create mode 100644 google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/delivery_api.rb create mode 100644 google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/delivery_vehicles.rb create mode 100644 google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/header.rb create mode 100644 google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/task_tracking_info.rb create mode 100644 google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/tasks.rb create mode 100644 google-maps-fleet_engine-delivery-v1/proto_docs/google/protobuf/duration.rb create mode 100644 google-maps-fleet_engine-delivery-v1/proto_docs/google/protobuf/field_mask.rb create mode 100644 google-maps-fleet_engine-delivery-v1/proto_docs/google/protobuf/timestamp.rb create mode 100644 google-maps-fleet_engine-delivery-v1/proto_docs/google/protobuf/wrappers.rb create mode 100644 google-maps-fleet_engine-delivery-v1/proto_docs/google/type/latlng.rb create mode 100644 google-maps-fleet_engine-delivery-v1/snippets/Gemfile create mode 100644 google-maps-fleet_engine-delivery-v1/snippets/delivery_service/batch_create_tasks.rb create mode 100644 google-maps-fleet_engine-delivery-v1/snippets/delivery_service/create_delivery_vehicle.rb create mode 100644 google-maps-fleet_engine-delivery-v1/snippets/delivery_service/create_task.rb create mode 100644 google-maps-fleet_engine-delivery-v1/snippets/delivery_service/get_delivery_vehicle.rb create mode 100644 google-maps-fleet_engine-delivery-v1/snippets/delivery_service/get_task.rb create mode 100644 google-maps-fleet_engine-delivery-v1/snippets/delivery_service/get_task_tracking_info.rb create mode 100644 google-maps-fleet_engine-delivery-v1/snippets/delivery_service/list_delivery_vehicles.rb create mode 100644 google-maps-fleet_engine-delivery-v1/snippets/delivery_service/list_tasks.rb create mode 100644 google-maps-fleet_engine-delivery-v1/snippets/delivery_service/search_tasks.rb create mode 100644 google-maps-fleet_engine-delivery-v1/snippets/delivery_service/update_delivery_vehicle.rb create mode 100644 google-maps-fleet_engine-delivery-v1/snippets/delivery_service/update_task.rb create mode 100644 google-maps-fleet_engine-delivery-v1/snippets/snippet_metadata_maps.fleetengine.delivery.v1.json create mode 100644 google-maps-fleet_engine-delivery-v1/test/google/maps/fleet_engine/delivery/v1/delivery_service_paths_test.rb create mode 100644 google-maps-fleet_engine-delivery-v1/test/google/maps/fleet_engine/delivery/v1/delivery_service_rest_test.rb create mode 100644 google-maps-fleet_engine-delivery-v1/test/google/maps/fleet_engine/delivery/v1/delivery_service_test.rb create mode 100644 google-maps-fleet_engine-delivery-v1/test/helper.rb diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 22a491c15da8..347966dbdb36 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -787,6 +787,8 @@ "google-identity-access_context_manager+FILLER": "0.0.0", "google-identity-access_context_manager-v1": "0.8.0", "google-identity-access_context_manager-v1+FILLER": "0.0.0", + "google-maps-fleet_engine-delivery-v1": "0.0.1", + "google-maps-fleet_engine-delivery-v1+FILLER": "0.0.0", "google-maps-fleet_engine-v1": "0.0.1", "google-maps-fleet_engine-v1+FILLER": "0.0.0", "google-shopping-merchant-conversions": "0.1.0", diff --git a/google-maps-fleet_engine-delivery-v1/.OwlBot.yaml b/google-maps-fleet_engine-delivery-v1/.OwlBot.yaml new file mode 100644 index 000000000000..9bf812c0ad38 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/.OwlBot.yaml @@ -0,0 +1,3 @@ +deep-copy-regex: + - source: /google/maps/fleetengine/delivery/v1/[^/]+-ruby/(.*) + dest: /owl-bot-staging/google-maps-fleet_engine-delivery-v1/$1 diff --git a/google-maps-fleet_engine-delivery-v1/.gitignore b/google-maps-fleet_engine-delivery-v1/.gitignore new file mode 100644 index 000000000000..0135b6bc6cfc --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/.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-maps-fleet_engine-delivery-v1/.owlbot-manifest.json b/google-maps-fleet_engine-delivery-v1/.owlbot-manifest.json new file mode 100644 index 000000000000..0e4befe719ab --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/.owlbot-manifest.json @@ -0,0 +1,73 @@ +{ + "generated": [ + ".gitignore", + ".repo-metadata.json", + ".rubocop.yml", + ".toys.rb", + ".yardopts", + "AUTHENTICATION.md", + "CHANGELOG.md", + "Gemfile", + "LICENSE.md", + "README.md", + "Rakefile", + "gapic_metadata.json", + "google-maps-fleet_engine-delivery-v1.gemspec", + "lib/google-maps-fleet_engine-delivery-v1.rb", + "lib/google/maps/fleet_engine/delivery/v1.rb", + "lib/google/maps/fleet_engine/delivery/v1/delivery_service.rb", + "lib/google/maps/fleet_engine/delivery/v1/delivery_service/client.rb", + "lib/google/maps/fleet_engine/delivery/v1/delivery_service/credentials.rb", + "lib/google/maps/fleet_engine/delivery/v1/delivery_service/paths.rb", + "lib/google/maps/fleet_engine/delivery/v1/delivery_service/rest.rb", + "lib/google/maps/fleet_engine/delivery/v1/delivery_service/rest/client.rb", + "lib/google/maps/fleet_engine/delivery/v1/delivery_service/rest/service_stub.rb", + "lib/google/maps/fleet_engine/delivery/v1/rest.rb", + "lib/google/maps/fleet_engine/delivery/v1/version.rb", + "lib/google/maps/fleetengine/delivery/v1/common_pb.rb", + "lib/google/maps/fleetengine/delivery/v1/delivery_api_pb.rb", + "lib/google/maps/fleetengine/delivery/v1/delivery_api_services_pb.rb", + "lib/google/maps/fleetengine/delivery/v1/delivery_vehicles_pb.rb", + "lib/google/maps/fleetengine/delivery/v1/header_pb.rb", + "lib/google/maps/fleetengine/delivery/v1/task_tracking_info_pb.rb", + "lib/google/maps/fleetengine/delivery/v1/tasks_pb.rb", + "proto_docs/README.md", + "proto_docs/google/api/client.rb", + "proto_docs/google/api/field_behavior.rb", + "proto_docs/google/api/launch_stage.rb", + "proto_docs/google/api/resource.rb", + "proto_docs/google/api/routing.rb", + "proto_docs/google/geo/type/viewport.rb", + "proto_docs/google/maps/fleetengine/delivery/v1/common.rb", + "proto_docs/google/maps/fleetengine/delivery/v1/delivery_api.rb", + "proto_docs/google/maps/fleetengine/delivery/v1/delivery_vehicles.rb", + "proto_docs/google/maps/fleetengine/delivery/v1/header.rb", + "proto_docs/google/maps/fleetengine/delivery/v1/task_tracking_info.rb", + "proto_docs/google/maps/fleetengine/delivery/v1/tasks.rb", + "proto_docs/google/protobuf/duration.rb", + "proto_docs/google/protobuf/field_mask.rb", + "proto_docs/google/protobuf/timestamp.rb", + "proto_docs/google/protobuf/wrappers.rb", + "proto_docs/google/type/latlng.rb", + "snippets/Gemfile", + "snippets/delivery_service/batch_create_tasks.rb", + "snippets/delivery_service/create_delivery_vehicle.rb", + "snippets/delivery_service/create_task.rb", + "snippets/delivery_service/get_delivery_vehicle.rb", + "snippets/delivery_service/get_task.rb", + "snippets/delivery_service/get_task_tracking_info.rb", + "snippets/delivery_service/list_delivery_vehicles.rb", + "snippets/delivery_service/list_tasks.rb", + "snippets/delivery_service/search_tasks.rb", + "snippets/delivery_service/update_delivery_vehicle.rb", + "snippets/delivery_service/update_task.rb", + "snippets/snippet_metadata_maps.fleetengine.delivery.v1.json", + "test/google/maps/fleet_engine/delivery/v1/delivery_service_paths_test.rb", + "test/google/maps/fleet_engine/delivery/v1/delivery_service_rest_test.rb", + "test/google/maps/fleet_engine/delivery/v1/delivery_service_test.rb", + "test/helper.rb" + ], + "static": [ + ".OwlBot.yaml" + ] +} diff --git a/google-maps-fleet_engine-delivery-v1/.repo-metadata.json b/google-maps-fleet_engine-delivery-v1/.repo-metadata.json new file mode 100644 index 000000000000..9720ed4289b0 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/.repo-metadata.json @@ -0,0 +1,17 @@ +{ + "api_id": "fleetengine.googleapis.com", + "api_shortname": "fleetengine-delivery", + "client_documentation": "https://rubydoc.info/gems/google-maps-fleet_engine-delivery-v1", + "distribution_name": "google-maps-fleet_engine-delivery-v1", + "is_cloud": false, + "language": "ruby", + "name": "fleetengine-delivery", + "name_pretty": "Last Mile Fleet Solution Delivery V1 API", + "product_documentation": "https://developers.google.com/maps/documentation/transportation-logistics/mobility", + "release_level": "unreleased", + "repo": "googleapis/google-cloud-ruby", + "requires_billing": true, + "ruby-cloud-description": "Enables Fleet Engine for access to the On Demand Rides and Deliveries and Last Mile Fleet Solution APIs. Customer's use of Google Maps Content in the Cloud Logging Services is subject to the Google Maps Platform Terms of Service located at https://cloud.google.com/maps-platform/terms. Note that google-maps-fleet_engine-delivery-v1 is a version-specific client library. For most uses, we recommend installing the main client library google-maps-fleet_engine-delivery instead. See the readme for more details.", + "ruby-cloud-product-url": "https://developers.google.com/maps/documentation/transportation-logistics/mobility", + "library_type": "GAPIC_AUTO" +} diff --git a/google-maps-fleet_engine-delivery-v1/.rubocop.yml b/google-maps-fleet_engine-delivery-v1/.rubocop.yml new file mode 100644 index 000000000000..5134ed6467fb --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/.rubocop.yml @@ -0,0 +1,33 @@ +inherit_gem: + google-style: google-style.yml + +AllCops: + Exclude: + - "google-maps-fleet_engine-delivery-v1.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-maps-fleet_engine-delivery-v1.rb" diff --git a/google-maps-fleet_engine-delivery-v1/.toys.rb b/google-maps-fleet_engine-delivery-v1/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/.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-maps-fleet_engine-delivery-v1/.yardopts b/google-maps-fleet_engine-delivery-v1/.yardopts new file mode 100644 index 000000000000..443d62823a66 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/.yardopts @@ -0,0 +1,12 @@ +--no-private +--title="Last Mile Fleet Solution Delivery V1 API" +--exclude _pb\.rb$ +--markup markdown +--markup-provider redcarpet + +./lib/**/*.rb +./proto_docs/**/*.rb +- +README.md +LICENSE.md +AUTHENTICATION.md diff --git a/google-maps-fleet_engine-delivery-v1/AUTHENTICATION.md b/google-maps-fleet_engine-delivery-v1/AUTHENTICATION.md new file mode 100644 index 000000000000..5667ca97e0e4 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/AUTHENTICATION.md @@ -0,0 +1,122 @@ +# Authentication + +The recommended way to authenticate to the google-maps-fleet_engine-delivery-v1 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-maps-fleet_engine-delivery-v1 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/maps/fleet_engine/delivery/v1" + +client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config| + config.credentials = "path/to/credentialfile.json" +end +``` + +To configure a credentials file globally for all clients: + +```ruby +require "google/maps/fleet_engine/delivery/v1" + +::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.configure do |config| + config.credentials = "path/to/credentialfile.json" +end + +client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::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-maps-fleet_engine-delivery-v1 +checks for credentials are: + +* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents +* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file + +```ruby +require "google/maps/fleet_engine/delivery/v1" + +ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json" + +client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::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-maps-fleet_engine-delivery-v1/CHANGELOG.md b/google-maps-fleet_engine-delivery-v1/CHANGELOG.md new file mode 100644 index 000000000000..f88957a62ba2 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/CHANGELOG.md @@ -0,0 +1,2 @@ +# Release History + diff --git a/google-maps-fleet_engine-delivery-v1/Gemfile b/google-maps-fleet_engine-delivery-v1/Gemfile new file mode 100644 index 000000000000..95163a6d11f8 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/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-maps-fleet_engine-delivery-v1/LICENSE.md b/google-maps-fleet_engine-delivery-v1/LICENSE.md new file mode 100644 index 000000000000..c261857ba6ad --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/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-maps-fleet_engine-delivery-v1/README.md b/google-maps-fleet_engine-delivery-v1/README.md new file mode 100644 index 000000000000..b640eb306002 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/README.md @@ -0,0 +1,144 @@ +# Ruby Client for the Last Mile Fleet Solution Delivery V1 API + +Enables Fleet Engine for access to the On Demand Rides and Deliveries and Last Mile Fleet Solution APIs. Customer's use of Google Maps Content in the Cloud Logging Services is subject to the Google Maps Platform Terms of Service located at https://cloud.google.com/maps-platform/terms. + +Enables Fleet Engine for access to the On Demand Rides and Deliveries and Last Mile Fleet Solution APIs. Customer's use of Google Maps Content in the Cloud Logging Services is subject to the Google Maps Platform Terms of Service located at https://cloud.google.com/maps-platform/terms. + +https://github.com/googleapis/google-cloud-ruby + +This gem is a _versioned_ client. It provides basic client classes for a +specific version of the Last Mile Fleet Solution Delivery V1 API. Most users should consider using +the main client gem, +[google-maps-fleet_engine-delivery](https://rubygems.org/gems/google-maps-fleet_engine-delivery). +See the section below titled *Which client should I use?* for more information. + +## Installation + +``` +$ gem install google-maps-fleet_engine-delivery-v1 +``` + +## 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/fleetengine.googleapis.com) +1. [Set up authentication.](AUTHENTICATION.md) + +## Quick Start + +```ruby +require "google/maps/fleet_engine/delivery/v1" + +client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new +request = ::Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest.new # (request fields as keyword arguments...) +response = client.create_delivery_vehicle request +``` + +View the [Client Library Documentation](https://rubydoc.info/gems/google-maps-fleet_engine-delivery-v1) +for class and method documentation. + +See also the [Product Documentation](https://developers.google.com/maps/documentation/transportation-logistics/mobility) +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-maps-fleet_engine-delivery`, +and lower-level _versioned_ client libraries with names such as +`google-maps-fleet_engine-delivery-v1`. +_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-maps-fleet_engine-delivery`. +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-maps-fleet_engine-delivery-v1`. + +### 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-maps-fleet_engine-delivery-v1/Rakefile b/google-maps-fleet_engine-delivery-v1/Rakefile new file mode 100644 index 000000000000..8a69b60d5333 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/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-maps-fleet_engine-delivery-v1 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/maps/fleet_engine/delivery/v1/delivery_service/credentials" + ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::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-maps-fleet_engine-delivery-v1 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-maps-fleet_engine-delivery-v1 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-maps-fleet_engine-delivery-v1 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-maps-fleet_engine-delivery-v1 gem does not have doctest tests." +end + +desc "Run the CI build" +task :ci do + header "BUILDING google-maps-fleet_engine-delivery-v1" + header "google-maps-fleet_engine-delivery-v1 rubocop", "*" + Rake::Task[:rubocop].invoke + header "google-maps-fleet_engine-delivery-v1 yard", "*" + Rake::Task[:yard].invoke + header "google-maps-fleet_engine-delivery-v1 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-maps-fleet_engine-delivery-v1 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-maps-fleet_engine-delivery-v1 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-maps-fleet_engine-delivery-v1/gapic_metadata.json b/google-maps-fleet_engine-delivery-v1/gapic_metadata.json new file mode 100644 index 000000000000..e32b82bf9163 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/gapic_metadata.json @@ -0,0 +1,73 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "ruby", + "protoPackage": "maps.fleetengine.delivery.v1", + "libraryPackage": "::Google::Maps::FleetEngine::Delivery::V1", + "services": { + "DeliveryService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client", + "rpcs": { + "CreateDeliveryVehicle": { + "methods": [ + "create_delivery_vehicle" + ] + }, + "GetDeliveryVehicle": { + "methods": [ + "get_delivery_vehicle" + ] + }, + "UpdateDeliveryVehicle": { + "methods": [ + "update_delivery_vehicle" + ] + }, + "BatchCreateTasks": { + "methods": [ + "batch_create_tasks" + ] + }, + "CreateTask": { + "methods": [ + "create_task" + ] + }, + "GetTask": { + "methods": [ + "get_task" + ] + }, + "SearchTasks": { + "methods": [ + "search_tasks" + ] + }, + "UpdateTask": { + "methods": [ + "update_task" + ] + }, + "ListTasks": { + "methods": [ + "list_tasks" + ] + }, + "GetTaskTrackingInfo": { + "methods": [ + "get_task_tracking_info" + ] + }, + "ListDeliveryVehicles": { + "methods": [ + "list_delivery_vehicles" + ] + } + } + } + } + } + } +} diff --git a/google-maps-fleet_engine-delivery-v1/google-maps-fleet_engine-delivery-v1.gemspec b/google-maps-fleet_engine-delivery-v1/google-maps-fleet_engine-delivery-v1.gemspec new file mode 100644 index 000000000000..fb556865bc99 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/google-maps-fleet_engine-delivery-v1.gemspec @@ -0,0 +1,29 @@ +# -*- ruby -*- +# encoding: utf-8 + +require File.expand_path("lib/google/maps/fleet_engine/delivery/v1/version", __dir__) + +Gem::Specification.new do |gem| + gem.name = "google-maps-fleet_engine-delivery-v1" + gem.version = Google::Maps::FleetEngine::Delivery::V1::VERSION + + gem.authors = ["Google LLC"] + gem.email = "googleapis-packages@google.com" + gem.description = "Enables Fleet Engine for access to the On Demand Rides and Deliveries and Last Mile Fleet Solution APIs. Customer's use of Google Maps Content in the Cloud Logging Services is subject to the Google Maps Platform Terms of Service located at https://cloud.google.com/maps-platform/terms. Note that google-maps-fleet_engine-delivery-v1 is a version-specific client library. For most uses, we recommend installing the main client library google-maps-fleet_engine-delivery instead. See the readme for more details." + gem.summary = "Enables Fleet Engine for access to the On Demand Rides and Deliveries and Last Mile Fleet Solution APIs. Customer's use of Google Maps Content in the Cloud Logging Services is subject to the Google Maps Platform Terms of Service located at https://cloud.google.com/maps-platform/terms." + 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-geo-type", "> 0.0", "< 2.a" +end diff --git a/google-maps-fleet_engine-delivery-v1/lib/google-maps-fleet_engine-delivery-v1.rb b/google-maps-fleet_engine-delivery-v1/lib/google-maps-fleet_engine-delivery-v1.rb new file mode 100644 index 000000000000..3234cb8cc922 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/lib/google-maps-fleet_engine-delivery-v1.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/maps/fleet_engine/delivery/v1" diff --git a/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1.rb b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1.rb new file mode 100644 index 000000000000..cd989415dd89 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1.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 "google/maps/fleet_engine/delivery/v1/delivery_service" +require "google/maps/fleet_engine/delivery/v1/version" + +module Google + module Maps + module FleetEngine + module Delivery + ## + # API client module. + # + # @example Load this package, including all its services, and instantiate a gRPC client + # + # require "google/maps/fleet_engine/delivery/v1" + # client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + # + # @example Load this package, including all its services, and instantiate a REST client + # + # require "google/maps/fleet_engine/delivery/v1" + # client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new + # + module V1 + end + end + end + end +end + +helper_path = ::File.join __dir__, "v1", "_helpers.rb" +require "google/maps/fleet_engine/delivery/v1/_helpers" if ::File.file? helper_path diff --git a/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service.rb b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service.rb new file mode 100644 index 000000000000..0162b8dd49be --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service.rb @@ -0,0 +1,57 @@ +# 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/maps/fleet_engine/delivery/v1/version" + +require "google/maps/fleet_engine/delivery/v1/delivery_service/credentials" +require "google/maps/fleet_engine/delivery/v1/delivery_service/paths" +require "google/maps/fleet_engine/delivery/v1/delivery_service/client" +require "google/maps/fleet_engine/delivery/v1/delivery_service/rest" + +module Google + module Maps + module FleetEngine + module Delivery + module V1 + ## + # The Last Mile Delivery service. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/maps/fleet_engine/delivery/v1/delivery_service" + # client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/maps/fleet_engine/delivery/v1/delivery_service/rest" + # client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new + # + module DeliveryService + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "delivery_service", "helpers.rb" +require "google/maps/fleet_engine/delivery/v1/delivery_service/helpers" if ::File.file? helper_path diff --git a/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/client.rb b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/client.rb new file mode 100644 index 000000000000..5335047ad1de --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/client.rb @@ -0,0 +1,1621 @@ +# 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/maps/fleetengine/delivery/v1/delivery_api_pb" + +module Google + module Maps + module FleetEngine + module Delivery + module V1 + module DeliveryService + ## + # Client for the DeliveryService service. + # + # The Last Mile Delivery service. + # + class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "fleetengine.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :delivery_service_stub + + ## + # Configure the DeliveryService Client class. + # + # See {::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all DeliveryService clients + # ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::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", "Maps", "FleetEngine", "Delivery", "V1"] + 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.rpcs.create_delivery_vehicle.timeout = 60.0 + default_config.rpcs.create_delivery_vehicle.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_delivery_vehicle.timeout = 60.0 + default_config.rpcs.get_delivery_vehicle.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.update_delivery_vehicle.timeout = 60.0 + default_config.rpcs.update_delivery_vehicle.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.batch_create_tasks.timeout = 60.0 + default_config.rpcs.batch_create_tasks.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.create_task.timeout = 60.0 + default_config.rpcs.create_task.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_task.timeout = 60.0 + default_config.rpcs.get_task.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.search_tasks.timeout = 60.0 + default_config.rpcs.search_tasks.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.update_task.timeout = 60.0 + default_config.rpcs.update_task.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.list_tasks.timeout = 60.0 + default_config.rpcs.list_tasks.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_task_tracking_info.timeout = 60.0 + default_config.rpcs.get_task_tracking_info.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.list_delivery_vehicles.timeout = 60.0 + default_config.rpcs.list_delivery_vehicles.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 DeliveryService 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::Maps::FleetEngine::Delivery::V1::DeliveryService::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 + @delivery_service_stub.universe_domain + end + + ## + # Create a new DeliveryService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the DeliveryService 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/maps/fleetengine/delivery/v1/delivery_api_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 + + @delivery_service_stub = ::Gapic::ServiceStub.new( + ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::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 + + ## + # Creates and returns a new `DeliveryVehicle`. + # + # @overload create_delivery_vehicle(request, options = nil) + # Pass arguments to `create_delivery_vehicle` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest, ::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 create_delivery_vehicle(header: nil, parent: nil, delivery_vehicle_id: nil, delivery_vehicle: nil) + # Pass arguments to `create_delivery_vehicle` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # @param parent [::String] + # Required. Must be in the format `providers/{provider}`. The provider must + # be the Google Cloud Project ID. For example, `sample-cloud-project`. + # @param delivery_vehicle_id [::String] + # Required. The Delivery Vehicle ID must be unique and subject to the + # following restrictions: + # + # * Must be a valid Unicode string. + # * Limited to a maximum length of 64 characters. + # * Normalized according to [Unicode Normalization Form C] + # (http://www.unicode.org/reports/tr15/). + # * May not contain any of the following ASCII characters: '/', ':', '?', + # ',', or '#'. + # @param delivery_vehicle [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle, ::Hash] + # Required. The `DeliveryVehicle` entity to create. When creating a new + # delivery vehicle, you may set the following optional fields: + # + # * last_location + # * attributes + # + # Note: The DeliveryVehicle's `name` field is ignored. All other + # DeliveryVehicle fields must not be set; otherwise, an error is returned. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest.new + # + # # Call the create_delivery_vehicle method. + # result = client.create_delivery_vehicle request + # + # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle. + # p result + # + def create_delivery_vehicle request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest + + # 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.create_delivery_vehicle.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::Maps::FleetEngine::Delivery::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent && + %r{^providers/[^/]+/?$}.match?(request.parent) + header_params["provider_id"] = request.parent + end + + request_params_header = URI.encode_www_form header_params + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.create_delivery_vehicle.timeout, + metadata: metadata, + retry_policy: @config.rpcs.create_delivery_vehicle.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.call_rpc :create_delivery_vehicle, 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 + + ## + # Returns the specified `DeliveryVehicle` instance. + # + # @overload get_delivery_vehicle(request, options = nil) + # Pass arguments to `get_delivery_vehicle` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest, ::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_delivery_vehicle(header: nil, name: nil) + # Pass arguments to `get_delivery_vehicle` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # @param name [::String] + # Required. Must be in the format + # `providers/{provider}/deliveryVehicles/{delivery_vehicle}`. + # The `provider` must be the Google Cloud Project ID. For example, + # `sample-cloud-project`. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest.new + # + # # Call the get_delivery_vehicle method. + # result = client.get_delivery_vehicle request + # + # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle. + # p result + # + def get_delivery_vehicle request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest + + # 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_delivery_vehicle.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::Maps::FleetEngine::Delivery::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name && + %r{^providers/[^/]+/?$}.match?(request.name) + header_params["provider_id"] = request.name + end + + request_params_header = URI.encode_www_form header_params + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_delivery_vehicle.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_delivery_vehicle.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.call_rpc :get_delivery_vehicle, 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 + + ## + # Writes updated `DeliveryVehicle` data to Fleet Engine, and assigns + # `Tasks` to the `DeliveryVehicle`. You cannot update the name of the + # `DeliveryVehicle`. You *can* update `remaining_vehicle_journey_segments` + # though, but it must contain all of the `VehicleJourneySegment`s currently + # on the `DeliveryVehicle`. The `task_id`s are retrieved from + # `remaining_vehicle_journey_segments`, and their corresponding `Tasks` are + # assigned to the `DeliveryVehicle` if they have not yet been assigned. + # + # @overload update_delivery_vehicle(request, options = nil) + # Pass arguments to `update_delivery_vehicle` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest, ::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 update_delivery_vehicle(header: nil, delivery_vehicle: nil, update_mask: nil) + # Pass arguments to `update_delivery_vehicle` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # @param delivery_vehicle [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle, ::Hash] + # Required. The `DeliveryVehicle` entity update to apply. + # Note: You cannot update the name of the `DeliveryVehicle`. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Required. A field mask that indicates which `DeliveryVehicle` fields to + # update. Note that the update_mask must contain at least one field. + # + # This is a comma-separated list of fully qualified names of fields. Example: + # `"remaining_vehicle_journey_segments"`. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest.new + # + # # Call the update_delivery_vehicle method. + # result = client.update_delivery_vehicle request + # + # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle. + # p result + # + def update_delivery_vehicle request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest + + # 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.update_delivery_vehicle.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::Maps::FleetEngine::Delivery::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.delivery_vehicle&.name && + %r{^providers/[^/]+/?$}.match?(request.delivery_vehicle.name) + header_params["provider_id"] = request.delivery_vehicle.name + end + + request_params_header = URI.encode_www_form header_params + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update_delivery_vehicle.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_delivery_vehicle.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.call_rpc :update_delivery_vehicle, 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 + + ## + # Creates and returns a batch of new `Task` objects. + # + # @overload batch_create_tasks(request, options = nil) + # Pass arguments to `batch_create_tasks` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest, ::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 batch_create_tasks(header: nil, parent: nil, requests: nil) + # Pass arguments to `batch_create_tasks` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # Note: If you set this field, then the header field in the + # `CreateTaskRequest` messages must either be empty, or it must match this + # field. + # @param parent [::String] + # Required. The parent resource shared by all tasks. This value must be in + # the format `providers/{provider}`. The `provider` must be the Google Cloud + # Project ID. For example, `sample-cloud-project`. The parent field in the + # `CreateTaskRequest` messages must either be empty, or it must match this + # field. + # @param requests [::Array<::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest, ::Hash>] + # Required. The request message that specifies the resources to create. + # Note: You can create a maximum of 500 tasks in a batch. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest.new + # + # # Call the batch_create_tasks method. + # result = client.batch_create_tasks request + # + # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksResponse. + # p result + # + def batch_create_tasks request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest + + # 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.batch_create_tasks.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::Maps::FleetEngine::Delivery::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent && + %r{^providers/[^/]+/?$}.match?(request.parent) + header_params["provider_id"] = request.parent + end + + request_params_header = URI.encode_www_form header_params + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.batch_create_tasks.timeout, + metadata: metadata, + retry_policy: @config.rpcs.batch_create_tasks.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.call_rpc :batch_create_tasks, 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 + + ## + # Creates and returns a new `Task` object. + # + # @overload create_task(request, options = nil) + # Pass arguments to `create_task` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest, ::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 create_task(header: nil, parent: nil, task_id: nil, task: nil) + # Pass arguments to `create_task` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # @param parent [::String] + # Required. Must be in the format `providers/{provider}`. The `provider` must + # be the Google Cloud Project ID. For example, `sample-cloud-project`. + # @param task_id [::String] + # Required. The Task ID must be unique, but it should be not a shipment + # tracking ID. To store a shipment tracking ID, use the `tracking_id` field. + # Note that multiple tasks can have the same `tracking_id`. Task IDs are + # subject to the following restrictions: + # + # * Must be a valid Unicode string. + # * Limited to a maximum length of 64 characters. + # * Normalized according to [Unicode Normalization Form C] + # (http://www.unicode.org/reports/tr15/). + # * May not contain any of the following ASCII characters: '/', ':', '?', + # ',', or '#'. + # @param task [::Google::Maps::FleetEngine::Delivery::V1::Task, ::Hash] + # Required. The Task entity to create. + # When creating a Task, the following fields are required: + # + # * `type` + # * `state` (must be set to `OPEN`) + # * `tracking_id` (must not be set for `UNAVAILABLE` or `SCHEDULED_STOP` + # tasks, but required for all other task types) + # * `planned_location` (optional for `UNAVAILABLE` tasks) + # * `task_duration` + # + # Note: The Task's `name` field is ignored. All other Task fields must not be + # set; otherwise, an error is returned. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::Task] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::Task] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest.new + # + # # Call the create_task method. + # result = client.create_task request + # + # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::Task. + # p result + # + def create_task request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest + + # 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.create_task.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::Maps::FleetEngine::Delivery::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent && + %r{^providers/[^/]+/?$}.match?(request.parent) + header_params["provider_id"] = request.parent + end + + request_params_header = URI.encode_www_form header_params + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.create_task.timeout, + metadata: metadata, + retry_policy: @config.rpcs.create_task.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.call_rpc :create_task, 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 + + ## + # Gets information about a `Task`. + # + # @overload get_task(request, options = nil) + # Pass arguments to `get_task` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest, ::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_task(header: nil, name: nil) + # Pass arguments to `get_task` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # @param name [::String] + # Required. Must be in the format `providers/{provider}/tasks/{task}`. The + # `provider` must be the Google Cloud Project ID. For example, + # `sample-cloud-project`. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::Task] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::Task] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest.new + # + # # Call the get_task method. + # result = client.get_task request + # + # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::Task. + # p result + # + def get_task request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest + + # 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_task.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::Maps::FleetEngine::Delivery::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name && + %r{^providers/[^/]+/?$}.match?(request.name) + header_params["provider_id"] = request.name + end + + request_params_header = URI.encode_www_form header_params + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_task.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_task.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.call_rpc :get_task, 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 + + ## + # Deprecated: Use `GetTaskTrackingInfo` instead. + # + # @deprecated This method is deprecated and may be removed in the next major version update. + # + # @overload search_tasks(request, options = nil) + # Pass arguments to `search_tasks` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::SearchTasksRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::SearchTasksRequest, ::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 search_tasks(header: nil, parent: nil, tracking_id: nil, page_size: nil, page_token: nil) + # Pass arguments to `search_tasks` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # @param parent [::String] + # Required. Must be in the format `providers/{provider}`. + # The provider must be the Google Cloud Project ID. For example, + # `sample-cloud-project`. + # @param tracking_id [::String] + # Required. The identifier of the set of related Tasks being requested. + # Tracking IDs are subject to the following restrictions: + # + # * Must be a valid Unicode string. + # * Limited to a maximum length of 64 characters. + # * Normalized according to [Unicode Normalization Form C] + # (http://www.unicode.org/reports/tr15/). + # * May not contain any of the following ASCII characters: '/', ':', '?', + # ',', or '#'. + # @param page_size [::Integer] + # Optional. The maximum number of Tasks to return. The service may return + # fewer than this value. If you don't specify this value, then the server + # determines the number of results to return. + # @param page_token [::String] + # Optional. A page token, received from a previous `SearchTasks` call. You + # must provide this value to retrieve the subsequent page. + # + # When paginating, all other parameters provided to `SearchTasks` must match + # the call that provided the page token. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::Task>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::Task>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::SearchTasksRequest.new + # + # # Call the search_tasks method. + # result = client.search_tasks 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::Maps::FleetEngine::Delivery::V1::Task. + # p item + # end + # + def search_tasks request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::SearchTasksRequest + + # 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.search_tasks.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::Maps::FleetEngine::Delivery::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent && + %r{^providers/[^/]+/?$}.match?(request.parent) + header_params["provider_id"] = request.parent + end + + request_params_header = URI.encode_www_form header_params + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.search_tasks.timeout, + metadata: metadata, + retry_policy: @config.rpcs.search_tasks.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.call_rpc :search_tasks, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @delivery_service_stub, :search_tasks, 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 + + ## + # Updates `Task` data. + # + # @overload update_task(request, options = nil) + # Pass arguments to `update_task` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest, ::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 update_task(header: nil, task: nil, update_mask: nil) + # Pass arguments to `update_task` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # @param task [::Google::Maps::FleetEngine::Delivery::V1::Task, ::Hash] + # Required. The Task associated with the update. + # The following fields are maintained by Fleet Engine. Do not update + # them using `Task.update`. + # + # * `last_location`. + # * `last_location_snappable`. + # * `name`. + # * `remaining_vehicle_journey_segments`. + # * `task_outcome_location_source`. + # + # Note: You cannot change the value of `task_outcome` once you set it. + # + # If the Task has been assigned to a delivery vehicle, then don't set the + # Task state to CLOSED using `Task.update`. Instead, remove the `VehicleStop` + # that contains the Task from the delivery vehicle, which automatically sets + # the Task state to CLOSED. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Required. The field mask that indicates which Task fields to update. + # Note: The `update_mask` must contain at least one field. + # + # This is a comma-separated list of fully qualified names of fields. Example: + # `"task_outcome,task_outcome_time,task_outcome_location"`. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::Task] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::Task] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest.new + # + # # Call the update_task method. + # result = client.update_task request + # + # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::Task. + # p result + # + def update_task request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest + + # 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.update_task.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::Maps::FleetEngine::Delivery::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.task&.name && + %r{^providers/[^/]+/?$}.match?(request.task.name) + header_params["provider_id"] = request.task.name + end + + request_params_header = URI.encode_www_form header_params + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update_task.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_task.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.call_rpc :update_task, 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 + + ## + # Gets all `Task`s that meet the specified filtering criteria. + # + # @overload list_tasks(request, options = nil) + # Pass arguments to `list_tasks` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest, ::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_tasks(header: nil, parent: nil, page_size: nil, page_token: nil, filter: nil) + # Pass arguments to `list_tasks` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # @param parent [::String] + # Required. Must be in the format `providers/{provider}`. + # The `provider` must be the Google Cloud Project ID. For example, + # `sample-cloud-project`. + # @param page_size [::Integer] + # Optional. The maximum number of Tasks to return. The service may return + # fewer than this value. If you don't specify this value, then the server + # determines the number of results to return. + # @param page_token [::String] + # Optional. A page token received from a previous `ListTasks` call. + # You can provide this to retrieve the subsequent page. + # + # When paginating, all other parameters provided to `ListTasks` must match + # the call that provided the page token. + # @param filter [::String] + # Optional. A filter query to apply when listing Tasks. See + # http://aip.dev/160 for examples of filter syntax. If you don't specify a + # value, or if you filter on an empty string, then all Tasks are returned. + # For information about the Task properties that you can filter on, see [List + # tasks](https://developers.google.com/maps/documentation/transportation-logistics/last-mile-fleet-solution/fleet-performance/fleet-engine/deliveries_api#list-tasks). + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::Task>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::Task>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest.new + # + # # Call the list_tasks method. + # result = client.list_tasks 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::Maps::FleetEngine::Delivery::V1::Task. + # p item + # end + # + def list_tasks request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest + + # 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_tasks.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::Maps::FleetEngine::Delivery::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent && + %r{^providers/[^/]+/?$}.match?(request.parent) + header_params["provider_id"] = request.parent + end + + request_params_header = URI.encode_www_form header_params + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_tasks.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_tasks.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.call_rpc :list_tasks, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @delivery_service_stub, :list_tasks, 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 + + ## + # Returns the specified `TaskTrackingInfo` instance. + # + # @overload get_task_tracking_info(request, options = nil) + # Pass arguments to `get_task_tracking_info` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest, ::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_task_tracking_info(header: nil, name: nil) + # Pass arguments to `get_task_tracking_info` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # @param name [::String] + # Required. Must be in the format + # `providers/{provider}/taskTrackingInfo/{tracking_id}`. The `provider` + # must be the Google Cloud Project ID, and the `tracking_id` must be the + # tracking ID associated with the task. An example name can be + # `providers/sample-cloud-project/taskTrackingInfo/sample-tracking-id`. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::TaskTrackingInfo] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::TaskTrackingInfo] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest.new + # + # # Call the get_task_tracking_info method. + # result = client.get_task_tracking_info request + # + # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::TaskTrackingInfo. + # p result + # + def get_task_tracking_info request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest + + # 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_task_tracking_info.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::Maps::FleetEngine::Delivery::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name && + %r{^providers/[^/]+/?$}.match?(request.name) + header_params["provider_id"] = request.name + end + + request_params_header = URI.encode_www_form header_params + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_task_tracking_info.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_task_tracking_info.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.call_rpc :get_task_tracking_info, 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 + + ## + # Gets all `DeliveryVehicle`s that meet the specified filtering criteria. + # + # @overload list_delivery_vehicles(request, options = nil) + # Pass arguments to `list_delivery_vehicles` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest, ::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_delivery_vehicles(header: nil, parent: nil, page_size: nil, page_token: nil, filter: nil, viewport: nil) + # Pass arguments to `list_delivery_vehicles` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # @param parent [::String] + # Required. Must be in the format `providers/{provider}`. + # The `provider` must be the Google Cloud Project ID. + # For example, `sample-cloud-project`. + # @param page_size [::Integer] + # Optional. The maximum number of vehicles to return. The service may return + # fewer than this number. If you don't specify this number, then the server + # determines the number of results to return. + # @param page_token [::String] + # Optional. A page token, received from a previous `ListDeliveryVehicles` + # call. You must provide this in order to retrieve the subsequent page. + # + # When paginating, all other parameters provided to `ListDeliveryVehicles` + # must match the call that provided the page token. + # @param filter [::String] + # Optional. A filter query to apply when listing delivery vehicles. See + # http://aip.dev/160 for examples of the filter syntax. If you don't specify + # a value, or if you specify an empty string for the filter, then all + # delivery vehicles are returned. + # + # Note that the only queries supported for `ListDeliveryVehicles` are + # on vehicle attributes (for example, `attributes. = ` or + # `attributes. = AND attributes. = `). Also, all + # attributes are stored as strings, so the only supported comparisons against + # attributes are string comparisons. In order to compare against number or + # boolean values, the values must be explicitly quoted to be treated as + # strings (for example, `attributes. = "10"` or + # `attributes. = "true"`). + # + # The maximum number of restrictions allowed in a filter query is 50. A + # restriction is a part of the query of the form + # `attribute. `, for example `attributes.foo = bar` + # is 1 restriction. + # @param viewport [::Google::Geo::Type::Viewport, ::Hash] + # Optional. A filter that limits the vehicles returned to those whose last + # known location was in the rectangular area defined by the viewport. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest.new + # + # # Call the list_delivery_vehicles method. + # result = client.list_delivery_vehicles 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::Maps::FleetEngine::Delivery::V1::DeliveryVehicle. + # p item + # end + # + def list_delivery_vehicles request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest + + # 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_delivery_vehicles.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::Maps::FleetEngine::Delivery::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent && + %r{^providers/[^/]+/?$}.match?(request.parent) + header_params["provider_id"] = request.parent + end + + request_params_header = URI.encode_www_form header_params + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_delivery_vehicles.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_delivery_vehicles.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.call_rpc :list_delivery_vehicles, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @delivery_service_stub, :list_delivery_vehicles, 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 DeliveryService API. + # + # This class represents the configuration for DeliveryService, + # 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::Maps::FleetEngine::Delivery::V1::DeliveryService::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 + # # create_delivery_vehicle to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.create_delivery_vehicle.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.create_delivery_vehicle.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 = "fleetengine.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 DeliveryService 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 `create_delivery_vehicle` + # @return [::Gapic::Config::Method] + # + attr_reader :create_delivery_vehicle + ## + # RPC-specific configuration for `get_delivery_vehicle` + # @return [::Gapic::Config::Method] + # + attr_reader :get_delivery_vehicle + ## + # RPC-specific configuration for `update_delivery_vehicle` + # @return [::Gapic::Config::Method] + # + attr_reader :update_delivery_vehicle + ## + # RPC-specific configuration for `batch_create_tasks` + # @return [::Gapic::Config::Method] + # + attr_reader :batch_create_tasks + ## + # RPC-specific configuration for `create_task` + # @return [::Gapic::Config::Method] + # + attr_reader :create_task + ## + # RPC-specific configuration for `get_task` + # @return [::Gapic::Config::Method] + # + attr_reader :get_task + ## + # RPC-specific configuration for `search_tasks` + # @return [::Gapic::Config::Method] + # + attr_reader :search_tasks + ## + # RPC-specific configuration for `update_task` + # @return [::Gapic::Config::Method] + # + attr_reader :update_task + ## + # RPC-specific configuration for `list_tasks` + # @return [::Gapic::Config::Method] + # + attr_reader :list_tasks + ## + # RPC-specific configuration for `get_task_tracking_info` + # @return [::Gapic::Config::Method] + # + attr_reader :get_task_tracking_info + ## + # RPC-specific configuration for `list_delivery_vehicles` + # @return [::Gapic::Config::Method] + # + attr_reader :list_delivery_vehicles + + # @private + def initialize parent_rpcs = nil + create_delivery_vehicle_config = parent_rpcs.create_delivery_vehicle if parent_rpcs.respond_to? :create_delivery_vehicle + @create_delivery_vehicle = ::Gapic::Config::Method.new create_delivery_vehicle_config + get_delivery_vehicle_config = parent_rpcs.get_delivery_vehicle if parent_rpcs.respond_to? :get_delivery_vehicle + @get_delivery_vehicle = ::Gapic::Config::Method.new get_delivery_vehicle_config + update_delivery_vehicle_config = parent_rpcs.update_delivery_vehicle if parent_rpcs.respond_to? :update_delivery_vehicle + @update_delivery_vehicle = ::Gapic::Config::Method.new update_delivery_vehicle_config + batch_create_tasks_config = parent_rpcs.batch_create_tasks if parent_rpcs.respond_to? :batch_create_tasks + @batch_create_tasks = ::Gapic::Config::Method.new batch_create_tasks_config + create_task_config = parent_rpcs.create_task if parent_rpcs.respond_to? :create_task + @create_task = ::Gapic::Config::Method.new create_task_config + get_task_config = parent_rpcs.get_task if parent_rpcs.respond_to? :get_task + @get_task = ::Gapic::Config::Method.new get_task_config + search_tasks_config = parent_rpcs.search_tasks if parent_rpcs.respond_to? :search_tasks + @search_tasks = ::Gapic::Config::Method.new search_tasks_config + update_task_config = parent_rpcs.update_task if parent_rpcs.respond_to? :update_task + @update_task = ::Gapic::Config::Method.new update_task_config + list_tasks_config = parent_rpcs.list_tasks if parent_rpcs.respond_to? :list_tasks + @list_tasks = ::Gapic::Config::Method.new list_tasks_config + get_task_tracking_info_config = parent_rpcs.get_task_tracking_info if parent_rpcs.respond_to? :get_task_tracking_info + @get_task_tracking_info = ::Gapic::Config::Method.new get_task_tracking_info_config + list_delivery_vehicles_config = parent_rpcs.list_delivery_vehicles if parent_rpcs.respond_to? :list_delivery_vehicles + @list_delivery_vehicles = ::Gapic::Config::Method.new list_delivery_vehicles_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/credentials.rb b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/credentials.rb new file mode 100644 index 000000000000..e008277b6dae --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_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 Maps + module FleetEngine + module Delivery + module V1 + module DeliveryService + # Credentials for the DeliveryService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform" + ] + 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-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/paths.rb b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/paths.rb new file mode 100644 index 000000000000..3d8b197732b1 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/paths.rb @@ -0,0 +1,100 @@ +# 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 Maps + module FleetEngine + module Delivery + module V1 + module DeliveryService + # Path helper methods for the DeliveryService API. + module Paths + ## + # Create a fully-qualified DeliveryVehicle resource string. + # + # The resource will be in the following format: + # + # `providers/{provider}/deliveryVehicles/{vehicle}` + # + # @param provider [String] + # @param vehicle [String] + # + # @return [::String] + def delivery_vehicle_path provider:, vehicle: + raise ::ArgumentError, "provider cannot contain /" if provider.to_s.include? "/" + + "providers/#{provider}/deliveryVehicles/#{vehicle}" + end + + ## + # Create a fully-qualified Provider resource string. + # + # The resource will be in the following format: + # + # `providers/{provider}` + # + # @param provider [String] + # + # @return [::String] + def provider_path provider: + "providers/#{provider}" + end + + ## + # Create a fully-qualified Task resource string. + # + # The resource will be in the following format: + # + # `providers/{provider}/tasks/{task}` + # + # @param provider [String] + # @param task [String] + # + # @return [::String] + def task_path provider:, task: + raise ::ArgumentError, "provider cannot contain /" if provider.to_s.include? "/" + + "providers/#{provider}/tasks/#{task}" + end + + ## + # Create a fully-qualified TaskTrackingInfo resource string. + # + # The resource will be in the following format: + # + # `providers/{provider}/taskTrackingInfo/{tracking}` + # + # @param provider [String] + # @param tracking [String] + # + # @return [::String] + def task_tracking_info_path provider:, tracking: + raise ::ArgumentError, "provider cannot contain /" if provider.to_s.include? "/" + + "providers/#{provider}/taskTrackingInfo/#{tracking}" + end + + extend self + end + end + end + end + end + end +end diff --git a/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/rest.rb b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/rest.rb new file mode 100644 index 000000000000..66a91ff5dc35 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/rest.rb @@ -0,0 +1,54 @@ +# 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/maps/fleet_engine/delivery/v1/version" + +require "google/maps/fleet_engine/delivery/v1/delivery_service/credentials" +require "google/maps/fleet_engine/delivery/v1/delivery_service/paths" +require "google/maps/fleet_engine/delivery/v1/delivery_service/rest/client" + +module Google + module Maps + module FleetEngine + module Delivery + module V1 + ## + # The Last Mile Delivery service. + # + # To load this service and instantiate a REST client: + # + # require "google/maps/fleet_engine/delivery/v1/delivery_service/rest" + # client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new + # + module DeliveryService + # Client for the REST transport + module Rest + end + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/maps/fleet_engine/delivery/v1/delivery_service/rest/helpers" if ::File.file? helper_path diff --git a/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/rest/client.rb b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/rest/client.rb new file mode 100644 index 000000000000..1f506f0de326 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/rest/client.rb @@ -0,0 +1,1505 @@ +# 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/maps/fleetengine/delivery/v1/delivery_api_pb" +require "google/maps/fleet_engine/delivery/v1/delivery_service/rest/service_stub" + +module Google + module Maps + module FleetEngine + module Delivery + module V1 + module DeliveryService + module Rest + ## + # REST client for the DeliveryService service. + # + # The Last Mile Delivery service. + # + class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "fleetengine.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :delivery_service_stub + + ## + # Configure the DeliveryService Client class. + # + # See {::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all DeliveryService clients + # ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::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", "Maps", "FleetEngine", "Delivery", "V1"] + 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.rpcs.create_delivery_vehicle.timeout = 60.0 + default_config.rpcs.create_delivery_vehicle.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_delivery_vehicle.timeout = 60.0 + default_config.rpcs.get_delivery_vehicle.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.update_delivery_vehicle.timeout = 60.0 + default_config.rpcs.update_delivery_vehicle.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.batch_create_tasks.timeout = 60.0 + default_config.rpcs.batch_create_tasks.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.create_task.timeout = 60.0 + default_config.rpcs.create_task.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_task.timeout = 60.0 + default_config.rpcs.get_task.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.search_tasks.timeout = 60.0 + default_config.rpcs.search_tasks.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.update_task.timeout = 60.0 + default_config.rpcs.update_task.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.list_tasks.timeout = 60.0 + default_config.rpcs.list_tasks.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_task_tracking_info.timeout = 60.0 + default_config.rpcs.get_task_tracking_info.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.list_delivery_vehicles.timeout = 60.0 + default_config.rpcs.list_delivery_vehicles.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 DeliveryService 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::Maps::FleetEngine::Delivery::V1::DeliveryService::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 + @delivery_service_stub.universe_domain + end + + ## + # Create a new DeliveryService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the DeliveryService 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 + + @delivery_service_stub = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) + end + + # Service calls + + ## + # Creates and returns a new `DeliveryVehicle`. + # + # @overload create_delivery_vehicle(request, options = nil) + # Pass arguments to `create_delivery_vehicle` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest, ::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 create_delivery_vehicle(header: nil, parent: nil, delivery_vehicle_id: nil, delivery_vehicle: nil) + # Pass arguments to `create_delivery_vehicle` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # @param parent [::String] + # Required. Must be in the format `providers/{provider}`. The provider must + # be the Google Cloud Project ID. For example, `sample-cloud-project`. + # @param delivery_vehicle_id [::String] + # Required. The Delivery Vehicle ID must be unique and subject to the + # following restrictions: + # + # * Must be a valid Unicode string. + # * Limited to a maximum length of 64 characters. + # * Normalized according to [Unicode Normalization Form C] + # (http://www.unicode.org/reports/tr15/). + # * May not contain any of the following ASCII characters: '/', ':', '?', + # ',', or '#'. + # @param delivery_vehicle [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle, ::Hash] + # Required. The `DeliveryVehicle` entity to create. When creating a new + # delivery vehicle, you may set the following optional fields: + # + # * last_location + # * attributes + # + # Note: The DeliveryVehicle's `name` field is ignored. All other + # DeliveryVehicle fields must not be set; otherwise, an error is returned. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest.new + # + # # Call the create_delivery_vehicle method. + # result = client.create_delivery_vehicle request + # + # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle. + # p result + # + def create_delivery_vehicle request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest + + # 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.create_delivery_vehicle.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::Maps::FleetEngine::Delivery::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.create_delivery_vehicle.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.create_delivery_vehicle.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.create_delivery_vehicle 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 + + ## + # Returns the specified `DeliveryVehicle` instance. + # + # @overload get_delivery_vehicle(request, options = nil) + # Pass arguments to `get_delivery_vehicle` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest, ::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_delivery_vehicle(header: nil, name: nil) + # Pass arguments to `get_delivery_vehicle` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # @param name [::String] + # Required. Must be in the format + # `providers/{provider}/deliveryVehicles/{delivery_vehicle}`. + # The `provider` must be the Google Cloud Project ID. For example, + # `sample-cloud-project`. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest.new + # + # # Call the get_delivery_vehicle method. + # result = client.get_delivery_vehicle request + # + # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle. + # p result + # + def get_delivery_vehicle request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest + + # 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_delivery_vehicle.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::Maps::FleetEngine::Delivery::V1::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_delivery_vehicle.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_delivery_vehicle.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.get_delivery_vehicle 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 + + ## + # Writes updated `DeliveryVehicle` data to Fleet Engine, and assigns + # `Tasks` to the `DeliveryVehicle`. You cannot update the name of the + # `DeliveryVehicle`. You *can* update `remaining_vehicle_journey_segments` + # though, but it must contain all of the `VehicleJourneySegment`s currently + # on the `DeliveryVehicle`. The `task_id`s are retrieved from + # `remaining_vehicle_journey_segments`, and their corresponding `Tasks` are + # assigned to the `DeliveryVehicle` if they have not yet been assigned. + # + # @overload update_delivery_vehicle(request, options = nil) + # Pass arguments to `update_delivery_vehicle` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest, ::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 update_delivery_vehicle(header: nil, delivery_vehicle: nil, update_mask: nil) + # Pass arguments to `update_delivery_vehicle` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # @param delivery_vehicle [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle, ::Hash] + # Required. The `DeliveryVehicle` entity update to apply. + # Note: You cannot update the name of the `DeliveryVehicle`. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Required. A field mask that indicates which `DeliveryVehicle` fields to + # update. Note that the update_mask must contain at least one field. + # + # This is a comma-separated list of fully qualified names of fields. Example: + # `"remaining_vehicle_journey_segments"`. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest.new + # + # # Call the update_delivery_vehicle method. + # result = client.update_delivery_vehicle request + # + # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle. + # p result + # + def update_delivery_vehicle request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest + + # 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.update_delivery_vehicle.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::Maps::FleetEngine::Delivery::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update_delivery_vehicle.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_delivery_vehicle.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.update_delivery_vehicle 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 + + ## + # Creates and returns a batch of new `Task` objects. + # + # @overload batch_create_tasks(request, options = nil) + # Pass arguments to `batch_create_tasks` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest, ::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 batch_create_tasks(header: nil, parent: nil, requests: nil) + # Pass arguments to `batch_create_tasks` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # Note: If you set this field, then the header field in the + # `CreateTaskRequest` messages must either be empty, or it must match this + # field. + # @param parent [::String] + # Required. The parent resource shared by all tasks. This value must be in + # the format `providers/{provider}`. The `provider` must be the Google Cloud + # Project ID. For example, `sample-cloud-project`. The parent field in the + # `CreateTaskRequest` messages must either be empty, or it must match this + # field. + # @param requests [::Array<::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest, ::Hash>] + # Required. The request message that specifies the resources to create. + # Note: You can create a maximum of 500 tasks in a batch. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest.new + # + # # Call the batch_create_tasks method. + # result = client.batch_create_tasks request + # + # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksResponse. + # p result + # + def batch_create_tasks request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest + + # 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.batch_create_tasks.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::Maps::FleetEngine::Delivery::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.batch_create_tasks.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.batch_create_tasks.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.batch_create_tasks 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 + + ## + # Creates and returns a new `Task` object. + # + # @overload create_task(request, options = nil) + # Pass arguments to `create_task` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest, ::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 create_task(header: nil, parent: nil, task_id: nil, task: nil) + # Pass arguments to `create_task` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # @param parent [::String] + # Required. Must be in the format `providers/{provider}`. The `provider` must + # be the Google Cloud Project ID. For example, `sample-cloud-project`. + # @param task_id [::String] + # Required. The Task ID must be unique, but it should be not a shipment + # tracking ID. To store a shipment tracking ID, use the `tracking_id` field. + # Note that multiple tasks can have the same `tracking_id`. Task IDs are + # subject to the following restrictions: + # + # * Must be a valid Unicode string. + # * Limited to a maximum length of 64 characters. + # * Normalized according to [Unicode Normalization Form C] + # (http://www.unicode.org/reports/tr15/). + # * May not contain any of the following ASCII characters: '/', ':', '?', + # ',', or '#'. + # @param task [::Google::Maps::FleetEngine::Delivery::V1::Task, ::Hash] + # Required. The Task entity to create. + # When creating a Task, the following fields are required: + # + # * `type` + # * `state` (must be set to `OPEN`) + # * `tracking_id` (must not be set for `UNAVAILABLE` or `SCHEDULED_STOP` + # tasks, but required for all other task types) + # * `planned_location` (optional for `UNAVAILABLE` tasks) + # * `task_duration` + # + # Note: The Task's `name` field is ignored. All other Task fields must not be + # set; otherwise, an error is returned. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Maps::FleetEngine::Delivery::V1::Task] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::Task] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest.new + # + # # Call the create_task method. + # result = client.create_task request + # + # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::Task. + # p result + # + def create_task request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest + + # 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.create_task.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::Maps::FleetEngine::Delivery::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.create_task.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.create_task.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.create_task 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 + + ## + # Gets information about a `Task`. + # + # @overload get_task(request, options = nil) + # Pass arguments to `get_task` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest, ::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_task(header: nil, name: nil) + # Pass arguments to `get_task` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # @param name [::String] + # Required. Must be in the format `providers/{provider}/tasks/{task}`. The + # `provider` must be the Google Cloud Project ID. For example, + # `sample-cloud-project`. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Maps::FleetEngine::Delivery::V1::Task] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::Task] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest.new + # + # # Call the get_task method. + # result = client.get_task request + # + # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::Task. + # p result + # + def get_task request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest + + # 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_task.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::Maps::FleetEngine::Delivery::V1::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_task.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_task.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.get_task 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 + + ## + # Deprecated: Use `GetTaskTrackingInfo` instead. + # + # @overload search_tasks(request, options = nil) + # Pass arguments to `search_tasks` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::SearchTasksRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::SearchTasksRequest, ::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 search_tasks(header: nil, parent: nil, tracking_id: nil, page_size: nil, page_token: nil) + # Pass arguments to `search_tasks` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # @param parent [::String] + # Required. Must be in the format `providers/{provider}`. + # The provider must be the Google Cloud Project ID. For example, + # `sample-cloud-project`. + # @param tracking_id [::String] + # Required. The identifier of the set of related Tasks being requested. + # Tracking IDs are subject to the following restrictions: + # + # * Must be a valid Unicode string. + # * Limited to a maximum length of 64 characters. + # * Normalized according to [Unicode Normalization Form C] + # (http://www.unicode.org/reports/tr15/). + # * May not contain any of the following ASCII characters: '/', ':', '?', + # ',', or '#'. + # @param page_size [::Integer] + # Optional. The maximum number of Tasks to return. The service may return + # fewer than this value. If you don't specify this value, then the server + # determines the number of results to return. + # @param page_token [::String] + # Optional. A page token, received from a previous `SearchTasks` call. You + # must provide this value to retrieve the subsequent page. + # + # When paginating, all other parameters provided to `SearchTasks` must match + # the call that provided the page token. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::Task>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::Task>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::SearchTasksRequest.new + # + # # Call the search_tasks method. + # result = client.search_tasks 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::Maps::FleetEngine::Delivery::V1::Task. + # p item + # end + # + def search_tasks request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::SearchTasksRequest + + # 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.search_tasks.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::Maps::FleetEngine::Delivery::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.search_tasks.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.search_tasks.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.search_tasks request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @delivery_service_stub, :search_tasks, "tasks", 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 + + ## + # Updates `Task` data. + # + # @overload update_task(request, options = nil) + # Pass arguments to `update_task` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest, ::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 update_task(header: nil, task: nil, update_mask: nil) + # Pass arguments to `update_task` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # @param task [::Google::Maps::FleetEngine::Delivery::V1::Task, ::Hash] + # Required. The Task associated with the update. + # The following fields are maintained by Fleet Engine. Do not update + # them using `Task.update`. + # + # * `last_location`. + # * `last_location_snappable`. + # * `name`. + # * `remaining_vehicle_journey_segments`. + # * `task_outcome_location_source`. + # + # Note: You cannot change the value of `task_outcome` once you set it. + # + # If the Task has been assigned to a delivery vehicle, then don't set the + # Task state to CLOSED using `Task.update`. Instead, remove the `VehicleStop` + # that contains the Task from the delivery vehicle, which automatically sets + # the Task state to CLOSED. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Required. The field mask that indicates which Task fields to update. + # Note: The `update_mask` must contain at least one field. + # + # This is a comma-separated list of fully qualified names of fields. Example: + # `"task_outcome,task_outcome_time,task_outcome_location"`. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Maps::FleetEngine::Delivery::V1::Task] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::Task] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest.new + # + # # Call the update_task method. + # result = client.update_task request + # + # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::Task. + # p result + # + def update_task request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest + + # 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.update_task.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::Maps::FleetEngine::Delivery::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update_task.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_task.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.update_task 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 + + ## + # Gets all `Task`s that meet the specified filtering criteria. + # + # @overload list_tasks(request, options = nil) + # Pass arguments to `list_tasks` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest, ::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_tasks(header: nil, parent: nil, page_size: nil, page_token: nil, filter: nil) + # Pass arguments to `list_tasks` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # @param parent [::String] + # Required. Must be in the format `providers/{provider}`. + # The `provider` must be the Google Cloud Project ID. For example, + # `sample-cloud-project`. + # @param page_size [::Integer] + # Optional. The maximum number of Tasks to return. The service may return + # fewer than this value. If you don't specify this value, then the server + # determines the number of results to return. + # @param page_token [::String] + # Optional. A page token received from a previous `ListTasks` call. + # You can provide this to retrieve the subsequent page. + # + # When paginating, all other parameters provided to `ListTasks` must match + # the call that provided the page token. + # @param filter [::String] + # Optional. A filter query to apply when listing Tasks. See + # http://aip.dev/160 for examples of filter syntax. If you don't specify a + # value, or if you filter on an empty string, then all Tasks are returned. + # For information about the Task properties that you can filter on, see [List + # tasks](https://developers.google.com/maps/documentation/transportation-logistics/last-mile-fleet-solution/fleet-performance/fleet-engine/deliveries_api#list-tasks). + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::Task>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::Task>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest.new + # + # # Call the list_tasks method. + # result = client.list_tasks 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::Maps::FleetEngine::Delivery::V1::Task. + # p item + # end + # + def list_tasks request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest + + # 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_tasks.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::Maps::FleetEngine::Delivery::V1::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_tasks.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_tasks.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.list_tasks request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @delivery_service_stub, :list_tasks, "tasks", 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 + + ## + # Returns the specified `TaskTrackingInfo` instance. + # + # @overload get_task_tracking_info(request, options = nil) + # Pass arguments to `get_task_tracking_info` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest, ::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_task_tracking_info(header: nil, name: nil) + # Pass arguments to `get_task_tracking_info` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # @param name [::String] + # Required. Must be in the format + # `providers/{provider}/taskTrackingInfo/{tracking_id}`. The `provider` + # must be the Google Cloud Project ID, and the `tracking_id` must be the + # tracking ID associated with the task. An example name can be + # `providers/sample-cloud-project/taskTrackingInfo/sample-tracking-id`. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Maps::FleetEngine::Delivery::V1::TaskTrackingInfo] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::TaskTrackingInfo] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest.new + # + # # Call the get_task_tracking_info method. + # result = client.get_task_tracking_info request + # + # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::TaskTrackingInfo. + # p result + # + def get_task_tracking_info request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest + + # 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_task_tracking_info.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::Maps::FleetEngine::Delivery::V1::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_task_tracking_info.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_task_tracking_info.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.get_task_tracking_info 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 + + ## + # Gets all `DeliveryVehicle`s that meet the specified filtering criteria. + # + # @overload list_delivery_vehicles(request, options = nil) + # Pass arguments to `list_delivery_vehicles` via a request object, either of type + # {::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest} or an equivalent Hash. + # + # @param request [::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest, ::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_delivery_vehicles(header: nil, parent: nil, page_size: nil, page_token: nil, filter: nil, viewport: nil) + # Pass arguments to `list_delivery_vehicles` 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 header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash] + # Optional. The standard Delivery API request header. + # @param parent [::String] + # Required. Must be in the format `providers/{provider}`. + # The `provider` must be the Google Cloud Project ID. + # For example, `sample-cloud-project`. + # @param page_size [::Integer] + # Optional. The maximum number of vehicles to return. The service may return + # fewer than this number. If you don't specify this number, then the server + # determines the number of results to return. + # @param page_token [::String] + # Optional. A page token, received from a previous `ListDeliveryVehicles` + # call. You must provide this in order to retrieve the subsequent page. + # + # When paginating, all other parameters provided to `ListDeliveryVehicles` + # must match the call that provided the page token. + # @param filter [::String] + # Optional. A filter query to apply when listing delivery vehicles. See + # http://aip.dev/160 for examples of the filter syntax. If you don't specify + # a value, or if you specify an empty string for the filter, then all + # delivery vehicles are returned. + # + # Note that the only queries supported for `ListDeliveryVehicles` are + # on vehicle attributes (for example, `attributes. = ` or + # `attributes. = AND attributes. = `). Also, all + # attributes are stored as strings, so the only supported comparisons against + # attributes are string comparisons. In order to compare against number or + # boolean values, the values must be explicitly quoted to be treated as + # strings (for example, `attributes. = "10"` or + # `attributes. = "true"`). + # + # The maximum number of restrictions allowed in a filter query is 50. A + # restriction is a part of the query of the form + # `attribute. `, for example `attributes.foo = bar` + # is 1 restriction. + # @param viewport [::Google::Geo::Type::Viewport, ::Hash] + # Optional. A filter that limits the vehicles returned to those whose last + # known location was in the rectangular area defined by the viewport. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/maps/fleet_engine/delivery/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest.new + # + # # Call the list_delivery_vehicles method. + # result = client.list_delivery_vehicles 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::Maps::FleetEngine::Delivery::V1::DeliveryVehicle. + # p item + # end + # + def list_delivery_vehicles request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest + + # 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_delivery_vehicles.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::Maps::FleetEngine::Delivery::V1::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_delivery_vehicles.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_delivery_vehicles.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @delivery_service_stub.list_delivery_vehicles request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @delivery_service_stub, :list_delivery_vehicles, "delivery_vehicles", 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 DeliveryService REST API. + # + # This class represents the configuration for DeliveryService 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::Maps::FleetEngine::Delivery::V1::DeliveryService::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 + # # create_delivery_vehicle to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.create_delivery_vehicle.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.create_delivery_vehicle.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 = "fleetengine.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 DeliveryService 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 `create_delivery_vehicle` + # @return [::Gapic::Config::Method] + # + attr_reader :create_delivery_vehicle + ## + # RPC-specific configuration for `get_delivery_vehicle` + # @return [::Gapic::Config::Method] + # + attr_reader :get_delivery_vehicle + ## + # RPC-specific configuration for `update_delivery_vehicle` + # @return [::Gapic::Config::Method] + # + attr_reader :update_delivery_vehicle + ## + # RPC-specific configuration for `batch_create_tasks` + # @return [::Gapic::Config::Method] + # + attr_reader :batch_create_tasks + ## + # RPC-specific configuration for `create_task` + # @return [::Gapic::Config::Method] + # + attr_reader :create_task + ## + # RPC-specific configuration for `get_task` + # @return [::Gapic::Config::Method] + # + attr_reader :get_task + ## + # RPC-specific configuration for `search_tasks` + # @return [::Gapic::Config::Method] + # + attr_reader :search_tasks + ## + # RPC-specific configuration for `update_task` + # @return [::Gapic::Config::Method] + # + attr_reader :update_task + ## + # RPC-specific configuration for `list_tasks` + # @return [::Gapic::Config::Method] + # + attr_reader :list_tasks + ## + # RPC-specific configuration for `get_task_tracking_info` + # @return [::Gapic::Config::Method] + # + attr_reader :get_task_tracking_info + ## + # RPC-specific configuration for `list_delivery_vehicles` + # @return [::Gapic::Config::Method] + # + attr_reader :list_delivery_vehicles + + # @private + def initialize parent_rpcs = nil + create_delivery_vehicle_config = parent_rpcs.create_delivery_vehicle if parent_rpcs.respond_to? :create_delivery_vehicle + @create_delivery_vehicle = ::Gapic::Config::Method.new create_delivery_vehicle_config + get_delivery_vehicle_config = parent_rpcs.get_delivery_vehicle if parent_rpcs.respond_to? :get_delivery_vehicle + @get_delivery_vehicle = ::Gapic::Config::Method.new get_delivery_vehicle_config + update_delivery_vehicle_config = parent_rpcs.update_delivery_vehicle if parent_rpcs.respond_to? :update_delivery_vehicle + @update_delivery_vehicle = ::Gapic::Config::Method.new update_delivery_vehicle_config + batch_create_tasks_config = parent_rpcs.batch_create_tasks if parent_rpcs.respond_to? :batch_create_tasks + @batch_create_tasks = ::Gapic::Config::Method.new batch_create_tasks_config + create_task_config = parent_rpcs.create_task if parent_rpcs.respond_to? :create_task + @create_task = ::Gapic::Config::Method.new create_task_config + get_task_config = parent_rpcs.get_task if parent_rpcs.respond_to? :get_task + @get_task = ::Gapic::Config::Method.new get_task_config + search_tasks_config = parent_rpcs.search_tasks if parent_rpcs.respond_to? :search_tasks + @search_tasks = ::Gapic::Config::Method.new search_tasks_config + update_task_config = parent_rpcs.update_task if parent_rpcs.respond_to? :update_task + @update_task = ::Gapic::Config::Method.new update_task_config + list_tasks_config = parent_rpcs.list_tasks if parent_rpcs.respond_to? :list_tasks + @list_tasks = ::Gapic::Config::Method.new list_tasks_config + get_task_tracking_info_config = parent_rpcs.get_task_tracking_info if parent_rpcs.respond_to? :get_task_tracking_info + @get_task_tracking_info = ::Gapic::Config::Method.new get_task_tracking_info_config + list_delivery_vehicles_config = parent_rpcs.list_delivery_vehicles if parent_rpcs.respond_to? :list_delivery_vehicles + @list_delivery_vehicles = ::Gapic::Config::Method.new list_delivery_vehicles_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end + end +end diff --git a/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/rest/service_stub.rb b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/rest/service_stub.rb new file mode 100644 index 000000000000..db401be21208 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/delivery_service/rest/service_stub.rb @@ -0,0 +1,725 @@ +# 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/maps/fleetengine/delivery/v1/delivery_api_pb" + +module Google + module Maps + module FleetEngine + module Delivery + module V1 + module DeliveryService + module Rest + ## + # REST service stub for the DeliveryService 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 create_delivery_vehicle REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest] + # 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::Maps::FleetEngine::Delivery::V1::DeliveryVehicle] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle] + # A result object deserialized from the server's reply + def create_delivery_vehicle request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_create_delivery_vehicle_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::Maps::FleetEngine::Delivery::V1::DeliveryVehicle.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the get_delivery_vehicle REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest] + # 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::Maps::FleetEngine::Delivery::V1::DeliveryVehicle] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle] + # A result object deserialized from the server's reply + def get_delivery_vehicle request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_delivery_vehicle_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::Maps::FleetEngine::Delivery::V1::DeliveryVehicle.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the update_delivery_vehicle REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest] + # 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::Maps::FleetEngine::Delivery::V1::DeliveryVehicle] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle] + # A result object deserialized from the server's reply + def update_delivery_vehicle request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_delivery_vehicle_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::Maps::FleetEngine::Delivery::V1::DeliveryVehicle.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the batch_create_tasks REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest] + # 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::Maps::FleetEngine::Delivery::V1::BatchCreateTasksResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksResponse] + # A result object deserialized from the server's reply + def batch_create_tasks request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_batch_create_tasks_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::Maps::FleetEngine::Delivery::V1::BatchCreateTasksResponse.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the create_task REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest] + # 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::Maps::FleetEngine::Delivery::V1::Task] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::Task] + # A result object deserialized from the server's reply + def create_task request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_create_task_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::Maps::FleetEngine::Delivery::V1::Task.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the get_task REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest] + # 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::Maps::FleetEngine::Delivery::V1::Task] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::Task] + # A result object deserialized from the server's reply + def get_task request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_task_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::Maps::FleetEngine::Delivery::V1::Task.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the search_tasks REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::SearchTasksRequest] + # 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::Maps::FleetEngine::Delivery::V1::SearchTasksResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::SearchTasksResponse] + # A result object deserialized from the server's reply + def search_tasks request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_search_tasks_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::Maps::FleetEngine::Delivery::V1::SearchTasksResponse.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the update_task REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest] + # 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::Maps::FleetEngine::Delivery::V1::Task] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::Task] + # A result object deserialized from the server's reply + def update_task request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_task_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::Maps::FleetEngine::Delivery::V1::Task.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the list_tasks REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest] + # 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::Maps::FleetEngine::Delivery::V1::ListTasksResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::ListTasksResponse] + # A result object deserialized from the server's reply + def list_tasks request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_tasks_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::Maps::FleetEngine::Delivery::V1::ListTasksResponse.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the get_task_tracking_info REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest] + # 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::Maps::FleetEngine::Delivery::V1::TaskTrackingInfo] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::TaskTrackingInfo] + # A result object deserialized from the server's reply + def get_task_tracking_info request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_task_tracking_info_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::Maps::FleetEngine::Delivery::V1::TaskTrackingInfo.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the list_delivery_vehicles REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest] + # 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::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesResponse] + # A result object deserialized from the server's reply + def list_delivery_vehicles request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_delivery_vehicles_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::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesResponse.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # @private + # + # GRPC transcoding helper method for the create_delivery_vehicle REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_create_delivery_vehicle_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{parent}/deliveryVehicles", + body: "delivery_vehicle", + matches: [ + ["parent", %r{^providers/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_delivery_vehicle REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest] + # 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_delivery_vehicle_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^providers/[^/]+/deliveryVehicles/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update_delivery_vehicle REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_delivery_vehicle_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v1/{delivery_vehicle.name}", + body: "delivery_vehicle", + matches: [ + ["delivery_vehicle.name", %r{^providers/[^/]+/deliveryVehicles/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the batch_create_tasks REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_batch_create_tasks_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{parent}/tasks:batchCreate", + body: "*", + matches: [ + ["parent", %r{^providers/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the create_task REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_create_task_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{parent}/tasks", + body: "task", + matches: [ + ["parent", %r{^providers/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_task REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest] + # 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_task_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^providers/[^/]+/tasks/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the search_tasks REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::SearchTasksRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_search_tasks_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{parent}/tasks:search", + matches: [ + ["parent", %r{^providers/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update_task REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_task_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v1/{task.name}", + body: "task", + matches: [ + ["task.name", %r{^providers/[^/]+/tasks/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_tasks REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest] + # 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_tasks_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{parent}/tasks", + matches: [ + ["parent", %r{^providers/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_task_tracking_info REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest] + # 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_task_tracking_info_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^providers/[^/]+/taskTrackingInfo/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_delivery_vehicles REST call + # + # @param request_pb [::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest] + # 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_delivery_vehicles_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{parent}/deliveryVehicles", + matches: [ + ["parent", %r{^providers/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end + end +end diff --git a/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/rest.rb b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/rest.rb new file mode 100644 index 000000000000..e125b0975e6e --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/rest.rb @@ -0,0 +1,39 @@ +# 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/maps/fleet_engine/delivery/v1/delivery_service/rest" +require "google/maps/fleet_engine/delivery/v1/version" + +module Google + module Maps + module FleetEngine + module Delivery + ## + # To load just the REST part of this package, including all its services, and instantiate a REST client: + # + # @example + # + # require "google/maps/fleet_engine/delivery/v1/rest" + # client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new + # + module V1 + end + end + end + end +end diff --git a/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/version.rb b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/version.rb new file mode 100644 index 000000000000..7b4c0180e777 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleet_engine/delivery/v1/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 Maps + module FleetEngine + module Delivery + module V1 + VERSION = "0.0.1" + end + end + end + end +end diff --git a/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleetengine/delivery/v1/common_pb.rb b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleetengine/delivery/v1/common_pb.rb new file mode 100644 index 000000000000..b08a7a52e89c --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleetengine/delivery/v1/common_pb.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/maps/fleetengine/delivery/v1/common.proto + +require 'google/protobuf' + +require 'google/api/field_behavior_pb' +require 'google/protobuf/timestamp_pb' +require 'google/protobuf/wrappers_pb' +require 'google/type/latlng_pb' + + +descriptor_data = "\n0google/maps/fleetengine/delivery/v1/common.proto\x12\x1cmaps.fleetengine.delivery.v1\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x18google/type/latlng.proto\"\xa0\x01\n\x18\x44\x65liveryVehicleAttribute\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\x12\x16\n\x0cstring_value\x18\x03 \x01(\tH\x00\x12\x14\n\nbool_value\x18\x04 \x01(\x08H\x00\x12\x16\n\x0cnumber_value\x18\x05 \x01(\x01H\x00\x42\"\n delivery_vehicle_attribute_value\"\xf4\x0c\n\x17\x44\x65liveryVehicleLocation\x12%\n\x08location\x18\x01 \x01(\x0b\x32\x13.google.type.LatLng\x12=\n\x13horizontal_accuracy\x18\x08 \x01(\x0b\x32\x1c.google.protobuf.DoubleValueB\x02\x18\x01\x12\x35\n\x0flatlng_accuracy\x18\x16 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12,\n\x07heading\x18\x02 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12:\n\x10\x62\x65\x61ring_accuracy\x18\n \x01(\x0b\x32\x1c.google.protobuf.DoubleValueB\x02\x18\x01\x12\x36\n\x10heading_accuracy\x18\x17 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12.\n\x08\x61ltitude\x18\x05 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12;\n\x11vertical_accuracy\x18\t \x01(\x0b\x32\x1c.google.protobuf.DoubleValueB\x02\x18\x01\x12\x37\n\x11\x61ltitude_accuracy\x18\x18 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x33\n\nspeed_kmph\x18\x03 \x01(\x0b\x32\x1b.google.protobuf.Int32ValueB\x02\x18\x01\x12+\n\x05speed\x18\x06 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x34\n\x0espeed_accuracy\x18\x07 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12/\n\x0bupdate_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x34\n\x0bserver_time\x18\r \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12T\n\x0flocation_sensor\x18\x0b \x01(\x0e\x32;.maps.fleetengine.delivery.v1.DeliveryVehicleLocationSensor\x12\x33\n\x0fis_road_snapped\x18\x1b \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12>\n\x15is_gps_sensor_enabled\x18\x0c \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x03\xe0\x41\x04\x12;\n\x11time_since_update\x18\x0e \x01(\x0b\x32\x1b.google.protobuf.Int32ValueB\x03\xe0\x41\x04\x12=\n\x11num_stale_updates\x18\x0f \x01(\x0b\x32\x1b.google.protobuf.Int32ValueB\x05\x18\x01\xe0\x41\x04\x12)\n\x0craw_location\x18\x10 \x01(\x0b\x32\x13.google.type.LatLng\x12\x35\n\x11raw_location_time\x18\x11 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12X\n\x13raw_location_sensor\x18\x1c \x01(\x0e\x32;.maps.fleetengine.delivery.v1.DeliveryVehicleLocationSensor\x12;\n\x15raw_location_accuracy\x18\x19 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x32\n\x15supplemental_location\x18\x12 \x01(\x0b\x32\x13.google.type.LatLng\x12>\n\x1asupplemental_location_time\x18\x13 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x61\n\x1csupplemental_location_sensor\x18\x14 \x01(\x0e\x32;.maps.fleetengine.delivery.v1.DeliveryVehicleLocationSensor\x12\x44\n\x1esupplemental_location_accuracy\x18\x15 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x18\n\x0croad_snapped\x18\x1a \x01(\x08\x42\x02\x18\x01\"t\n\nTimeWindow\x12\x33\n\nstart_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x02\x12\x31\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x02\"z\n\rTaskAttribute\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x16\n\x0cstring_value\x18\x02 \x01(\tH\x00\x12\x14\n\nbool_value\x18\x03 \x01(\x08H\x00\x12\x16\n\x0cnumber_value\x18\x04 \x01(\x01H\x00\x42\x16\n\x14task_attribute_value*\xe6\x01\n\x1d\x44\x65liveryVehicleLocationSensor\x12\x12\n\x0eUNKNOWN_SENSOR\x10\x00\x12\x07\n\x03GPS\x10\x01\x12\x0b\n\x07NETWORK\x10\x02\x12\x0b\n\x07PASSIVE\x10\x03\x12\"\n\x1eROAD_SNAPPED_LOCATION_PROVIDER\x10\x04\x12\x1e\n\x1a\x43USTOMER_SUPPLIED_LOCATION\x10\x05\x12\x19\n\x15\x46LEET_ENGINE_LOCATION\x10\x06\x12\x1b\n\x17\x46USED_LOCATION_PROVIDER\x10\x64\x12\x12\n\rCORE_LOCATION\x10\xc8\x01*\x98\x01\n\x1f\x44\x65liveryVehicleNavigationStatus\x12\x1d\n\x19UNKNOWN_NAVIGATION_STATUS\x10\x00\x12\x0f\n\x0bNO_GUIDANCE\x10\x01\x12\x1a\n\x16\x45NROUTE_TO_DESTINATION\x10\x02\x12\r\n\tOFF_ROUTE\x10\x03\x12\x1a\n\x16\x41RRIVED_AT_DESTINATION\x10\x04\x42\xd1\x01\n#google.maps.fleetengine.delivery.v1B\x06\x43ommonP\x01ZIcloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb;deliverypb\xa2\x02\x04\x43\x46\x45\x44\xaa\x02#Google.Maps.FleetEngine.Delivery.V1\xea\x02\'Google::Maps::FleetEngine::Delivery::V1b\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.type.LatLng", "google/type/latlng.proto"], + ["google.protobuf.DoubleValue", "google/protobuf/wrappers.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 Maps + module FleetEngine + module Delivery + module V1 + DeliveryVehicleAttribute = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("maps.fleetengine.delivery.v1.DeliveryVehicleAttribute").msgclass + DeliveryVehicleLocation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("maps.fleetengine.delivery.v1.DeliveryVehicleLocation").msgclass + TimeWindow = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("maps.fleetengine.delivery.v1.TimeWindow").msgclass + TaskAttribute = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("maps.fleetengine.delivery.v1.TaskAttribute").msgclass + DeliveryVehicleLocationSensor = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("maps.fleetengine.delivery.v1.DeliveryVehicleLocationSensor").enummodule + DeliveryVehicleNavigationStatus = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("maps.fleetengine.delivery.v1.DeliveryVehicleNavigationStatus").enummodule + end + end + end + end +end diff --git a/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleetengine/delivery/v1/delivery_api_pb.rb b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleetengine/delivery/v1/delivery_api_pb.rb new file mode 100644 index 000000000000..204c3c635274 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleetengine/delivery/v1/delivery_api_pb.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/maps/fleetengine/delivery/v1/delivery_api.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/api/routing_pb' +require 'google/geo/type/viewport_pb' +require 'google/maps/fleetengine/delivery/v1/delivery_vehicles_pb' +require 'google/maps/fleetengine/delivery/v1/header_pb' +require 'google/maps/fleetengine/delivery/v1/task_tracking_info_pb' +require 'google/maps/fleetengine/delivery/v1/tasks_pb' +require 'google/protobuf/field_mask_pb' + + +descriptor_data = "\n6google/maps/fleetengine/delivery/v1/delivery_api.proto\x12\x1cmaps.fleetengine.delivery.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x18google/api/routing.proto\x1a\x1egoogle/geo/type/viewport.proto\x1a;google/maps/fleetengine/delivery/v1/delivery_vehicles.proto\x1a\x30google/maps/fleetengine/delivery/v1/header.proto\x1a\n\x19remaining_distance_meters\x18\x06 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12\x35\n\x12remaining_duration\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12_\n\"remaining_vehicle_journey_segments\x18\x08 \x03(\x0b\x32\x33.maps.fleetengine.delivery.v1.VehicleJourneySegment\x12J\n\nattributes\x18\t \x03(\x0b\x32\x36.maps.fleetengine.delivery.v1.DeliveryVehicleAttribute\x12O\n\x04type\x18\n \x01(\x0e\x32\x41.maps.fleetengine.delivery.v1.DeliveryVehicle.DeliveryVehicleType\"t\n\x13\x44\x65liveryVehicleType\x12%\n!DELIVERY_VEHICLE_TYPE_UNSPECIFIED\x10\x00\x12\x08\n\x04\x41UTO\x10\x01\x12\x0f\n\x0bTWO_WHEELER\x10\x02\x12\x0b\n\x07\x42ICYCLE\x10\x03\x12\x0e\n\nPEDESTRIAN\x10\x04:`\xea\x41]\n*fleetengine.googleapis.com/DeliveryVehicle\x12/providers/{provider}/deliveryVehicles/{vehicle}\"2\n\x0cLocationInfo\x12\"\n\x05point\x18\x01 \x01(\x0b\x32\x13.google.type.LatLng\"\xf5\x01\n\x15VehicleJourneySegment\x12\x37\n\x04stop\x18\x01 \x01(\x0b\x32).maps.fleetengine.delivery.v1.VehicleStop\x12\x41\n\x17\x64riving_distance_meters\x18\x02 \x01(\x0b\x32\x1b.google.protobuf.Int32ValueB\x03\xe0\x41\x03\x12\x38\n\x10\x64riving_duration\x18\x03 \x01(\x0b\x32\x19.google.protobuf.DurationB\x03\xe0\x41\x03\x12&\n\x04path\x18\x05 \x03(\x0b\x32\x13.google.type.LatLngB\x03\xe0\x41\x03\"\xbe\x03\n\x0bVehicleStop\x12I\n\x10planned_location\x18\x01 \x01(\x0b\x32*.maps.fleetengine.delivery.v1.LocationInfoB\x03\xe0\x41\x02\x12\x41\n\x05tasks\x18\x02 \x03(\x0b\x32\x32.maps.fleetengine.delivery.v1.VehicleStop.TaskInfo\x12>\n\x05state\x18\x03 \x01(\x0e\x32/.maps.fleetengine.delivery.v1.VehicleStop.State\x1a\x9d\x01\n\x08TaskInfo\x12\x0f\n\x07task_id\x18\x01 \x01(\t\x12\x35\n\rtask_duration\x18\x02 \x01(\x0b\x32\x19.google.protobuf.DurationB\x03\xe0\x41\x03\x12I\n\x12target_time_window\x18\x03 \x01(\x0b\x32(.maps.fleetengine.delivery.v1.TimeWindowB\x03\xe0\x41\x03\"A\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x07\n\x03NEW\x10\x01\x12\x0b\n\x07\x45NROUTE\x10\x02\x12\x0b\n\x07\x41RRIVED\x10\x03\x42\xdb\x01\n#google.maps.fleetengine.delivery.v1B\x10\x44\x65liveryVehiclesP\x01ZIcloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb;deliverypb\xa2\x02\x04\x43\x46\x45\x44\xaa\x02#Google.Maps.FleetEngine.Delivery.V1\xea\x02\'Google::Maps::FleetEngine::Delivery::V1b\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 = [ + ["maps.fleetengine.delivery.v1.DeliveryVehicleLocation", "google/maps/fleetengine/delivery/v1/common.proto"], + ["google.type.LatLng", "google/type/latlng.proto"], + ["google.protobuf.Int32Value", "google/protobuf/wrappers.proto"], + ["google.protobuf.Duration", "google/protobuf/duration.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 Maps + module FleetEngine + module Delivery + module V1 + DeliveryVehicle = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("maps.fleetengine.delivery.v1.DeliveryVehicle").msgclass + DeliveryVehicle::DeliveryVehicleType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("maps.fleetengine.delivery.v1.DeliveryVehicle.DeliveryVehicleType").enummodule + LocationInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("maps.fleetengine.delivery.v1.LocationInfo").msgclass + VehicleJourneySegment = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("maps.fleetengine.delivery.v1.VehicleJourneySegment").msgclass + VehicleStop = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("maps.fleetengine.delivery.v1.VehicleStop").msgclass + VehicleStop::TaskInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("maps.fleetengine.delivery.v1.VehicleStop.TaskInfo").msgclass + VehicleStop::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("maps.fleetengine.delivery.v1.VehicleStop.State").enummodule + end + end + end + end +end diff --git a/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleetengine/delivery/v1/header_pb.rb b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleetengine/delivery/v1/header_pb.rb new file mode 100644 index 000000000000..7f08d63b7134 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleetengine/delivery/v1/header_pb.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/maps/fleetengine/delivery/v1/header.proto + +require 'google/protobuf' + +require 'google/api/field_behavior_pb' + + +descriptor_data = "\n0google/maps/fleetengine/delivery/v1/header.proto\x12\x1cmaps.fleetengine.delivery.v1\x1a\x1fgoogle/api/field_behavior.proto\"\xb0\x04\n\x15\x44\x65liveryRequestHeader\x12\x15\n\rlanguage_code\x18\x01 \x01(\t\x12\x18\n\x0bregion_code\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x13\n\x0bsdk_version\x18\x03 \x01(\t\x12\x12\n\nos_version\x18\x04 \x01(\t\x12\x14\n\x0c\x64\x65vice_model\x18\x05 \x01(\t\x12M\n\x08sdk_type\x18\x06 \x01(\x0e\x32;.maps.fleetengine.delivery.v1.DeliveryRequestHeader.SdkType\x12\x18\n\x10maps_sdk_version\x18\x07 \x01(\t\x12\x17\n\x0fnav_sdk_version\x18\x08 \x01(\t\x12N\n\x08platform\x18\t \x01(\x0e\x32<.maps.fleetengine.delivery.v1.DeliveryRequestHeader.Platform\x12\x14\n\x0cmanufacturer\x18\n \x01(\t\x12\x19\n\x11\x61ndroid_api_level\x18\x0b \x01(\x05\x12\x10\n\x08trace_id\x18\x0c \x01(\t\"M\n\x07SdkType\x12\x18\n\x14SDK_TYPE_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x43ONSUMER\x10\x01\x12\n\n\x06\x44RIVER\x10\x02\x12\x0e\n\nJAVASCRIPT\x10\x03\"C\n\x08Platform\x12\x18\n\x14PLATFORM_UNSPECIFIED\x10\x00\x12\x0b\n\x07\x41NDROID\x10\x01\x12\x07\n\x03IOS\x10\x02\x12\x07\n\x03WEB\x10\x03\x42\xd2\x01\n#google.maps.fleetengine.delivery.v1B\x07HeadersP\x01ZIcloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb;deliverypb\xa2\x02\x04\x43\x46\x45\x44\xaa\x02#Google.Maps.FleetEngine.Delivery.V1\xea\x02\'Google::Maps::FleetEngine::Delivery::V1b\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 Maps + module FleetEngine + module Delivery + module V1 + DeliveryRequestHeader = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("maps.fleetengine.delivery.v1.DeliveryRequestHeader").msgclass + DeliveryRequestHeader::SdkType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("maps.fleetengine.delivery.v1.DeliveryRequestHeader.SdkType").enummodule + DeliveryRequestHeader::Platform = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("maps.fleetengine.delivery.v1.DeliveryRequestHeader.Platform").enummodule + end + end + end + end +end diff --git a/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleetengine/delivery/v1/task_tracking_info_pb.rb b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleetengine/delivery/v1/task_tracking_info_pb.rb new file mode 100644 index 000000000000..17315c472b58 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/lib/google/maps/fleetengine/delivery/v1/task_tracking_info_pb.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/maps/fleetengine/delivery/v1/task_tracking_info.proto + +require 'google/protobuf' + +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/maps/fleetengine/delivery/v1/common_pb' +require 'google/maps/fleetengine/delivery/v1/delivery_vehicles_pb' +require 'google/maps/fleetengine/delivery/v1/tasks_pb' +require 'google/protobuf/timestamp_pb' +require 'google/protobuf/wrappers_pb' +require 'google/type/latlng_pb' + + +descriptor_data = "\n] + # 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-maps-fleet_engine-delivery-v1/proto_docs/google/api/field_behavior.rb b/google-maps-fleet_engine-delivery-v1/proto_docs/google/api/field_behavior.rb new file mode 100644 index 000000000000..b03587481349 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/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-maps-fleet_engine-delivery-v1/proto_docs/google/api/launch_stage.rb b/google-maps-fleet_engine-delivery-v1/proto_docs/google/api/launch_stage.rb new file mode 100644 index 000000000000..38b4b61e6061 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/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-maps-fleet_engine-delivery-v1/proto_docs/google/api/resource.rb b/google-maps-fleet_engine-delivery-v1/proto_docs/google/api/resource.rb new file mode 100644 index 000000000000..6497ebc78dc1 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/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-maps-fleet_engine-delivery-v1/proto_docs/google/api/routing.rb b/google-maps-fleet_engine-delivery-v1/proto_docs/google/api/routing.rb new file mode 100644 index 000000000000..53c8874ea19d --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/proto_docs/google/api/routing.rb @@ -0,0 +1,459 @@ +# 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 + # Specifies the routing information that should be sent along with the request + # in the form of routing header. + # **NOTE:** All service configuration rules follow the "last one wins" order. + # + # The examples below will apply to an RPC which has the following request type: + # + # Message Definition: + # + # message Request { + # // The name of the Table + # // Values can be of the following formats: + # // - `projects//tables/` + # // - `projects//instances//tables/
` + # // - `region//zones//tables/
` + # string table_name = 1; + # + # // This value specifies routing for replication. + # // It can be in the following formats: + # // - `profiles/` + # // - a legacy `profile_id` that can be any string + # string app_profile_id = 2; + # } + # + # Example message: + # + # { + # table_name: projects/proj_foo/instances/instance_bar/table/table_baz, + # app_profile_id: profiles/prof_qux + # } + # + # The routing header consists of one or multiple key-value pairs. Every key + # and value must be percent-encoded, and joined together in the format of + # `key1=value1&key2=value2`. + # In the examples below I am skipping the percent-encoding for readablity. + # + # Example 1 + # + # Extracting a field from the request to put into the routing header + # unchanged, with the key equal to the field name. + # + # annotation: + # + # option (google.api.routing) = { + # // Take the `app_profile_id`. + # routing_parameters { + # field: "app_profile_id" + # } + # }; + # + # result: + # + # x-goog-request-params: app_profile_id=profiles/prof_qux + # + # Example 2 + # + # Extracting a field from the request to put into the routing header + # unchanged, with the key different from the field name. + # + # annotation: + # + # option (google.api.routing) = { + # // Take the `app_profile_id`, but name it `routing_id` in the header. + # routing_parameters { + # field: "app_profile_id" + # path_template: "{routing_id=**}" + # } + # }; + # + # result: + # + # x-goog-request-params: routing_id=profiles/prof_qux + # + # Example 3 + # + # Extracting a field from the request to put into the routing + # header, while matching a path template syntax on the field's value. + # + # NB: it is more useful to send nothing than to send garbage for the purpose + # of dynamic routing, since garbage pollutes cache. Thus the matching. + # + # Sub-example 3a + # + # The field matches the template. + # + # annotation: + # + # option (google.api.routing) = { + # // Take the `table_name`, if it's well-formed (with project-based + # // syntax). + # routing_parameters { + # field: "table_name" + # path_template: "{table_name=projects/*/instances/*/**}" + # } + # }; + # + # result: + # + # x-goog-request-params: + # table_name=projects/proj_foo/instances/instance_bar/table/table_baz + # + # Sub-example 3b + # + # The field does not match the template. + # + # annotation: + # + # option (google.api.routing) = { + # // Take the `table_name`, if it's well-formed (with region-based + # // syntax). + # routing_parameters { + # field: "table_name" + # path_template: "{table_name=regions/*/zones/*/**}" + # } + # }; + # + # result: + # + # + # + # Sub-example 3c + # + # Multiple alternative conflictingly named path templates are + # specified. The one that matches is used to construct the header. + # + # annotation: + # + # option (google.api.routing) = { + # // Take the `table_name`, if it's well-formed, whether + # // using the region- or projects-based syntax. + # + # routing_parameters { + # field: "table_name" + # path_template: "{table_name=regions/*/zones/*/**}" + # } + # routing_parameters { + # field: "table_name" + # path_template: "{table_name=projects/*/instances/*/**}" + # } + # }; + # + # result: + # + # x-goog-request-params: + # table_name=projects/proj_foo/instances/instance_bar/table/table_baz + # + # Example 4 + # + # Extracting a single routing header key-value pair by matching a + # template syntax on (a part of) a single request field. + # + # annotation: + # + # option (google.api.routing) = { + # // Take just the project id from the `table_name` field. + # routing_parameters { + # field: "table_name" + # path_template: "{routing_id=projects/*}/**" + # } + # }; + # + # result: + # + # x-goog-request-params: routing_id=projects/proj_foo + # + # Example 5 + # + # Extracting a single routing header key-value pair by matching + # several conflictingly named path templates on (parts of) a single request + # field. The last template to match "wins" the conflict. + # + # annotation: + # + # option (google.api.routing) = { + # // If the `table_name` does not have instances information, + # // take just the project id for routing. + # // Otherwise take project + instance. + # + # routing_parameters { + # field: "table_name" + # path_template: "{routing_id=projects/*}/**" + # } + # routing_parameters { + # field: "table_name" + # path_template: "{routing_id=projects/*/instances/*}/**" + # } + # }; + # + # result: + # + # x-goog-request-params: + # routing_id=projects/proj_foo/instances/instance_bar + # + # Example 6 + # + # Extracting multiple routing header key-value pairs by matching + # several non-conflicting path templates on (parts of) a single request field. + # + # Sub-example 6a + # + # Make the templates strict, so that if the `table_name` does not + # have an instance information, nothing is sent. + # + # annotation: + # + # option (google.api.routing) = { + # // The routing code needs two keys instead of one composite + # // but works only for the tables with the "project-instance" name + # // syntax. + # + # routing_parameters { + # field: "table_name" + # path_template: "{project_id=projects/*}/instances/*/**" + # } + # routing_parameters { + # field: "table_name" + # path_template: "projects/*/{instance_id=instances/*}/**" + # } + # }; + # + # result: + # + # x-goog-request-params: + # project_id=projects/proj_foo&instance_id=instances/instance_bar + # + # Sub-example 6b + # + # Make the templates loose, so that if the `table_name` does not + # have an instance information, just the project id part is sent. + # + # annotation: + # + # option (google.api.routing) = { + # // The routing code wants two keys instead of one composite + # // but will work with just the `project_id` for tables without + # // an instance in the `table_name`. + # + # routing_parameters { + # field: "table_name" + # path_template: "{project_id=projects/*}/**" + # } + # routing_parameters { + # field: "table_name" + # path_template: "projects/*/{instance_id=instances/*}/**" + # } + # }; + # + # result (is the same as 6a for our example message because it has the instance + # information): + # + # x-goog-request-params: + # project_id=projects/proj_foo&instance_id=instances/instance_bar + # + # Example 7 + # + # Extracting multiple routing header key-value pairs by matching + # several path templates on multiple request fields. + # + # NB: note that here there is no way to specify sending nothing if one of the + # fields does not match its template. E.g. if the `table_name` is in the wrong + # format, the `project_id` will not be sent, but the `routing_id` will be. + # The backend routing code has to be aware of that and be prepared to not + # receive a full complement of keys if it expects multiple. + # + # annotation: + # + # option (google.api.routing) = { + # // The routing needs both `project_id` and `routing_id` + # // (from the `app_profile_id` field) for routing. + # + # routing_parameters { + # field: "table_name" + # path_template: "{project_id=projects/*}/**" + # } + # routing_parameters { + # field: "app_profile_id" + # path_template: "{routing_id=**}" + # } + # }; + # + # result: + # + # x-goog-request-params: + # project_id=projects/proj_foo&routing_id=profiles/prof_qux + # + # Example 8 + # + # Extracting a single routing header key-value pair by matching + # several conflictingly named path templates on several request fields. The + # last template to match "wins" the conflict. + # + # annotation: + # + # option (google.api.routing) = { + # // The `routing_id` can be a project id or a region id depending on + # // the table name format, but only if the `app_profile_id` is not set. + # // If `app_profile_id` is set it should be used instead. + # + # routing_parameters { + # field: "table_name" + # path_template: "{routing_id=projects/*}/**" + # } + # routing_parameters { + # field: "table_name" + # path_template: "{routing_id=regions/*}/**" + # } + # routing_parameters { + # field: "app_profile_id" + # path_template: "{routing_id=**}" + # } + # }; + # + # result: + # + # x-goog-request-params: routing_id=profiles/prof_qux + # + # Example 9 + # + # Bringing it all together. + # + # annotation: + # + # option (google.api.routing) = { + # // For routing both `table_location` and a `routing_id` are needed. + # // + # // table_location can be either an instance id or a region+zone id. + # // + # // For `routing_id`, take the value of `app_profile_id` + # // - If it's in the format `profiles/`, send + # // just the `` part. + # // - If it's any other literal, send it as is. + # // If the `app_profile_id` is empty, and the `table_name` starts with + # // the project_id, send that instead. + # + # routing_parameters { + # field: "table_name" + # path_template: "projects/*/{table_location=instances/*}/tables/*" + # } + # routing_parameters { + # field: "table_name" + # path_template: "{table_location=regions/*/zones/*}/tables/*" + # } + # routing_parameters { + # field: "table_name" + # path_template: "{routing_id=projects/*}/**" + # } + # routing_parameters { + # field: "app_profile_id" + # path_template: "{routing_id=**}" + # } + # routing_parameters { + # field: "app_profile_id" + # path_template: "profiles/{routing_id=*}" + # } + # }; + # + # result: + # + # x-goog-request-params: + # table_location=instances/instance_bar&routing_id=prof_qux + # @!attribute [rw] routing_parameters + # @return [::Array<::Google::Api::RoutingParameter>] + # A collection of Routing Parameter specifications. + # **NOTE:** If multiple Routing Parameters describe the same key + # (via the `path_template` field or via the `field` field when + # `path_template` is not provided), "last one wins" rule + # determines which Parameter gets used. + # See the examples for more details. + class RoutingRule + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A projection from an input message to the GRPC or REST header. + # @!attribute [rw] field + # @return [::String] + # A request field to extract the header key-value pair from. + # @!attribute [rw] path_template + # @return [::String] + # A pattern matching the key-value field. Optional. + # If not specified, the whole field specified in the `field` field will be + # taken as value, and its name used as key. If specified, it MUST contain + # exactly one named segment (along with any number of unnamed segments) The + # pattern will be matched over the field specified in the `field` field, then + # if the match is successful: + # - the name of the single named segment will be used as a header name, + # - the match value of the segment will be used as a header value; + # if the match is NOT successful, nothing will be sent. + # + # Example: + # + # -- This is a field in the request message + # | that the header value will be extracted from. + # | + # | -- This is the key name in the + # | | routing header. + # V | + # field: "table_name" v + # path_template: "projects/*/{table_location=instances/*}/tables/*" + # ^ ^ + # | | + # In the {} brackets is the pattern that -- | + # specifies what to extract from the | + # field as a value to be sent. | + # | + # The string in the field must match the whole pattern -- + # before brackets, inside brackets, after brackets. + # + # When looking at this specific example, we can see that: + # - A key-value pair with the key `table_location` + # and the value matching `instances/*` should be added + # to the x-goog-request-params routing header. + # - The value is extracted from the request message's `table_name` field + # if it matches the full pattern specified: + # `projects/*/instances/*/tables/*`. + # + # **NB:** If the `path_template` field is not provided, the key name is + # equal to the field name, and the whole field should be sent as a value. + # This makes the pattern for the field and the value functionally equivalent + # to `**`, and the configuration + # + # { + # field: "table_name" + # } + # + # is a functionally equivalent shorthand to: + # + # { + # field: "table_name" + # path_template: "{table_name=**}" + # } + # + # See Example 1 for more details. + class RoutingParameter + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-maps-fleet_engine-delivery-v1/proto_docs/google/geo/type/viewport.rb b/google-maps-fleet_engine-delivery-v1/proto_docs/google/geo/type/viewport.rb new file mode 100644 index 000000000000..fe0ee05cff16 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/proto_docs/google/geo/type/viewport.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 Geo + module Type + # A latitude-longitude viewport, represented as two diagonally opposite `low` + # and `high` points. A viewport is considered a closed region, i.e. it includes + # its boundary. The latitude bounds must range between -90 to 90 degrees + # inclusive, and the longitude bounds must range between -180 to 180 degrees + # inclusive. Various cases include: + # + # - If `low` = `high`, the viewport consists of that single point. + # + # - If `low.longitude` > `high.longitude`, the longitude range is inverted + # (the viewport crosses the 180 degree longitude line). + # + # - If `low.longitude` = -180 degrees and `high.longitude` = 180 degrees, + # the viewport includes all longitudes. + # + # - If `low.longitude` = 180 degrees and `high.longitude` = -180 degrees, + # the longitude range is empty. + # + # - If `low.latitude` > `high.latitude`, the latitude range is empty. + # + # Both `low` and `high` must be populated, and the represented box cannot be + # empty (as specified by the definitions above). An empty viewport will result + # in an error. + # + # For example, this viewport fully encloses New York City: + # + # { + # "low": { + # "latitude": 40.477398, + # "longitude": -74.259087 + # }, + # "high": { + # "latitude": 40.91618, + # "longitude": -73.70018 + # } + # } + # @!attribute [rw] low + # @return [::Google::Type::LatLng] + # Required. The low point of the viewport. + # @!attribute [rw] high + # @return [::Google::Type::LatLng] + # Required. The high point of the viewport. + class Viewport + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end +end diff --git a/google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/common.rb b/google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/common.rb new file mode 100644 index 000000000000..d745f15cbaa9 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/common.rb @@ -0,0 +1,251 @@ +# 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 Maps + module FleetEngine + module Delivery + module V1 + # Describes a vehicle attribute as a key-value pair. The "key:value" string + # length cannot exceed 256 characters. + # @!attribute [rw] key + # @return [::String] + # The attribute's key. + # @!attribute [rw] value + # @return [::String] + # The attribute's value. + # @!attribute [rw] string_value + # @return [::String] + # String typed attribute value. + # + # Note: This is identical to the `value` field which will eventually be + # deprecated. For create or update methods, either field can be used, but + # it's strongly recommended to use `string_value`. If both `string_value` + # and `value` are set, they must be identical or an error will be thrown. + # Both fields are populated in responses. + # @!attribute [rw] bool_value + # @return [::Boolean] + # Boolean typed attribute value. + # @!attribute [rw] number_value + # @return [::Float] + # Double typed attribute value. + class DeliveryVehicleAttribute + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The location, speed, and heading of a vehicle at a point in time. + # @!attribute [rw] location + # @return [::Google::Type::LatLng] + # The location of the vehicle. + # When it is sent to Fleet Engine, the vehicle's location is a GPS location. + # When you receive it in a response, the vehicle's location can be either a + # GPS location, a supplemental location, or some other estimated location. + # The source is specified in `location_sensor`. + # @!attribute [rw] horizontal_accuracy + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Google::Protobuf::DoubleValue] + # Deprecated: Use `latlng_accuracy` instead. + # @!attribute [rw] latlng_accuracy + # @return [::Google::Protobuf::DoubleValue] + # Accuracy of `location` in meters as a radius. + # @!attribute [rw] heading + # @return [::Google::Protobuf::Int32Value] + # Direction the vehicle is moving in degrees. 0 represents North. + # The valid range is [0,360). + # @!attribute [rw] bearing_accuracy + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Google::Protobuf::DoubleValue] + # Deprecated: Use `heading_accuracy` instead. + # @!attribute [rw] heading_accuracy + # @return [::Google::Protobuf::DoubleValue] + # Accuracy of `heading` in degrees. + # @!attribute [rw] altitude + # @return [::Google::Protobuf::DoubleValue] + # Altitude in meters above WGS84. + # @!attribute [rw] vertical_accuracy + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Google::Protobuf::DoubleValue] + # Deprecated: Use `altitude_accuracy` instead. + # @!attribute [rw] altitude_accuracy + # @return [::Google::Protobuf::DoubleValue] + # Accuracy of `altitude` in meters. + # @!attribute [rw] speed_kmph + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Google::Protobuf::Int32Value] + # Speed of the vehicle in kilometers per hour. + # Deprecated: Use `speed` instead. + # @!attribute [rw] speed + # @return [::Google::Protobuf::DoubleValue] + # Speed of the vehicle in meters/second + # @!attribute [rw] speed_accuracy + # @return [::Google::Protobuf::DoubleValue] + # Accuracy of `speed` in meters/second. + # @!attribute [rw] update_time + # @return [::Google::Protobuf::Timestamp] + # The time when `location` was reported by the sensor according to the + # sensor's clock. + # @!attribute [r] server_time + # @return [::Google::Protobuf::Timestamp] + # Output only. The time when the server received the location information. + # @!attribute [rw] location_sensor + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicleLocationSensor] + # Provider of location data (for example, `GPS`). + # @!attribute [rw] is_road_snapped + # @return [::Google::Protobuf::BoolValue] + # Whether `location` is snapped to a road. + # @!attribute [rw] is_gps_sensor_enabled + # @return [::Google::Protobuf::BoolValue] + # Input only. Indicates whether the GPS sensor is enabled on the mobile + # device. + # @!attribute [rw] time_since_update + # @return [::Google::Protobuf::Int32Value] + # Input only. Time (in seconds) since this location was first sent to the + # server. This will be zero for the first update. If the time is unknown (for + # example, when the app restarts), this value resets to zero. + # @!attribute [rw] num_stale_updates + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Google::Protobuf::Int32Value] + # Input only. Deprecated: Other signals are now used to determine if a + # location is stale. + # @!attribute [rw] raw_location + # @return [::Google::Type::LatLng] + # Raw vehicle location (unprocessed by road-snapper). + # @!attribute [rw] raw_location_time + # @return [::Google::Protobuf::Timestamp] + # Timestamp associated with the raw location. + # @!attribute [rw] raw_location_sensor + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicleLocationSensor] + # Source of the raw location. Defaults to `GPS`. + # @!attribute [rw] raw_location_accuracy + # @return [::Google::Protobuf::DoubleValue] + # Accuracy of `raw_location` as a radius, in meters. + # @!attribute [rw] supplemental_location + # @return [::Google::Type::LatLng] + # Supplemental location provided by the integrating app. + # @!attribute [rw] supplemental_location_time + # @return [::Google::Protobuf::Timestamp] + # Timestamp associated with the supplemental location. + # @!attribute [rw] supplemental_location_sensor + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicleLocationSensor] + # Source of the supplemental location. Defaults to + # `CUSTOMER_SUPPLIED_LOCATION`. + # @!attribute [rw] supplemental_location_accuracy + # @return [::Google::Protobuf::DoubleValue] + # Accuracy of `supplemental_location` as a radius, in meters. + # @!attribute [rw] road_snapped + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Boolean] + # Deprecated: Use `is_road_snapped` instead. + class DeliveryVehicleLocation + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A time range. + # @!attribute [rw] start_time + # @return [::Google::Protobuf::Timestamp] + # Required. The start time of the time window (inclusive). + # @!attribute [rw] end_time + # @return [::Google::Protobuf::Timestamp] + # Required. The end time of the time window (inclusive). + class TimeWindow + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Describes a task attribute as a key-value pair. The "key:value" string length + # cannot exceed 256 characters. + # @!attribute [rw] key + # @return [::String] + # The attribute's key. Keys may not contain the colon character (:). + # @!attribute [rw] string_value + # @return [::String] + # String typed attribute value. + # @!attribute [rw] bool_value + # @return [::Boolean] + # Boolean typed attribute value. + # @!attribute [rw] number_value + # @return [::Float] + # Double typed attribute value. + class TaskAttribute + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The sensor or methodology used to determine the location. + module DeliveryVehicleLocationSensor + # The sensor is unspecified or unknown. + UNKNOWN_SENSOR = 0 + + # GPS or Assisted GPS. + GPS = 1 + + # Assisted GPS, cell tower ID, or WiFi access point. + NETWORK = 2 + + # Cell tower ID or WiFi access point. + PASSIVE = 3 + + # A location determined by the mobile device to be the most likely + # road position. + ROAD_SNAPPED_LOCATION_PROVIDER = 4 + + # A customer-supplied location from an independent source. Typically, this + # value is used for a location provided from sources other than the mobile + # device running Driver SDK. If the original source is described by one of + # the other enum values, use that value. Locations marked + # CUSTOMER_SUPPLIED_LOCATION are typically provided via a DeliveryVehicle's + # `last_location.supplemental_location_sensor`. + CUSTOMER_SUPPLIED_LOCATION = 5 + + # A location calculated by Fleet Engine based on the signals available to it. + # Output only. This value will be rejected if it is received in a request. + FLEET_ENGINE_LOCATION = 6 + + # Android's Fused Location Provider. + FUSED_LOCATION_PROVIDER = 100 + + # The location provider on Apple operating systems. + CORE_LOCATION = 200 + end + + # The vehicle's navigation status. + module DeliveryVehicleNavigationStatus + # Unspecified navigation status. + UNKNOWN_NAVIGATION_STATUS = 0 + + # The Driver app's navigation is in `FREE_NAV` mode. + NO_GUIDANCE = 1 + + # Turn-by-turn navigation is available and the Driver app navigation has + # entered `GUIDED_NAV` mode. + ENROUTE_TO_DESTINATION = 2 + + # The vehicle has gone off the suggested route. + OFF_ROUTE = 3 + + # The vehicle is within approximately 50m of the destination. + ARRIVED_AT_DESTINATION = 4 + end + end + end + end + end +end diff --git a/google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/delivery_api.rb b/google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/delivery_api.rb new file mode 100644 index 000000000000..9294e5bbb8d0 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/delivery_api.rb @@ -0,0 +1,416 @@ +# 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 Maps + module FleetEngine + module Delivery + module V1 + # The `CreateDeliveryVehicle` request message. + # @!attribute [rw] header + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader] + # Optional. The standard Delivery API request header. + # @!attribute [rw] parent + # @return [::String] + # Required. Must be in the format `providers/{provider}`. The provider must + # be the Google Cloud Project ID. For example, `sample-cloud-project`. + # @!attribute [rw] delivery_vehicle_id + # @return [::String] + # Required. The Delivery Vehicle ID must be unique and subject to the + # following restrictions: + # + # * Must be a valid Unicode string. + # * Limited to a maximum length of 64 characters. + # * Normalized according to [Unicode Normalization Form C] + # (http://www.unicode.org/reports/tr15/). + # * May not contain any of the following ASCII characters: '/', ':', '?', + # ',', or '#'. + # @!attribute [rw] delivery_vehicle + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle] + # Required. The `DeliveryVehicle` entity to create. When creating a new + # delivery vehicle, you may set the following optional fields: + # + # * last_location + # * attributes + # + # Note: The DeliveryVehicle's `name` field is ignored. All other + # DeliveryVehicle fields must not be set; otherwise, an error is returned. + class CreateDeliveryVehicleRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The `GetDeliveryVehicle` request message. + # @!attribute [rw] header + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader] + # Optional. The standard Delivery API request header. + # @!attribute [rw] name + # @return [::String] + # Required. Must be in the format + # `providers/{provider}/deliveryVehicles/{delivery_vehicle}`. + # The `provider` must be the Google Cloud Project ID. For example, + # `sample-cloud-project`. + class GetDeliveryVehicleRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The `ListDeliveryVehicles` request message. + # @!attribute [rw] header + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader] + # Optional. The standard Delivery API request header. + # @!attribute [rw] parent + # @return [::String] + # Required. Must be in the format `providers/{provider}`. + # The `provider` must be the Google Cloud Project ID. + # For example, `sample-cloud-project`. + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. The maximum number of vehicles to return. The service may return + # fewer than this number. If you don't specify this number, then the server + # determines the number of results to return. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A page token, received from a previous `ListDeliveryVehicles` + # call. You must provide this in order to retrieve the subsequent page. + # + # When paginating, all other parameters provided to `ListDeliveryVehicles` + # must match the call that provided the page token. + # @!attribute [rw] filter + # @return [::String] + # Optional. A filter query to apply when listing delivery vehicles. See + # http://aip.dev/160 for examples of the filter syntax. If you don't specify + # a value, or if you specify an empty string for the filter, then all + # delivery vehicles are returned. + # + # Note that the only queries supported for `ListDeliveryVehicles` are + # on vehicle attributes (for example, `attributes. = ` or + # `attributes. = AND attributes. = `). Also, all + # attributes are stored as strings, so the only supported comparisons against + # attributes are string comparisons. In order to compare against number or + # boolean values, the values must be explicitly quoted to be treated as + # strings (for example, `attributes. = "10"` or + # `attributes. = "true"`). + # + # The maximum number of restrictions allowed in a filter query is 50. A + # restriction is a part of the query of the form + # `attribute. `, for example `attributes.foo = bar` + # is 1 restriction. + # @!attribute [rw] viewport + # @return [::Google::Geo::Type::Viewport] + # Optional. A filter that limits the vehicles returned to those whose last + # known location was in the rectangular area defined by the viewport. + class ListDeliveryVehiclesRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The `ListDeliveryVehicles` response message. + # @!attribute [rw] delivery_vehicles + # @return [::Array<::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle>] + # The set of delivery vehicles that meet the requested filtering criteria. + # When no filter is specified, the request returns all delivery vehicles. A + # successful response can also be empty. An empty response indicates that no + # delivery vehicles were found meeting the requested filter criteria. + # @!attribute [rw] next_page_token + # @return [::String] + # You can pass this token in the `ListDeliveryVehiclesRequest` to continue to + # list results. When all of the results are returned, this field won't be in + # the response, or it will be an empty string. + # @!attribute [rw] total_size + # @return [::Integer] + # The total number of delivery vehicles that match the request criteria, + # across all pages. + class ListDeliveryVehiclesResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The `UpdateDeliveryVehicle` request message. + # @!attribute [rw] header + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader] + # Optional. The standard Delivery API request header. + # @!attribute [rw] delivery_vehicle + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle] + # Required. The `DeliveryVehicle` entity update to apply. + # Note: You cannot update the name of the `DeliveryVehicle`. + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # Required. A field mask that indicates which `DeliveryVehicle` fields to + # update. Note that the update_mask must contain at least one field. + # + # This is a comma-separated list of fully qualified names of fields. Example: + # `"remaining_vehicle_journey_segments"`. + class UpdateDeliveryVehicleRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The `BatchCreateTask` request message. + # @!attribute [rw] header + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader] + # Optional. The standard Delivery API request header. + # Note: If you set this field, then the header field in the + # `CreateTaskRequest` messages must either be empty, or it must match this + # field. + # @!attribute [rw] parent + # @return [::String] + # Required. The parent resource shared by all tasks. This value must be in + # the format `providers/{provider}`. The `provider` must be the Google Cloud + # Project ID. For example, `sample-cloud-project`. The parent field in the + # `CreateTaskRequest` messages must either be empty, or it must match this + # field. + # @!attribute [rw] requests + # @return [::Array<::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest>] + # Required. The request message that specifies the resources to create. + # Note: You can create a maximum of 500 tasks in a batch. + class BatchCreateTasksRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The `BatchCreateTask` response message. + # @!attribute [rw] tasks + # @return [::Array<::Google::Maps::FleetEngine::Delivery::V1::Task>] + # The created Tasks. + class BatchCreateTasksResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The `CreateTask` request message. + # @!attribute [rw] header + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader] + # Optional. The standard Delivery API request header. + # @!attribute [rw] parent + # @return [::String] + # Required. Must be in the format `providers/{provider}`. The `provider` must + # be the Google Cloud Project ID. For example, `sample-cloud-project`. + # @!attribute [rw] task_id + # @return [::String] + # Required. The Task ID must be unique, but it should be not a shipment + # tracking ID. To store a shipment tracking ID, use the `tracking_id` field. + # Note that multiple tasks can have the same `tracking_id`. Task IDs are + # subject to the following restrictions: + # + # * Must be a valid Unicode string. + # * Limited to a maximum length of 64 characters. + # * Normalized according to [Unicode Normalization Form C] + # (http://www.unicode.org/reports/tr15/). + # * May not contain any of the following ASCII characters: '/', ':', '?', + # ',', or '#'. + # @!attribute [rw] task + # @return [::Google::Maps::FleetEngine::Delivery::V1::Task] + # Required. The Task entity to create. + # When creating a Task, the following fields are required: + # + # * `type` + # * `state` (must be set to `OPEN`) + # * `tracking_id` (must not be set for `UNAVAILABLE` or `SCHEDULED_STOP` + # tasks, but required for all other task types) + # * `planned_location` (optional for `UNAVAILABLE` tasks) + # * `task_duration` + # + # Note: The Task's `name` field is ignored. All other Task fields must not be + # set; otherwise, an error is returned. + class CreateTaskRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The `GetTask` request message. + # @!attribute [rw] header + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader] + # Optional. The standard Delivery API request header. + # @!attribute [rw] name + # @return [::String] + # Required. Must be in the format `providers/{provider}/tasks/{task}`. The + # `provider` must be the Google Cloud Project ID. For example, + # `sample-cloud-project`. + class GetTaskRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Deprecated: Issue `GetTaskTrackingInfoRequest`s to `GetTaskTrackingInfo` + # instead. + # @deprecated This message is deprecated and may be removed in the next major version update. + # @!attribute [rw] header + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader] + # Optional. The standard Delivery API request header. + # @!attribute [rw] parent + # @return [::String] + # Required. Must be in the format `providers/{provider}`. + # The provider must be the Google Cloud Project ID. For example, + # `sample-cloud-project`. + # @!attribute [rw] tracking_id + # @return [::String] + # Required. The identifier of the set of related Tasks being requested. + # Tracking IDs are subject to the following restrictions: + # + # * Must be a valid Unicode string. + # * Limited to a maximum length of 64 characters. + # * Normalized according to [Unicode Normalization Form C] + # (http://www.unicode.org/reports/tr15/). + # * May not contain any of the following ASCII characters: '/', ':', '?', + # ',', or '#'. + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. The maximum number of Tasks to return. The service may return + # fewer than this value. If you don't specify this value, then the server + # determines the number of results to return. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A page token, received from a previous `SearchTasks` call. You + # must provide this value to retrieve the subsequent page. + # + # When paginating, all other parameters provided to `SearchTasks` must match + # the call that provided the page token. + class SearchTasksRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The `SearchTasks` response. It contains the set of Tasks that meet the search + # criteria in the `SearchTasksRequest`. + # @deprecated This message is deprecated and may be removed in the next major version update. + # @!attribute [rw] tasks + # @return [::Array<::Google::Maps::FleetEngine::Delivery::V1::Task>] + # The set of Tasks for the requested `tracking_id`. A successful response can + # also be empty. An empty response indicates that no Tasks are associated + # with the supplied `tracking_id`. + # @!attribute [rw] next_page_token + # @return [::String] + # Pass this token in the `SearchTasksRequest` to continue to + # list results. If all results have been returned, then this field is either + # an empty string, or it doesn't appear in the response. + class SearchTasksResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The `UpdateTask` request message. + # @!attribute [rw] header + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader] + # Optional. The standard Delivery API request header. + # @!attribute [rw] task + # @return [::Google::Maps::FleetEngine::Delivery::V1::Task] + # Required. The Task associated with the update. + # The following fields are maintained by Fleet Engine. Do not update + # them using `Task.update`. + # + # * `last_location`. + # * `last_location_snappable`. + # * `name`. + # * `remaining_vehicle_journey_segments`. + # * `task_outcome_location_source`. + # + # Note: You cannot change the value of `task_outcome` once you set it. + # + # If the Task has been assigned to a delivery vehicle, then don't set the + # Task state to CLOSED using `Task.update`. Instead, remove the `VehicleStop` + # that contains the Task from the delivery vehicle, which automatically sets + # the Task state to CLOSED. + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # Required. The field mask that indicates which Task fields to update. + # Note: The `update_mask` must contain at least one field. + # + # This is a comma-separated list of fully qualified names of fields. Example: + # `"task_outcome,task_outcome_time,task_outcome_location"`. + class UpdateTaskRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The `ListTasks` request message. + # @!attribute [rw] header + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader] + # Optional. The standard Delivery API request header. + # @!attribute [rw] parent + # @return [::String] + # Required. Must be in the format `providers/{provider}`. + # The `provider` must be the Google Cloud Project ID. For example, + # `sample-cloud-project`. + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. The maximum number of Tasks to return. The service may return + # fewer than this value. If you don't specify this value, then the server + # determines the number of results to return. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A page token received from a previous `ListTasks` call. + # You can provide this to retrieve the subsequent page. + # + # When paginating, all other parameters provided to `ListTasks` must match + # the call that provided the page token. + # @!attribute [rw] filter + # @return [::String] + # Optional. A filter query to apply when listing Tasks. See + # http://aip.dev/160 for examples of filter syntax. If you don't specify a + # value, or if you filter on an empty string, then all Tasks are returned. + # For information about the Task properties that you can filter on, see [List + # tasks](https://developers.google.com/maps/documentation/transportation-logistics/last-mile-fleet-solution/fleet-performance/fleet-engine/deliveries_api#list-tasks). + class ListTasksRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The `ListTasks` response that contains the set of Tasks that meet the filter + # criteria in the `ListTasksRequest`. + # @!attribute [rw] tasks + # @return [::Array<::Google::Maps::FleetEngine::Delivery::V1::Task>] + # The set of Tasks that meet the requested filtering criteria. When no filter + # is specified, the request returns all tasks. A successful response can also + # be empty. An empty response indicates that no Tasks were found meeting the + # requested filter criteria. + # @!attribute [rw] next_page_token + # @return [::String] + # Pass this token in the `ListTasksRequest` to continue to list results. + # If all results have been returned, then this field is either an empty + # string, or it doesn't appear in the response. + # @!attribute [rw] total_size + # @return [::Integer] + # The total number of Tasks that match the request criteria, across all + # pages. + class ListTasksResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The `GetTaskTrackingInfoRequest` request message. + # @!attribute [rw] header + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader] + # Optional. The standard Delivery API request header. + # @!attribute [rw] name + # @return [::String] + # Required. Must be in the format + # `providers/{provider}/taskTrackingInfo/{tracking_id}`. The `provider` + # must be the Google Cloud Project ID, and the `tracking_id` must be the + # tracking ID associated with the task. An example name can be + # `providers/sample-cloud-project/taskTrackingInfo/sample-tracking-id`. + class GetTaskTrackingInfoRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end + end +end diff --git a/google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/delivery_vehicles.rb b/google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/delivery_vehicles.rb new file mode 100644 index 000000000000..244947542229 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/delivery_vehicles.rb @@ -0,0 +1,271 @@ +# 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 Maps + module FleetEngine + module Delivery + module V1 + # The `DeliveryVehicle` message. A delivery vehicle transports shipments from a + # depot to a delivery location, and from a pickup location to the depot. In + # some cases, delivery vehicles also transport shipments directly from the + # pickup location to the delivery location. + # + # Note: gRPC and REST APIs use different field naming conventions. For example, + # the `DeliveryVehicle.current_route_segment` field in the gRPC API and the + # `DeliveryVehicle.currentRouteSegment` field in the REST API refer to the same + # field. + # @!attribute [rw] name + # @return [::String] + # The unique name of this Delivery Vehicle. + # The format is `providers/{provider}/deliveryVehicles/{vehicle}`. + # @!attribute [rw] last_location + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicleLocation] + # The last reported location of the Delivery Vehicle. + # @!attribute [rw] navigation_status + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicleNavigationStatus] + # The Delivery Vehicle's navigation status. + # @!attribute [rw] current_route_segment + # @return [::String] + # The encoded polyline specifying the route that the navigation recommends + # taking to the next waypoint. Your driver app updates this when a + # stop is reached or passed, and when the navigation reroutes. These + # `LatLng`s are returned in + # `Task.journey_sharing_info.remaining_vehicle_journey_segments[0].path` + # (gRPC) or `Task.journeySharingInfo.remainingVehicleJourneySegments[0].path` + # (REST) for all active Tasks assigned to the Vehicle. + # + # There are a few cases where this field might not be used to populate + # `Task.journey_sharing_info.remaining_vehicle_journey_segments[0].path` + # (gRPC) or `Task.journeySharingInfo.remainingVehicleJourneySegments[0].path` + # (REST): + # + # * The endpoint of the `current_route_segment` does not match + # `DeliveryVehicle.remaining_vehicle_journey_segments[0].stop` (gRPC) or + # `DeliveryVehicle.remainingVehicleJourneySegments[0].stop` (REST). + # + # * The driver app has not updated its location recently, so the last + # updated value for this field might be stale. + # + # * The driver app has recently updated its location, but the + # `current_route_segment` is stale, and points to a previous vehicle stop. + # + # In these cases, Fleet Engine populates this field with a route from the + # most recently passed VehicleStop to the upcoming VehicleStop to ensure that + # the consumer of this field has the best available information on the + # current path of the Delivery Vehicle. + # @!attribute [rw] current_route_segment_end_point + # @return [::Google::Type::LatLng] + # The location where the `current_route_segment` ends. This is not currently + # populated by the driver app, but you can supply it on + # `UpdateDeliveryVehicle` calls. It is either the `LatLng` from the upcoming + # vehicle stop, or the last `LatLng` of the `current_route_segment`. Fleet + # Engine will then do its best to interpolate to an actual `VehicleStop`. + # + # This field is ignored in `UpdateDeliveryVehicle` calls if the + # `current_route_segment` field is empty. + # @!attribute [rw] remaining_distance_meters + # @return [::Google::Protobuf::Int32Value] + # The remaining driving distance for the `current_route_segment`. + # The Driver app typically provides this field, but there are some + # circumstances in which Fleet Engine will override the value sent by the + # app. For more information, see + # {::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle#current_route_segment DeliveryVehicle.current_route_segment}. + # This field is returned in + # `Task.remaining_vehicle_journey_segments[0].driving_distance_meters` (gRPC) + # or `Task.remainingVehicleJourneySegments[0].drivingDistanceMeters` (REST) + # for all active `Task`s assigned to the Delivery Vehicle. + # + # Fleet Engine ignores this field in `UpdateDeliveryVehicleRequest` if the + # `current_route_segment` field is empty. + # @!attribute [rw] remaining_duration + # @return [::Google::Protobuf::Duration] + # The remaining driving time for the `current_route_segment`. + # The Driver app typically provides this field, but there are some + # circumstances in which Fleet Engine will override the value sent by the + # app. For more information, see + # {::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle#current_route_segment DeliveryVehicle.current_route_segment}. + # This field is returned in + # `Task.remaining_vehicle_journey_segments[0].driving_duration` (gRPC) or + # `Task.remainingVehicleJourneySegments[0].drivingDuration` (REST) for all + # active tasks assigned to the Delivery Vehicle. + # + # Fleet Engine ignores this field in `UpdateDeliveryVehicleRequest` if the + # `current_route_segment` field is empty. + # @!attribute [rw] remaining_vehicle_journey_segments + # @return [::Array<::Google::Maps::FleetEngine::Delivery::V1::VehicleJourneySegment>] + # The journey segments assigned to this Delivery Vehicle, starting from the + # Vehicle's most recently reported location. This field won't be populated + # in the response of `ListDeliveryVehicles`. + # @!attribute [rw] attributes + # @return [::Array<::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicleAttribute>] + # A list of custom Delivery Vehicle attributes. A Delivery Vehicle can have + # at most 100 attributes, and each attribute must have a unique key. + # @!attribute [rw] type + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle::DeliveryVehicleType] + # The type of this delivery vehicle. If unset, this will default to `AUTO`. + class DeliveryVehicle + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The type of delivery vehicle. + module DeliveryVehicleType + # The value is unused. + DELIVERY_VEHICLE_TYPE_UNSPECIFIED = 0 + + # An automobile. + AUTO = 1 + + # A motorcycle, moped, or other two-wheeled vehicle + TWO_WHEELER = 2 + + # Human-powered transport. + BICYCLE = 3 + + # A human transporter, typically walking or running, traveling along + # pedestrian pathways. + PEDESTRIAN = 4 + end + end + + # A location with any additional identifiers. + # @!attribute [rw] point + # @return [::Google::Type::LatLng] + # The location's coordinates. + class LocationInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Represents a Vehicle’s travel segment - from its previous stop to the + # current stop. If it is the first active stop, then it is from the + # Vehicle’s current location to this stop. + # @!attribute [rw] stop + # @return [::Google::Maps::FleetEngine::Delivery::V1::VehicleStop] + # Specifies the stop location, along with the `Task`s associated with + # the stop. Some fields of the VehicleStop might not be present if this + # journey segment is part of `JourneySharingInfo`. + # @!attribute [r] driving_distance_meters + # @return [::Google::Protobuf::Int32Value] + # Output only. The travel distance from the previous stop to this stop. + # If the current stop is the first stop in the list of journey + # segments, then the starting point is the vehicle's location recorded + # at the time that this stop was added to the list. This field might not be + # present if this journey segment is part of `JourneySharingInfo`. + # @!attribute [r] driving_duration + # @return [::Google::Protobuf::Duration] + # Output only. The travel time from the previous stop to this stop. + # If the current stop is the first stop in the list of journey + # segments, then the starting point is the Vehicle's location recorded + # at the time that this stop was added to the list. + # + # If this field is defined in the path + # `Task.remaining_vehicle_journey_segments[0].driving_duration` (gRPC) or + # `Task.remainingVehicleJourneySegments[0].drivingDuration` (REST), + # then it may be populated with the value from + # `DeliveryVehicle.remaining_duration` (gRPC) or + # `DeliveryVehicle.remainingDuration` (REST). + # This provides the remaining driving duration from the driver app's latest + # known location rather than the driving time from the previous stop. + # @!attribute [r] path + # @return [::Array<::Google::Type::LatLng>] + # Output only. The path from the previous stop to this stop. If the current + # stop is the first stop in the list of journey segments, then this is the + # path from the vehicle's current location to this stop at the time that the + # stop was added to the list. This field might not be present if this journey + # segment is part of `JourneySharingInfo`. + # + # If this field is defined in the path + # `Task.journey_sharing_info.remaining_vehicle_journey_segments[0].path` + # (gRPC) or `Task.journeySharingInfo.remainingVehicleJourneySegments[0].path` + # (REST), then it may be populated with the `LatLng`s decoded from + # `DeliveryVehicle.current_route_segment` (gRPC) or + # `DeliveryVehicle.currentRouteSegment` (REST). This provides the driving + # path from the driver app's latest known location rather than the path from + # the previous stop. + class VehicleJourneySegment + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Describes a point where a Vehicle stops to perform one or more `Task`s. + # @!attribute [rw] planned_location + # @return [::Google::Maps::FleetEngine::Delivery::V1::LocationInfo] + # Required. The location of the stop. Note that the locations in the `Task`s + # might not exactly match this location, but will be within a short distance + # of it. This field won't be populated in the response of either a `GetTask`, + # or a `SearchTasks` call. + # @!attribute [rw] tasks + # @return [::Array<::Google::Maps::FleetEngine::Delivery::V1::VehicleStop::TaskInfo>] + # The list of `Task`s to be performed at this stop. This field won't be + # populated in the response of either a `GetTask` or `SearchTasks` call. + # @!attribute [rw] state + # @return [::Google::Maps::FleetEngine::Delivery::V1::VehicleStop::State] + # The state of the `VehicleStop`. This field won't be populated in the + # response of either a `GetTask`, or a `SearchTasks` call. + class VehicleStop + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Additional information about the Task performed at this stop. + # @!attribute [rw] task_id + # @return [::String] + # The Task ID. This field won't be populated in the response of either a + # `GetTask`, or a `SearchTasks` call. Task IDs are subject to the following + # restrictions: + # + # * Must be a valid Unicode string. + # * Limited to a maximum length of 64 characters. + # * Normalized according to [Unicode Normalization Form C] + # (http://www.unicode.org/reports/tr15/). + # * May not contain any of the following ASCII characters: '/', ':', '?', + # ',', or '#'. + # @!attribute [r] task_duration + # @return [::Google::Protobuf::Duration] + # Output only. The time required to perform the Task. + # @!attribute [r] target_time_window + # @return [::Google::Maps::FleetEngine::Delivery::V1::TimeWindow] + # Output only. The time window during which the task should be completed. + # This is only set in the response to `GetDeliveryVehicle`. + class TaskInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The current state of a `VehicleStop`. + module State + # Unknown. + STATE_UNSPECIFIED = 0 + + # Created, but not actively routing. + NEW = 1 + + # Assigned and actively routing. + ENROUTE = 2 + + # Arrived at stop. Assumes that when the Vehicle is routing to the next + # stop, that all previous stops have been completed. + ARRIVED = 3 + end + end + end + end + end + end +end diff --git a/google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/header.rb b/google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/header.rb new file mode 100644 index 000000000000..88612273bff2 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/header.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 Maps + module FleetEngine + module Delivery + module V1 + # A RequestHeader contains fields common to all Delivery RPC requests. + # @!attribute [rw] language_code + # @return [::String] + # The BCP-47 language code, such as en-US or sr-Latn. For more information, + # see http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. If none + # is specified, the response may be in any language, with a preference for + # English if such a name exists. Field value example: `en-US`. + # @!attribute [rw] region_code + # @return [::String] + # Required. CLDR region code of the region where the request originates. + # Field value example: `US`. + # @!attribute [rw] sdk_version + # @return [::String] + # Version of the calling SDK, if applicable. + # The version format is "major.minor.patch", example: `1.1.2`. + # @!attribute [rw] os_version + # @return [::String] + # Version of the operating system on which the calling SDK is running. + # Field value examples: `4.4.1`, `12.1`. + # @!attribute [rw] device_model + # @return [::String] + # Model of the device on which the calling SDK is running. + # Field value examples: `iPhone12,1`, `SM-G920F`. + # @!attribute [rw] sdk_type + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader::SdkType] + # The type of SDK sending the request. + # @!attribute [rw] maps_sdk_version + # @return [::String] + # Version of the MapSDK which the calling SDK depends on, if applicable. + # The version format is "major.minor.patch", example: `5.2.1`. + # @!attribute [rw] nav_sdk_version + # @return [::String] + # Version of the NavSDK which the calling SDK depends on, if applicable. + # The version format is "major.minor.patch", example: `2.1.0`. + # @!attribute [rw] platform + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader::Platform] + # Platform of the calling SDK. + # @!attribute [rw] manufacturer + # @return [::String] + # Manufacturer of the Android device from the calling SDK, only applicable + # for the Android SDKs. + # Field value example: `Samsung`. + # @!attribute [rw] android_api_level + # @return [::Integer] + # Android API level of the calling SDK, only applicable for the Android SDKs. + # Field value example: `23`. + # @!attribute [rw] trace_id + # @return [::String] + # Optional ID that can be provided for logging purposes in order to identify + # the request. + class DeliveryRequestHeader + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Possible types of SDK. + module SdkType + # The default value. This value is used if the `sdk_type` is omitted. + SDK_TYPE_UNSPECIFIED = 0 + + # The calling SDK is Consumer. + CONSUMER = 1 + + # The calling SDK is Driver. + DRIVER = 2 + + # The calling SDK is JavaScript. + JAVASCRIPT = 3 + end + + # The platform of the calling SDK. + module Platform + # The default value. This value is used if the platform is omitted. + PLATFORM_UNSPECIFIED = 0 + + # The request is coming from Android. + ANDROID = 1 + + # The request is coming from iOS. + IOS = 2 + + # The request is coming from the web. + WEB = 3 + end + end + end + end + end + end +end diff --git a/google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/task_tracking_info.rb b/google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/task_tracking_info.rb new file mode 100644 index 000000000000..8968c28b4600 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/task_tracking_info.rb @@ -0,0 +1,91 @@ +# 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 Maps + module FleetEngine + module Delivery + module V1 + # The `TaskTrackingInfo` message. The message contains task tracking + # information which will be used for display. If a tracking ID is associated + # with multiple Tasks, Fleet Engine uses a heuristic to decide which Task's + # TaskTrackingInfo to select. + # @!attribute [rw] name + # @return [::String] + # Must be in the format `providers/{provider}/taskTrackingInfo/{tracking}`, + # where `tracking` represents the tracking ID. + # @!attribute [rw] tracking_id + # @return [::String] + # Immutable. The tracking ID of a Task. + # * Must be a valid Unicode string. + # * Limited to a maximum length of 64 characters. + # * Normalized according to [Unicode Normalization Form C] + # (http://www.unicode.org/reports/tr15/). + # * May not contain any of the following ASCII characters: '/', ':', '?', + # ',', or '#'. + # @!attribute [rw] vehicle_location + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicleLocation] + # The vehicle's last location. + # @!attribute [rw] route_polyline_points + # @return [::Array<::Google::Type::LatLng>] + # A list of points which when connected forms a polyline of the vehicle's + # expected route to the location of this task. + # @!attribute [rw] remaining_stop_count + # @return [::Google::Protobuf::Int32Value] + # Indicates the number of stops the vehicle remaining until the task stop is + # reached, including the task stop. For example, if the vehicle's next stop + # is the task stop, the value will be 1. + # @!attribute [rw] remaining_driving_distance_meters + # @return [::Google::Protobuf::Int32Value] + # The total remaining distance in meters to the `VehicleStop` of interest. + # @!attribute [rw] estimated_arrival_time + # @return [::Google::Protobuf::Timestamp] + # The timestamp that indicates the estimated arrival time to the stop + # location. + # @!attribute [rw] estimated_task_completion_time + # @return [::Google::Protobuf::Timestamp] + # The timestamp that indicates the estimated completion time of a Task. + # @!attribute [rw] state + # @return [::Google::Maps::FleetEngine::Delivery::V1::Task::State] + # The current execution state of the Task. + # @!attribute [rw] task_outcome + # @return [::Google::Maps::FleetEngine::Delivery::V1::Task::TaskOutcome] + # The outcome of attempting to execute a Task. + # @!attribute [rw] task_outcome_time + # @return [::Google::Protobuf::Timestamp] + # The timestamp that indicates when the Task's outcome was set by the + # provider. + # @!attribute [rw] planned_location + # @return [::Google::Maps::FleetEngine::Delivery::V1::LocationInfo] + # Immutable. The location where the Task will be completed. + # @!attribute [rw] target_time_window + # @return [::Google::Maps::FleetEngine::Delivery::V1::TimeWindow] + # The time window during which the task should be completed. + # @!attribute [rw] attributes + # @return [::Array<::Google::Maps::FleetEngine::Delivery::V1::TaskAttribute>] + # The custom attributes set on the task. + class TaskTrackingInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end + end +end diff --git a/google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/tasks.rb b/google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/tasks.rb new file mode 100644 index 000000000000..6d2feac59f61 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/proto_docs/google/maps/fleetengine/delivery/v1/tasks.rb @@ -0,0 +1,281 @@ +# 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 Maps + module FleetEngine + module Delivery + module V1 + # A Task in the Delivery API represents a single action to track. In general, + # there is a distinction between shipment-related Tasks and break Tasks. A + # shipment can have multiple Tasks associated with it. For example, there could + # be one Task for the pickup, and one for the drop-off or transfer. Also, + # different Tasks for a given shipment can be handled by different vehicles. + # For example, one vehicle could handle the pickup, driving the shipment to the + # hub, while another vehicle drives the same shipment from the hub to the + # drop-off location. + # + # Note: gRPC and REST APIs use different field naming conventions. For example, + # the `Task.journey_sharing_info` field in the gRPC API and the + # `Task.journeySharingInfo` field in the REST API refer to the same + # field. + # @!attribute [rw] name + # @return [::String] + # Must be in the format `providers/{provider}/tasks/{task}`. + # @!attribute [rw] type + # @return [::Google::Maps::FleetEngine::Delivery::V1::Task::Type] + # Required. Immutable. Defines the type of the Task. For example, a break or + # shipment. + # @!attribute [rw] state + # @return [::Google::Maps::FleetEngine::Delivery::V1::Task::State] + # Required. The current execution state of the Task. + # @!attribute [rw] task_outcome + # @return [::Google::Maps::FleetEngine::Delivery::V1::Task::TaskOutcome] + # The outcome of the Task. + # @!attribute [rw] task_outcome_time + # @return [::Google::Protobuf::Timestamp] + # The timestamp that indicates when the `Task`'s outcome was set by the + # provider. + # @!attribute [rw] task_outcome_location + # @return [::Google::Maps::FleetEngine::Delivery::V1::LocationInfo] + # The location where the `Task`'s outcome was set. This value is updated as + # part of `UpdateTask`. If this value isn't explicitly updated by the + # provider, then Fleet Engine populates it by default with the last known + # vehicle location (the *raw* location). + # @!attribute [rw] task_outcome_location_source + # @return [::Google::Maps::FleetEngine::Delivery::V1::Task::TaskOutcomeLocationSource] + # Indicates where the value of the `task_outcome_location` came from. + # @!attribute [rw] tracking_id + # @return [::String] + # Immutable. This field facilitates the storing of an ID so you can avoid + # using a complicated mapping. You cannot set `tracking_id` for Tasks of type + # `UNAVAILABLE` and `SCHEDULED_STOP`. These IDs are subject to the + # following restrictions: + # + # * Must be a valid Unicode string. + # * Limited to a maximum length of 64 characters. + # * Normalized according to [Unicode Normalization Form C] + # (http://www.unicode.org/reports/tr15/). + # * May not contain any of the following ASCII characters: '/', ':', '?', + # ',', or '#'. + # @!attribute [r] delivery_vehicle_id + # @return [::String] + # Output only. The ID of the vehicle that is executing this Task. Delivery + # Vehicle IDs are subject to the following restrictions: + # + # * Must be a valid Unicode string. + # * Limited to a maximum length of 64 characters. + # * Normalized according to [Unicode Normalization Form C] + # (http://www.unicode.org/reports/tr15/). + # * May not contain any of the following ASCII characters: '/', ':', '?', + # ',', or '#'. + # @!attribute [rw] planned_location + # @return [::Google::Maps::FleetEngine::Delivery::V1::LocationInfo] + # Immutable. The location where the Task will be completed. + # Optional for `UNAVAILABLE` Tasks, but required for all other Tasks. + # @!attribute [rw] task_duration + # @return [::Google::Protobuf::Duration] + # Required. Immutable. The time needed to execute a Task at this location. + # @!attribute [rw] target_time_window + # @return [::Google::Maps::FleetEngine::Delivery::V1::TimeWindow] + # The time window during which the task should be completed. + # @!attribute [r] journey_sharing_info + # @return [::Google::Maps::FleetEngine::Delivery::V1::Task::JourneySharingInfo] + # Output only. Journey sharing-specific fields. Not populated when state is + # `CLOSED`. + # @!attribute [rw] task_tracking_view_config + # @return [::Google::Maps::FleetEngine::Delivery::V1::TaskTrackingViewConfig] + # The configuration for task tracking that specifies which data elements are + # visible to the end users under what circumstances. + # @!attribute [rw] attributes + # @return [::Array<::Google::Maps::FleetEngine::Delivery::V1::TaskAttribute>] + # A list of custom Task attributes. Each attribute must have a unique key. + class Task + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Journey sharing specific fields. + # @!attribute [rw] remaining_vehicle_journey_segments + # @return [::Array<::Google::Maps::FleetEngine::Delivery::V1::VehicleJourneySegment>] + # Tracking information for the stops that the assigned vehicle will make + # before it completes this Task. Note that this list can contain stops + # from other tasks. + # + # The first segment, + # `Task.journey_sharing_info.remaining_vehicle_journey_segments[0]` (gRPC) + # or `Task.journeySharingInfo.remainingVehicleJourneySegments[0]` (REST), + # contains route information from the driver's last known location to the + # upcoming `VehicleStop`. Current route information usually comes from the + # driver app, except for some cases noted in the documentation for + # {::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle#current_route_segment DeliveryVehicle.current_route_segment}. + # The other segments in + # `Task.journey_sharing_info.remaining_vehicle_journey_segments` (gRPC) or + # `Task.journeySharingInfo.remainingVehicleJourneySegments` (REST) are + # populated by Fleet Engine. They provide route information between the + # remaining `VehicleStops`. + # @!attribute [rw] last_location + # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicleLocation] + # Indicates the vehicle's last reported location of the assigned vehicle. + # @!attribute [rw] last_location_snappable + # @return [::Boolean] + # Indicates whether the vehicle's lastLocation can be snapped to + # the `current_route_segment`. This value is False if either + # `last_location` or `current_route_segment` don't exist. This value is + # computed by Fleet Engine. Updates from clients are ignored. + class JourneySharingInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The type of Task. + module Type + # Default, the Task type is unknown. + TYPE_UNSPECIFIED = 0 + + # A pickup Task is the action taken for picking up a shipment from a + # customer. Depot or feeder vehicle pickups should use the `SCHEDULED_STOP` + # type. + PICKUP = 1 + + # A delivery Task is the action taken for delivering a shipment to an end + # customer. Depot or feeder vehicle dropoffs should use the + # `SCHEDULED_STOP` type. + DELIVERY = 2 + + # A scheduled stop Task is used for planning purposes. For example, it + # could represent picking up or dropping off shipments from feeder vehicles + # or depots. It shouldn't be used for any shipments that are picked up or + # dropped off from an end customer. + SCHEDULED_STOP = 3 + + # A Task that means the Vehicle is not available for service. For example, + # this can happen when the driver takes a break, or when the vehicle + # is being refueled. + UNAVAILABLE = 4 + end + + # The state of a Task. This indicates the Tasks's progress. + module State + # Default. Used for an unspecified or unrecognized Task state. + STATE_UNSPECIFIED = 0 + + # Either the Task has not yet been assigned to a delivery vehicle, or the + # delivery vehicle has not yet passed the `Task`'s assigned vehicle stop. + OPEN = 1 + + # When the vehicle passes the vehicle stop for this Task. + CLOSED = 2 + end + + # The outcome of attempting to execute a Task. When `TaskState` is closed, + # `TaskOutcome` indicates whether it was completed successfully. + module TaskOutcome + # The Task outcome before its value is set. + TASK_OUTCOME_UNSPECIFIED = 0 + + # The Task completed successfully. + SUCCEEDED = 1 + + # Either the Task couldn't be completed, or it was cancelled. + FAILED = 2 + end + + # The identity of the source that populated the `task_outcome_location`. + module TaskOutcomeLocationSource + # The task outcome before it is set. + TASK_OUTCOME_LOCATION_SOURCE_UNSPECIFIED = 0 + + # The provider-specified the `task_outcome_location`. + PROVIDER = 2 + + # The provider didn't specify the `task_outcome_location`, so Fleet Engine + # used the last known vehicle location. + LAST_VEHICLE_LOCATION = 3 + end + end + + # The configuration message that defines when a data element of a Task should + # be visible to the end users. + # @!attribute [rw] route_polyline_points_visibility + # @return [::Google::Maps::FleetEngine::Delivery::V1::TaskTrackingViewConfig::VisibilityOption] + # The field that specifies when route polyline points can be visible. If this + # field is not specified, the project level default visibility configuration + # for this data will be used. + # @!attribute [rw] estimated_arrival_time_visibility + # @return [::Google::Maps::FleetEngine::Delivery::V1::TaskTrackingViewConfig::VisibilityOption] + # The field that specifies when estimated arrival time can be visible. If + # this field is not specified, the project level default visibility + # configuration for this data will be used. + # @!attribute [rw] estimated_task_completion_time_visibility + # @return [::Google::Maps::FleetEngine::Delivery::V1::TaskTrackingViewConfig::VisibilityOption] + # The field that specifies when estimated task completion time can be + # visible. If this field is not specified, the project level default + # visibility configuration for this data will be used. + # @!attribute [rw] remaining_driving_distance_visibility + # @return [::Google::Maps::FleetEngine::Delivery::V1::TaskTrackingViewConfig::VisibilityOption] + # The field that specifies when remaining driving distance can be visible. If + # this field is not specified, the project level default visibility + # configuration for this data will be used. + # @!attribute [rw] remaining_stop_count_visibility + # @return [::Google::Maps::FleetEngine::Delivery::V1::TaskTrackingViewConfig::VisibilityOption] + # The field that specifies when remaining stop count can be visible. If this + # field is not specified, the project level default visibility configuration + # for this data will be used. + # @!attribute [rw] vehicle_location_visibility + # @return [::Google::Maps::FleetEngine::Delivery::V1::TaskTrackingViewConfig::VisibilityOption] + # The field that specifies when vehicle location can be visible. If this + # field is not specified, the project level default visibility configuration + # for this data will be used. + class TaskTrackingViewConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The option message that defines when a data element should be visible to + # the end users. + # @!attribute [rw] remaining_stop_count_threshold + # @return [::Integer] + # This data element is visible to the end users if the remaining stop + # count <= remaining_stop_count_threshold. + # @!attribute [rw] duration_until_estimated_arrival_time_threshold + # @return [::Google::Protobuf::Duration] + # This data element is visible to the end users if the ETA to the stop + # <= duration_until_estimated_arrival_time_threshold. + # @!attribute [rw] remaining_driving_distance_meters_threshold + # @return [::Integer] + # This data element is visible to the end users if the remaining + # driving distance in meters <= + # remaining_driving_distance_meters_threshold. + # @!attribute [rw] always + # @return [::Boolean] + # If set to true, this data element is always visible to the end users + # with no thresholds. This field cannot be set to false. + # @!attribute [rw] never + # @return [::Boolean] + # If set to true, this data element is always hidden from the end users + # with no thresholds. This field cannot be set to false. + class VisibilityOption + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end + end + end +end diff --git a/google-maps-fleet_engine-delivery-v1/proto_docs/google/protobuf/duration.rb b/google-maps-fleet_engine-delivery-v1/proto_docs/google/protobuf/duration.rb new file mode 100644 index 000000000000..b5731a824060 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/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-maps-fleet_engine-delivery-v1/proto_docs/google/protobuf/field_mask.rb b/google-maps-fleet_engine-delivery-v1/proto_docs/google/protobuf/field_mask.rb new file mode 100644 index 000000000000..8e7abcf8f052 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/proto_docs/google/protobuf/field_mask.rb @@ -0,0 +1,229 @@ +# 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 + # `FieldMask` represents a set of symbolic field paths, for example: + # + # paths: "f.a" + # paths: "f.b.d" + # + # Here `f` represents a field in some root message, `a` and `b` + # fields in the message found in `f`, and `d` a field found in the + # message in `f.b`. + # + # Field masks are used to specify a subset of fields that should be + # returned by a get operation or modified by an update operation. + # Field masks also have a custom JSON encoding (see below). + # + # # Field Masks in Projections + # + # When used in the context of a projection, a response message or + # sub-message is filtered by the API to only contain those fields as + # specified in the mask. For example, if the mask in the previous + # example is applied to a response message as follows: + # + # f { + # a : 22 + # b { + # d : 1 + # x : 2 + # } + # y : 13 + # } + # z: 8 + # + # The result will not contain specific values for fields x,y and z + # (their value will be set to the default, and omitted in proto text + # output): + # + # + # f { + # a : 22 + # b { + # d : 1 + # } + # } + # + # A repeated field is not allowed except at the last position of a + # paths string. + # + # If a FieldMask object is not present in a get operation, the + # operation applies to all fields (as if a FieldMask of all fields + # had been specified). + # + # Note that a field mask does not necessarily apply to the + # top-level response message. In case of a REST get operation, the + # field mask applies directly to the response, but in case of a REST + # list operation, the mask instead applies to each individual message + # in the returned resource list. In case of a REST custom method, + # other definitions may be used. Where the mask applies will be + # clearly documented together with its declaration in the API. In + # any case, the effect on the returned resource/resources is required + # behavior for APIs. + # + # # Field Masks in Update Operations + # + # A field mask in update operations specifies which fields of the + # targeted resource are going to be updated. The API is required + # to only change the values of the fields as specified in the mask + # and leave the others untouched. If a resource is passed in to + # describe the updated values, the API ignores the values of all + # fields not covered by the mask. + # + # If a repeated field is specified for an update operation, new values will + # be appended to the existing repeated field in the target resource. Note that + # a repeated field is only allowed in the last position of a `paths` string. + # + # If a sub-message is specified in the last position of the field mask for an + # update operation, then new value will be merged into the existing sub-message + # in the target resource. + # + # For example, given the target message: + # + # f { + # b { + # d: 1 + # x: 2 + # } + # c: [1] + # } + # + # And an update message: + # + # f { + # b { + # d: 10 + # } + # c: [2] + # } + # + # then if the field mask is: + # + # paths: ["f.b", "f.c"] + # + # then the result will be: + # + # f { + # b { + # d: 10 + # x: 2 + # } + # c: [1, 2] + # } + # + # An implementation may provide options to override this default behavior for + # repeated and message fields. + # + # In order to reset a field's value to the default, the field must + # be in the mask and set to the default value in the provided resource. + # Hence, in order to reset all fields of a resource, provide a default + # instance of the resource and set all fields in the mask, or do + # not provide a mask as described below. + # + # If a field mask is not present on update, the operation applies to + # all fields (as if a field mask of all fields has been specified). + # Note that in the presence of schema evolution, this may mean that + # fields the client does not know and has therefore not filled into + # the request will be reset to their default. If this is unwanted + # behavior, a specific service may require a client to always specify + # a field mask, producing an error if not. + # + # As with get operations, the location of the resource which + # describes the updated values in the request message depends on the + # operation kind. In any case, the effect of the field mask is + # required to be honored by the API. + # + # ## Considerations for HTTP REST + # + # The HTTP kind of an update operation which uses a field mask must + # be set to PATCH instead of PUT in order to satisfy HTTP semantics + # (PUT must only be used for full updates). + # + # # JSON Encoding of Field Masks + # + # In JSON, a field mask is encoded as a single string where paths are + # separated by a comma. Fields name in each path are converted + # to/from lower-camel naming conventions. + # + # As an example, consider the following message declarations: + # + # message Profile { + # User user = 1; + # Photo photo = 2; + # } + # message User { + # string display_name = 1; + # string address = 2; + # } + # + # In proto a field mask for `Profile` may look as such: + # + # mask { + # paths: "user.display_name" + # paths: "photo" + # } + # + # In JSON, the same mask is represented as below: + # + # { + # mask: "user.displayName,photo" + # } + # + # # Field Masks and Oneof Fields + # + # Field masks treat fields in oneofs just as regular fields. Consider the + # following message: + # + # message SampleMessage { + # oneof test_oneof { + # string name = 4; + # SubMessage sub_message = 9; + # } + # } + # + # The field mask can be: + # + # mask { + # paths: "name" + # } + # + # Or: + # + # mask { + # paths: "sub_message" + # } + # + # Note that oneof type names ("test_oneof" in this case) cannot be used in + # paths. + # + # ## Field Mask Verification + # + # The implementation of any API method which has a FieldMask type field in the + # request should verify the included field paths, and return an + # `INVALID_ARGUMENT` error if any path is unmappable. + # @!attribute [rw] paths + # @return [::Array<::String>] + # The set of field mask paths. + class FieldMask + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-maps-fleet_engine-delivery-v1/proto_docs/google/protobuf/timestamp.rb b/google-maps-fleet_engine-delivery-v1/proto_docs/google/protobuf/timestamp.rb new file mode 100644 index 000000000000..4ac9c4801a3f --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/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-maps-fleet_engine-delivery-v1/proto_docs/google/protobuf/wrappers.rb b/google-maps-fleet_engine-delivery-v1/proto_docs/google/protobuf/wrappers.rb new file mode 100644 index 000000000000..5160138862c2 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/proto_docs/google/protobuf/wrappers.rb @@ -0,0 +1,121 @@ +# 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 + # Wrapper message for `double`. + # + # The JSON representation for `DoubleValue` is JSON number. + # @!attribute [rw] value + # @return [::Float] + # The double value. + class DoubleValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `float`. + # + # The JSON representation for `FloatValue` is JSON number. + # @!attribute [rw] value + # @return [::Float] + # The float value. + class FloatValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `int64`. + # + # The JSON representation for `Int64Value` is JSON string. + # @!attribute [rw] value + # @return [::Integer] + # The int64 value. + class Int64Value + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `uint64`. + # + # The JSON representation for `UInt64Value` is JSON string. + # @!attribute [rw] value + # @return [::Integer] + # The uint64 value. + class UInt64Value + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `int32`. + # + # The JSON representation for `Int32Value` is JSON number. + # @!attribute [rw] value + # @return [::Integer] + # The int32 value. + class Int32Value + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `uint32`. + # + # The JSON representation for `UInt32Value` is JSON number. + # @!attribute [rw] value + # @return [::Integer] + # The uint32 value. + class UInt32Value + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `bool`. + # + # The JSON representation for `BoolValue` is JSON `true` and `false`. + # @!attribute [rw] value + # @return [::Boolean] + # The bool value. + class BoolValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `string`. + # + # The JSON representation for `StringValue` is JSON string. + # @!attribute [rw] value + # @return [::String] + # The string value. + class StringValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `bytes`. + # + # The JSON representation for `BytesValue` is JSON string. + # @!attribute [rw] value + # @return [::String] + # The bytes value. + class BytesValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-maps-fleet_engine-delivery-v1/proto_docs/google/type/latlng.rb b/google-maps-fleet_engine-delivery-v1/proto_docs/google/type/latlng.rb new file mode 100644 index 000000000000..0d9e1c6995f8 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/proto_docs/google/type/latlng.rb @@ -0,0 +1,38 @@ +# 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 Type + # An object that represents a latitude/longitude pair. This is expressed as a + # pair of doubles to represent degrees latitude and degrees longitude. Unless + # specified otherwise, this must conform to the + # WGS84 + # standard. Values must be within normalized ranges. + # @!attribute [rw] latitude + # @return [::Float] + # The latitude in degrees. It must be in the range [-90.0, +90.0]. + # @!attribute [rw] longitude + # @return [::Float] + # The longitude in degrees. It must be in the range [-180.0, +180.0]. + class LatLng + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-maps-fleet_engine-delivery-v1/snippets/Gemfile b/google-maps-fleet_engine-delivery-v1/snippets/Gemfile new file mode 100644 index 000000000000..439a18a97a9b --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/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-maps-fleet_engine-delivery-v1", path: "../" +else + gem "google-maps-fleet_engine-delivery-v1" +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-maps-fleet_engine-delivery-v1/snippets/delivery_service/batch_create_tasks.rb b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/batch_create_tasks.rb new file mode 100644 index 000000000000..7010b3247d8e --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/batch_create_tasks.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 fleetenginedelivery_v1_generated_DeliveryService_BatchCreateTasks_sync] +require "google/maps/fleet_engine/delivery/v1" + +## +# Snippet for the batch_create_tasks call in the DeliveryService 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::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#batch_create_tasks. +# +def batch_create_tasks + # Create a client object. The client can be reused for multiple calls. + client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest.new + + # Call the batch_create_tasks method. + result = client.batch_create_tasks request + + # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksResponse. + p result +end +# [END fleetenginedelivery_v1_generated_DeliveryService_BatchCreateTasks_sync] diff --git a/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/create_delivery_vehicle.rb b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/create_delivery_vehicle.rb new file mode 100644 index 000000000000..6a0fe81aab15 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/create_delivery_vehicle.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 fleetenginedelivery_v1_generated_DeliveryService_CreateDeliveryVehicle_sync] +require "google/maps/fleet_engine/delivery/v1" + +## +# Snippet for the create_delivery_vehicle call in the DeliveryService 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::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#create_delivery_vehicle. +# +def create_delivery_vehicle + # Create a client object. The client can be reused for multiple calls. + client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest.new + + # Call the create_delivery_vehicle method. + result = client.create_delivery_vehicle request + + # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle. + p result +end +# [END fleetenginedelivery_v1_generated_DeliveryService_CreateDeliveryVehicle_sync] diff --git a/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/create_task.rb b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/create_task.rb new file mode 100644 index 000000000000..8e25a5d300cc --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/create_task.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 fleetenginedelivery_v1_generated_DeliveryService_CreateTask_sync] +require "google/maps/fleet_engine/delivery/v1" + +## +# Snippet for the create_task call in the DeliveryService 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::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#create_task. +# +def create_task + # Create a client object. The client can be reused for multiple calls. + client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest.new + + # Call the create_task method. + result = client.create_task request + + # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::Task. + p result +end +# [END fleetenginedelivery_v1_generated_DeliveryService_CreateTask_sync] diff --git a/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/get_delivery_vehicle.rb b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/get_delivery_vehicle.rb new file mode 100644 index 000000000000..2208fb1f955e --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/get_delivery_vehicle.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 fleetenginedelivery_v1_generated_DeliveryService_GetDeliveryVehicle_sync] +require "google/maps/fleet_engine/delivery/v1" + +## +# Snippet for the get_delivery_vehicle call in the DeliveryService 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::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#get_delivery_vehicle. +# +def get_delivery_vehicle + # Create a client object. The client can be reused for multiple calls. + client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest.new + + # Call the get_delivery_vehicle method. + result = client.get_delivery_vehicle request + + # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle. + p result +end +# [END fleetenginedelivery_v1_generated_DeliveryService_GetDeliveryVehicle_sync] diff --git a/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/get_task.rb b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/get_task.rb new file mode 100644 index 000000000000..c23dda7faa9a --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/get_task.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 fleetenginedelivery_v1_generated_DeliveryService_GetTask_sync] +require "google/maps/fleet_engine/delivery/v1" + +## +# Snippet for the get_task call in the DeliveryService 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::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#get_task. +# +def get_task + # Create a client object. The client can be reused for multiple calls. + client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest.new + + # Call the get_task method. + result = client.get_task request + + # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::Task. + p result +end +# [END fleetenginedelivery_v1_generated_DeliveryService_GetTask_sync] diff --git a/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/get_task_tracking_info.rb b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/get_task_tracking_info.rb new file mode 100644 index 000000000000..ba53a2eaed06 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/get_task_tracking_info.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 fleetenginedelivery_v1_generated_DeliveryService_GetTaskTrackingInfo_sync] +require "google/maps/fleet_engine/delivery/v1" + +## +# Snippet for the get_task_tracking_info call in the DeliveryService 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::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#get_task_tracking_info. +# +def get_task_tracking_info + # Create a client object. The client can be reused for multiple calls. + client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest.new + + # Call the get_task_tracking_info method. + result = client.get_task_tracking_info request + + # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::TaskTrackingInfo. + p result +end +# [END fleetenginedelivery_v1_generated_DeliveryService_GetTaskTrackingInfo_sync] diff --git a/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/list_delivery_vehicles.rb b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/list_delivery_vehicles.rb new file mode 100644 index 000000000000..f271d3d21afb --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/list_delivery_vehicles.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 fleetenginedelivery_v1_generated_DeliveryService_ListDeliveryVehicles_sync] +require "google/maps/fleet_engine/delivery/v1" + +## +# Snippet for the list_delivery_vehicles call in the DeliveryService 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::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#list_delivery_vehicles. +# +def list_delivery_vehicles + # Create a client object. The client can be reused for multiple calls. + client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest.new + + # Call the list_delivery_vehicles method. + result = client.list_delivery_vehicles 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::Maps::FleetEngine::Delivery::V1::DeliveryVehicle. + p item + end +end +# [END fleetenginedelivery_v1_generated_DeliveryService_ListDeliveryVehicles_sync] diff --git a/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/list_tasks.rb b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/list_tasks.rb new file mode 100644 index 000000000000..87ebb9b9f62c --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/list_tasks.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 fleetenginedelivery_v1_generated_DeliveryService_ListTasks_sync] +require "google/maps/fleet_engine/delivery/v1" + +## +# Snippet for the list_tasks call in the DeliveryService 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::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#list_tasks. +# +def list_tasks + # Create a client object. The client can be reused for multiple calls. + client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest.new + + # Call the list_tasks method. + result = client.list_tasks 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::Maps::FleetEngine::Delivery::V1::Task. + p item + end +end +# [END fleetenginedelivery_v1_generated_DeliveryService_ListTasks_sync] diff --git a/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/search_tasks.rb b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/search_tasks.rb new file mode 100644 index 000000000000..d706ab807135 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/search_tasks.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 fleetenginedelivery_v1_generated_DeliveryService_SearchTasks_sync] +require "google/maps/fleet_engine/delivery/v1" + +## +# Snippet for the search_tasks call in the DeliveryService 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::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#search_tasks. +# +def search_tasks + # Create a client object. The client can be reused for multiple calls. + client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Maps::FleetEngine::Delivery::V1::SearchTasksRequest.new + + # Call the search_tasks method. + result = client.search_tasks 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::Maps::FleetEngine::Delivery::V1::Task. + p item + end +end +# [END fleetenginedelivery_v1_generated_DeliveryService_SearchTasks_sync] diff --git a/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/update_delivery_vehicle.rb b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/update_delivery_vehicle.rb new file mode 100644 index 000000000000..2d0d5bae808f --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/update_delivery_vehicle.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 fleetenginedelivery_v1_generated_DeliveryService_UpdateDeliveryVehicle_sync] +require "google/maps/fleet_engine/delivery/v1" + +## +# Snippet for the update_delivery_vehicle call in the DeliveryService 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::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#update_delivery_vehicle. +# +def update_delivery_vehicle + # Create a client object. The client can be reused for multiple calls. + client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest.new + + # Call the update_delivery_vehicle method. + result = client.update_delivery_vehicle request + + # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle. + p result +end +# [END fleetenginedelivery_v1_generated_DeliveryService_UpdateDeliveryVehicle_sync] diff --git a/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/update_task.rb b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/update_task.rb new file mode 100644 index 000000000000..f8223a66b079 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/snippets/delivery_service/update_task.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 fleetenginedelivery_v1_generated_DeliveryService_UpdateTask_sync] +require "google/maps/fleet_engine/delivery/v1" + +## +# Snippet for the update_task call in the DeliveryService 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::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#update_task. +# +def update_task + # Create a client object. The client can be reused for multiple calls. + client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest.new + + # Call the update_task method. + result = client.update_task request + + # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::Task. + p result +end +# [END fleetenginedelivery_v1_generated_DeliveryService_UpdateTask_sync] diff --git a/google-maps-fleet_engine-delivery-v1/snippets/snippet_metadata_maps.fleetengine.delivery.v1.json b/google-maps-fleet_engine-delivery-v1/snippets/snippet_metadata_maps.fleetengine.delivery.v1.json new file mode 100644 index 000000000000..a62b9e137db6 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/snippets/snippet_metadata_maps.fleetengine.delivery.v1.json @@ -0,0 +1,455 @@ +{ + "client_library": { + "name": "google-maps-fleet_engine-delivery-v1", + "version": "", + "language": "RUBY", + "apis": [ + { + "id": "maps.fleetengine.delivery.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "region_tag": "fleetenginedelivery_v1_generated_DeliveryService_CreateDeliveryVehicle_sync", + "title": "Snippet for the create_delivery_vehicle call in the DeliveryService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#create_delivery_vehicle.", + "file": "delivery_service/create_delivery_vehicle.rb", + "language": "RUBY", + "client_method": { + "short_name": "create_delivery_vehicle", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#create_delivery_vehicle", + "async": false, + "parameters": [ + { + "type": "::Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest", + "name": "request" + } + ], + "result_type": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle", + "client": { + "short_name": "DeliveryService::Client", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client" + }, + "method": { + "short_name": "CreateDeliveryVehicle", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService.CreateDeliveryVehicle", + "service": { + "short_name": "DeliveryService", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "fleetenginedelivery_v1_generated_DeliveryService_GetDeliveryVehicle_sync", + "title": "Snippet for the get_delivery_vehicle call in the DeliveryService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#get_delivery_vehicle.", + "file": "delivery_service/get_delivery_vehicle.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_delivery_vehicle", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#get_delivery_vehicle", + "async": false, + "parameters": [ + { + "type": "::Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest", + "name": "request" + } + ], + "result_type": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle", + "client": { + "short_name": "DeliveryService::Client", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client" + }, + "method": { + "short_name": "GetDeliveryVehicle", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService.GetDeliveryVehicle", + "service": { + "short_name": "DeliveryService", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "fleetenginedelivery_v1_generated_DeliveryService_UpdateDeliveryVehicle_sync", + "title": "Snippet for the update_delivery_vehicle call in the DeliveryService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#update_delivery_vehicle.", + "file": "delivery_service/update_delivery_vehicle.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_delivery_vehicle", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#update_delivery_vehicle", + "async": false, + "parameters": [ + { + "type": "::Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest", + "name": "request" + } + ], + "result_type": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle", + "client": { + "short_name": "DeliveryService::Client", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client" + }, + "method": { + "short_name": "UpdateDeliveryVehicle", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService.UpdateDeliveryVehicle", + "service": { + "short_name": "DeliveryService", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "fleetenginedelivery_v1_generated_DeliveryService_BatchCreateTasks_sync", + "title": "Snippet for the batch_create_tasks call in the DeliveryService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#batch_create_tasks.", + "file": "delivery_service/batch_create_tasks.rb", + "language": "RUBY", + "client_method": { + "short_name": "batch_create_tasks", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#batch_create_tasks", + "async": false, + "parameters": [ + { + "type": "::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest", + "name": "request" + } + ], + "result_type": "::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksResponse", + "client": { + "short_name": "DeliveryService::Client", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client" + }, + "method": { + "short_name": "BatchCreateTasks", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService.BatchCreateTasks", + "service": { + "short_name": "DeliveryService", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "fleetenginedelivery_v1_generated_DeliveryService_CreateTask_sync", + "title": "Snippet for the create_task call in the DeliveryService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#create_task.", + "file": "delivery_service/create_task.rb", + "language": "RUBY", + "client_method": { + "short_name": "create_task", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#create_task", + "async": false, + "parameters": [ + { + "type": "::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest", + "name": "request" + } + ], + "result_type": "::Google::Maps::FleetEngine::Delivery::V1::Task", + "client": { + "short_name": "DeliveryService::Client", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client" + }, + "method": { + "short_name": "CreateTask", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService.CreateTask", + "service": { + "short_name": "DeliveryService", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "fleetenginedelivery_v1_generated_DeliveryService_GetTask_sync", + "title": "Snippet for the get_task call in the DeliveryService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#get_task.", + "file": "delivery_service/get_task.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_task", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#get_task", + "async": false, + "parameters": [ + { + "type": "::Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest", + "name": "request" + } + ], + "result_type": "::Google::Maps::FleetEngine::Delivery::V1::Task", + "client": { + "short_name": "DeliveryService::Client", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client" + }, + "method": { + "short_name": "GetTask", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService.GetTask", + "service": { + "short_name": "DeliveryService", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "fleetenginedelivery_v1_generated_DeliveryService_SearchTasks_sync", + "title": "Snippet for the search_tasks call in the DeliveryService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#search_tasks.", + "file": "delivery_service/search_tasks.rb", + "language": "RUBY", + "client_method": { + "short_name": "search_tasks", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#search_tasks", + "async": false, + "parameters": [ + { + "type": "::Google::Maps::FleetEngine::Delivery::V1::SearchTasksRequest", + "name": "request" + } + ], + "result_type": "::Google::Maps::FleetEngine::Delivery::V1::SearchTasksResponse", + "client": { + "short_name": "DeliveryService::Client", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client" + }, + "method": { + "short_name": "SearchTasks", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService.SearchTasks", + "service": { + "short_name": "DeliveryService", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "fleetenginedelivery_v1_generated_DeliveryService_UpdateTask_sync", + "title": "Snippet for the update_task call in the DeliveryService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#update_task.", + "file": "delivery_service/update_task.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_task", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#update_task", + "async": false, + "parameters": [ + { + "type": "::Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest", + "name": "request" + } + ], + "result_type": "::Google::Maps::FleetEngine::Delivery::V1::Task", + "client": { + "short_name": "DeliveryService::Client", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client" + }, + "method": { + "short_name": "UpdateTask", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService.UpdateTask", + "service": { + "short_name": "DeliveryService", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "fleetenginedelivery_v1_generated_DeliveryService_ListTasks_sync", + "title": "Snippet for the list_tasks call in the DeliveryService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#list_tasks.", + "file": "delivery_service/list_tasks.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_tasks", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#list_tasks", + "async": false, + "parameters": [ + { + "type": "::Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest", + "name": "request" + } + ], + "result_type": "::Google::Maps::FleetEngine::Delivery::V1::ListTasksResponse", + "client": { + "short_name": "DeliveryService::Client", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client" + }, + "method": { + "short_name": "ListTasks", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService.ListTasks", + "service": { + "short_name": "DeliveryService", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "fleetenginedelivery_v1_generated_DeliveryService_GetTaskTrackingInfo_sync", + "title": "Snippet for the get_task_tracking_info call in the DeliveryService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#get_task_tracking_info.", + "file": "delivery_service/get_task_tracking_info.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_task_tracking_info", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#get_task_tracking_info", + "async": false, + "parameters": [ + { + "type": "::Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest", + "name": "request" + } + ], + "result_type": "::Google::Maps::FleetEngine::Delivery::V1::TaskTrackingInfo", + "client": { + "short_name": "DeliveryService::Client", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client" + }, + "method": { + "short_name": "GetTaskTrackingInfo", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService.GetTaskTrackingInfo", + "service": { + "short_name": "DeliveryService", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "fleetenginedelivery_v1_generated_DeliveryService_ListDeliveryVehicles_sync", + "title": "Snippet for the list_delivery_vehicles call in the DeliveryService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#list_delivery_vehicles.", + "file": "delivery_service/list_delivery_vehicles.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_delivery_vehicles", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client#list_delivery_vehicles", + "async": false, + "parameters": [ + { + "type": "::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest", + "name": "request" + } + ], + "result_type": "::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesResponse", + "client": { + "short_name": "DeliveryService::Client", + "full_name": "::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client" + }, + "method": { + "short_name": "ListDeliveryVehicles", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService.ListDeliveryVehicles", + "service": { + "short_name": "DeliveryService", + "full_name": "maps.fleetengine.delivery.v1.DeliveryService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + } + ] +} \ No newline at end of file diff --git a/google-maps-fleet_engine-delivery-v1/test/google/maps/fleet_engine/delivery/v1/delivery_service_paths_test.rb b/google-maps-fleet_engine-delivery-v1/test/google/maps/fleet_engine/delivery/v1/delivery_service_paths_test.rb new file mode 100644 index 000000000000..218225a3aeb5 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/test/google/maps/fleet_engine/delivery/v1/delivery_service_paths_test.rb @@ -0,0 +1,83 @@ +# 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/maps/fleet_engine/delivery/v1/delivery_service" + +class ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + end + + def test_delivery_vehicle_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.delivery_vehicle_path provider: "value0", vehicle: "value1" + assert_equal "providers/value0/deliveryVehicles/value1", path + end + end + + def test_provider_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.provider_path provider: "value0" + assert_equal "providers/value0", path + end + end + + def test_task_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.task_path provider: "value0", task: "value1" + assert_equal "providers/value0/tasks/value1", path + end + end + + def test_task_tracking_info_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.task_tracking_info_path provider: "value0", tracking: "value1" + assert_equal "providers/value0/taskTrackingInfo/value1", path + end + end +end diff --git a/google-maps-fleet_engine-delivery-v1/test/google/maps/fleet_engine/delivery/v1/delivery_service_rest_test.rb b/google-maps-fleet_engine-delivery-v1/test/google/maps/fleet_engine/delivery/v1/delivery_service_rest_test.rb new file mode 100644 index 000000000000..48b7a41e7208 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/test/google/maps/fleet_engine/delivery/v1/delivery_service_rest_test.rb @@ -0,0 +1,713 @@ +# 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/maps/fleetengine/delivery/v1/delivery_api_pb" +require "google/maps/fleet_engine/delivery/v1/delivery_service/rest" + + +class ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::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_create_delivery_vehicle + # Create test objects. + client_result = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + header = {} + parent = "hello world" + delivery_vehicle_id = "hello world" + delivery_vehicle = {} + + create_delivery_vehicle_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::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::ServiceStub.stub :transcode_create_delivery_vehicle_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, create_delivery_vehicle_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.create_delivery_vehicle({ header: header, parent: parent, delivery_vehicle_id: delivery_vehicle_id, delivery_vehicle: delivery_vehicle }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.create_delivery_vehicle header: header, parent: parent, delivery_vehicle_id: delivery_vehicle_id, delivery_vehicle: delivery_vehicle do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.create_delivery_vehicle ::Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest.new(header: header, parent: parent, delivery_vehicle_id: delivery_vehicle_id, delivery_vehicle: delivery_vehicle) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.create_delivery_vehicle({ header: header, parent: parent, delivery_vehicle_id: delivery_vehicle_id, delivery_vehicle: delivery_vehicle }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.create_delivery_vehicle(::Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest.new(header: header, parent: parent, delivery_vehicle_id: delivery_vehicle_id, delivery_vehicle: delivery_vehicle), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, create_delivery_vehicle_client_stub.call_count + end + end + end + + def test_get_delivery_vehicle + # Create test objects. + client_result = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + header = {} + name = "hello world" + + get_delivery_vehicle_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::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::ServiceStub.stub :transcode_get_delivery_vehicle_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_delivery_vehicle_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_delivery_vehicle({ header: header, name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_delivery_vehicle header: header, name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_delivery_vehicle ::Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest.new(header: header, name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_delivery_vehicle({ header: header, name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_delivery_vehicle(::Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest.new(header: header, name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_delivery_vehicle_client_stub.call_count + end + end + end + + def test_update_delivery_vehicle + # Create test objects. + client_result = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + header = {} + delivery_vehicle = {} + update_mask = {} + + update_delivery_vehicle_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::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::ServiceStub.stub :transcode_update_delivery_vehicle_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_delivery_vehicle_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.update_delivery_vehicle({ header: header, delivery_vehicle: delivery_vehicle, update_mask: update_mask }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.update_delivery_vehicle header: header, delivery_vehicle: delivery_vehicle, update_mask: update_mask do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.update_delivery_vehicle ::Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest.new(header: header, delivery_vehicle: delivery_vehicle, update_mask: update_mask) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.update_delivery_vehicle({ header: header, delivery_vehicle: delivery_vehicle, update_mask: update_mask }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.update_delivery_vehicle(::Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest.new(header: header, delivery_vehicle: delivery_vehicle, update_mask: update_mask), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_delivery_vehicle_client_stub.call_count + end + end + end + + def test_batch_create_tasks + # Create test objects. + client_result = ::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + header = {} + parent = "hello world" + requests = [{}] + + batch_create_tasks_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::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::ServiceStub.stub :transcode_batch_create_tasks_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, batch_create_tasks_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.batch_create_tasks({ header: header, parent: parent, requests: requests }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.batch_create_tasks header: header, parent: parent, requests: requests do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.batch_create_tasks ::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest.new(header: header, parent: parent, requests: requests) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.batch_create_tasks({ header: header, parent: parent, requests: requests }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.batch_create_tasks(::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest.new(header: header, parent: parent, requests: requests), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, batch_create_tasks_client_stub.call_count + end + end + end + + def test_create_task + # Create test objects. + client_result = ::Google::Maps::FleetEngine::Delivery::V1::Task.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + header = {} + parent = "hello world" + task_id = "hello world" + task = {} + + create_task_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::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::ServiceStub.stub :transcode_create_task_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, create_task_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.create_task({ header: header, parent: parent, task_id: task_id, task: task }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.create_task header: header, parent: parent, task_id: task_id, task: task do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.create_task ::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest.new(header: header, parent: parent, task_id: task_id, task: task) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.create_task({ header: header, parent: parent, task_id: task_id, task: task }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.create_task(::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest.new(header: header, parent: parent, task_id: task_id, task: task), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, create_task_client_stub.call_count + end + end + end + + def test_get_task + # Create test objects. + client_result = ::Google::Maps::FleetEngine::Delivery::V1::Task.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + header = {} + name = "hello world" + + get_task_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::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::ServiceStub.stub :transcode_get_task_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_task_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_task({ header: header, name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_task header: header, name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_task ::Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest.new(header: header, name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_task({ header: header, name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_task(::Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest.new(header: header, name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_task_client_stub.call_count + end + end + end + + def test_search_tasks + # Create test objects. + client_result = ::Google::Maps::FleetEngine::Delivery::V1::SearchTasksResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + header = {} + parent = "hello world" + tracking_id = "hello world" + page_size = 42 + page_token = "hello world" + + search_tasks_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::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::ServiceStub.stub :transcode_search_tasks_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, search_tasks_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.search_tasks({ header: header, parent: parent, tracking_id: tracking_id, page_size: page_size, page_token: page_token }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.search_tasks header: header, parent: parent, tracking_id: tracking_id, page_size: page_size, page_token: page_token do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.search_tasks ::Google::Maps::FleetEngine::Delivery::V1::SearchTasksRequest.new(header: header, parent: parent, tracking_id: tracking_id, 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.search_tasks({ header: header, parent: parent, tracking_id: tracking_id, 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.search_tasks(::Google::Maps::FleetEngine::Delivery::V1::SearchTasksRequest.new(header: header, parent: parent, tracking_id: tracking_id, 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, search_tasks_client_stub.call_count + end + end + end + + def test_update_task + # Create test objects. + client_result = ::Google::Maps::FleetEngine::Delivery::V1::Task.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + header = {} + task = {} + update_mask = {} + + update_task_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::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::ServiceStub.stub :transcode_update_task_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_task_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.update_task({ header: header, task: task, update_mask: update_mask }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.update_task header: header, task: task, update_mask: update_mask do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.update_task ::Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest.new(header: header, task: task, update_mask: update_mask) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.update_task({ header: header, task: task, update_mask: update_mask }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.update_task(::Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest.new(header: header, task: task, update_mask: update_mask), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_task_client_stub.call_count + end + end + end + + def test_list_tasks + # Create test objects. + client_result = ::Google::Maps::FleetEngine::Delivery::V1::ListTasksResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + header = {} + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + + list_tasks_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::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::ServiceStub.stub :transcode_list_tasks_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_tasks_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_tasks({ header: header, parent: parent, page_size: page_size, page_token: page_token, filter: filter }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_tasks header: header, parent: parent, page_size: page_size, page_token: page_token, filter: filter do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_tasks ::Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest.new(header: header, parent: parent, page_size: page_size, page_token: page_token, filter: filter) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_tasks({ header: header, parent: parent, page_size: page_size, page_token: page_token, filter: filter }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_tasks(::Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest.new(header: header, parent: parent, page_size: page_size, page_token: page_token, filter: filter), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_tasks_client_stub.call_count + end + end + end + + def test_get_task_tracking_info + # Create test objects. + client_result = ::Google::Maps::FleetEngine::Delivery::V1::TaskTrackingInfo.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + header = {} + name = "hello world" + + get_task_tracking_info_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::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::ServiceStub.stub :transcode_get_task_tracking_info_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_task_tracking_info_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_task_tracking_info({ header: header, name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_task_tracking_info header: header, name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_task_tracking_info ::Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest.new(header: header, name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_task_tracking_info({ header: header, name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_task_tracking_info(::Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest.new(header: header, name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_task_tracking_info_client_stub.call_count + end + end + end + + def test_list_delivery_vehicles + # Create test objects. + client_result = ::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + header = {} + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + viewport = {} + + list_delivery_vehicles_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::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::ServiceStub.stub :transcode_list_delivery_vehicles_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_delivery_vehicles_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_delivery_vehicles({ header: header, parent: parent, page_size: page_size, page_token: page_token, filter: filter, viewport: viewport }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_delivery_vehicles header: header, parent: parent, page_size: page_size, page_token: page_token, filter: filter, viewport: viewport do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_delivery_vehicles ::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest.new(header: header, parent: parent, page_size: page_size, page_token: page_token, filter: filter, viewport: viewport) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_delivery_vehicles({ header: header, parent: parent, page_size: page_size, page_token: page_token, filter: filter, viewport: viewport }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_delivery_vehicles(::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest.new(header: header, parent: parent, page_size: page_size, page_token: page_token, filter: filter, viewport: viewport), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_delivery_vehicles_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::Maps::FleetEngine::Delivery::V1::DeliveryService::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::Maps::FleetEngine::Delivery::V1::DeliveryService::Rest::Client::Configuration, config + end +end diff --git a/google-maps-fleet_engine-delivery-v1/test/google/maps/fleet_engine/delivery/v1/delivery_service_test.rb b/google-maps-fleet_engine-delivery-v1/test/google/maps/fleet_engine/delivery/v1/delivery_service_test.rb new file mode 100644 index 000000000000..2a1d666e5564 --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/test/google/maps/fleet_engine/delivery/v1/delivery_service_test.rb @@ -0,0 +1,785 @@ +# 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/maps/fleetengine/delivery/v1/delivery_api_pb" +require "google/maps/fleetengine/delivery/v1/delivery_api_services_pb" +require "google/maps/fleet_engine/delivery/v1/delivery_service" + +class ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::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_create_delivery_vehicle + # Create GRPC objects. + grpc_response = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle.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. + header = {} + parent = "hello world" + delivery_vehicle_id = "hello world" + delivery_vehicle = {} + + create_delivery_vehicle_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :create_delivery_vehicle, name + assert_kind_of ::Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader), request["header"] + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["delivery_vehicle_id"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle), request["delivery_vehicle"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, create_delivery_vehicle_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.create_delivery_vehicle({ header: header, parent: parent, delivery_vehicle_id: delivery_vehicle_id, delivery_vehicle: delivery_vehicle }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.create_delivery_vehicle header: header, parent: parent, delivery_vehicle_id: delivery_vehicle_id, delivery_vehicle: delivery_vehicle do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.create_delivery_vehicle ::Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest.new(header: header, parent: parent, delivery_vehicle_id: delivery_vehicle_id, delivery_vehicle: delivery_vehicle) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.create_delivery_vehicle({ header: header, parent: parent, delivery_vehicle_id: delivery_vehicle_id, delivery_vehicle: delivery_vehicle }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.create_delivery_vehicle(::Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest.new(header: header, parent: parent, delivery_vehicle_id: delivery_vehicle_id, delivery_vehicle: delivery_vehicle), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, create_delivery_vehicle_client_stub.call_rpc_count + end + end + + def test_get_delivery_vehicle + # Create GRPC objects. + grpc_response = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle.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. + header = {} + name = "hello world" + + get_delivery_vehicle_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_delivery_vehicle, name + assert_kind_of ::Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader), request["header"] + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_delivery_vehicle_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_delivery_vehicle({ header: header, name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_delivery_vehicle header: header, name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_delivery_vehicle ::Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest.new(header: header, name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_delivery_vehicle({ header: header, 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_delivery_vehicle(::Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest.new(header: header, 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_delivery_vehicle_client_stub.call_rpc_count + end + end + + def test_update_delivery_vehicle + # Create GRPC objects. + grpc_response = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle.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. + header = {} + delivery_vehicle = {} + update_mask = {} + + update_delivery_vehicle_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_delivery_vehicle, name + assert_kind_of ::Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader), request["header"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle), request["delivery_vehicle"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_delivery_vehicle_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.update_delivery_vehicle({ header: header, delivery_vehicle: delivery_vehicle, update_mask: update_mask }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.update_delivery_vehicle header: header, delivery_vehicle: delivery_vehicle, update_mask: update_mask do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.update_delivery_vehicle ::Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest.new(header: header, delivery_vehicle: delivery_vehicle, update_mask: update_mask) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.update_delivery_vehicle({ header: header, delivery_vehicle: delivery_vehicle, update_mask: update_mask }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.update_delivery_vehicle(::Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest.new(header: header, delivery_vehicle: delivery_vehicle, update_mask: update_mask), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_delivery_vehicle_client_stub.call_rpc_count + end + end + + def test_batch_create_tasks + # Create GRPC objects. + grpc_response = ::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksResponse.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. + header = {} + parent = "hello world" + requests = [{}] + + batch_create_tasks_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :batch_create_tasks, name + assert_kind_of ::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader), request["header"] + assert_equal "hello world", request["parent"] + assert_kind_of ::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest, request["requests"].first + refute_nil options + end + + Gapic::ServiceStub.stub :new, batch_create_tasks_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.batch_create_tasks({ header: header, parent: parent, requests: requests }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.batch_create_tasks header: header, parent: parent, requests: requests do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.batch_create_tasks ::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest.new(header: header, parent: parent, requests: requests) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.batch_create_tasks({ header: header, parent: parent, requests: requests }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.batch_create_tasks(::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest.new(header: header, parent: parent, requests: requests), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, batch_create_tasks_client_stub.call_rpc_count + end + end + + def test_create_task + # Create GRPC objects. + grpc_response = ::Google::Maps::FleetEngine::Delivery::V1::Task.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. + header = {} + parent = "hello world" + task_id = "hello world" + task = {} + + create_task_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :create_task, name + assert_kind_of ::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader), request["header"] + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["task_id"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Maps::FleetEngine::Delivery::V1::Task), request["task"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, create_task_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.create_task({ header: header, parent: parent, task_id: task_id, task: task }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.create_task header: header, parent: parent, task_id: task_id, task: task do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.create_task ::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest.new(header: header, parent: parent, task_id: task_id, task: task) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.create_task({ header: header, parent: parent, task_id: task_id, task: task }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.create_task(::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest.new(header: header, parent: parent, task_id: task_id, task: task), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, create_task_client_stub.call_rpc_count + end + end + + def test_get_task + # Create GRPC objects. + grpc_response = ::Google::Maps::FleetEngine::Delivery::V1::Task.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. + header = {} + name = "hello world" + + get_task_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_task, name + assert_kind_of ::Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader), request["header"] + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_task_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_task({ header: header, name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_task header: header, name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_task ::Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest.new(header: header, name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_task({ header: header, 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_task(::Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest.new(header: header, 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_task_client_stub.call_rpc_count + end + end + + def test_search_tasks + # Create GRPC objects. + grpc_response = ::Google::Maps::FleetEngine::Delivery::V1::SearchTasksResponse.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. + header = {} + parent = "hello world" + tracking_id = "hello world" + page_size = 42 + page_token = "hello world" + + search_tasks_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :search_tasks, name + assert_kind_of ::Google::Maps::FleetEngine::Delivery::V1::SearchTasksRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader), request["header"] + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["tracking_id"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, search_tasks_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.search_tasks({ header: header, parent: parent, tracking_id: tracking_id, 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.search_tasks header: header, parent: parent, tracking_id: tracking_id, 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.search_tasks ::Google::Maps::FleetEngine::Delivery::V1::SearchTasksRequest.new(header: header, parent: parent, tracking_id: tracking_id, 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.search_tasks({ header: header, parent: parent, tracking_id: tracking_id, 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.search_tasks(::Google::Maps::FleetEngine::Delivery::V1::SearchTasksRequest.new(header: header, parent: parent, tracking_id: tracking_id, 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, search_tasks_client_stub.call_rpc_count + end + end + + def test_update_task + # Create GRPC objects. + grpc_response = ::Google::Maps::FleetEngine::Delivery::V1::Task.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. + header = {} + task = {} + update_mask = {} + + update_task_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_task, name + assert_kind_of ::Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader), request["header"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Maps::FleetEngine::Delivery::V1::Task), request["task"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_task_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.update_task({ header: header, task: task, update_mask: update_mask }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.update_task header: header, task: task, update_mask: update_mask do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.update_task ::Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest.new(header: header, task: task, update_mask: update_mask) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.update_task({ header: header, task: task, update_mask: update_mask }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.update_task(::Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest.new(header: header, task: task, update_mask: update_mask), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_task_client_stub.call_rpc_count + end + end + + def test_list_tasks + # Create GRPC objects. + grpc_response = ::Google::Maps::FleetEngine::Delivery::V1::ListTasksResponse.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. + header = {} + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + + list_tasks_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_tasks, name + assert_kind_of ::Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader), request["header"] + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal "hello world", request["filter"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_tasks_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_tasks({ header: header, parent: parent, page_size: page_size, page_token: page_token, filter: filter }) 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_tasks header: header, parent: parent, page_size: page_size, page_token: page_token, filter: filter 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_tasks ::Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest.new(header: header, parent: parent, page_size: page_size, page_token: page_token, filter: filter) 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_tasks({ header: header, parent: parent, page_size: page_size, page_token: page_token, filter: filter }, 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_tasks(::Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest.new(header: header, parent: parent, page_size: page_size, page_token: page_token, filter: filter), 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_tasks_client_stub.call_rpc_count + end + end + + def test_get_task_tracking_info + # Create GRPC objects. + grpc_response = ::Google::Maps::FleetEngine::Delivery::V1::TaskTrackingInfo.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. + header = {} + name = "hello world" + + get_task_tracking_info_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_task_tracking_info, name + assert_kind_of ::Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader), request["header"] + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_task_tracking_info_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_task_tracking_info({ header: header, name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_task_tracking_info header: header, name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_task_tracking_info ::Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest.new(header: header, name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_task_tracking_info({ header: header, 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_task_tracking_info(::Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest.new(header: header, 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_task_tracking_info_client_stub.call_rpc_count + end + end + + def test_list_delivery_vehicles + # Create GRPC objects. + grpc_response = ::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesResponse.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. + header = {} + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + viewport = {} + + list_delivery_vehicles_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_delivery_vehicles, name + assert_kind_of ::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader), request["header"] + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal "hello world", request["filter"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Geo::Type::Viewport), request["viewport"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_delivery_vehicles_client_stub do + # Create client + client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_delivery_vehicles({ header: header, parent: parent, page_size: page_size, page_token: page_token, filter: filter, viewport: viewport }) 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_delivery_vehicles header: header, parent: parent, page_size: page_size, page_token: page_token, filter: filter, viewport: viewport 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_delivery_vehicles ::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest.new(header: header, parent: parent, page_size: page_size, page_token: page_token, filter: filter, viewport: viewport) 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_delivery_vehicles({ header: header, parent: parent, page_size: page_size, page_token: page_token, filter: filter, viewport: viewport }, 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_delivery_vehicles(::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest.new(header: header, parent: parent, page_size: page_size, page_token: page_token, filter: filter, viewport: viewport), 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_delivery_vehicles_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::Maps::FleetEngine::Delivery::V1::DeliveryService::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::Maps::FleetEngine::Delivery::V1::DeliveryService::Client::Configuration, config + end +end diff --git a/google-maps-fleet_engine-delivery-v1/test/helper.rb b/google-maps-fleet_engine-delivery-v1/test/helper.rb new file mode 100644 index 000000000000..48407bca7edb --- /dev/null +++ b/google-maps-fleet_engine-delivery-v1/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 559e9c6db93f..b4608540ddac 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -1587,6 +1587,10 @@ "component": "google-identity-access_context_manager-v1", "version_file": "lib/google/identity/access_context_manager/v1/version.rb" }, + "google-maps-fleet_engine-delivery-v1": { + "component": "google-maps-fleet_engine-delivery-v1", + "version_file": "lib/google/maps/fleet_engine/delivery/v1/version.rb" + }, "google-maps-fleet_engine-v1": { "component": "google-maps-fleet_engine-v1", "version_file": "lib/google/maps/fleet_engine/v1/version.rb"