google-maps-fleet_engine-delivery-v1 0.a → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +122 -0
- data/README.md +144 -8
- data/lib/google/maps/fleet_engine/delivery/v1/delivery_service/client.rb +1505 -0
- data/lib/google/maps/fleet_engine/delivery/v1/delivery_service/credentials.rb +49 -0
- data/lib/google/maps/fleet_engine/delivery/v1/delivery_service/paths.rb +100 -0
- data/lib/google/maps/fleet_engine/delivery/v1/delivery_service/rest/client.rb +1399 -0
- data/lib/google/maps/fleet_engine/delivery/v1/delivery_service/rest/service_stub.rb +666 -0
- data/lib/google/maps/fleet_engine/delivery/v1/delivery_service/rest.rb +54 -0
- data/lib/google/maps/fleet_engine/delivery/v1/delivery_service.rb +57 -0
- data/lib/google/maps/fleet_engine/delivery/v1/rest.rb +39 -0
- data/lib/google/maps/fleet_engine/delivery/v1/version.rb +8 -3
- data/lib/google/maps/fleet_engine/delivery/v1.rb +47 -0
- data/lib/google/maps/fleetengine/delivery/v1/common_pb.rb +57 -0
- data/lib/google/maps/fleetengine/delivery/v1/delivery_api_pb.rb +73 -0
- data/lib/google/maps/fleetengine/delivery/v1/delivery_api_services_pb.rb +71 -0
- data/lib/google/maps/fleetengine/delivery/v1/delivery_vehicles_pb.rb +61 -0
- data/lib/google/maps/fleetengine/delivery/v1/header_pb.rb +48 -0
- data/lib/google/maps/fleetengine/delivery/v1/task_tracking_info_pb.rb +58 -0
- data/lib/google/maps/fleetengine/delivery/v1/tasks_pb.rb +62 -0
- data/lib/google-maps-fleet_engine-delivery-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +399 -0
- data/proto_docs/google/api/field_behavior.rb +85 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/api/resource.rb +222 -0
- data/proto_docs/google/api/routing.rb +459 -0
- data/proto_docs/google/geo/type/viewport.rb +70 -0
- data/proto_docs/google/maps/fleetengine/delivery/v1/common.rb +251 -0
- data/proto_docs/google/maps/fleetengine/delivery/v1/delivery_api.rb +359 -0
- data/proto_docs/google/maps/fleetengine/delivery/v1/delivery_vehicles.rb +269 -0
- data/proto_docs/google/maps/fleetengine/delivery/v1/header.rb +113 -0
- data/proto_docs/google/maps/fleetengine/delivery/v1/task_tracking_info.rb +91 -0
- data/proto_docs/google/maps/fleetengine/delivery/v1/tasks.rb +281 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/timestamp.rb +127 -0
- data/proto_docs/google/protobuf/wrappers.rb +121 -0
- data/proto_docs/google/type/latlng.rb +38 -0
- metadata +109 -13
@@ -0,0 +1,1505 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2024 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/maps/fleetengine/delivery/v1/delivery_api_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Maps
|
24
|
+
module FleetEngine
|
25
|
+
module Delivery
|
26
|
+
module V1
|
27
|
+
module DeliveryService
|
28
|
+
##
|
29
|
+
# Client for the DeliveryService service.
|
30
|
+
#
|
31
|
+
# The Last Mile Delivery service.
|
32
|
+
#
|
33
|
+
class Client
|
34
|
+
# @private
|
35
|
+
API_VERSION = ""
|
36
|
+
|
37
|
+
# @private
|
38
|
+
DEFAULT_ENDPOINT_TEMPLATE = "fleetengine.$UNIVERSE_DOMAIN$"
|
39
|
+
|
40
|
+
include Paths
|
41
|
+
|
42
|
+
# @private
|
43
|
+
attr_reader :delivery_service_stub
|
44
|
+
|
45
|
+
##
|
46
|
+
# Configure the DeliveryService Client class.
|
47
|
+
#
|
48
|
+
# See {::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client::Configuration}
|
49
|
+
# for a description of the configuration fields.
|
50
|
+
#
|
51
|
+
# @example
|
52
|
+
#
|
53
|
+
# # Modify the configuration for all DeliveryService clients
|
54
|
+
# ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.configure do |config|
|
55
|
+
# config.timeout = 10.0
|
56
|
+
# end
|
57
|
+
#
|
58
|
+
# @yield [config] Configure the Client client.
|
59
|
+
# @yieldparam config [Client::Configuration]
|
60
|
+
#
|
61
|
+
# @return [Client::Configuration]
|
62
|
+
#
|
63
|
+
def self.configure
|
64
|
+
@configure ||= begin
|
65
|
+
namespace = ["Google", "Maps", "FleetEngine", "Delivery", "V1"]
|
66
|
+
parent_config = while namespace.any?
|
67
|
+
parent_name = namespace.join "::"
|
68
|
+
parent_const = const_get parent_name
|
69
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
70
|
+
namespace.pop
|
71
|
+
end
|
72
|
+
default_config = Client::Configuration.new parent_config
|
73
|
+
|
74
|
+
default_config.rpcs.create_delivery_vehicle.timeout = 60.0
|
75
|
+
default_config.rpcs.create_delivery_vehicle.retry_policy = {
|
76
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
77
|
+
}
|
78
|
+
|
79
|
+
default_config.rpcs.get_delivery_vehicle.timeout = 60.0
|
80
|
+
default_config.rpcs.get_delivery_vehicle.retry_policy = {
|
81
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
82
|
+
}
|
83
|
+
|
84
|
+
default_config.rpcs.update_delivery_vehicle.timeout = 60.0
|
85
|
+
default_config.rpcs.update_delivery_vehicle.retry_policy = {
|
86
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
87
|
+
}
|
88
|
+
|
89
|
+
default_config.rpcs.batch_create_tasks.timeout = 60.0
|
90
|
+
default_config.rpcs.batch_create_tasks.retry_policy = {
|
91
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
92
|
+
}
|
93
|
+
|
94
|
+
default_config.rpcs.create_task.timeout = 60.0
|
95
|
+
default_config.rpcs.create_task.retry_policy = {
|
96
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
97
|
+
}
|
98
|
+
|
99
|
+
default_config.rpcs.get_task.timeout = 60.0
|
100
|
+
default_config.rpcs.get_task.retry_policy = {
|
101
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
102
|
+
}
|
103
|
+
|
104
|
+
default_config.rpcs.update_task.timeout = 60.0
|
105
|
+
default_config.rpcs.update_task.retry_policy = {
|
106
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
107
|
+
}
|
108
|
+
|
109
|
+
default_config.rpcs.list_tasks.timeout = 60.0
|
110
|
+
default_config.rpcs.list_tasks.retry_policy = {
|
111
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
112
|
+
}
|
113
|
+
|
114
|
+
default_config.rpcs.get_task_tracking_info.timeout = 60.0
|
115
|
+
default_config.rpcs.get_task_tracking_info.retry_policy = {
|
116
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
117
|
+
}
|
118
|
+
|
119
|
+
default_config.rpcs.list_delivery_vehicles.timeout = 60.0
|
120
|
+
default_config.rpcs.list_delivery_vehicles.retry_policy = {
|
121
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
122
|
+
}
|
123
|
+
|
124
|
+
default_config
|
125
|
+
end
|
126
|
+
yield @configure if block_given?
|
127
|
+
@configure
|
128
|
+
end
|
129
|
+
|
130
|
+
##
|
131
|
+
# Configure the DeliveryService Client instance.
|
132
|
+
#
|
133
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
134
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
135
|
+
# should be made on {Client.configure}.
|
136
|
+
#
|
137
|
+
# See {::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client::Configuration}
|
138
|
+
# for a description of the configuration fields.
|
139
|
+
#
|
140
|
+
# @yield [config] Configure the Client client.
|
141
|
+
# @yieldparam config [Client::Configuration]
|
142
|
+
#
|
143
|
+
# @return [Client::Configuration]
|
144
|
+
#
|
145
|
+
def configure
|
146
|
+
yield @config if block_given?
|
147
|
+
@config
|
148
|
+
end
|
149
|
+
|
150
|
+
##
|
151
|
+
# The effective universe domain
|
152
|
+
#
|
153
|
+
# @return [String]
|
154
|
+
#
|
155
|
+
def universe_domain
|
156
|
+
@delivery_service_stub.universe_domain
|
157
|
+
end
|
158
|
+
|
159
|
+
##
|
160
|
+
# Create a new DeliveryService client object.
|
161
|
+
#
|
162
|
+
# @example
|
163
|
+
#
|
164
|
+
# # Create a client using the default configuration
|
165
|
+
# client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
|
166
|
+
#
|
167
|
+
# # Create a client using a custom configuration
|
168
|
+
# client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config|
|
169
|
+
# config.timeout = 10.0
|
170
|
+
# end
|
171
|
+
#
|
172
|
+
# @yield [config] Configure the DeliveryService client.
|
173
|
+
# @yieldparam config [Client::Configuration]
|
174
|
+
#
|
175
|
+
def initialize
|
176
|
+
# These require statements are intentionally placed here to initialize
|
177
|
+
# the gRPC module only when it's required.
|
178
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
179
|
+
require "gapic/grpc"
|
180
|
+
require "google/maps/fleetengine/delivery/v1/delivery_api_services_pb"
|
181
|
+
|
182
|
+
# Create the configuration object
|
183
|
+
@config = Configuration.new Client.configure
|
184
|
+
|
185
|
+
# Yield the configuration if needed
|
186
|
+
yield @config if block_given?
|
187
|
+
|
188
|
+
# Create credentials
|
189
|
+
credentials = @config.credentials
|
190
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
191
|
+
# but only if the default endpoint does not have a region prefix.
|
192
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
193
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
194
|
+
!@config.endpoint.split(".").first.include?("-"))
|
195
|
+
credentials ||= Credentials.default scope: @config.scope,
|
196
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
197
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
198
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
199
|
+
end
|
200
|
+
@quota_project_id = @config.quota_project
|
201
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
202
|
+
|
203
|
+
@delivery_service_stub = ::Gapic::ServiceStub.new(
|
204
|
+
::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Stub,
|
205
|
+
credentials: credentials,
|
206
|
+
endpoint: @config.endpoint,
|
207
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
208
|
+
universe_domain: @config.universe_domain,
|
209
|
+
channel_args: @config.channel_args,
|
210
|
+
interceptors: @config.interceptors,
|
211
|
+
channel_pool_config: @config.channel_pool
|
212
|
+
)
|
213
|
+
end
|
214
|
+
|
215
|
+
# Service calls
|
216
|
+
|
217
|
+
##
|
218
|
+
# Creates and returns a new `DeliveryVehicle`.
|
219
|
+
#
|
220
|
+
# @overload create_delivery_vehicle(request, options = nil)
|
221
|
+
# Pass arguments to `create_delivery_vehicle` via a request object, either of type
|
222
|
+
# {::Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest} or an equivalent Hash.
|
223
|
+
#
|
224
|
+
# @param request [::Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest, ::Hash]
|
225
|
+
# A request object representing the call parameters. Required. To specify no
|
226
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
227
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
228
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
229
|
+
#
|
230
|
+
# @overload create_delivery_vehicle(header: nil, parent: nil, delivery_vehicle_id: nil, delivery_vehicle: nil)
|
231
|
+
# Pass arguments to `create_delivery_vehicle` via keyword arguments. Note that at
|
232
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
233
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
234
|
+
#
|
235
|
+
# @param header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash]
|
236
|
+
# Optional. The standard Delivery API request header.
|
237
|
+
# @param parent [::String]
|
238
|
+
# Required. Must be in the format `providers/{provider}`. The provider must
|
239
|
+
# be the Google Cloud Project ID. For example, `sample-cloud-project`.
|
240
|
+
# @param delivery_vehicle_id [::String]
|
241
|
+
# Required. The Delivery Vehicle ID must be unique and subject to the
|
242
|
+
# following restrictions:
|
243
|
+
#
|
244
|
+
# * Must be a valid Unicode string.
|
245
|
+
# * Limited to a maximum length of 64 characters.
|
246
|
+
# * Normalized according to [Unicode Normalization Form C]
|
247
|
+
# (http://www.unicode.org/reports/tr15/).
|
248
|
+
# * May not contain any of the following ASCII characters: '/', ':', '?',
|
249
|
+
# ',', or '#'.
|
250
|
+
# @param delivery_vehicle [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle, ::Hash]
|
251
|
+
# Required. The `DeliveryVehicle` entity to create. When creating a new
|
252
|
+
# delivery vehicle, you may set the following optional fields:
|
253
|
+
#
|
254
|
+
# * last_location
|
255
|
+
# * attributes
|
256
|
+
#
|
257
|
+
# Note: The DeliveryVehicle's `name` field is ignored. All other
|
258
|
+
# DeliveryVehicle fields must not be set; otherwise, an error is returned.
|
259
|
+
#
|
260
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
261
|
+
# @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle]
|
262
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
263
|
+
#
|
264
|
+
# @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle]
|
265
|
+
#
|
266
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
267
|
+
#
|
268
|
+
# @example Basic example
|
269
|
+
# require "google/maps/fleet_engine/delivery/v1"
|
270
|
+
#
|
271
|
+
# # Create a client object. The client can be reused for multiple calls.
|
272
|
+
# client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
|
273
|
+
#
|
274
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
275
|
+
# request = Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest.new
|
276
|
+
#
|
277
|
+
# # Call the create_delivery_vehicle method.
|
278
|
+
# result = client.create_delivery_vehicle request
|
279
|
+
#
|
280
|
+
# # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle.
|
281
|
+
# p result
|
282
|
+
#
|
283
|
+
def create_delivery_vehicle request, options = nil
|
284
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
285
|
+
|
286
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest
|
287
|
+
|
288
|
+
# Converts hash and nil to an options object
|
289
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
290
|
+
|
291
|
+
# Customize the options with defaults
|
292
|
+
metadata = @config.rpcs.create_delivery_vehicle.metadata.to_h
|
293
|
+
|
294
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
295
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
296
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
297
|
+
gapic_version: ::Google::Maps::FleetEngine::Delivery::V1::VERSION
|
298
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
299
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
300
|
+
|
301
|
+
header_params = {}
|
302
|
+
if request.parent &&
|
303
|
+
%r{^providers/[^/]+/?$}.match?(request.parent)
|
304
|
+
header_params["provider_id"] = request.parent
|
305
|
+
end
|
306
|
+
|
307
|
+
request_params_header = URI.encode_www_form header_params
|
308
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
309
|
+
|
310
|
+
options.apply_defaults timeout: @config.rpcs.create_delivery_vehicle.timeout,
|
311
|
+
metadata: metadata,
|
312
|
+
retry_policy: @config.rpcs.create_delivery_vehicle.retry_policy
|
313
|
+
|
314
|
+
options.apply_defaults timeout: @config.timeout,
|
315
|
+
metadata: @config.metadata,
|
316
|
+
retry_policy: @config.retry_policy
|
317
|
+
|
318
|
+
@delivery_service_stub.call_rpc :create_delivery_vehicle, request, options: options do |response, operation|
|
319
|
+
yield response, operation if block_given?
|
320
|
+
return response
|
321
|
+
end
|
322
|
+
rescue ::GRPC::BadStatus => e
|
323
|
+
raise ::Google::Cloud::Error.from_error(e)
|
324
|
+
end
|
325
|
+
|
326
|
+
##
|
327
|
+
# Returns the specified `DeliveryVehicle` instance.
|
328
|
+
#
|
329
|
+
# @overload get_delivery_vehicle(request, options = nil)
|
330
|
+
# Pass arguments to `get_delivery_vehicle` via a request object, either of type
|
331
|
+
# {::Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest} or an equivalent Hash.
|
332
|
+
#
|
333
|
+
# @param request [::Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest, ::Hash]
|
334
|
+
# A request object representing the call parameters. Required. To specify no
|
335
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
336
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
337
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
338
|
+
#
|
339
|
+
# @overload get_delivery_vehicle(header: nil, name: nil)
|
340
|
+
# Pass arguments to `get_delivery_vehicle` via keyword arguments. Note that at
|
341
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
342
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
343
|
+
#
|
344
|
+
# @param header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash]
|
345
|
+
# Optional. The standard Delivery API request header.
|
346
|
+
# @param name [::String]
|
347
|
+
# Required. Must be in the format
|
348
|
+
# `providers/{provider}/deliveryVehicles/{delivery_vehicle}`.
|
349
|
+
# The `provider` must be the Google Cloud Project ID. For example,
|
350
|
+
# `sample-cloud-project`.
|
351
|
+
#
|
352
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
353
|
+
# @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle]
|
354
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
355
|
+
#
|
356
|
+
# @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle]
|
357
|
+
#
|
358
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
359
|
+
#
|
360
|
+
# @example Basic example
|
361
|
+
# require "google/maps/fleet_engine/delivery/v1"
|
362
|
+
#
|
363
|
+
# # Create a client object. The client can be reused for multiple calls.
|
364
|
+
# client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
|
365
|
+
#
|
366
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
367
|
+
# request = Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest.new
|
368
|
+
#
|
369
|
+
# # Call the get_delivery_vehicle method.
|
370
|
+
# result = client.get_delivery_vehicle request
|
371
|
+
#
|
372
|
+
# # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle.
|
373
|
+
# p result
|
374
|
+
#
|
375
|
+
def get_delivery_vehicle request, options = nil
|
376
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
377
|
+
|
378
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest
|
379
|
+
|
380
|
+
# Converts hash and nil to an options object
|
381
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
382
|
+
|
383
|
+
# Customize the options with defaults
|
384
|
+
metadata = @config.rpcs.get_delivery_vehicle.metadata.to_h
|
385
|
+
|
386
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
387
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
388
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
389
|
+
gapic_version: ::Google::Maps::FleetEngine::Delivery::V1::VERSION
|
390
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
391
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
392
|
+
|
393
|
+
header_params = {}
|
394
|
+
if request.name &&
|
395
|
+
%r{^providers/[^/]+/?$}.match?(request.name)
|
396
|
+
header_params["provider_id"] = request.name
|
397
|
+
end
|
398
|
+
|
399
|
+
request_params_header = URI.encode_www_form header_params
|
400
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
401
|
+
|
402
|
+
options.apply_defaults timeout: @config.rpcs.get_delivery_vehicle.timeout,
|
403
|
+
metadata: metadata,
|
404
|
+
retry_policy: @config.rpcs.get_delivery_vehicle.retry_policy
|
405
|
+
|
406
|
+
options.apply_defaults timeout: @config.timeout,
|
407
|
+
metadata: @config.metadata,
|
408
|
+
retry_policy: @config.retry_policy
|
409
|
+
|
410
|
+
@delivery_service_stub.call_rpc :get_delivery_vehicle, request, options: options do |response, operation|
|
411
|
+
yield response, operation if block_given?
|
412
|
+
return response
|
413
|
+
end
|
414
|
+
rescue ::GRPC::BadStatus => e
|
415
|
+
raise ::Google::Cloud::Error.from_error(e)
|
416
|
+
end
|
417
|
+
|
418
|
+
##
|
419
|
+
# Writes updated `DeliveryVehicle` data to Fleet Engine, and assigns
|
420
|
+
# `Tasks` to the `DeliveryVehicle`. You cannot update the name of the
|
421
|
+
# `DeliveryVehicle`. You *can* update `remaining_vehicle_journey_segments`
|
422
|
+
# though, but it must contain all of the `VehicleJourneySegment`s currently
|
423
|
+
# on the `DeliveryVehicle`. The `task_id`s are retrieved from
|
424
|
+
# `remaining_vehicle_journey_segments`, and their corresponding `Tasks` are
|
425
|
+
# assigned to the `DeliveryVehicle` if they have not yet been assigned.
|
426
|
+
#
|
427
|
+
# @overload update_delivery_vehicle(request, options = nil)
|
428
|
+
# Pass arguments to `update_delivery_vehicle` via a request object, either of type
|
429
|
+
# {::Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest} or an equivalent Hash.
|
430
|
+
#
|
431
|
+
# @param request [::Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest, ::Hash]
|
432
|
+
# A request object representing the call parameters. Required. To specify no
|
433
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
434
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
435
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
436
|
+
#
|
437
|
+
# @overload update_delivery_vehicle(header: nil, delivery_vehicle: nil, update_mask: nil)
|
438
|
+
# Pass arguments to `update_delivery_vehicle` via keyword arguments. Note that at
|
439
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
440
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
441
|
+
#
|
442
|
+
# @param header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash]
|
443
|
+
# Optional. The standard Delivery API request header.
|
444
|
+
# @param delivery_vehicle [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle, ::Hash]
|
445
|
+
# Required. The `DeliveryVehicle` entity update to apply.
|
446
|
+
# Note: You cannot update the name of the `DeliveryVehicle`.
|
447
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
448
|
+
# Required. A field mask that indicates which `DeliveryVehicle` fields to
|
449
|
+
# update. Note that the update_mask must contain at least one field.
|
450
|
+
#
|
451
|
+
# This is a comma-separated list of fully qualified names of fields. Example:
|
452
|
+
# `"remaining_vehicle_journey_segments"`.
|
453
|
+
#
|
454
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
455
|
+
# @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle]
|
456
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
457
|
+
#
|
458
|
+
# @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle]
|
459
|
+
#
|
460
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
461
|
+
#
|
462
|
+
# @example Basic example
|
463
|
+
# require "google/maps/fleet_engine/delivery/v1"
|
464
|
+
#
|
465
|
+
# # Create a client object. The client can be reused for multiple calls.
|
466
|
+
# client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
|
467
|
+
#
|
468
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
469
|
+
# request = Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest.new
|
470
|
+
#
|
471
|
+
# # Call the update_delivery_vehicle method.
|
472
|
+
# result = client.update_delivery_vehicle request
|
473
|
+
#
|
474
|
+
# # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle.
|
475
|
+
# p result
|
476
|
+
#
|
477
|
+
def update_delivery_vehicle request, options = nil
|
478
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
479
|
+
|
480
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest
|
481
|
+
|
482
|
+
# Converts hash and nil to an options object
|
483
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
484
|
+
|
485
|
+
# Customize the options with defaults
|
486
|
+
metadata = @config.rpcs.update_delivery_vehicle.metadata.to_h
|
487
|
+
|
488
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
489
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
490
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
491
|
+
gapic_version: ::Google::Maps::FleetEngine::Delivery::V1::VERSION
|
492
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
493
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
494
|
+
|
495
|
+
header_params = {}
|
496
|
+
if request.delivery_vehicle&.name &&
|
497
|
+
%r{^providers/[^/]+/?$}.match?(request.delivery_vehicle.name)
|
498
|
+
header_params["provider_id"] = request.delivery_vehicle.name
|
499
|
+
end
|
500
|
+
|
501
|
+
request_params_header = URI.encode_www_form header_params
|
502
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
503
|
+
|
504
|
+
options.apply_defaults timeout: @config.rpcs.update_delivery_vehicle.timeout,
|
505
|
+
metadata: metadata,
|
506
|
+
retry_policy: @config.rpcs.update_delivery_vehicle.retry_policy
|
507
|
+
|
508
|
+
options.apply_defaults timeout: @config.timeout,
|
509
|
+
metadata: @config.metadata,
|
510
|
+
retry_policy: @config.retry_policy
|
511
|
+
|
512
|
+
@delivery_service_stub.call_rpc :update_delivery_vehicle, request, options: options do |response, operation|
|
513
|
+
yield response, operation if block_given?
|
514
|
+
return response
|
515
|
+
end
|
516
|
+
rescue ::GRPC::BadStatus => e
|
517
|
+
raise ::Google::Cloud::Error.from_error(e)
|
518
|
+
end
|
519
|
+
|
520
|
+
##
|
521
|
+
# Creates and returns a batch of new `Task` objects.
|
522
|
+
#
|
523
|
+
# @overload batch_create_tasks(request, options = nil)
|
524
|
+
# Pass arguments to `batch_create_tasks` via a request object, either of type
|
525
|
+
# {::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest} or an equivalent Hash.
|
526
|
+
#
|
527
|
+
# @param request [::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest, ::Hash]
|
528
|
+
# A request object representing the call parameters. Required. To specify no
|
529
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
530
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
531
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
532
|
+
#
|
533
|
+
# @overload batch_create_tasks(header: nil, parent: nil, requests: nil)
|
534
|
+
# Pass arguments to `batch_create_tasks` via keyword arguments. Note that at
|
535
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
536
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
537
|
+
#
|
538
|
+
# @param header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash]
|
539
|
+
# Optional. The standard Delivery API request header.
|
540
|
+
# Note: If you set this field, then the header field in the
|
541
|
+
# `CreateTaskRequest` messages must either be empty, or it must match this
|
542
|
+
# field.
|
543
|
+
# @param parent [::String]
|
544
|
+
# Required. The parent resource shared by all tasks. This value must be in
|
545
|
+
# the format `providers/{provider}`. The `provider` must be the Google Cloud
|
546
|
+
# Project ID. For example, `sample-cloud-project`. The parent field in the
|
547
|
+
# `CreateTaskRequest` messages must either be empty, or it must match this
|
548
|
+
# field.
|
549
|
+
# @param requests [::Array<::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest, ::Hash>]
|
550
|
+
# Required. The request message that specifies the resources to create.
|
551
|
+
# Note: You can create a maximum of 500 tasks in a batch.
|
552
|
+
#
|
553
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
554
|
+
# @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksResponse]
|
555
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
556
|
+
#
|
557
|
+
# @return [::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksResponse]
|
558
|
+
#
|
559
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
560
|
+
#
|
561
|
+
# @example Basic example
|
562
|
+
# require "google/maps/fleet_engine/delivery/v1"
|
563
|
+
#
|
564
|
+
# # Create a client object. The client can be reused for multiple calls.
|
565
|
+
# client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
|
566
|
+
#
|
567
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
568
|
+
# request = Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest.new
|
569
|
+
#
|
570
|
+
# # Call the batch_create_tasks method.
|
571
|
+
# result = client.batch_create_tasks request
|
572
|
+
#
|
573
|
+
# # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksResponse.
|
574
|
+
# p result
|
575
|
+
#
|
576
|
+
def batch_create_tasks request, options = nil
|
577
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
578
|
+
|
579
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest
|
580
|
+
|
581
|
+
# Converts hash and nil to an options object
|
582
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
583
|
+
|
584
|
+
# Customize the options with defaults
|
585
|
+
metadata = @config.rpcs.batch_create_tasks.metadata.to_h
|
586
|
+
|
587
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
588
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
589
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
590
|
+
gapic_version: ::Google::Maps::FleetEngine::Delivery::V1::VERSION
|
591
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
592
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
593
|
+
|
594
|
+
header_params = {}
|
595
|
+
if request.parent &&
|
596
|
+
%r{^providers/[^/]+/?$}.match?(request.parent)
|
597
|
+
header_params["provider_id"] = request.parent
|
598
|
+
end
|
599
|
+
|
600
|
+
request_params_header = URI.encode_www_form header_params
|
601
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
602
|
+
|
603
|
+
options.apply_defaults timeout: @config.rpcs.batch_create_tasks.timeout,
|
604
|
+
metadata: metadata,
|
605
|
+
retry_policy: @config.rpcs.batch_create_tasks.retry_policy
|
606
|
+
|
607
|
+
options.apply_defaults timeout: @config.timeout,
|
608
|
+
metadata: @config.metadata,
|
609
|
+
retry_policy: @config.retry_policy
|
610
|
+
|
611
|
+
@delivery_service_stub.call_rpc :batch_create_tasks, request, options: options do |response, operation|
|
612
|
+
yield response, operation if block_given?
|
613
|
+
return response
|
614
|
+
end
|
615
|
+
rescue ::GRPC::BadStatus => e
|
616
|
+
raise ::Google::Cloud::Error.from_error(e)
|
617
|
+
end
|
618
|
+
|
619
|
+
##
|
620
|
+
# Creates and returns a new `Task` object.
|
621
|
+
#
|
622
|
+
# @overload create_task(request, options = nil)
|
623
|
+
# Pass arguments to `create_task` via a request object, either of type
|
624
|
+
# {::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest} or an equivalent Hash.
|
625
|
+
#
|
626
|
+
# @param request [::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest, ::Hash]
|
627
|
+
# A request object representing the call parameters. Required. To specify no
|
628
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
629
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
630
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
631
|
+
#
|
632
|
+
# @overload create_task(header: nil, parent: nil, task_id: nil, task: nil)
|
633
|
+
# Pass arguments to `create_task` via keyword arguments. Note that at
|
634
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
635
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
636
|
+
#
|
637
|
+
# @param header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash]
|
638
|
+
# Optional. The standard Delivery API request header.
|
639
|
+
# @param parent [::String]
|
640
|
+
# Required. Must be in the format `providers/{provider}`. The `provider` must
|
641
|
+
# be the Google Cloud Project ID. For example, `sample-cloud-project`.
|
642
|
+
# @param task_id [::String]
|
643
|
+
# Required. The Task ID must be unique, but it should be not a shipment
|
644
|
+
# tracking ID. To store a shipment tracking ID, use the `tracking_id` field.
|
645
|
+
# Note that multiple tasks can have the same `tracking_id`. Task IDs are
|
646
|
+
# subject to the following restrictions:
|
647
|
+
#
|
648
|
+
# * Must be a valid Unicode string.
|
649
|
+
# * Limited to a maximum length of 64 characters.
|
650
|
+
# * Normalized according to [Unicode Normalization Form C]
|
651
|
+
# (http://www.unicode.org/reports/tr15/).
|
652
|
+
# * May not contain any of the following ASCII characters: '/', ':', '?',
|
653
|
+
# ',', or '#'.
|
654
|
+
# @param task [::Google::Maps::FleetEngine::Delivery::V1::Task, ::Hash]
|
655
|
+
# Required. The Task entity to create.
|
656
|
+
# When creating a Task, the following fields are required:
|
657
|
+
#
|
658
|
+
# * `type`
|
659
|
+
# * `state` (must be set to `OPEN`)
|
660
|
+
# * `tracking_id` (must not be set for `UNAVAILABLE` or `SCHEDULED_STOP`
|
661
|
+
# tasks, but required for all other task types)
|
662
|
+
# * `planned_location` (optional for `UNAVAILABLE` tasks)
|
663
|
+
# * `task_duration`
|
664
|
+
#
|
665
|
+
# Note: The Task's `name` field is ignored. All other Task fields must not be
|
666
|
+
# set; otherwise, an error is returned.
|
667
|
+
#
|
668
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
669
|
+
# @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::Task]
|
670
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
671
|
+
#
|
672
|
+
# @return [::Google::Maps::FleetEngine::Delivery::V1::Task]
|
673
|
+
#
|
674
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
675
|
+
#
|
676
|
+
# @example Basic example
|
677
|
+
# require "google/maps/fleet_engine/delivery/v1"
|
678
|
+
#
|
679
|
+
# # Create a client object. The client can be reused for multiple calls.
|
680
|
+
# client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
|
681
|
+
#
|
682
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
683
|
+
# request = Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest.new
|
684
|
+
#
|
685
|
+
# # Call the create_task method.
|
686
|
+
# result = client.create_task request
|
687
|
+
#
|
688
|
+
# # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::Task.
|
689
|
+
# p result
|
690
|
+
#
|
691
|
+
def create_task request, options = nil
|
692
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
693
|
+
|
694
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest
|
695
|
+
|
696
|
+
# Converts hash and nil to an options object
|
697
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
698
|
+
|
699
|
+
# Customize the options with defaults
|
700
|
+
metadata = @config.rpcs.create_task.metadata.to_h
|
701
|
+
|
702
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
703
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
704
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
705
|
+
gapic_version: ::Google::Maps::FleetEngine::Delivery::V1::VERSION
|
706
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
707
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
708
|
+
|
709
|
+
header_params = {}
|
710
|
+
if request.parent &&
|
711
|
+
%r{^providers/[^/]+/?$}.match?(request.parent)
|
712
|
+
header_params["provider_id"] = request.parent
|
713
|
+
end
|
714
|
+
|
715
|
+
request_params_header = URI.encode_www_form header_params
|
716
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
717
|
+
|
718
|
+
options.apply_defaults timeout: @config.rpcs.create_task.timeout,
|
719
|
+
metadata: metadata,
|
720
|
+
retry_policy: @config.rpcs.create_task.retry_policy
|
721
|
+
|
722
|
+
options.apply_defaults timeout: @config.timeout,
|
723
|
+
metadata: @config.metadata,
|
724
|
+
retry_policy: @config.retry_policy
|
725
|
+
|
726
|
+
@delivery_service_stub.call_rpc :create_task, request, options: options do |response, operation|
|
727
|
+
yield response, operation if block_given?
|
728
|
+
return response
|
729
|
+
end
|
730
|
+
rescue ::GRPC::BadStatus => e
|
731
|
+
raise ::Google::Cloud::Error.from_error(e)
|
732
|
+
end
|
733
|
+
|
734
|
+
##
|
735
|
+
# Gets information about a `Task`.
|
736
|
+
#
|
737
|
+
# @overload get_task(request, options = nil)
|
738
|
+
# Pass arguments to `get_task` via a request object, either of type
|
739
|
+
# {::Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest} or an equivalent Hash.
|
740
|
+
#
|
741
|
+
# @param request [::Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest, ::Hash]
|
742
|
+
# A request object representing the call parameters. Required. To specify no
|
743
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
744
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
745
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
746
|
+
#
|
747
|
+
# @overload get_task(header: nil, name: nil)
|
748
|
+
# Pass arguments to `get_task` via keyword arguments. Note that at
|
749
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
750
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
751
|
+
#
|
752
|
+
# @param header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash]
|
753
|
+
# Optional. The standard Delivery API request header.
|
754
|
+
# @param name [::String]
|
755
|
+
# Required. Must be in the format `providers/{provider}/tasks/{task}`. The
|
756
|
+
# `provider` must be the Google Cloud Project ID. For example,
|
757
|
+
# `sample-cloud-project`.
|
758
|
+
#
|
759
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
760
|
+
# @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::Task]
|
761
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
762
|
+
#
|
763
|
+
# @return [::Google::Maps::FleetEngine::Delivery::V1::Task]
|
764
|
+
#
|
765
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
766
|
+
#
|
767
|
+
# @example Basic example
|
768
|
+
# require "google/maps/fleet_engine/delivery/v1"
|
769
|
+
#
|
770
|
+
# # Create a client object. The client can be reused for multiple calls.
|
771
|
+
# client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
|
772
|
+
#
|
773
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
774
|
+
# request = Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest.new
|
775
|
+
#
|
776
|
+
# # Call the get_task method.
|
777
|
+
# result = client.get_task request
|
778
|
+
#
|
779
|
+
# # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::Task.
|
780
|
+
# p result
|
781
|
+
#
|
782
|
+
def get_task request, options = nil
|
783
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
784
|
+
|
785
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest
|
786
|
+
|
787
|
+
# Converts hash and nil to an options object
|
788
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
789
|
+
|
790
|
+
# Customize the options with defaults
|
791
|
+
metadata = @config.rpcs.get_task.metadata.to_h
|
792
|
+
|
793
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
794
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
795
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
796
|
+
gapic_version: ::Google::Maps::FleetEngine::Delivery::V1::VERSION
|
797
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
798
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
799
|
+
|
800
|
+
header_params = {}
|
801
|
+
if request.name &&
|
802
|
+
%r{^providers/[^/]+/?$}.match?(request.name)
|
803
|
+
header_params["provider_id"] = request.name
|
804
|
+
end
|
805
|
+
|
806
|
+
request_params_header = URI.encode_www_form header_params
|
807
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
808
|
+
|
809
|
+
options.apply_defaults timeout: @config.rpcs.get_task.timeout,
|
810
|
+
metadata: metadata,
|
811
|
+
retry_policy: @config.rpcs.get_task.retry_policy
|
812
|
+
|
813
|
+
options.apply_defaults timeout: @config.timeout,
|
814
|
+
metadata: @config.metadata,
|
815
|
+
retry_policy: @config.retry_policy
|
816
|
+
|
817
|
+
@delivery_service_stub.call_rpc :get_task, request, options: options do |response, operation|
|
818
|
+
yield response, operation if block_given?
|
819
|
+
return response
|
820
|
+
end
|
821
|
+
rescue ::GRPC::BadStatus => e
|
822
|
+
raise ::Google::Cloud::Error.from_error(e)
|
823
|
+
end
|
824
|
+
|
825
|
+
##
|
826
|
+
# Updates `Task` data.
|
827
|
+
#
|
828
|
+
# @overload update_task(request, options = nil)
|
829
|
+
# Pass arguments to `update_task` via a request object, either of type
|
830
|
+
# {::Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest} or an equivalent Hash.
|
831
|
+
#
|
832
|
+
# @param request [::Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest, ::Hash]
|
833
|
+
# A request object representing the call parameters. Required. To specify no
|
834
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
835
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
836
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
837
|
+
#
|
838
|
+
# @overload update_task(header: nil, task: nil, update_mask: nil)
|
839
|
+
# Pass arguments to `update_task` via keyword arguments. Note that at
|
840
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
841
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
842
|
+
#
|
843
|
+
# @param header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash]
|
844
|
+
# Optional. The standard Delivery API request header.
|
845
|
+
# @param task [::Google::Maps::FleetEngine::Delivery::V1::Task, ::Hash]
|
846
|
+
# Required. The Task associated with the update.
|
847
|
+
# The following fields are maintained by Fleet Engine. Do not update
|
848
|
+
# them using `Task.update`.
|
849
|
+
#
|
850
|
+
# * `last_location`.
|
851
|
+
# * `last_location_snappable`.
|
852
|
+
# * `name`.
|
853
|
+
# * `remaining_vehicle_journey_segments`.
|
854
|
+
# * `task_outcome_location_source`.
|
855
|
+
#
|
856
|
+
# Note: You cannot change the value of `task_outcome` once you set it.
|
857
|
+
#
|
858
|
+
# If the Task has been assigned to a delivery vehicle, then don't set the
|
859
|
+
# Task state to CLOSED using `Task.update`. Instead, remove the `VehicleStop`
|
860
|
+
# that contains the Task from the delivery vehicle, which automatically sets
|
861
|
+
# the Task state to CLOSED.
|
862
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
863
|
+
# Required. The field mask that indicates which Task fields to update.
|
864
|
+
# Note: The `update_mask` must contain at least one field.
|
865
|
+
#
|
866
|
+
# This is a comma-separated list of fully qualified names of fields. Example:
|
867
|
+
# `"task_outcome,task_outcome_time,task_outcome_location"`.
|
868
|
+
#
|
869
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
870
|
+
# @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::Task]
|
871
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
872
|
+
#
|
873
|
+
# @return [::Google::Maps::FleetEngine::Delivery::V1::Task]
|
874
|
+
#
|
875
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
876
|
+
#
|
877
|
+
# @example Basic example
|
878
|
+
# require "google/maps/fleet_engine/delivery/v1"
|
879
|
+
#
|
880
|
+
# # Create a client object. The client can be reused for multiple calls.
|
881
|
+
# client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
|
882
|
+
#
|
883
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
884
|
+
# request = Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest.new
|
885
|
+
#
|
886
|
+
# # Call the update_task method.
|
887
|
+
# result = client.update_task request
|
888
|
+
#
|
889
|
+
# # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::Task.
|
890
|
+
# p result
|
891
|
+
#
|
892
|
+
def update_task request, options = nil
|
893
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
894
|
+
|
895
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest
|
896
|
+
|
897
|
+
# Converts hash and nil to an options object
|
898
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
899
|
+
|
900
|
+
# Customize the options with defaults
|
901
|
+
metadata = @config.rpcs.update_task.metadata.to_h
|
902
|
+
|
903
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
904
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
905
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
906
|
+
gapic_version: ::Google::Maps::FleetEngine::Delivery::V1::VERSION
|
907
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
908
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
909
|
+
|
910
|
+
header_params = {}
|
911
|
+
if request.task&.name &&
|
912
|
+
%r{^providers/[^/]+/?$}.match?(request.task.name)
|
913
|
+
header_params["provider_id"] = request.task.name
|
914
|
+
end
|
915
|
+
|
916
|
+
request_params_header = URI.encode_www_form header_params
|
917
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
918
|
+
|
919
|
+
options.apply_defaults timeout: @config.rpcs.update_task.timeout,
|
920
|
+
metadata: metadata,
|
921
|
+
retry_policy: @config.rpcs.update_task.retry_policy
|
922
|
+
|
923
|
+
options.apply_defaults timeout: @config.timeout,
|
924
|
+
metadata: @config.metadata,
|
925
|
+
retry_policy: @config.retry_policy
|
926
|
+
|
927
|
+
@delivery_service_stub.call_rpc :update_task, request, options: options do |response, operation|
|
928
|
+
yield response, operation if block_given?
|
929
|
+
return response
|
930
|
+
end
|
931
|
+
rescue ::GRPC::BadStatus => e
|
932
|
+
raise ::Google::Cloud::Error.from_error(e)
|
933
|
+
end
|
934
|
+
|
935
|
+
##
|
936
|
+
# Gets all `Task`s that meet the specified filtering criteria.
|
937
|
+
#
|
938
|
+
# @overload list_tasks(request, options = nil)
|
939
|
+
# Pass arguments to `list_tasks` via a request object, either of type
|
940
|
+
# {::Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest} or an equivalent Hash.
|
941
|
+
#
|
942
|
+
# @param request [::Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest, ::Hash]
|
943
|
+
# A request object representing the call parameters. Required. To specify no
|
944
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
945
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
946
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
947
|
+
#
|
948
|
+
# @overload list_tasks(header: nil, parent: nil, page_size: nil, page_token: nil, filter: nil)
|
949
|
+
# Pass arguments to `list_tasks` via keyword arguments. Note that at
|
950
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
951
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
952
|
+
#
|
953
|
+
# @param header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash]
|
954
|
+
# Optional. The standard Delivery API request header.
|
955
|
+
# @param parent [::String]
|
956
|
+
# Required. Must be in the format `providers/{provider}`.
|
957
|
+
# The `provider` must be the Google Cloud Project ID. For example,
|
958
|
+
# `sample-cloud-project`.
|
959
|
+
# @param page_size [::Integer]
|
960
|
+
# Optional. The maximum number of Tasks to return. The service may return
|
961
|
+
# fewer than this value. If you don't specify this value, then the server
|
962
|
+
# determines the number of results to return.
|
963
|
+
# @param page_token [::String]
|
964
|
+
# Optional. A page token received from a previous `ListTasks` call.
|
965
|
+
# You can provide this to retrieve the subsequent page.
|
966
|
+
#
|
967
|
+
# When paginating, all other parameters provided to `ListTasks` must match
|
968
|
+
# the call that provided the page token.
|
969
|
+
# @param filter [::String]
|
970
|
+
# Optional. A filter query to apply when listing Tasks. See
|
971
|
+
# http://aip.dev/160 for examples of filter syntax. If you don't specify a
|
972
|
+
# value, or if you filter on an empty string, then all Tasks are returned.
|
973
|
+
# For information about the Task properties that you can filter on, see [List
|
974
|
+
# tasks](https://developers.google.com/maps/documentation/transportation-logistics/last-mile-fleet-solution/fleet-performance/fleet-engine/deliveries_api#list-tasks).
|
975
|
+
#
|
976
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
977
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::Task>]
|
978
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
979
|
+
#
|
980
|
+
# @return [::Gapic::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::Task>]
|
981
|
+
#
|
982
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
983
|
+
#
|
984
|
+
# @example Basic example
|
985
|
+
# require "google/maps/fleet_engine/delivery/v1"
|
986
|
+
#
|
987
|
+
# # Create a client object. The client can be reused for multiple calls.
|
988
|
+
# client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
|
989
|
+
#
|
990
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
991
|
+
# request = Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest.new
|
992
|
+
#
|
993
|
+
# # Call the list_tasks method.
|
994
|
+
# result = client.list_tasks request
|
995
|
+
#
|
996
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
997
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
998
|
+
# result.each do |item|
|
999
|
+
# # Each element is of type ::Google::Maps::FleetEngine::Delivery::V1::Task.
|
1000
|
+
# p item
|
1001
|
+
# end
|
1002
|
+
#
|
1003
|
+
def list_tasks request, options = nil
|
1004
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1005
|
+
|
1006
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest
|
1007
|
+
|
1008
|
+
# Converts hash and nil to an options object
|
1009
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1010
|
+
|
1011
|
+
# Customize the options with defaults
|
1012
|
+
metadata = @config.rpcs.list_tasks.metadata.to_h
|
1013
|
+
|
1014
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
1015
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1016
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1017
|
+
gapic_version: ::Google::Maps::FleetEngine::Delivery::V1::VERSION
|
1018
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
1019
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1020
|
+
|
1021
|
+
header_params = {}
|
1022
|
+
if request.parent &&
|
1023
|
+
%r{^providers/[^/]+/?$}.match?(request.parent)
|
1024
|
+
header_params["provider_id"] = request.parent
|
1025
|
+
end
|
1026
|
+
|
1027
|
+
request_params_header = URI.encode_www_form header_params
|
1028
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1029
|
+
|
1030
|
+
options.apply_defaults timeout: @config.rpcs.list_tasks.timeout,
|
1031
|
+
metadata: metadata,
|
1032
|
+
retry_policy: @config.rpcs.list_tasks.retry_policy
|
1033
|
+
|
1034
|
+
options.apply_defaults timeout: @config.timeout,
|
1035
|
+
metadata: @config.metadata,
|
1036
|
+
retry_policy: @config.retry_policy
|
1037
|
+
|
1038
|
+
@delivery_service_stub.call_rpc :list_tasks, request, options: options do |response, operation|
|
1039
|
+
response = ::Gapic::PagedEnumerable.new @delivery_service_stub, :list_tasks, request, response, operation, options
|
1040
|
+
yield response, operation if block_given?
|
1041
|
+
return response
|
1042
|
+
end
|
1043
|
+
rescue ::GRPC::BadStatus => e
|
1044
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1045
|
+
end
|
1046
|
+
|
1047
|
+
##
|
1048
|
+
# Returns the specified `TaskTrackingInfo` instance.
|
1049
|
+
#
|
1050
|
+
# @overload get_task_tracking_info(request, options = nil)
|
1051
|
+
# Pass arguments to `get_task_tracking_info` via a request object, either of type
|
1052
|
+
# {::Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest} or an equivalent Hash.
|
1053
|
+
#
|
1054
|
+
# @param request [::Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest, ::Hash]
|
1055
|
+
# A request object representing the call parameters. Required. To specify no
|
1056
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1057
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1058
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1059
|
+
#
|
1060
|
+
# @overload get_task_tracking_info(header: nil, name: nil)
|
1061
|
+
# Pass arguments to `get_task_tracking_info` via keyword arguments. Note that at
|
1062
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1063
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1064
|
+
#
|
1065
|
+
# @param header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash]
|
1066
|
+
# Optional. The standard Delivery API request header.
|
1067
|
+
# @param name [::String]
|
1068
|
+
# Required. Must be in the format
|
1069
|
+
# `providers/{provider}/taskTrackingInfo/{tracking_id}`. The `provider`
|
1070
|
+
# must be the Google Cloud Project ID, and the `tracking_id` must be the
|
1071
|
+
# tracking ID associated with the task. An example name can be
|
1072
|
+
# `providers/sample-cloud-project/taskTrackingInfo/sample-tracking-id`.
|
1073
|
+
#
|
1074
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1075
|
+
# @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::TaskTrackingInfo]
|
1076
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1077
|
+
#
|
1078
|
+
# @return [::Google::Maps::FleetEngine::Delivery::V1::TaskTrackingInfo]
|
1079
|
+
#
|
1080
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1081
|
+
#
|
1082
|
+
# @example Basic example
|
1083
|
+
# require "google/maps/fleet_engine/delivery/v1"
|
1084
|
+
#
|
1085
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1086
|
+
# client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
|
1087
|
+
#
|
1088
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1089
|
+
# request = Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest.new
|
1090
|
+
#
|
1091
|
+
# # Call the get_task_tracking_info method.
|
1092
|
+
# result = client.get_task_tracking_info request
|
1093
|
+
#
|
1094
|
+
# # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::TaskTrackingInfo.
|
1095
|
+
# p result
|
1096
|
+
#
|
1097
|
+
def get_task_tracking_info request, options = nil
|
1098
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1099
|
+
|
1100
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest
|
1101
|
+
|
1102
|
+
# Converts hash and nil to an options object
|
1103
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1104
|
+
|
1105
|
+
# Customize the options with defaults
|
1106
|
+
metadata = @config.rpcs.get_task_tracking_info.metadata.to_h
|
1107
|
+
|
1108
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
1109
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1110
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1111
|
+
gapic_version: ::Google::Maps::FleetEngine::Delivery::V1::VERSION
|
1112
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
1113
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1114
|
+
|
1115
|
+
header_params = {}
|
1116
|
+
if request.name &&
|
1117
|
+
%r{^providers/[^/]+/?$}.match?(request.name)
|
1118
|
+
header_params["provider_id"] = request.name
|
1119
|
+
end
|
1120
|
+
|
1121
|
+
request_params_header = URI.encode_www_form header_params
|
1122
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1123
|
+
|
1124
|
+
options.apply_defaults timeout: @config.rpcs.get_task_tracking_info.timeout,
|
1125
|
+
metadata: metadata,
|
1126
|
+
retry_policy: @config.rpcs.get_task_tracking_info.retry_policy
|
1127
|
+
|
1128
|
+
options.apply_defaults timeout: @config.timeout,
|
1129
|
+
metadata: @config.metadata,
|
1130
|
+
retry_policy: @config.retry_policy
|
1131
|
+
|
1132
|
+
@delivery_service_stub.call_rpc :get_task_tracking_info, request, options: options do |response, operation|
|
1133
|
+
yield response, operation if block_given?
|
1134
|
+
return response
|
1135
|
+
end
|
1136
|
+
rescue ::GRPC::BadStatus => e
|
1137
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1138
|
+
end
|
1139
|
+
|
1140
|
+
##
|
1141
|
+
# Gets all `DeliveryVehicle`s that meet the specified filtering criteria.
|
1142
|
+
#
|
1143
|
+
# @overload list_delivery_vehicles(request, options = nil)
|
1144
|
+
# Pass arguments to `list_delivery_vehicles` via a request object, either of type
|
1145
|
+
# {::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest} or an equivalent Hash.
|
1146
|
+
#
|
1147
|
+
# @param request [::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest, ::Hash]
|
1148
|
+
# A request object representing the call parameters. Required. To specify no
|
1149
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1150
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1151
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1152
|
+
#
|
1153
|
+
# @overload list_delivery_vehicles(header: nil, parent: nil, page_size: nil, page_token: nil, filter: nil, viewport: nil)
|
1154
|
+
# Pass arguments to `list_delivery_vehicles` via keyword arguments. Note that at
|
1155
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1156
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1157
|
+
#
|
1158
|
+
# @param header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash]
|
1159
|
+
# Optional. The standard Delivery API request header.
|
1160
|
+
# @param parent [::String]
|
1161
|
+
# Required. Must be in the format `providers/{provider}`.
|
1162
|
+
# The `provider` must be the Google Cloud Project ID.
|
1163
|
+
# For example, `sample-cloud-project`.
|
1164
|
+
# @param page_size [::Integer]
|
1165
|
+
# Optional. The maximum number of vehicles to return. The service may return
|
1166
|
+
# fewer than this number. If you don't specify this number, then the server
|
1167
|
+
# determines the number of results to return.
|
1168
|
+
# @param page_token [::String]
|
1169
|
+
# Optional. A page token, received from a previous `ListDeliveryVehicles`
|
1170
|
+
# call. You must provide this in order to retrieve the subsequent page.
|
1171
|
+
#
|
1172
|
+
# When paginating, all other parameters provided to `ListDeliveryVehicles`
|
1173
|
+
# must match the call that provided the page token.
|
1174
|
+
# @param filter [::String]
|
1175
|
+
# Optional. A filter query to apply when listing delivery vehicles. See
|
1176
|
+
# http://aip.dev/160 for examples of the filter syntax. If you don't specify
|
1177
|
+
# a value, or if you specify an empty string for the filter, then all
|
1178
|
+
# delivery vehicles are returned.
|
1179
|
+
#
|
1180
|
+
# Note that the only queries supported for `ListDeliveryVehicles` are
|
1181
|
+
# on vehicle attributes (for example, `attributes.<key> = <value>` or
|
1182
|
+
# `attributes.<key1> = <value1> AND attributes.<key2> = <value2>`). Also, all
|
1183
|
+
# attributes are stored as strings, so the only supported comparisons against
|
1184
|
+
# attributes are string comparisons. In order to compare against number or
|
1185
|
+
# boolean values, the values must be explicitly quoted to be treated as
|
1186
|
+
# strings (for example, `attributes.<key> = "10"` or
|
1187
|
+
# `attributes.<key> = "true"`).
|
1188
|
+
#
|
1189
|
+
# The maximum number of restrictions allowed in a filter query is 50. A
|
1190
|
+
# restriction is a part of the query of the form
|
1191
|
+
# `attribute.<KEY> <COMPARATOR> <VALUE>`, for example `attributes.foo = bar`
|
1192
|
+
# is 1 restriction.
|
1193
|
+
# @param viewport [::Google::Geo::Type::Viewport, ::Hash]
|
1194
|
+
# Optional. A filter that limits the vehicles returned to those whose last
|
1195
|
+
# known location was in the rectangular area defined by the viewport.
|
1196
|
+
#
|
1197
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1198
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle>]
|
1199
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1200
|
+
#
|
1201
|
+
# @return [::Gapic::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle>]
|
1202
|
+
#
|
1203
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1204
|
+
#
|
1205
|
+
# @example Basic example
|
1206
|
+
# require "google/maps/fleet_engine/delivery/v1"
|
1207
|
+
#
|
1208
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1209
|
+
# client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
|
1210
|
+
#
|
1211
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1212
|
+
# request = Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest.new
|
1213
|
+
#
|
1214
|
+
# # Call the list_delivery_vehicles method.
|
1215
|
+
# result = client.list_delivery_vehicles request
|
1216
|
+
#
|
1217
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
1218
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
1219
|
+
# result.each do |item|
|
1220
|
+
# # Each element is of type ::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle.
|
1221
|
+
# p item
|
1222
|
+
# end
|
1223
|
+
#
|
1224
|
+
def list_delivery_vehicles request, options = nil
|
1225
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1226
|
+
|
1227
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest
|
1228
|
+
|
1229
|
+
# Converts hash and nil to an options object
|
1230
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1231
|
+
|
1232
|
+
# Customize the options with defaults
|
1233
|
+
metadata = @config.rpcs.list_delivery_vehicles.metadata.to_h
|
1234
|
+
|
1235
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
1236
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1237
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1238
|
+
gapic_version: ::Google::Maps::FleetEngine::Delivery::V1::VERSION
|
1239
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
1240
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1241
|
+
|
1242
|
+
header_params = {}
|
1243
|
+
if request.parent &&
|
1244
|
+
%r{^providers/[^/]+/?$}.match?(request.parent)
|
1245
|
+
header_params["provider_id"] = request.parent
|
1246
|
+
end
|
1247
|
+
|
1248
|
+
request_params_header = URI.encode_www_form header_params
|
1249
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1250
|
+
|
1251
|
+
options.apply_defaults timeout: @config.rpcs.list_delivery_vehicles.timeout,
|
1252
|
+
metadata: metadata,
|
1253
|
+
retry_policy: @config.rpcs.list_delivery_vehicles.retry_policy
|
1254
|
+
|
1255
|
+
options.apply_defaults timeout: @config.timeout,
|
1256
|
+
metadata: @config.metadata,
|
1257
|
+
retry_policy: @config.retry_policy
|
1258
|
+
|
1259
|
+
@delivery_service_stub.call_rpc :list_delivery_vehicles, request, options: options do |response, operation|
|
1260
|
+
response = ::Gapic::PagedEnumerable.new @delivery_service_stub, :list_delivery_vehicles, request, response, operation, options
|
1261
|
+
yield response, operation if block_given?
|
1262
|
+
return response
|
1263
|
+
end
|
1264
|
+
rescue ::GRPC::BadStatus => e
|
1265
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1266
|
+
end
|
1267
|
+
|
1268
|
+
##
|
1269
|
+
# Configuration class for the DeliveryService API.
|
1270
|
+
#
|
1271
|
+
# This class represents the configuration for DeliveryService,
|
1272
|
+
# providing control over timeouts, retry behavior, logging, transport
|
1273
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
1274
|
+
# applied individually to specific RPCs. See
|
1275
|
+
# {::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client::Configuration::Rpcs}
|
1276
|
+
# for a list of RPCs that can be configured independently.
|
1277
|
+
#
|
1278
|
+
# Configuration can be applied globally to all clients, or to a single client
|
1279
|
+
# on construction.
|
1280
|
+
#
|
1281
|
+
# @example
|
1282
|
+
#
|
1283
|
+
# # Modify the global config, setting the timeout for
|
1284
|
+
# # create_delivery_vehicle to 20 seconds,
|
1285
|
+
# # and all remaining timeouts to 10 seconds.
|
1286
|
+
# ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.configure do |config|
|
1287
|
+
# config.timeout = 10.0
|
1288
|
+
# config.rpcs.create_delivery_vehicle.timeout = 20.0
|
1289
|
+
# end
|
1290
|
+
#
|
1291
|
+
# # Apply the above configuration only to a new client.
|
1292
|
+
# client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config|
|
1293
|
+
# config.timeout = 10.0
|
1294
|
+
# config.rpcs.create_delivery_vehicle.timeout = 20.0
|
1295
|
+
# end
|
1296
|
+
#
|
1297
|
+
# @!attribute [rw] endpoint
|
1298
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
1299
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
1300
|
+
# @return [::String,nil]
|
1301
|
+
# @!attribute [rw] credentials
|
1302
|
+
# Credentials to send with calls. You may provide any of the following types:
|
1303
|
+
# * (`String`) The path to a service account key file in JSON format
|
1304
|
+
# * (`Hash`) A service account key as a Hash
|
1305
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
1306
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
1307
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
1308
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
1309
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
1310
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
1311
|
+
# * (`nil`) indicating no credentials
|
1312
|
+
# @return [::Object]
|
1313
|
+
# @!attribute [rw] scope
|
1314
|
+
# The OAuth scopes
|
1315
|
+
# @return [::Array<::String>]
|
1316
|
+
# @!attribute [rw] lib_name
|
1317
|
+
# The library name as recorded in instrumentation and logging
|
1318
|
+
# @return [::String]
|
1319
|
+
# @!attribute [rw] lib_version
|
1320
|
+
# The library version as recorded in instrumentation and logging
|
1321
|
+
# @return [::String]
|
1322
|
+
# @!attribute [rw] channel_args
|
1323
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
1324
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
1325
|
+
# @return [::Hash]
|
1326
|
+
# @!attribute [rw] interceptors
|
1327
|
+
# An array of interceptors that are run before calls are executed.
|
1328
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
1329
|
+
# @!attribute [rw] timeout
|
1330
|
+
# The call timeout in seconds.
|
1331
|
+
# @return [::Numeric]
|
1332
|
+
# @!attribute [rw] metadata
|
1333
|
+
# Additional gRPC headers to be sent with the call.
|
1334
|
+
# @return [::Hash{::Symbol=>::String}]
|
1335
|
+
# @!attribute [rw] retry_policy
|
1336
|
+
# The retry policy. The value is a hash with the following keys:
|
1337
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1338
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1339
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1340
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1341
|
+
# trigger a retry.
|
1342
|
+
# @return [::Hash]
|
1343
|
+
# @!attribute [rw] quota_project
|
1344
|
+
# A separate project against which to charge quota.
|
1345
|
+
# @return [::String]
|
1346
|
+
# @!attribute [rw] universe_domain
|
1347
|
+
# The universe domain within which to make requests. This determines the
|
1348
|
+
# default endpoint URL. The default value of nil uses the environment
|
1349
|
+
# universe (usually the default "googleapis.com" universe).
|
1350
|
+
# @return [::String,nil]
|
1351
|
+
#
|
1352
|
+
class Configuration
|
1353
|
+
extend ::Gapic::Config
|
1354
|
+
|
1355
|
+
# @private
|
1356
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
1357
|
+
DEFAULT_ENDPOINT = "fleetengine.googleapis.com"
|
1358
|
+
|
1359
|
+
config_attr :endpoint, nil, ::String, nil
|
1360
|
+
config_attr :credentials, nil do |value|
|
1361
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
1362
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
1363
|
+
allowed.any? { |klass| klass === value }
|
1364
|
+
end
|
1365
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
1366
|
+
config_attr :lib_name, nil, ::String, nil
|
1367
|
+
config_attr :lib_version, nil, ::String, nil
|
1368
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
1369
|
+
config_attr :interceptors, nil, ::Array, nil
|
1370
|
+
config_attr :timeout, nil, ::Numeric, nil
|
1371
|
+
config_attr :metadata, nil, ::Hash, nil
|
1372
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
1373
|
+
config_attr :quota_project, nil, ::String, nil
|
1374
|
+
config_attr :universe_domain, nil, ::String, nil
|
1375
|
+
|
1376
|
+
# @private
|
1377
|
+
def initialize parent_config = nil
|
1378
|
+
@parent_config = parent_config unless parent_config.nil?
|
1379
|
+
|
1380
|
+
yield self if block_given?
|
1381
|
+
end
|
1382
|
+
|
1383
|
+
##
|
1384
|
+
# Configurations for individual RPCs
|
1385
|
+
# @return [Rpcs]
|
1386
|
+
#
|
1387
|
+
def rpcs
|
1388
|
+
@rpcs ||= begin
|
1389
|
+
parent_rpcs = nil
|
1390
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
1391
|
+
Rpcs.new parent_rpcs
|
1392
|
+
end
|
1393
|
+
end
|
1394
|
+
|
1395
|
+
##
|
1396
|
+
# Configuration for the channel pool
|
1397
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
1398
|
+
#
|
1399
|
+
def channel_pool
|
1400
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
1401
|
+
end
|
1402
|
+
|
1403
|
+
##
|
1404
|
+
# Configuration RPC class for the DeliveryService API.
|
1405
|
+
#
|
1406
|
+
# Includes fields providing the configuration for each RPC in this service.
|
1407
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1408
|
+
# the following configuration fields:
|
1409
|
+
#
|
1410
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
1411
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
1412
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1413
|
+
# include the following keys:
|
1414
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1415
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1416
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1417
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1418
|
+
# trigger a retry.
|
1419
|
+
#
|
1420
|
+
class Rpcs
|
1421
|
+
##
|
1422
|
+
# RPC-specific configuration for `create_delivery_vehicle`
|
1423
|
+
# @return [::Gapic::Config::Method]
|
1424
|
+
#
|
1425
|
+
attr_reader :create_delivery_vehicle
|
1426
|
+
##
|
1427
|
+
# RPC-specific configuration for `get_delivery_vehicle`
|
1428
|
+
# @return [::Gapic::Config::Method]
|
1429
|
+
#
|
1430
|
+
attr_reader :get_delivery_vehicle
|
1431
|
+
##
|
1432
|
+
# RPC-specific configuration for `update_delivery_vehicle`
|
1433
|
+
# @return [::Gapic::Config::Method]
|
1434
|
+
#
|
1435
|
+
attr_reader :update_delivery_vehicle
|
1436
|
+
##
|
1437
|
+
# RPC-specific configuration for `batch_create_tasks`
|
1438
|
+
# @return [::Gapic::Config::Method]
|
1439
|
+
#
|
1440
|
+
attr_reader :batch_create_tasks
|
1441
|
+
##
|
1442
|
+
# RPC-specific configuration for `create_task`
|
1443
|
+
# @return [::Gapic::Config::Method]
|
1444
|
+
#
|
1445
|
+
attr_reader :create_task
|
1446
|
+
##
|
1447
|
+
# RPC-specific configuration for `get_task`
|
1448
|
+
# @return [::Gapic::Config::Method]
|
1449
|
+
#
|
1450
|
+
attr_reader :get_task
|
1451
|
+
##
|
1452
|
+
# RPC-specific configuration for `update_task`
|
1453
|
+
# @return [::Gapic::Config::Method]
|
1454
|
+
#
|
1455
|
+
attr_reader :update_task
|
1456
|
+
##
|
1457
|
+
# RPC-specific configuration for `list_tasks`
|
1458
|
+
# @return [::Gapic::Config::Method]
|
1459
|
+
#
|
1460
|
+
attr_reader :list_tasks
|
1461
|
+
##
|
1462
|
+
# RPC-specific configuration for `get_task_tracking_info`
|
1463
|
+
# @return [::Gapic::Config::Method]
|
1464
|
+
#
|
1465
|
+
attr_reader :get_task_tracking_info
|
1466
|
+
##
|
1467
|
+
# RPC-specific configuration for `list_delivery_vehicles`
|
1468
|
+
# @return [::Gapic::Config::Method]
|
1469
|
+
#
|
1470
|
+
attr_reader :list_delivery_vehicles
|
1471
|
+
|
1472
|
+
# @private
|
1473
|
+
def initialize parent_rpcs = nil
|
1474
|
+
create_delivery_vehicle_config = parent_rpcs.create_delivery_vehicle if parent_rpcs.respond_to? :create_delivery_vehicle
|
1475
|
+
@create_delivery_vehicle = ::Gapic::Config::Method.new create_delivery_vehicle_config
|
1476
|
+
get_delivery_vehicle_config = parent_rpcs.get_delivery_vehicle if parent_rpcs.respond_to? :get_delivery_vehicle
|
1477
|
+
@get_delivery_vehicle = ::Gapic::Config::Method.new get_delivery_vehicle_config
|
1478
|
+
update_delivery_vehicle_config = parent_rpcs.update_delivery_vehicle if parent_rpcs.respond_to? :update_delivery_vehicle
|
1479
|
+
@update_delivery_vehicle = ::Gapic::Config::Method.new update_delivery_vehicle_config
|
1480
|
+
batch_create_tasks_config = parent_rpcs.batch_create_tasks if parent_rpcs.respond_to? :batch_create_tasks
|
1481
|
+
@batch_create_tasks = ::Gapic::Config::Method.new batch_create_tasks_config
|
1482
|
+
create_task_config = parent_rpcs.create_task if parent_rpcs.respond_to? :create_task
|
1483
|
+
@create_task = ::Gapic::Config::Method.new create_task_config
|
1484
|
+
get_task_config = parent_rpcs.get_task if parent_rpcs.respond_to? :get_task
|
1485
|
+
@get_task = ::Gapic::Config::Method.new get_task_config
|
1486
|
+
update_task_config = parent_rpcs.update_task if parent_rpcs.respond_to? :update_task
|
1487
|
+
@update_task = ::Gapic::Config::Method.new update_task_config
|
1488
|
+
list_tasks_config = parent_rpcs.list_tasks if parent_rpcs.respond_to? :list_tasks
|
1489
|
+
@list_tasks = ::Gapic::Config::Method.new list_tasks_config
|
1490
|
+
get_task_tracking_info_config = parent_rpcs.get_task_tracking_info if parent_rpcs.respond_to? :get_task_tracking_info
|
1491
|
+
@get_task_tracking_info = ::Gapic::Config::Method.new get_task_tracking_info_config
|
1492
|
+
list_delivery_vehicles_config = parent_rpcs.list_delivery_vehicles if parent_rpcs.respond_to? :list_delivery_vehicles
|
1493
|
+
@list_delivery_vehicles = ::Gapic::Config::Method.new list_delivery_vehicles_config
|
1494
|
+
|
1495
|
+
yield self if block_given?
|
1496
|
+
end
|
1497
|
+
end
|
1498
|
+
end
|
1499
|
+
end
|
1500
|
+
end
|
1501
|
+
end
|
1502
|
+
end
|
1503
|
+
end
|
1504
|
+
end
|
1505
|
+
end
|