google-maps-fleet_engine-v1 0.a → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +144 -8
  5. data/lib/google/maps/fleet_engine/v1/rest.rb +38 -0
  6. data/lib/google/maps/fleet_engine/v1/trip_service/client.rb +1004 -0
  7. data/lib/google/maps/fleet_engine/v1/trip_service/credentials.rb +47 -0
  8. data/lib/google/maps/fleet_engine/v1/trip_service/paths.rb +50 -0
  9. data/lib/google/maps/fleet_engine/v1/trip_service/rest/client.rb +938 -0
  10. data/lib/google/maps/fleet_engine/v1/trip_service/rest/service_stub.rb +368 -0
  11. data/lib/google/maps/fleet_engine/v1/trip_service/rest.rb +52 -0
  12. data/lib/google/maps/fleet_engine/v1/trip_service.rb +55 -0
  13. data/lib/google/maps/fleet_engine/v1/vehicle_service/client.rb +1314 -0
  14. data/lib/google/maps/fleet_engine/v1/vehicle_service/credentials.rb +47 -0
  15. data/lib/google/maps/fleet_engine/v1/vehicle_service/paths.rb +50 -0
  16. data/lib/google/maps/fleet_engine/v1/vehicle_service/rest/client.rb +1240 -0
  17. data/lib/google/maps/fleet_engine/v1/vehicle_service/rest/service_stub.rb +427 -0
  18. data/lib/google/maps/fleet_engine/v1/vehicle_service/rest.rb +52 -0
  19. data/lib/google/maps/fleet_engine/v1/vehicle_service.rb +55 -0
  20. data/lib/google/maps/fleet_engine/v1/version.rb +8 -3
  21. data/lib/google/maps/fleet_engine/v1.rb +46 -0
  22. data/lib/google/maps/fleetengine/v1/fleetengine_pb.rb +63 -0
  23. data/lib/google/maps/fleetengine/v1/header_pb.rb +46 -0
  24. data/lib/google/maps/fleetengine/v1/traffic_pb.rb +44 -0
  25. data/lib/google/maps/fleetengine/v1/trip_api_pb.rb +66 -0
  26. data/lib/google/maps/fleetengine/v1/trip_api_services_pb.rb +53 -0
  27. data/lib/google/maps/fleetengine/v1/trips_pb.rb +61 -0
  28. data/lib/google/maps/fleetengine/v1/vehicle_api_pb.rb +80 -0
  29. data/lib/google/maps/fleetengine/v1/vehicle_api_services_pb.rb +103 -0
  30. data/lib/google/maps/fleetengine/v1/vehicles_pb.rb +64 -0
  31. data/lib/google-maps-fleet_engine-v1.rb +21 -0
  32. data/proto_docs/README.md +4 -0
  33. data/proto_docs/google/api/client.rb +399 -0
  34. data/proto_docs/google/api/field_behavior.rb +85 -0
  35. data/proto_docs/google/api/launch_stage.rb +71 -0
  36. data/proto_docs/google/api/resource.rb +222 -0
  37. data/proto_docs/google/api/routing.rb +459 -0
  38. data/proto_docs/google/geo/type/viewport.rb +70 -0
  39. data/proto_docs/google/maps/fleetengine/v1/fleetengine.rb +342 -0
  40. data/proto_docs/google/maps/fleetengine/v1/header.rb +111 -0
  41. data/proto_docs/google/maps/fleetengine/v1/traffic.rb +76 -0
  42. data/proto_docs/google/maps/fleetengine/v1/trip_api.rb +296 -0
  43. data/proto_docs/google/maps/fleetengine/v1/trips.rb +286 -0
  44. data/proto_docs/google/maps/fleetengine/v1/vehicle_api.rb +659 -0
  45. data/proto_docs/google/maps/fleetengine/v1/vehicles.rb +358 -0
  46. data/proto_docs/google/protobuf/duration.rb +98 -0
  47. data/proto_docs/google/protobuf/empty.rb +34 -0
  48. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  49. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  50. data/proto_docs/google/protobuf/wrappers.rb +121 -0
  51. data/proto_docs/google/type/latlng.rb +38 -0
  52. metadata +119 -13
@@ -0,0 +1,1240 @@
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/v1/vehicle_api_pb"
21
+ require "google/maps/fleet_engine/v1/vehicle_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Maps
25
+ module FleetEngine
26
+ module V1
27
+ module VehicleService
28
+ module Rest
29
+ ##
30
+ # REST client for the VehicleService service.
31
+ #
32
+ # Vehicle management service.
33
+ #
34
+ class Client
35
+ # @private
36
+ API_VERSION = ""
37
+
38
+ # @private
39
+ DEFAULT_ENDPOINT_TEMPLATE = "fleetengine.$UNIVERSE_DOMAIN$"
40
+
41
+ include Paths
42
+
43
+ # @private
44
+ attr_reader :vehicle_service_stub
45
+
46
+ ##
47
+ # Configure the VehicleService Client class.
48
+ #
49
+ # See {::Google::Maps::FleetEngine::V1::VehicleService::Rest::Client::Configuration}
50
+ # for a description of the configuration fields.
51
+ #
52
+ # @example
53
+ #
54
+ # # Modify the configuration for all VehicleService clients
55
+ # ::Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.configure do |config|
56
+ # config.timeout = 10.0
57
+ # end
58
+ #
59
+ # @yield [config] Configure the Client client.
60
+ # @yieldparam config [Client::Configuration]
61
+ #
62
+ # @return [Client::Configuration]
63
+ #
64
+ def self.configure
65
+ @configure ||= begin
66
+ namespace = ["Google", "Maps", "FleetEngine", "V1"]
67
+ parent_config = while namespace.any?
68
+ parent_name = namespace.join "::"
69
+ parent_const = const_get parent_name
70
+ break parent_const.configure if parent_const.respond_to? :configure
71
+ namespace.pop
72
+ end
73
+ default_config = Client::Configuration.new parent_config
74
+
75
+ default_config.rpcs.create_vehicle.timeout = 15.0
76
+ default_config.rpcs.create_vehicle.retry_policy = {
77
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
78
+ }
79
+
80
+ default_config.rpcs.get_vehicle.timeout = 15.0
81
+ default_config.rpcs.get_vehicle.retry_policy = {
82
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
83
+ }
84
+
85
+ default_config.rpcs.update_vehicle.timeout = 15.0
86
+ default_config.rpcs.update_vehicle.retry_policy = {
87
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
88
+ }
89
+
90
+ default_config.rpcs.update_vehicle_attributes.timeout = 15.0
91
+ default_config.rpcs.update_vehicle_attributes.retry_policy = {
92
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
93
+ }
94
+
95
+ default_config.rpcs.search_vehicles.timeout = 15.0
96
+ default_config.rpcs.search_vehicles.retry_policy = {
97
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
98
+ }
99
+
100
+ default_config
101
+ end
102
+ yield @configure if block_given?
103
+ @configure
104
+ end
105
+
106
+ ##
107
+ # Configure the VehicleService Client instance.
108
+ #
109
+ # The configuration is set to the derived mode, meaning that values can be changed,
110
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
111
+ # should be made on {Client.configure}.
112
+ #
113
+ # See {::Google::Maps::FleetEngine::V1::VehicleService::Rest::Client::Configuration}
114
+ # for a description of the configuration fields.
115
+ #
116
+ # @yield [config] Configure the Client client.
117
+ # @yieldparam config [Client::Configuration]
118
+ #
119
+ # @return [Client::Configuration]
120
+ #
121
+ def configure
122
+ yield @config if block_given?
123
+ @config
124
+ end
125
+
126
+ ##
127
+ # The effective universe domain
128
+ #
129
+ # @return [String]
130
+ #
131
+ def universe_domain
132
+ @vehicle_service_stub.universe_domain
133
+ end
134
+
135
+ ##
136
+ # Create a new VehicleService REST client object.
137
+ #
138
+ # @example
139
+ #
140
+ # # Create a client using the default configuration
141
+ # client = ::Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.new
142
+ #
143
+ # # Create a client using a custom configuration
144
+ # client = ::Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.new do |config|
145
+ # config.timeout = 10.0
146
+ # end
147
+ #
148
+ # @yield [config] Configure the VehicleService client.
149
+ # @yieldparam config [Client::Configuration]
150
+ #
151
+ def initialize
152
+ # Create the configuration object
153
+ @config = Configuration.new Client.configure
154
+
155
+ # Yield the configuration if needed
156
+ yield @config if block_given?
157
+
158
+ # Create credentials
159
+ credentials = @config.credentials
160
+ # Use self-signed JWT if the endpoint is unchanged from default,
161
+ # but only if the default endpoint does not have a region prefix.
162
+ enable_self_signed_jwt = @config.endpoint.nil? ||
163
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
164
+ !@config.endpoint.split(".").first.include?("-"))
165
+ credentials ||= Credentials.default scope: @config.scope,
166
+ enable_self_signed_jwt: enable_self_signed_jwt
167
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
168
+ credentials = Credentials.new credentials, scope: @config.scope
169
+ end
170
+
171
+ @quota_project_id = @config.quota_project
172
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
173
+
174
+ @vehicle_service_stub = ::Google::Maps::FleetEngine::V1::VehicleService::Rest::ServiceStub.new(
175
+ endpoint: @config.endpoint,
176
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
177
+ universe_domain: @config.universe_domain,
178
+ credentials: credentials
179
+ )
180
+ end
181
+
182
+ # Service calls
183
+
184
+ ##
185
+ # Instantiates a new vehicle associated with an on-demand rideshare or
186
+ # deliveries provider. Each `Vehicle` must have a unique vehicle ID.
187
+ #
188
+ # The following `Vehicle` fields are required when creating a `Vehicle`:
189
+ #
190
+ # * `vehicleState`
191
+ # * `supportedTripTypes`
192
+ # * `maximumCapacity`
193
+ # * `vehicleType`
194
+ #
195
+ # The following `Vehicle` fields are ignored when creating a `Vehicle`:
196
+ #
197
+ # * `name`
198
+ # * `currentTrips`
199
+ # * `availableCapacity`
200
+ # * `current_route_segment`
201
+ # * `current_route_segment_end_point`
202
+ # * `current_route_segment_version`
203
+ # * `current_route_segment_traffic`
204
+ # * `route`
205
+ # * `waypoints`
206
+ # * `waypoints_version`
207
+ # * `remaining_distance_meters`
208
+ # * `remaining_time_seconds`
209
+ # * `eta_to_next_waypoint`
210
+ # * `navigation_status`
211
+ #
212
+ # All other fields are optional and used if provided.
213
+ #
214
+ # @overload create_vehicle(request, options = nil)
215
+ # Pass arguments to `create_vehicle` via a request object, either of type
216
+ # {::Google::Maps::FleetEngine::V1::CreateVehicleRequest} or an equivalent Hash.
217
+ #
218
+ # @param request [::Google::Maps::FleetEngine::V1::CreateVehicleRequest, ::Hash]
219
+ # A request object representing the call parameters. Required. To specify no
220
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
221
+ # @param options [::Gapic::CallOptions, ::Hash]
222
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
223
+ #
224
+ # @overload create_vehicle(header: nil, parent: nil, vehicle_id: nil, vehicle: nil)
225
+ # Pass arguments to `create_vehicle` via keyword arguments. Note that at
226
+ # least one keyword argument is required. To specify no parameters, or to keep all
227
+ # the default parameter values, pass an empty Hash as a request object (see above).
228
+ #
229
+ # @param header [::Google::Maps::FleetEngine::V1::RequestHeader, ::Hash]
230
+ # The standard Fleet Engine request header.
231
+ # @param parent [::String]
232
+ # Required. Must be in the format `providers/{provider}`.
233
+ # The provider must be the Project ID (for example, `sample-cloud-project`)
234
+ # of the Google Cloud Project of which the service account making
235
+ # this call is a member.
236
+ # @param vehicle_id [::String]
237
+ # Required. Unique Vehicle ID.
238
+ # Subject to the following restrictions:
239
+ #
240
+ # * Must be a valid Unicode string.
241
+ # * Limited to a maximum length of 64 characters.
242
+ # * Normalized according to [Unicode Normalization Form C]
243
+ # (http://www.unicode.org/reports/tr15/).
244
+ # * May not contain any of the following ASCII characters: '/', ':', '?',
245
+ # ',', or '#'.
246
+ # @param vehicle [::Google::Maps::FleetEngine::V1::Vehicle, ::Hash]
247
+ # Required. The Vehicle entity to create. When creating a Vehicle, the
248
+ # following fields are required:
249
+ #
250
+ # * `vehicleState`
251
+ # * `supportedTripTypes`
252
+ # * `maximumCapacity`
253
+ # * `vehicleType`
254
+ #
255
+ # When creating a Vehicle, the following fields are ignored:
256
+ #
257
+ # * `name`
258
+ # * `currentTrips`
259
+ # * `availableCapacity`
260
+ # * `current_route_segment`
261
+ # * `current_route_segment_end_point`
262
+ # * `current_route_segment_version`
263
+ # * `current_route_segment_traffic`
264
+ # * `route`
265
+ # * `waypoints`
266
+ # * `waypoints_version`
267
+ # * `remaining_distance_meters`
268
+ # * `remaining_time_seconds`
269
+ # * `eta_to_next_waypoint`
270
+ # * `navigation_status`
271
+ #
272
+ # All other fields are optional and used if provided.
273
+ # @yield [result, operation] Access the result along with the TransportOperation object
274
+ # @yieldparam result [::Google::Maps::FleetEngine::V1::Vehicle]
275
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
276
+ #
277
+ # @return [::Google::Maps::FleetEngine::V1::Vehicle]
278
+ #
279
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
280
+ #
281
+ # @example Basic example
282
+ # require "google/maps/fleet_engine/v1"
283
+ #
284
+ # # Create a client object. The client can be reused for multiple calls.
285
+ # client = Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.new
286
+ #
287
+ # # Create a request. To set request fields, pass in keyword arguments.
288
+ # request = Google::Maps::FleetEngine::V1::CreateVehicleRequest.new
289
+ #
290
+ # # Call the create_vehicle method.
291
+ # result = client.create_vehicle request
292
+ #
293
+ # # The returned object is of type Google::Maps::FleetEngine::V1::Vehicle.
294
+ # p result
295
+ #
296
+ def create_vehicle request, options = nil
297
+ raise ::ArgumentError, "request must be provided" if request.nil?
298
+
299
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::V1::CreateVehicleRequest
300
+
301
+ # Converts hash and nil to an options object
302
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
303
+
304
+ # Customize the options with defaults
305
+ call_metadata = @config.rpcs.create_vehicle.metadata.to_h
306
+
307
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
308
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
309
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
310
+ gapic_version: ::Google::Maps::FleetEngine::V1::VERSION,
311
+ transports_version_send: [:rest]
312
+
313
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
314
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
315
+
316
+ options.apply_defaults timeout: @config.rpcs.create_vehicle.timeout,
317
+ metadata: call_metadata,
318
+ retry_policy: @config.rpcs.create_vehicle.retry_policy
319
+
320
+ options.apply_defaults timeout: @config.timeout,
321
+ metadata: @config.metadata,
322
+ retry_policy: @config.retry_policy
323
+
324
+ @vehicle_service_stub.create_vehicle request, options do |result, operation|
325
+ yield result, operation if block_given?
326
+ return result
327
+ end
328
+ rescue ::Gapic::Rest::Error => e
329
+ raise ::Google::Cloud::Error.from_error(e)
330
+ end
331
+
332
+ ##
333
+ # Returns a vehicle from the Fleet Engine.
334
+ #
335
+ # @overload get_vehicle(request, options = nil)
336
+ # Pass arguments to `get_vehicle` via a request object, either of type
337
+ # {::Google::Maps::FleetEngine::V1::GetVehicleRequest} or an equivalent Hash.
338
+ #
339
+ # @param request [::Google::Maps::FleetEngine::V1::GetVehicleRequest, ::Hash]
340
+ # A request object representing the call parameters. Required. To specify no
341
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
342
+ # @param options [::Gapic::CallOptions, ::Hash]
343
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
344
+ #
345
+ # @overload get_vehicle(header: nil, name: nil, current_route_segment_version: nil, waypoints_version: nil)
346
+ # Pass arguments to `get_vehicle` via keyword arguments. Note that at
347
+ # least one keyword argument is required. To specify no parameters, or to keep all
348
+ # the default parameter values, pass an empty Hash as a request object (see above).
349
+ #
350
+ # @param header [::Google::Maps::FleetEngine::V1::RequestHeader, ::Hash]
351
+ # The standard Fleet Engine request header.
352
+ # @param name [::String]
353
+ # Required. Must be in the format
354
+ # `providers/{provider}/vehicles/{vehicle}`.
355
+ # The provider must be the Project ID (for example, `sample-cloud-project`)
356
+ # of the Google Cloud Project of which the service account making
357
+ # this call is a member.
358
+ # @param current_route_segment_version [::Google::Protobuf::Timestamp, ::Hash]
359
+ # Indicates the minimum timestamp (exclusive) for which
360
+ # `Vehicle.current_route_segment` is retrieved.
361
+ # If the route is unchanged since this timestamp, the `current_route_segment`
362
+ # field is not set in the response. If a minimum is unspecified, the
363
+ # `current_route_segment` is always retrieved.
364
+ # @param waypoints_version [::Google::Protobuf::Timestamp, ::Hash]
365
+ # Indicates the minimum timestamp (exclusive) for which `Vehicle.waypoints`
366
+ # data is retrieved. If the waypoints are unchanged since this timestamp, the
367
+ # `vehicle.waypoints` data is not set in the response. If this field is
368
+ # unspecified, `vehicle.waypoints` is always retrieved.
369
+ # @yield [result, operation] Access the result along with the TransportOperation object
370
+ # @yieldparam result [::Google::Maps::FleetEngine::V1::Vehicle]
371
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
372
+ #
373
+ # @return [::Google::Maps::FleetEngine::V1::Vehicle]
374
+ #
375
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
376
+ #
377
+ # @example Basic example
378
+ # require "google/maps/fleet_engine/v1"
379
+ #
380
+ # # Create a client object. The client can be reused for multiple calls.
381
+ # client = Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.new
382
+ #
383
+ # # Create a request. To set request fields, pass in keyword arguments.
384
+ # request = Google::Maps::FleetEngine::V1::GetVehicleRequest.new
385
+ #
386
+ # # Call the get_vehicle method.
387
+ # result = client.get_vehicle request
388
+ #
389
+ # # The returned object is of type Google::Maps::FleetEngine::V1::Vehicle.
390
+ # p result
391
+ #
392
+ def get_vehicle request, options = nil
393
+ raise ::ArgumentError, "request must be provided" if request.nil?
394
+
395
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::V1::GetVehicleRequest
396
+
397
+ # Converts hash and nil to an options object
398
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
399
+
400
+ # Customize the options with defaults
401
+ call_metadata = @config.rpcs.get_vehicle.metadata.to_h
402
+
403
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
404
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
405
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
406
+ gapic_version: ::Google::Maps::FleetEngine::V1::VERSION,
407
+ transports_version_send: [:rest]
408
+
409
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
410
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
411
+
412
+ options.apply_defaults timeout: @config.rpcs.get_vehicle.timeout,
413
+ metadata: call_metadata,
414
+ retry_policy: @config.rpcs.get_vehicle.retry_policy
415
+
416
+ options.apply_defaults timeout: @config.timeout,
417
+ metadata: @config.metadata,
418
+ retry_policy: @config.retry_policy
419
+
420
+ @vehicle_service_stub.get_vehicle request, options do |result, operation|
421
+ yield result, operation if block_given?
422
+ return result
423
+ end
424
+ rescue ::Gapic::Rest::Error => e
425
+ raise ::Google::Cloud::Error.from_error(e)
426
+ end
427
+
428
+ ##
429
+ # Writes updated vehicle data to the Fleet Engine.
430
+ #
431
+ # When updating a `Vehicle`, the following fields cannot be updated since
432
+ # they are managed by the server:
433
+ #
434
+ # * `currentTrips`
435
+ # * `availableCapacity`
436
+ # * `current_route_segment_version`
437
+ # * `waypoints_version`
438
+ #
439
+ # The vehicle `name` also cannot be updated.
440
+ #
441
+ # If the `attributes` field is updated, **all** the vehicle's attributes are
442
+ # replaced with the attributes provided in the request. If you want to update
443
+ # only some attributes, see the `UpdateVehicleAttributes` method. Likewise,
444
+ # the `waypoints` field can be updated, but must contain all the waypoints
445
+ # currently on the vehicle, and no other waypoints.
446
+ #
447
+ # @overload update_vehicle(request, options = nil)
448
+ # Pass arguments to `update_vehicle` via a request object, either of type
449
+ # {::Google::Maps::FleetEngine::V1::UpdateVehicleRequest} or an equivalent Hash.
450
+ #
451
+ # @param request [::Google::Maps::FleetEngine::V1::UpdateVehicleRequest, ::Hash]
452
+ # A request object representing the call parameters. Required. To specify no
453
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
454
+ # @param options [::Gapic::CallOptions, ::Hash]
455
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
456
+ #
457
+ # @overload update_vehicle(header: nil, name: nil, vehicle: nil, update_mask: nil)
458
+ # Pass arguments to `update_vehicle` via keyword arguments. Note that at
459
+ # least one keyword argument is required. To specify no parameters, or to keep all
460
+ # the default parameter values, pass an empty Hash as a request object (see above).
461
+ #
462
+ # @param header [::Google::Maps::FleetEngine::V1::RequestHeader, ::Hash]
463
+ # The standard Fleet Engine request header.
464
+ # @param name [::String]
465
+ # Required. Must be in the format
466
+ # `providers/{provider}/vehicles/{vehicle}`.
467
+ # The \\{provider} must be the Project ID (for example, `sample-cloud-project`)
468
+ # of the Google Cloud Project of which the service account making
469
+ # this call is a member.
470
+ # @param vehicle [::Google::Maps::FleetEngine::V1::Vehicle, ::Hash]
471
+ # Required. The `Vehicle` entity values to apply. When updating a `Vehicle`,
472
+ # the following fields may not be updated as they are managed by the
473
+ # server.
474
+ #
475
+ # * `available_capacity`
476
+ # * `current_route_segment_version`
477
+ # * `current_trips`
478
+ # * `name`
479
+ # * `waypoints_version`
480
+ #
481
+ # If the `attributes` field is updated, **all** the vehicle's attributes are
482
+ # replaced with the attributes provided in the request. If you want to update
483
+ # only some attributes, see the `UpdateVehicleAttributes` method.
484
+ #
485
+ # Likewise, the `waypoints` field can be updated, but must contain all the
486
+ # waypoints currently on the vehicle, and no other waypoints.
487
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
488
+ # Required. A field mask indicating which fields of the `Vehicle` to update.
489
+ # At least one field name must be provided.
490
+ # @yield [result, operation] Access the result along with the TransportOperation object
491
+ # @yieldparam result [::Google::Maps::FleetEngine::V1::Vehicle]
492
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
493
+ #
494
+ # @return [::Google::Maps::FleetEngine::V1::Vehicle]
495
+ #
496
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
497
+ #
498
+ # @example Basic example
499
+ # require "google/maps/fleet_engine/v1"
500
+ #
501
+ # # Create a client object. The client can be reused for multiple calls.
502
+ # client = Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.new
503
+ #
504
+ # # Create a request. To set request fields, pass in keyword arguments.
505
+ # request = Google::Maps::FleetEngine::V1::UpdateVehicleRequest.new
506
+ #
507
+ # # Call the update_vehicle method.
508
+ # result = client.update_vehicle request
509
+ #
510
+ # # The returned object is of type Google::Maps::FleetEngine::V1::Vehicle.
511
+ # p result
512
+ #
513
+ def update_vehicle request, options = nil
514
+ raise ::ArgumentError, "request must be provided" if request.nil?
515
+
516
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::V1::UpdateVehicleRequest
517
+
518
+ # Converts hash and nil to an options object
519
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
520
+
521
+ # Customize the options with defaults
522
+ call_metadata = @config.rpcs.update_vehicle.metadata.to_h
523
+
524
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
525
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
526
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
527
+ gapic_version: ::Google::Maps::FleetEngine::V1::VERSION,
528
+ transports_version_send: [:rest]
529
+
530
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
531
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
532
+
533
+ options.apply_defaults timeout: @config.rpcs.update_vehicle.timeout,
534
+ metadata: call_metadata,
535
+ retry_policy: @config.rpcs.update_vehicle.retry_policy
536
+
537
+ options.apply_defaults timeout: @config.timeout,
538
+ metadata: @config.metadata,
539
+ retry_policy: @config.retry_policy
540
+
541
+ @vehicle_service_stub.update_vehicle request, options do |result, operation|
542
+ yield result, operation if block_given?
543
+ return result
544
+ end
545
+ rescue ::Gapic::Rest::Error => e
546
+ raise ::Google::Cloud::Error.from_error(e)
547
+ end
548
+
549
+ ##
550
+ # Partially updates a vehicle's attributes.
551
+ # Only the attributes mentioned in the request will be updated, other
552
+ # attributes will NOT be altered. Note: this is different in `UpdateVehicle`,
553
+ # where the whole `attributes` field will be replaced by the one in
554
+ # `UpdateVehicleRequest`, attributes not in the request would be removed.
555
+ #
556
+ # @overload update_vehicle_attributes(request, options = nil)
557
+ # Pass arguments to `update_vehicle_attributes` via a request object, either of type
558
+ # {::Google::Maps::FleetEngine::V1::UpdateVehicleAttributesRequest} or an equivalent Hash.
559
+ #
560
+ # @param request [::Google::Maps::FleetEngine::V1::UpdateVehicleAttributesRequest, ::Hash]
561
+ # A request object representing the call parameters. Required. To specify no
562
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
563
+ # @param options [::Gapic::CallOptions, ::Hash]
564
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
565
+ #
566
+ # @overload update_vehicle_attributes(header: nil, name: nil, attributes: nil)
567
+ # Pass arguments to `update_vehicle_attributes` via keyword arguments. Note that at
568
+ # least one keyword argument is required. To specify no parameters, or to keep all
569
+ # the default parameter values, pass an empty Hash as a request object (see above).
570
+ #
571
+ # @param header [::Google::Maps::FleetEngine::V1::RequestHeader, ::Hash]
572
+ # The standard Fleet Engine request header.
573
+ # @param name [::String]
574
+ # Required. Must be in the format `providers/{provider}/vehicles/{vehicle}`.
575
+ # The provider must be the Project ID (for example, `sample-cloud-project`)
576
+ # of the Google Cloud Project of which the service account making
577
+ # this call is a member.
578
+ # @param attributes [::Array<::Google::Maps::FleetEngine::V1::VehicleAttribute, ::Hash>]
579
+ # Required. The vehicle attributes to update. Unmentioned attributes are not
580
+ # altered or removed.
581
+ # @yield [result, operation] Access the result along with the TransportOperation object
582
+ # @yieldparam result [::Google::Maps::FleetEngine::V1::UpdateVehicleAttributesResponse]
583
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
584
+ #
585
+ # @return [::Google::Maps::FleetEngine::V1::UpdateVehicleAttributesResponse]
586
+ #
587
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
588
+ #
589
+ # @example Basic example
590
+ # require "google/maps/fleet_engine/v1"
591
+ #
592
+ # # Create a client object. The client can be reused for multiple calls.
593
+ # client = Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.new
594
+ #
595
+ # # Create a request. To set request fields, pass in keyword arguments.
596
+ # request = Google::Maps::FleetEngine::V1::UpdateVehicleAttributesRequest.new
597
+ #
598
+ # # Call the update_vehicle_attributes method.
599
+ # result = client.update_vehicle_attributes request
600
+ #
601
+ # # The returned object is of type Google::Maps::FleetEngine::V1::UpdateVehicleAttributesResponse.
602
+ # p result
603
+ #
604
+ def update_vehicle_attributes request, options = nil
605
+ raise ::ArgumentError, "request must be provided" if request.nil?
606
+
607
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::V1::UpdateVehicleAttributesRequest
608
+
609
+ # Converts hash and nil to an options object
610
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
611
+
612
+ # Customize the options with defaults
613
+ call_metadata = @config.rpcs.update_vehicle_attributes.metadata.to_h
614
+
615
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
616
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
617
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
618
+ gapic_version: ::Google::Maps::FleetEngine::V1::VERSION,
619
+ transports_version_send: [:rest]
620
+
621
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
622
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
623
+
624
+ options.apply_defaults timeout: @config.rpcs.update_vehicle_attributes.timeout,
625
+ metadata: call_metadata,
626
+ retry_policy: @config.rpcs.update_vehicle_attributes.retry_policy
627
+
628
+ options.apply_defaults timeout: @config.timeout,
629
+ metadata: @config.metadata,
630
+ retry_policy: @config.retry_policy
631
+
632
+ @vehicle_service_stub.update_vehicle_attributes request, options do |result, operation|
633
+ yield result, operation if block_given?
634
+ return result
635
+ end
636
+ rescue ::Gapic::Rest::Error => e
637
+ raise ::Google::Cloud::Error.from_error(e)
638
+ end
639
+
640
+ ##
641
+ # Returns a paginated list of vehicles associated with
642
+ # a provider that match the request options.
643
+ #
644
+ # @overload list_vehicles(request, options = nil)
645
+ # Pass arguments to `list_vehicles` via a request object, either of type
646
+ # {::Google::Maps::FleetEngine::V1::ListVehiclesRequest} or an equivalent Hash.
647
+ #
648
+ # @param request [::Google::Maps::FleetEngine::V1::ListVehiclesRequest, ::Hash]
649
+ # A request object representing the call parameters. Required. To specify no
650
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
651
+ # @param options [::Gapic::CallOptions, ::Hash]
652
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
653
+ #
654
+ # @overload list_vehicles(header: nil, parent: nil, page_size: nil, page_token: nil, minimum_capacity: nil, trip_types: nil, maximum_staleness: nil, vehicle_type_categories: nil, required_attributes: nil, required_one_of_attributes: nil, required_one_of_attribute_sets: nil, vehicle_state: nil, on_trip_only: nil, filter: nil, viewport: nil)
655
+ # Pass arguments to `list_vehicles` via keyword arguments. Note that at
656
+ # least one keyword argument is required. To specify no parameters, or to keep all
657
+ # the default parameter values, pass an empty Hash as a request object (see above).
658
+ #
659
+ # @param header [::Google::Maps::FleetEngine::V1::RequestHeader, ::Hash]
660
+ # The standard Fleet Engine request header.
661
+ # @param parent [::String]
662
+ # Required. Must be in the format `providers/{provider}`.
663
+ # The provider must be the Project ID (for example, `sample-cloud-project`)
664
+ # of the Google Cloud Project of which the service account making
665
+ # this call is a member.
666
+ # @param page_size [::Integer]
667
+ # The maximum number of vehicles to return.
668
+ # Default value: 100.
669
+ # @param page_token [::String]
670
+ # The value of the `next_page_token` provided by a previous call to
671
+ # `ListVehicles` so that you can paginate through groups of vehicles. The
672
+ # value is undefined if the filter criteria of the request is not the same as
673
+ # the filter criteria for the previous call to `ListVehicles`.
674
+ # @param minimum_capacity [::Google::Protobuf::Int32Value, ::Hash]
675
+ # Specifies the required minimum capacity of the vehicle. All vehicles
676
+ # returned will have a `maximum_capacity` greater than or equal to this
677
+ # value. If set, must be greater or equal to 0.
678
+ # @param trip_types [::Array<::Google::Maps::FleetEngine::V1::TripType>]
679
+ # Restricts the response to vehicles that support at least one of the
680
+ # specified trip types.
681
+ # @param maximum_staleness [::Google::Protobuf::Duration, ::Hash]
682
+ # Restricts the response to vehicles that have sent location updates to Fleet
683
+ # Engine within the specified duration. Stationary vehicles still
684
+ # transmitting their locations are not considered stale. If present, must be
685
+ # a valid positive duration.
686
+ # @param vehicle_type_categories [::Array<::Google::Maps::FleetEngine::V1::Vehicle::VehicleType::Category>]
687
+ # Required. Restricts the response to vehicles with one of the specified type
688
+ # categories. `UNKNOWN` is not allowed.
689
+ # @param required_attributes [::Array<::String>]
690
+ # Callers can form complex logical operations using any combination of the
691
+ # `required_attributes`, `required_one_of_attributes`, and
692
+ # `required_one_of_attribute_sets` fields.
693
+ #
694
+ # `required_attributes` is a list; `required_one_of_attributes` uses a
695
+ # message which allows a list of lists. In combination, the two fields allow
696
+ # the composition of this expression:
697
+ #
698
+ # ```
699
+ # (required_attributes[0] AND required_attributes[1] AND ...)
700
+ # AND
701
+ # (required_one_of_attributes[0][0] OR required_one_of_attributes[0][1] OR
702
+ # ...)
703
+ # AND
704
+ # (required_one_of_attributes[1][0] OR required_one_of_attributes[1][1] OR
705
+ # ...)
706
+ # ```
707
+ #
708
+ # Restricts the response to vehicles with the specified attributes. This
709
+ # field is a conjunction/AND operation. A max of 50 required_attributes is
710
+ # allowed. This matches the maximum number of attributes allowed on a
711
+ # vehicle. Each repeated string should be of the format "key:value".
712
+ # @param required_one_of_attributes [::Array<::String>]
713
+ # Restricts the response to vehicles with at least one of the specified
714
+ # attributes in each `VehicleAttributeList`. Within each list, a vehicle must
715
+ # match at least one of the attributes. This field is an inclusive
716
+ # disjunction/OR operation in each `VehicleAttributeList` and a
717
+ # conjunction/AND operation across the collection of `VehicleAttributeList`.
718
+ # Each repeated string should be of the format
719
+ # "key1:value1|key2:value2|key3:value3".
720
+ # @param required_one_of_attribute_sets [::Array<::String>]
721
+ # `required_one_of_attribute_sets` provides additional functionality.
722
+ #
723
+ # Similar to `required_one_of_attributes`, `required_one_of_attribute_sets`
724
+ # uses a message which allows a list of lists, allowing expressions such as
725
+ # this one:
726
+ #
727
+ # ```
728
+ # (required_attributes[0] AND required_attributes[1] AND ...)
729
+ # AND
730
+ # (
731
+ # (required_one_of_attribute_sets[0][0] AND
732
+ # required_one_of_attribute_sets[0][1] AND
733
+ # ...)
734
+ # OR
735
+ # (required_one_of_attribute_sets[1][0] AND
736
+ # required_one_of_attribute_sets[1][1] AND
737
+ # ...)
738
+ # )
739
+ # ```
740
+ #
741
+ # Restricts the response to vehicles that match all the attributes in a
742
+ # `VehicleAttributeList`. Within each list, a vehicle must match all of the
743
+ # attributes. This field is a conjunction/AND operation in each
744
+ # `VehicleAttributeList` and inclusive disjunction/OR operation across the
745
+ # collection of `VehicleAttributeList`. Each repeated string should be of the
746
+ # format "key1:value1|key2:value2|key3:value3".
747
+ # @param vehicle_state [::Google::Maps::FleetEngine::V1::VehicleState]
748
+ # Restricts the response to vehicles that have this vehicle state.
749
+ # @param on_trip_only [::Boolean]
750
+ # Only return the vehicles with current trip(s).
751
+ # @param filter [::String]
752
+ # Optional. A filter query to apply when listing vehicles. See
753
+ # http://aip.dev/160 for examples of the filter syntax.
754
+ #
755
+ # This field is designed to replace the `required_attributes`,
756
+ # `required_one_of_attributes`, and `required_one_of_attributes_sets` fields.
757
+ # If a non-empty value is specified here, the following fields must be empty:
758
+ # `required_attributes`, `required_one_of_attributes`, and
759
+ # `required_one_of_attributes_sets`.
760
+ #
761
+ # This filter functions as an AND clause with other constraints,
762
+ # such as `vehicle_state` or `on_trip_only`.
763
+ #
764
+ # Note that the only queries supported are on vehicle attributes (for
765
+ # example, `attributes.<key> = <value>` or `attributes.<key1> = <value1> AND
766
+ # attributes.<key2> = <value2>`). The maximum number of restrictions allowed
767
+ # in a filter query is 50.
768
+ #
769
+ # Also, all attributes are stored as strings, so the only supported
770
+ # comparisons against attributes are string comparisons. In order to compare
771
+ # against number or boolean values, the values must be explicitly quoted to
772
+ # be treated as strings (for example, `attributes.<key> = "10"` or
773
+ # `attributes.<key> = "true"`).
774
+ # @param viewport [::Google::Geo::Type::Viewport, ::Hash]
775
+ # Optional. A filter that limits the vehicles returned to those whose last
776
+ # known location was in the rectangular area defined by the viewport.
777
+ # @yield [result, operation] Access the result along with the TransportOperation object
778
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Maps::FleetEngine::V1::Vehicle>]
779
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
780
+ #
781
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Maps::FleetEngine::V1::Vehicle>]
782
+ #
783
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
784
+ #
785
+ # @example Basic example
786
+ # require "google/maps/fleet_engine/v1"
787
+ #
788
+ # # Create a client object. The client can be reused for multiple calls.
789
+ # client = Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.new
790
+ #
791
+ # # Create a request. To set request fields, pass in keyword arguments.
792
+ # request = Google::Maps::FleetEngine::V1::ListVehiclesRequest.new
793
+ #
794
+ # # Call the list_vehicles method.
795
+ # result = client.list_vehicles request
796
+ #
797
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
798
+ # # over elements, and API calls will be issued to fetch pages as needed.
799
+ # result.each do |item|
800
+ # # Each element is of type ::Google::Maps::FleetEngine::V1::Vehicle.
801
+ # p item
802
+ # end
803
+ #
804
+ def list_vehicles request, options = nil
805
+ raise ::ArgumentError, "request must be provided" if request.nil?
806
+
807
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::V1::ListVehiclesRequest
808
+
809
+ # Converts hash and nil to an options object
810
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
811
+
812
+ # Customize the options with defaults
813
+ call_metadata = @config.rpcs.list_vehicles.metadata.to_h
814
+
815
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
816
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
817
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
818
+ gapic_version: ::Google::Maps::FleetEngine::V1::VERSION,
819
+ transports_version_send: [:rest]
820
+
821
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
822
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
823
+
824
+ options.apply_defaults timeout: @config.rpcs.list_vehicles.timeout,
825
+ metadata: call_metadata,
826
+ retry_policy: @config.rpcs.list_vehicles.retry_policy
827
+
828
+ options.apply_defaults timeout: @config.timeout,
829
+ metadata: @config.metadata,
830
+ retry_policy: @config.retry_policy
831
+
832
+ @vehicle_service_stub.list_vehicles request, options do |result, operation|
833
+ result = ::Gapic::Rest::PagedEnumerable.new @vehicle_service_stub, :list_vehicles, "vehicles", request, result, options
834
+ yield result, operation if block_given?
835
+ return result
836
+ end
837
+ rescue ::Gapic::Rest::Error => e
838
+ raise ::Google::Cloud::Error.from_error(e)
839
+ end
840
+
841
+ ##
842
+ # Returns a list of vehicles that match the request options.
843
+ #
844
+ # @overload search_vehicles(request, options = nil)
845
+ # Pass arguments to `search_vehicles` via a request object, either of type
846
+ # {::Google::Maps::FleetEngine::V1::SearchVehiclesRequest} or an equivalent Hash.
847
+ #
848
+ # @param request [::Google::Maps::FleetEngine::V1::SearchVehiclesRequest, ::Hash]
849
+ # A request object representing the call parameters. Required. To specify no
850
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
851
+ # @param options [::Gapic::CallOptions, ::Hash]
852
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
853
+ #
854
+ # @overload search_vehicles(header: nil, parent: nil, pickup_point: nil, dropoff_point: nil, pickup_radius_meters: nil, count: nil, minimum_capacity: nil, trip_types: nil, maximum_staleness: nil, vehicle_types: nil, required_attributes: nil, required_one_of_attributes: nil, required_one_of_attribute_sets: nil, order_by: nil, include_back_to_back: nil, trip_id: nil, current_trips_present: nil, filter: nil)
855
+ # Pass arguments to `search_vehicles` via keyword arguments. Note that at
856
+ # least one keyword argument is required. To specify no parameters, or to keep all
857
+ # the default parameter values, pass an empty Hash as a request object (see above).
858
+ #
859
+ # @param header [::Google::Maps::FleetEngine::V1::RequestHeader, ::Hash]
860
+ # The standard Fleet Engine request header.
861
+ # @param parent [::String]
862
+ # Required. Must be in the format `providers/{provider}`.
863
+ # The provider must be the Project ID (for example, `sample-cloud-project`)
864
+ # of the Google Cloud Project of which the service account making
865
+ # this call is a member.
866
+ # @param pickup_point [::Google::Maps::FleetEngine::V1::TerminalLocation, ::Hash]
867
+ # Required. The pickup point to search near.
868
+ # @param dropoff_point [::Google::Maps::FleetEngine::V1::TerminalLocation, ::Hash]
869
+ # The customer's intended dropoff location. The field is required if
870
+ # `trip_types` contains `TripType.SHARED`.
871
+ # @param pickup_radius_meters [::Integer]
872
+ # Required. Defines the vehicle search radius around the pickup point. Only
873
+ # vehicles within the search radius will be returned. Value must be between
874
+ # 400 and 10000 meters (inclusive).
875
+ # @param count [::Integer]
876
+ # Required. Specifies the maximum number of vehicles to return. The value
877
+ # must be between 1 and 50 (inclusive).
878
+ # @param minimum_capacity [::Integer]
879
+ # Required. Specifies the number of passengers being considered for a trip.
880
+ # The value must be greater than or equal to one. The driver is not
881
+ # considered in the capacity value.
882
+ # @param trip_types [::Array<::Google::Maps::FleetEngine::V1::TripType>]
883
+ # Required. Represents the type of proposed trip. Must include exactly one
884
+ # type. `UNKNOWN_TRIP_TYPE` is not allowed. Restricts the search to only
885
+ # those vehicles that can support that trip type.
886
+ # @param maximum_staleness [::Google::Protobuf::Duration, ::Hash]
887
+ # Restricts the search to only those vehicles that have sent location updates
888
+ # to Fleet Engine within the specified duration. Stationary vehicles still
889
+ # transmitting their locations are not considered stale. If this field is not
890
+ # set, the server uses five minutes as the default value.
891
+ # @param vehicle_types [::Array<::Google::Maps::FleetEngine::V1::Vehicle::VehicleType, ::Hash>]
892
+ # Required. Restricts the search to vehicles with one of the specified types.
893
+ # At least one vehicle type must be specified. VehicleTypes with a category
894
+ # of `UNKNOWN` are not allowed.
895
+ # @param required_attributes [::Array<::Google::Maps::FleetEngine::V1::VehicleAttribute, ::Hash>]
896
+ # Callers can form complex logical operations using any combination of the
897
+ # `required_attributes`, `required_one_of_attributes`, and
898
+ # `required_one_of_attribute_sets` fields.
899
+ #
900
+ # `required_attributes` is a list; `required_one_of_attributes` uses a
901
+ # message which allows a list of lists. In combination, the two fields allow
902
+ # the composition of this expression:
903
+ #
904
+ # ```
905
+ # (required_attributes[0] AND required_attributes[1] AND ...)
906
+ # AND
907
+ # (required_one_of_attributes[0][0] OR required_one_of_attributes[0][1] OR
908
+ # ...)
909
+ # AND
910
+ # (required_one_of_attributes[1][0] OR required_one_of_attributes[1][1] OR
911
+ # ...)
912
+ # ```
913
+ #
914
+ # Restricts the search to only those vehicles with the specified attributes.
915
+ # This field is a conjunction/AND operation. A max of 50 required_attributes
916
+ # is allowed. This matches the maximum number of attributes allowed on a
917
+ # vehicle.
918
+ # @param required_one_of_attributes [::Array<::Google::Maps::FleetEngine::V1::VehicleAttributeList, ::Hash>]
919
+ # Restricts the search to only those vehicles with at least one of
920
+ # the specified attributes in each `VehicleAttributeList`. Within each
921
+ # list, a vehicle must match at least one of the attributes. This field is an
922
+ # inclusive disjunction/OR operation in each `VehicleAttributeList` and a
923
+ # conjunction/AND operation across the collection of `VehicleAttributeList`.
924
+ # @param required_one_of_attribute_sets [::Array<::Google::Maps::FleetEngine::V1::VehicleAttributeList, ::Hash>]
925
+ # `required_one_of_attribute_sets` provides additional functionality.
926
+ #
927
+ # Similar to `required_one_of_attributes`, `required_one_of_attribute_sets`
928
+ # uses a message which allows a list of lists, allowing expressions such as
929
+ # this one:
930
+ #
931
+ # ```
932
+ # (required_attributes[0] AND required_attributes[1] AND ...)
933
+ # AND
934
+ # (
935
+ # (required_one_of_attribute_sets[0][0] AND
936
+ # required_one_of_attribute_sets[0][1] AND
937
+ # ...)
938
+ # OR
939
+ # (required_one_of_attribute_sets[1][0] AND
940
+ # required_one_of_attribute_sets[1][1] AND
941
+ # ...)
942
+ # )
943
+ # ```
944
+ #
945
+ # Restricts the search to only those vehicles with all the attributes in a
946
+ # `VehicleAttributeList`. Within each list, a
947
+ # vehicle must match all of the attributes. This field is a conjunction/AND
948
+ # operation in each `VehicleAttributeList` and inclusive disjunction/OR
949
+ # operation across the collection of `VehicleAttributeList`.
950
+ # @param order_by [::Google::Maps::FleetEngine::V1::SearchVehiclesRequest::VehicleMatchOrder]
951
+ # Required. Specifies the desired ordering criterion for results.
952
+ # @param include_back_to_back [::Boolean]
953
+ # This indicates if vehicles with a single active trip are eligible for this
954
+ # search. This field is only used when `current_trips_present` is
955
+ # unspecified. When `current_trips_present` is unspecified and this field
956
+ # is `false`, vehicles with assigned trips are excluded from the search
957
+ # results. When `current_trips_present` is unspecified and this field is
958
+ # `true`, search results can include vehicles with one active trip that has a
959
+ # status of `ENROUTE_TO_DROPOFF`. When `current_trips_present` is specified,
960
+ # this field cannot be set to true.
961
+ #
962
+ # The default value is `false`.
963
+ # @param trip_id [::String]
964
+ # Indicates the trip associated with this `SearchVehicleRequest`.
965
+ # @param current_trips_present [::Google::Maps::FleetEngine::V1::SearchVehiclesRequest::CurrentTripsPresent]
966
+ # This indicates if vehicles with active trips are eligible for this search.
967
+ # This must be set to something other than
968
+ # `CURRENT_TRIPS_PRESENT_UNSPECIFIED` if `trip_type` includes `SHARED`.
969
+ # @param filter [::String]
970
+ # Optional. A filter query to apply when searching vehicles. See
971
+ # http://aip.dev/160 for examples of the filter syntax.
972
+ #
973
+ # This field is designed to replace the `required_attributes`,
974
+ # `required_one_of_attributes`, and `required_one_of_attributes_sets` fields.
975
+ # If a non-empty value is specified here, the following fields must be empty:
976
+ # `required_attributes`, `required_one_of_attributes`, and
977
+ # `required_one_of_attributes_sets`.
978
+ #
979
+ # This filter functions as an AND clause with other constraints,
980
+ # such as `minimum_capacity` or `vehicle_types`.
981
+ #
982
+ # Note that the only queries supported are on vehicle attributes (for
983
+ # example, `attributes.<key> = <value>` or `attributes.<key1> = <value1> AND
984
+ # attributes.<key2> = <value2>`). The maximum number of restrictions allowed
985
+ # in a filter query is 50.
986
+ #
987
+ # Also, all attributes are stored as strings, so the only supported
988
+ # comparisons against attributes are string comparisons. In order to compare
989
+ # against number or boolean values, the values must be explicitly quoted to
990
+ # be treated as strings (for example, `attributes.<key> = "10"` or
991
+ # `attributes.<key> = "true"`).
992
+ # @yield [result, operation] Access the result along with the TransportOperation object
993
+ # @yieldparam result [::Google::Maps::FleetEngine::V1::SearchVehiclesResponse]
994
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
995
+ #
996
+ # @return [::Google::Maps::FleetEngine::V1::SearchVehiclesResponse]
997
+ #
998
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
999
+ #
1000
+ # @example Basic example
1001
+ # require "google/maps/fleet_engine/v1"
1002
+ #
1003
+ # # Create a client object. The client can be reused for multiple calls.
1004
+ # client = Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.new
1005
+ #
1006
+ # # Create a request. To set request fields, pass in keyword arguments.
1007
+ # request = Google::Maps::FleetEngine::V1::SearchVehiclesRequest.new
1008
+ #
1009
+ # # Call the search_vehicles method.
1010
+ # result = client.search_vehicles request
1011
+ #
1012
+ # # The returned object is of type Google::Maps::FleetEngine::V1::SearchVehiclesResponse.
1013
+ # p result
1014
+ #
1015
+ def search_vehicles request, options = nil
1016
+ raise ::ArgumentError, "request must be provided" if request.nil?
1017
+
1018
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::V1::SearchVehiclesRequest
1019
+
1020
+ # Converts hash and nil to an options object
1021
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1022
+
1023
+ # Customize the options with defaults
1024
+ call_metadata = @config.rpcs.search_vehicles.metadata.to_h
1025
+
1026
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1027
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1028
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1029
+ gapic_version: ::Google::Maps::FleetEngine::V1::VERSION,
1030
+ transports_version_send: [:rest]
1031
+
1032
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1033
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1034
+
1035
+ options.apply_defaults timeout: @config.rpcs.search_vehicles.timeout,
1036
+ metadata: call_metadata,
1037
+ retry_policy: @config.rpcs.search_vehicles.retry_policy
1038
+
1039
+ options.apply_defaults timeout: @config.timeout,
1040
+ metadata: @config.metadata,
1041
+ retry_policy: @config.retry_policy
1042
+
1043
+ @vehicle_service_stub.search_vehicles request, options do |result, operation|
1044
+ yield result, operation if block_given?
1045
+ return result
1046
+ end
1047
+ rescue ::Gapic::Rest::Error => e
1048
+ raise ::Google::Cloud::Error.from_error(e)
1049
+ end
1050
+
1051
+ ##
1052
+ # Configuration class for the VehicleService REST API.
1053
+ #
1054
+ # This class represents the configuration for VehicleService REST,
1055
+ # providing control over timeouts, retry behavior, logging, transport
1056
+ # parameters, and other low-level controls. Certain parameters can also be
1057
+ # applied individually to specific RPCs. See
1058
+ # {::Google::Maps::FleetEngine::V1::VehicleService::Rest::Client::Configuration::Rpcs}
1059
+ # for a list of RPCs that can be configured independently.
1060
+ #
1061
+ # Configuration can be applied globally to all clients, or to a single client
1062
+ # on construction.
1063
+ #
1064
+ # @example
1065
+ #
1066
+ # # Modify the global config, setting the timeout for
1067
+ # # create_vehicle to 20 seconds,
1068
+ # # and all remaining timeouts to 10 seconds.
1069
+ # ::Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.configure do |config|
1070
+ # config.timeout = 10.0
1071
+ # config.rpcs.create_vehicle.timeout = 20.0
1072
+ # end
1073
+ #
1074
+ # # Apply the above configuration only to a new client.
1075
+ # client = ::Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.new do |config|
1076
+ # config.timeout = 10.0
1077
+ # config.rpcs.create_vehicle.timeout = 20.0
1078
+ # end
1079
+ #
1080
+ # @!attribute [rw] endpoint
1081
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1082
+ # nil, indicating to use the default endpoint in the current universe domain.
1083
+ # @return [::String,nil]
1084
+ # @!attribute [rw] credentials
1085
+ # Credentials to send with calls. You may provide any of the following types:
1086
+ # * (`String`) The path to a service account key file in JSON format
1087
+ # * (`Hash`) A service account key as a Hash
1088
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1089
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1090
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1091
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1092
+ # * (`nil`) indicating no credentials
1093
+ # @return [::Object]
1094
+ # @!attribute [rw] scope
1095
+ # The OAuth scopes
1096
+ # @return [::Array<::String>]
1097
+ # @!attribute [rw] lib_name
1098
+ # The library name as recorded in instrumentation and logging
1099
+ # @return [::String]
1100
+ # @!attribute [rw] lib_version
1101
+ # The library version as recorded in instrumentation and logging
1102
+ # @return [::String]
1103
+ # @!attribute [rw] timeout
1104
+ # The call timeout in seconds.
1105
+ # @return [::Numeric]
1106
+ # @!attribute [rw] metadata
1107
+ # Additional headers to be sent with the call.
1108
+ # @return [::Hash{::Symbol=>::String}]
1109
+ # @!attribute [rw] retry_policy
1110
+ # The retry policy. The value is a hash with the following keys:
1111
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1112
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1113
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1114
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1115
+ # trigger a retry.
1116
+ # @return [::Hash]
1117
+ # @!attribute [rw] quota_project
1118
+ # A separate project against which to charge quota.
1119
+ # @return [::String]
1120
+ # @!attribute [rw] universe_domain
1121
+ # The universe domain within which to make requests. This determines the
1122
+ # default endpoint URL. The default value of nil uses the environment
1123
+ # universe (usually the default "googleapis.com" universe).
1124
+ # @return [::String,nil]
1125
+ #
1126
+ class Configuration
1127
+ extend ::Gapic::Config
1128
+
1129
+ # @private
1130
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1131
+ DEFAULT_ENDPOINT = "fleetengine.googleapis.com"
1132
+
1133
+ config_attr :endpoint, nil, ::String, nil
1134
+ config_attr :credentials, nil do |value|
1135
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1136
+ allowed.any? { |klass| klass === value }
1137
+ end
1138
+ config_attr :scope, nil, ::String, ::Array, nil
1139
+ config_attr :lib_name, nil, ::String, nil
1140
+ config_attr :lib_version, nil, ::String, nil
1141
+ config_attr :timeout, nil, ::Numeric, nil
1142
+ config_attr :metadata, nil, ::Hash, nil
1143
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1144
+ config_attr :quota_project, nil, ::String, nil
1145
+ config_attr :universe_domain, nil, ::String, nil
1146
+
1147
+ # @private
1148
+ def initialize parent_config = nil
1149
+ @parent_config = parent_config unless parent_config.nil?
1150
+
1151
+ yield self if block_given?
1152
+ end
1153
+
1154
+ ##
1155
+ # Configurations for individual RPCs
1156
+ # @return [Rpcs]
1157
+ #
1158
+ def rpcs
1159
+ @rpcs ||= begin
1160
+ parent_rpcs = nil
1161
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1162
+ Rpcs.new parent_rpcs
1163
+ end
1164
+ end
1165
+
1166
+ ##
1167
+ # Configuration RPC class for the VehicleService API.
1168
+ #
1169
+ # Includes fields providing the configuration for each RPC in this service.
1170
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1171
+ # the following configuration fields:
1172
+ #
1173
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1174
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1175
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1176
+ # include the following keys:
1177
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1178
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1179
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1180
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1181
+ # trigger a retry.
1182
+ #
1183
+ class Rpcs
1184
+ ##
1185
+ # RPC-specific configuration for `create_vehicle`
1186
+ # @return [::Gapic::Config::Method]
1187
+ #
1188
+ attr_reader :create_vehicle
1189
+ ##
1190
+ # RPC-specific configuration for `get_vehicle`
1191
+ # @return [::Gapic::Config::Method]
1192
+ #
1193
+ attr_reader :get_vehicle
1194
+ ##
1195
+ # RPC-specific configuration for `update_vehicle`
1196
+ # @return [::Gapic::Config::Method]
1197
+ #
1198
+ attr_reader :update_vehicle
1199
+ ##
1200
+ # RPC-specific configuration for `update_vehicle_attributes`
1201
+ # @return [::Gapic::Config::Method]
1202
+ #
1203
+ attr_reader :update_vehicle_attributes
1204
+ ##
1205
+ # RPC-specific configuration for `list_vehicles`
1206
+ # @return [::Gapic::Config::Method]
1207
+ #
1208
+ attr_reader :list_vehicles
1209
+ ##
1210
+ # RPC-specific configuration for `search_vehicles`
1211
+ # @return [::Gapic::Config::Method]
1212
+ #
1213
+ attr_reader :search_vehicles
1214
+
1215
+ # @private
1216
+ def initialize parent_rpcs = nil
1217
+ create_vehicle_config = parent_rpcs.create_vehicle if parent_rpcs.respond_to? :create_vehicle
1218
+ @create_vehicle = ::Gapic::Config::Method.new create_vehicle_config
1219
+ get_vehicle_config = parent_rpcs.get_vehicle if parent_rpcs.respond_to? :get_vehicle
1220
+ @get_vehicle = ::Gapic::Config::Method.new get_vehicle_config
1221
+ update_vehicle_config = parent_rpcs.update_vehicle if parent_rpcs.respond_to? :update_vehicle
1222
+ @update_vehicle = ::Gapic::Config::Method.new update_vehicle_config
1223
+ update_vehicle_attributes_config = parent_rpcs.update_vehicle_attributes if parent_rpcs.respond_to? :update_vehicle_attributes
1224
+ @update_vehicle_attributes = ::Gapic::Config::Method.new update_vehicle_attributes_config
1225
+ list_vehicles_config = parent_rpcs.list_vehicles if parent_rpcs.respond_to? :list_vehicles
1226
+ @list_vehicles = ::Gapic::Config::Method.new list_vehicles_config
1227
+ search_vehicles_config = parent_rpcs.search_vehicles if parent_rpcs.respond_to? :search_vehicles
1228
+ @search_vehicles = ::Gapic::Config::Method.new search_vehicles_config
1229
+
1230
+ yield self if block_given?
1231
+ end
1232
+ end
1233
+ end
1234
+ end
1235
+ end
1236
+ end
1237
+ end
1238
+ end
1239
+ end
1240
+ end