google-maps-fleet_engine-v1 0.a → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +122 -0
- data/README.md +144 -8
- data/lib/google/maps/fleet_engine/v1/rest.rb +38 -0
- data/lib/google/maps/fleet_engine/v1/trip_service/client.rb +996 -0
- data/lib/google/maps/fleet_engine/v1/trip_service/credentials.rb +47 -0
- data/lib/google/maps/fleet_engine/v1/trip_service/paths.rb +50 -0
- data/lib/google/maps/fleet_engine/v1/trip_service/rest/client.rb +930 -0
- data/lib/google/maps/fleet_engine/v1/trip_service/rest/service_stub.rb +368 -0
- data/lib/google/maps/fleet_engine/v1/trip_service/rest.rb +52 -0
- data/lib/google/maps/fleet_engine/v1/trip_service.rb +55 -0
- data/lib/google/maps/fleet_engine/v1/vehicle_service/client.rb +1639 -0
- data/lib/google/maps/fleet_engine/v1/vehicle_service/credentials.rb +47 -0
- data/lib/google/maps/fleet_engine/v1/vehicle_service/paths.rb +50 -0
- data/lib/google/maps/fleet_engine/v1/vehicle_service/rest/client.rb +1545 -0
- data/lib/google/maps/fleet_engine/v1/vehicle_service/rest/service_stub.rb +547 -0
- data/lib/google/maps/fleet_engine/v1/vehicle_service/rest.rb +52 -0
- data/lib/google/maps/fleet_engine/v1/vehicle_service.rb +55 -0
- data/lib/google/maps/fleet_engine/v1/version.rb +8 -3
- data/lib/google/maps/fleet_engine/v1.rb +46 -0
- data/lib/google/maps/fleetengine/v1/fleetengine_pb.rb +63 -0
- data/lib/google/maps/fleetengine/v1/header_pb.rb +46 -0
- data/lib/google/maps/fleetengine/v1/traffic_pb.rb +44 -0
- data/lib/google/maps/fleetengine/v1/trip_api_pb.rb +66 -0
- data/lib/google/maps/fleetengine/v1/trip_api_services_pb.rb +53 -0
- data/lib/google/maps/fleetengine/v1/trips_pb.rb +61 -0
- data/lib/google/maps/fleetengine/v1/vehicle_api_pb.rb +81 -0
- data/lib/google/maps/fleetengine/v1/vehicle_api_services_pb.rb +108 -0
- data/lib/google/maps/fleetengine/v1/vehicles_pb.rb +64 -0
- data/lib/google-maps-fleet_engine-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/v1/fleetengine.rb +342 -0
- data/proto_docs/google/maps/fleetengine/v1/header.rb +111 -0
- data/proto_docs/google/maps/fleetengine/v1/traffic.rb +76 -0
- data/proto_docs/google/maps/fleetengine/v1/trip_api.rb +296 -0
- data/proto_docs/google/maps/fleetengine/v1/trips.rb +286 -0
- data/proto_docs/google/maps/fleetengine/v1/vehicle_api.rb +684 -0
- data/proto_docs/google/maps/fleetengine/v1/vehicles.rb +358 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +34 -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 +119 -13
@@ -0,0 +1,996 @@
|
|
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/trip_api_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Maps
|
24
|
+
module FleetEngine
|
25
|
+
module V1
|
26
|
+
module TripService
|
27
|
+
##
|
28
|
+
# Client for the TripService service.
|
29
|
+
#
|
30
|
+
# Trip management service.
|
31
|
+
#
|
32
|
+
class Client
|
33
|
+
# @private
|
34
|
+
DEFAULT_ENDPOINT_TEMPLATE = "fleetengine.$UNIVERSE_DOMAIN$"
|
35
|
+
|
36
|
+
include Paths
|
37
|
+
|
38
|
+
# @private
|
39
|
+
attr_reader :trip_service_stub
|
40
|
+
|
41
|
+
##
|
42
|
+
# Configure the TripService Client class.
|
43
|
+
#
|
44
|
+
# See {::Google::Maps::FleetEngine::V1::TripService::Client::Configuration}
|
45
|
+
# for a description of the configuration fields.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
#
|
49
|
+
# # Modify the configuration for all TripService clients
|
50
|
+
# ::Google::Maps::FleetEngine::V1::TripService::Client.configure do |config|
|
51
|
+
# config.timeout = 10.0
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# @yield [config] Configure the Client client.
|
55
|
+
# @yieldparam config [Client::Configuration]
|
56
|
+
#
|
57
|
+
# @return [Client::Configuration]
|
58
|
+
#
|
59
|
+
def self.configure
|
60
|
+
@configure ||= begin
|
61
|
+
namespace = ["Google", "Maps", "FleetEngine", "V1"]
|
62
|
+
parent_config = while namespace.any?
|
63
|
+
parent_name = namespace.join "::"
|
64
|
+
parent_const = const_get parent_name
|
65
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
66
|
+
namespace.pop
|
67
|
+
end
|
68
|
+
default_config = Client::Configuration.new parent_config
|
69
|
+
|
70
|
+
default_config.rpcs.create_trip.timeout = 15.0
|
71
|
+
default_config.rpcs.create_trip.retry_policy = {
|
72
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
73
|
+
}
|
74
|
+
|
75
|
+
default_config.rpcs.get_trip.timeout = 15.0
|
76
|
+
default_config.rpcs.get_trip.retry_policy = {
|
77
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
78
|
+
}
|
79
|
+
|
80
|
+
default_config.rpcs.search_trips.timeout = 15.0
|
81
|
+
default_config.rpcs.search_trips.retry_policy = {
|
82
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
83
|
+
}
|
84
|
+
|
85
|
+
default_config.rpcs.update_trip.timeout = 15.0
|
86
|
+
default_config.rpcs.update_trip.retry_policy = {
|
87
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
88
|
+
}
|
89
|
+
|
90
|
+
default_config
|
91
|
+
end
|
92
|
+
yield @configure if block_given?
|
93
|
+
@configure
|
94
|
+
end
|
95
|
+
|
96
|
+
##
|
97
|
+
# Configure the TripService Client instance.
|
98
|
+
#
|
99
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
100
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
101
|
+
# should be made on {Client.configure}.
|
102
|
+
#
|
103
|
+
# See {::Google::Maps::FleetEngine::V1::TripService::Client::Configuration}
|
104
|
+
# for a description of the configuration fields.
|
105
|
+
#
|
106
|
+
# @yield [config] Configure the Client client.
|
107
|
+
# @yieldparam config [Client::Configuration]
|
108
|
+
#
|
109
|
+
# @return [Client::Configuration]
|
110
|
+
#
|
111
|
+
def configure
|
112
|
+
yield @config if block_given?
|
113
|
+
@config
|
114
|
+
end
|
115
|
+
|
116
|
+
##
|
117
|
+
# The effective universe domain
|
118
|
+
#
|
119
|
+
# @return [String]
|
120
|
+
#
|
121
|
+
def universe_domain
|
122
|
+
@trip_service_stub.universe_domain
|
123
|
+
end
|
124
|
+
|
125
|
+
##
|
126
|
+
# Create a new TripService client object.
|
127
|
+
#
|
128
|
+
# @example
|
129
|
+
#
|
130
|
+
# # Create a client using the default configuration
|
131
|
+
# client = ::Google::Maps::FleetEngine::V1::TripService::Client.new
|
132
|
+
#
|
133
|
+
# # Create a client using a custom configuration
|
134
|
+
# client = ::Google::Maps::FleetEngine::V1::TripService::Client.new do |config|
|
135
|
+
# config.timeout = 10.0
|
136
|
+
# end
|
137
|
+
#
|
138
|
+
# @yield [config] Configure the TripService client.
|
139
|
+
# @yieldparam config [Client::Configuration]
|
140
|
+
#
|
141
|
+
def initialize
|
142
|
+
# These require statements are intentionally placed here to initialize
|
143
|
+
# the gRPC module only when it's required.
|
144
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
145
|
+
require "gapic/grpc"
|
146
|
+
require "google/maps/fleetengine/v1/trip_api_services_pb"
|
147
|
+
|
148
|
+
# Create the configuration object
|
149
|
+
@config = Configuration.new Client.configure
|
150
|
+
|
151
|
+
# Yield the configuration if needed
|
152
|
+
yield @config if block_given?
|
153
|
+
|
154
|
+
# Create credentials
|
155
|
+
credentials = @config.credentials
|
156
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
157
|
+
# but only if the default endpoint does not have a region prefix.
|
158
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
159
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
160
|
+
!@config.endpoint.split(".").first.include?("-"))
|
161
|
+
credentials ||= Credentials.default scope: @config.scope,
|
162
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
163
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
164
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
165
|
+
end
|
166
|
+
@quota_project_id = @config.quota_project
|
167
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
168
|
+
|
169
|
+
@trip_service_stub = ::Gapic::ServiceStub.new(
|
170
|
+
::Google::Maps::FleetEngine::V1::TripService::Stub,
|
171
|
+
credentials: credentials,
|
172
|
+
endpoint: @config.endpoint,
|
173
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
174
|
+
universe_domain: @config.universe_domain,
|
175
|
+
channel_args: @config.channel_args,
|
176
|
+
interceptors: @config.interceptors,
|
177
|
+
channel_pool_config: @config.channel_pool
|
178
|
+
)
|
179
|
+
end
|
180
|
+
|
181
|
+
# Service calls
|
182
|
+
|
183
|
+
##
|
184
|
+
# Creates a trip in the Fleet Engine and returns the new trip.
|
185
|
+
#
|
186
|
+
# @overload create_trip(request, options = nil)
|
187
|
+
# Pass arguments to `create_trip` via a request object, either of type
|
188
|
+
# {::Google::Maps::FleetEngine::V1::CreateTripRequest} or an equivalent Hash.
|
189
|
+
#
|
190
|
+
# @param request [::Google::Maps::FleetEngine::V1::CreateTripRequest, ::Hash]
|
191
|
+
# A request object representing the call parameters. Required. To specify no
|
192
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
193
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
194
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
195
|
+
#
|
196
|
+
# @overload create_trip(header: nil, parent: nil, trip_id: nil, trip: nil)
|
197
|
+
# Pass arguments to `create_trip` via keyword arguments. Note that at
|
198
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
199
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
200
|
+
#
|
201
|
+
# @param header [::Google::Maps::FleetEngine::V1::RequestHeader, ::Hash]
|
202
|
+
# The standard Fleet Engine request header.
|
203
|
+
# @param parent [::String]
|
204
|
+
# Required. Must be in the format `providers/{provider}`.
|
205
|
+
# The provider must be the Project ID (for example, `sample-cloud-project`)
|
206
|
+
# of the Google Cloud Project of which the service account making
|
207
|
+
# this call is a member.
|
208
|
+
# @param trip_id [::String]
|
209
|
+
# Required. Unique Trip ID.
|
210
|
+
# Subject to the following restrictions:
|
211
|
+
#
|
212
|
+
# * Must be a valid Unicode string.
|
213
|
+
# * Limited to a maximum length of 64 characters.
|
214
|
+
# * Normalized according to [Unicode Normalization Form C]
|
215
|
+
# (http://www.unicode.org/reports/tr15/).
|
216
|
+
# * May not contain any of the following ASCII characters: '/', ':', '?',
|
217
|
+
# ',', or '#'.
|
218
|
+
# @param trip [::Google::Maps::FleetEngine::V1::Trip, ::Hash]
|
219
|
+
# Required. Trip entity to create.
|
220
|
+
#
|
221
|
+
# When creating a Trip, the following fields are required:
|
222
|
+
#
|
223
|
+
# * `trip_type`
|
224
|
+
# * `pickup_point`
|
225
|
+
#
|
226
|
+
# The following fields are used if you provide them:
|
227
|
+
#
|
228
|
+
# * `number_of_passengers`
|
229
|
+
# * `vehicle_id`
|
230
|
+
# * `dropoff_point`
|
231
|
+
# * `intermediate_destinations`
|
232
|
+
# * `vehicle_waypoints`
|
233
|
+
#
|
234
|
+
# All other Trip fields are ignored. For example, all trips start with a
|
235
|
+
# `trip_status` of `NEW` even if you pass in a `trip_status` of `CANCELED` in
|
236
|
+
# the creation request.
|
237
|
+
#
|
238
|
+
# Only `EXCLUSIVE` trips support `intermediate_destinations`.
|
239
|
+
#
|
240
|
+
# When `vehicle_id` is set for a shared trip, you must supply
|
241
|
+
# the list of `Trip.vehicle_waypoints` to specify the order of the remaining
|
242
|
+
# waypoints for the vehicle, otherwise the waypoint order will be
|
243
|
+
# undetermined.
|
244
|
+
#
|
245
|
+
# When you specify `Trip.vehicle_waypoints`, the list must contain all
|
246
|
+
# the remaining waypoints of the vehicle's trips, with no extra waypoints.
|
247
|
+
# You must order these waypoints such that for a given trip, the pickup
|
248
|
+
# point is before intermediate destinations, and all intermediate
|
249
|
+
# destinations come before the drop-off point. An `EXCLUSIVE` trip's
|
250
|
+
# waypoints must not interleave with any other trips.
|
251
|
+
#
|
252
|
+
# The `trip_id`, `waypoint_type` and `location` fields are used, and all
|
253
|
+
# other TripWaypoint fields in `vehicle_waypoints` are ignored.
|
254
|
+
#
|
255
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
256
|
+
# @yieldparam response [::Google::Maps::FleetEngine::V1::Trip]
|
257
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
258
|
+
#
|
259
|
+
# @return [::Google::Maps::FleetEngine::V1::Trip]
|
260
|
+
#
|
261
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
262
|
+
#
|
263
|
+
# @example Basic example
|
264
|
+
# require "google/maps/fleet_engine/v1"
|
265
|
+
#
|
266
|
+
# # Create a client object. The client can be reused for multiple calls.
|
267
|
+
# client = Google::Maps::FleetEngine::V1::TripService::Client.new
|
268
|
+
#
|
269
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
270
|
+
# request = Google::Maps::FleetEngine::V1::CreateTripRequest.new
|
271
|
+
#
|
272
|
+
# # Call the create_trip method.
|
273
|
+
# result = client.create_trip request
|
274
|
+
#
|
275
|
+
# # The returned object is of type Google::Maps::FleetEngine::V1::Trip.
|
276
|
+
# p result
|
277
|
+
#
|
278
|
+
def create_trip request, options = nil
|
279
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
280
|
+
|
281
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::V1::CreateTripRequest
|
282
|
+
|
283
|
+
# Converts hash and nil to an options object
|
284
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
285
|
+
|
286
|
+
# Customize the options with defaults
|
287
|
+
metadata = @config.rpcs.create_trip.metadata.to_h
|
288
|
+
|
289
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
290
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
291
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
292
|
+
gapic_version: ::Google::Maps::FleetEngine::V1::VERSION
|
293
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
294
|
+
|
295
|
+
header_params = {}
|
296
|
+
if request.parent &&
|
297
|
+
%r{^providers/[^/]+/?$}.match?(request.parent)
|
298
|
+
header_params["provider_id"] = request.parent
|
299
|
+
end
|
300
|
+
|
301
|
+
request_params_header = URI.encode_www_form header_params
|
302
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
303
|
+
|
304
|
+
options.apply_defaults timeout: @config.rpcs.create_trip.timeout,
|
305
|
+
metadata: metadata,
|
306
|
+
retry_policy: @config.rpcs.create_trip.retry_policy
|
307
|
+
|
308
|
+
options.apply_defaults timeout: @config.timeout,
|
309
|
+
metadata: @config.metadata,
|
310
|
+
retry_policy: @config.retry_policy
|
311
|
+
|
312
|
+
@trip_service_stub.call_rpc :create_trip, request, options: options do |response, operation|
|
313
|
+
yield response, operation if block_given?
|
314
|
+
return response
|
315
|
+
end
|
316
|
+
rescue ::GRPC::BadStatus => e
|
317
|
+
raise ::Google::Cloud::Error.from_error(e)
|
318
|
+
end
|
319
|
+
|
320
|
+
##
|
321
|
+
# Get information about a single trip.
|
322
|
+
#
|
323
|
+
# @overload get_trip(request, options = nil)
|
324
|
+
# Pass arguments to `get_trip` via a request object, either of type
|
325
|
+
# {::Google::Maps::FleetEngine::V1::GetTripRequest} or an equivalent Hash.
|
326
|
+
#
|
327
|
+
# @param request [::Google::Maps::FleetEngine::V1::GetTripRequest, ::Hash]
|
328
|
+
# A request object representing the call parameters. Required. To specify no
|
329
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
330
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
331
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
332
|
+
#
|
333
|
+
# @overload get_trip(header: nil, name: nil, view: nil, current_route_segment_version: nil, remaining_waypoints_version: nil, route_format_type: nil, current_route_segment_traffic_version: nil, remaining_waypoints_route_version: nil)
|
334
|
+
# Pass arguments to `get_trip` via keyword arguments. Note that at
|
335
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
336
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
337
|
+
#
|
338
|
+
# @param header [::Google::Maps::FleetEngine::V1::RequestHeader, ::Hash]
|
339
|
+
# The standard Fleet Engine request header.
|
340
|
+
# @param name [::String]
|
341
|
+
# Required. Must be in the format `providers/{provider}/trips/{trip}`.
|
342
|
+
# The provider must be the Project ID (for example, `sample-cloud-project`)
|
343
|
+
# of the Google Cloud Project of which the service account making
|
344
|
+
# this call is a member.
|
345
|
+
# @param view [::Google::Maps::FleetEngine::V1::TripView]
|
346
|
+
# The subset of Trip fields that should be returned and their interpretation.
|
347
|
+
# @param current_route_segment_version [::Google::Protobuf::Timestamp, ::Hash]
|
348
|
+
# Indicates the minimum timestamp (exclusive) for which `Trip.route` or
|
349
|
+
# `Trip.current_route_segment` data are retrieved. If route data are
|
350
|
+
# unchanged since this timestamp, the route field is not set in the response.
|
351
|
+
# If a minimum is unspecified, the route data are always retrieved.
|
352
|
+
# @param remaining_waypoints_version [::Google::Protobuf::Timestamp, ::Hash]
|
353
|
+
# Indicates the minimum timestamp (exclusive) for which
|
354
|
+
# `Trip.remaining_waypoints` are retrieved. If they are unchanged since this
|
355
|
+
# timestamp, the `remaining_waypoints` are not set in the response. If this
|
356
|
+
# field is unspecified, `remaining_waypoints` is always retrieved.
|
357
|
+
# @param route_format_type [::Google::Maps::FleetEngine::V1::PolylineFormatType]
|
358
|
+
# The returned current route format, `LAT_LNG_LIST_TYPE` (in `Trip.route`),
|
359
|
+
# or `ENCODED_POLYLINE_TYPE` (in `Trip.current_route_segment`). The default
|
360
|
+
# is `LAT_LNG_LIST_TYPE`.
|
361
|
+
# @param current_route_segment_traffic_version [::Google::Protobuf::Timestamp, ::Hash]
|
362
|
+
# Indicates the minimum timestamp (exclusive) for which
|
363
|
+
# `Trip.current_route_segment_traffic` is retrieved. If traffic data are
|
364
|
+
# unchanged since this timestamp, the `current_route_segment_traffic` field
|
365
|
+
# is not set in the response. If a minimum is unspecified, the traffic data
|
366
|
+
# are always retrieved. Note that traffic is only available for On-Demand
|
367
|
+
# Rides and Deliveries Solution customers.
|
368
|
+
# @param remaining_waypoints_route_version [::Google::Protobuf::Timestamp, ::Hash]
|
369
|
+
# Indicates the minimum timestamp (exclusive) for which
|
370
|
+
# `Trip.remaining_waypoints.traffic_to_waypoint` and
|
371
|
+
# `Trip.remaining_waypoints.path_to_waypoint` data are retrieved. If data are
|
372
|
+
# unchanged since this timestamp, the fields above are
|
373
|
+
# not set in the response. If `remaining_waypoints_route_version` is
|
374
|
+
# unspecified, traffic and path are always retrieved.
|
375
|
+
#
|
376
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
377
|
+
# @yieldparam response [::Google::Maps::FleetEngine::V1::Trip]
|
378
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
379
|
+
#
|
380
|
+
# @return [::Google::Maps::FleetEngine::V1::Trip]
|
381
|
+
#
|
382
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
383
|
+
#
|
384
|
+
# @example Basic example
|
385
|
+
# require "google/maps/fleet_engine/v1"
|
386
|
+
#
|
387
|
+
# # Create a client object. The client can be reused for multiple calls.
|
388
|
+
# client = Google::Maps::FleetEngine::V1::TripService::Client.new
|
389
|
+
#
|
390
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
391
|
+
# request = Google::Maps::FleetEngine::V1::GetTripRequest.new
|
392
|
+
#
|
393
|
+
# # Call the get_trip method.
|
394
|
+
# result = client.get_trip request
|
395
|
+
#
|
396
|
+
# # The returned object is of type Google::Maps::FleetEngine::V1::Trip.
|
397
|
+
# p result
|
398
|
+
#
|
399
|
+
def get_trip request, options = nil
|
400
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
401
|
+
|
402
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::V1::GetTripRequest
|
403
|
+
|
404
|
+
# Converts hash and nil to an options object
|
405
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
406
|
+
|
407
|
+
# Customize the options with defaults
|
408
|
+
metadata = @config.rpcs.get_trip.metadata.to_h
|
409
|
+
|
410
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
411
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
412
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
413
|
+
gapic_version: ::Google::Maps::FleetEngine::V1::VERSION
|
414
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
415
|
+
|
416
|
+
header_params = {}
|
417
|
+
if request.name &&
|
418
|
+
%r{^providers/[^/]+/?$}.match?(request.name)
|
419
|
+
header_params["provider_id"] = request.name
|
420
|
+
end
|
421
|
+
|
422
|
+
request_params_header = URI.encode_www_form header_params
|
423
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
424
|
+
|
425
|
+
options.apply_defaults timeout: @config.rpcs.get_trip.timeout,
|
426
|
+
metadata: metadata,
|
427
|
+
retry_policy: @config.rpcs.get_trip.retry_policy
|
428
|
+
|
429
|
+
options.apply_defaults timeout: @config.timeout,
|
430
|
+
metadata: @config.metadata,
|
431
|
+
retry_policy: @config.retry_policy
|
432
|
+
|
433
|
+
@trip_service_stub.call_rpc :get_trip, request, options: options do |response, operation|
|
434
|
+
yield response, operation if block_given?
|
435
|
+
return response
|
436
|
+
end
|
437
|
+
rescue ::GRPC::BadStatus => e
|
438
|
+
raise ::Google::Cloud::Error.from_error(e)
|
439
|
+
end
|
440
|
+
|
441
|
+
##
|
442
|
+
# Report billable trip usage.
|
443
|
+
#
|
444
|
+
# @overload report_billable_trip(request, options = nil)
|
445
|
+
# Pass arguments to `report_billable_trip` via a request object, either of type
|
446
|
+
# {::Google::Maps::FleetEngine::V1::ReportBillableTripRequest} or an equivalent Hash.
|
447
|
+
#
|
448
|
+
# @param request [::Google::Maps::FleetEngine::V1::ReportBillableTripRequest, ::Hash]
|
449
|
+
# A request object representing the call parameters. Required. To specify no
|
450
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
451
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
452
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
453
|
+
#
|
454
|
+
# @overload report_billable_trip(name: nil, country_code: nil, platform: nil, related_ids: nil, solution_type: nil)
|
455
|
+
# Pass arguments to `report_billable_trip` via keyword arguments. Note that at
|
456
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
457
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
458
|
+
#
|
459
|
+
# @param name [::String]
|
460
|
+
# Required. Must be in the format
|
461
|
+
# `providers/{provider}/billableTrips/{billable_trip}`. The
|
462
|
+
# provider must be the Project ID (for example, `sample-cloud-project`) of
|
463
|
+
# the Google Cloud Project of which the service account making this call is a
|
464
|
+
# member.
|
465
|
+
# @param country_code [::String]
|
466
|
+
# Required. Two letter country code of the country where the trip takes
|
467
|
+
# place. Price is defined according to country code.
|
468
|
+
# @param platform [::Google::Maps::FleetEngine::V1::BillingPlatformIdentifier]
|
469
|
+
# The platform upon which the request was issued.
|
470
|
+
# @param related_ids [::Array<::String>]
|
471
|
+
# The identifiers that are directly related to the trip being reported. These
|
472
|
+
# are usually IDs (for example, session IDs) of pre-booking operations done
|
473
|
+
# before the trip ID is available. The number of `related_ids` is
|
474
|
+
# limited to 50.
|
475
|
+
# @param solution_type [::Google::Maps::FleetEngine::V1::ReportBillableTripRequest::SolutionType]
|
476
|
+
# The type of GMP product solution (for example,
|
477
|
+
# `ON_DEMAND_RIDESHARING_AND_DELIVERIES`) used for the reported trip.
|
478
|
+
#
|
479
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
480
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
481
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
482
|
+
#
|
483
|
+
# @return [::Google::Protobuf::Empty]
|
484
|
+
#
|
485
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
486
|
+
#
|
487
|
+
# @example Basic example
|
488
|
+
# require "google/maps/fleet_engine/v1"
|
489
|
+
#
|
490
|
+
# # Create a client object. The client can be reused for multiple calls.
|
491
|
+
# client = Google::Maps::FleetEngine::V1::TripService::Client.new
|
492
|
+
#
|
493
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
494
|
+
# request = Google::Maps::FleetEngine::V1::ReportBillableTripRequest.new
|
495
|
+
#
|
496
|
+
# # Call the report_billable_trip method.
|
497
|
+
# result = client.report_billable_trip request
|
498
|
+
#
|
499
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
500
|
+
# p result
|
501
|
+
#
|
502
|
+
def report_billable_trip request, options = nil
|
503
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
504
|
+
|
505
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::V1::ReportBillableTripRequest
|
506
|
+
|
507
|
+
# Converts hash and nil to an options object
|
508
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
509
|
+
|
510
|
+
# Customize the options with defaults
|
511
|
+
metadata = @config.rpcs.report_billable_trip.metadata.to_h
|
512
|
+
|
513
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
514
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
515
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
516
|
+
gapic_version: ::Google::Maps::FleetEngine::V1::VERSION
|
517
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
518
|
+
|
519
|
+
header_params = {}
|
520
|
+
if request.name &&
|
521
|
+
%r{^providers/[^/]+/?$}.match?(request.name)
|
522
|
+
header_params["provider_id"] = request.name
|
523
|
+
end
|
524
|
+
|
525
|
+
request_params_header = URI.encode_www_form header_params
|
526
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
527
|
+
|
528
|
+
options.apply_defaults timeout: @config.rpcs.report_billable_trip.timeout,
|
529
|
+
metadata: metadata,
|
530
|
+
retry_policy: @config.rpcs.report_billable_trip.retry_policy
|
531
|
+
|
532
|
+
options.apply_defaults timeout: @config.timeout,
|
533
|
+
metadata: @config.metadata,
|
534
|
+
retry_policy: @config.retry_policy
|
535
|
+
|
536
|
+
@trip_service_stub.call_rpc :report_billable_trip, request, options: options do |response, operation|
|
537
|
+
yield response, operation if block_given?
|
538
|
+
return response
|
539
|
+
end
|
540
|
+
rescue ::GRPC::BadStatus => e
|
541
|
+
raise ::Google::Cloud::Error.from_error(e)
|
542
|
+
end
|
543
|
+
|
544
|
+
##
|
545
|
+
# Get all the trips for a specific vehicle.
|
546
|
+
#
|
547
|
+
# @overload search_trips(request, options = nil)
|
548
|
+
# Pass arguments to `search_trips` via a request object, either of type
|
549
|
+
# {::Google::Maps::FleetEngine::V1::SearchTripsRequest} or an equivalent Hash.
|
550
|
+
#
|
551
|
+
# @param request [::Google::Maps::FleetEngine::V1::SearchTripsRequest, ::Hash]
|
552
|
+
# A request object representing the call parameters. Required. To specify no
|
553
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
554
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
555
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
556
|
+
#
|
557
|
+
# @overload search_trips(header: nil, parent: nil, vehicle_id: nil, active_trips_only: nil, page_size: nil, page_token: nil, minimum_staleness: nil)
|
558
|
+
# Pass arguments to `search_trips` via keyword arguments. Note that at
|
559
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
560
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
561
|
+
#
|
562
|
+
# @param header [::Google::Maps::FleetEngine::V1::RequestHeader, ::Hash]
|
563
|
+
# The standard Fleet Engine request header.
|
564
|
+
# @param parent [::String]
|
565
|
+
# Required. Must be in the format `providers/{provider}`.
|
566
|
+
# The provider must be the Project ID (for example, `sample-cloud-project`)
|
567
|
+
# of the Google Cloud Project of which the service account making
|
568
|
+
# this call is a member.
|
569
|
+
# @param vehicle_id [::String]
|
570
|
+
# The vehicle associated with the trips in the request. If unspecified, the
|
571
|
+
# returned trips do not contain:
|
572
|
+
#
|
573
|
+
# * `current_route_segment`
|
574
|
+
# * `remaining_waypoints`
|
575
|
+
# * `remaining_distance_meters`
|
576
|
+
# * `eta_to_first_waypoint`
|
577
|
+
# @param active_trips_only [::Boolean]
|
578
|
+
# If set to true, the response includes Trips that influence a driver's
|
579
|
+
# route.
|
580
|
+
# @param page_size [::Integer]
|
581
|
+
# If not set, the server decides the number of results to return.
|
582
|
+
# @param page_token [::String]
|
583
|
+
# Set this to a value previously returned in the `SearchTripsResponse` to
|
584
|
+
# continue from previous results.
|
585
|
+
# @param minimum_staleness [::Google::Protobuf::Duration, ::Hash]
|
586
|
+
# If specified, returns the trips that have not been updated after the time
|
587
|
+
# `(current - minimum_staleness)`.
|
588
|
+
#
|
589
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
590
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Maps::FleetEngine::V1::Trip>]
|
591
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
592
|
+
#
|
593
|
+
# @return [::Gapic::PagedEnumerable<::Google::Maps::FleetEngine::V1::Trip>]
|
594
|
+
#
|
595
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
596
|
+
#
|
597
|
+
# @example Basic example
|
598
|
+
# require "google/maps/fleet_engine/v1"
|
599
|
+
#
|
600
|
+
# # Create a client object. The client can be reused for multiple calls.
|
601
|
+
# client = Google::Maps::FleetEngine::V1::TripService::Client.new
|
602
|
+
#
|
603
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
604
|
+
# request = Google::Maps::FleetEngine::V1::SearchTripsRequest.new
|
605
|
+
#
|
606
|
+
# # Call the search_trips method.
|
607
|
+
# result = client.search_trips request
|
608
|
+
#
|
609
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
610
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
611
|
+
# result.each do |item|
|
612
|
+
# # Each element is of type ::Google::Maps::FleetEngine::V1::Trip.
|
613
|
+
# p item
|
614
|
+
# end
|
615
|
+
#
|
616
|
+
def search_trips request, options = nil
|
617
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
618
|
+
|
619
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::V1::SearchTripsRequest
|
620
|
+
|
621
|
+
# Converts hash and nil to an options object
|
622
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
623
|
+
|
624
|
+
# Customize the options with defaults
|
625
|
+
metadata = @config.rpcs.search_trips.metadata.to_h
|
626
|
+
|
627
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
628
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
629
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
630
|
+
gapic_version: ::Google::Maps::FleetEngine::V1::VERSION
|
631
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
632
|
+
|
633
|
+
header_params = {}
|
634
|
+
if request.parent &&
|
635
|
+
%r{^providers/[^/]+/?$}.match?(request.parent)
|
636
|
+
header_params["provider_id"] = request.parent
|
637
|
+
end
|
638
|
+
|
639
|
+
request_params_header = URI.encode_www_form header_params
|
640
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
641
|
+
|
642
|
+
options.apply_defaults timeout: @config.rpcs.search_trips.timeout,
|
643
|
+
metadata: metadata,
|
644
|
+
retry_policy: @config.rpcs.search_trips.retry_policy
|
645
|
+
|
646
|
+
options.apply_defaults timeout: @config.timeout,
|
647
|
+
metadata: @config.metadata,
|
648
|
+
retry_policy: @config.retry_policy
|
649
|
+
|
650
|
+
@trip_service_stub.call_rpc :search_trips, request, options: options do |response, operation|
|
651
|
+
response = ::Gapic::PagedEnumerable.new @trip_service_stub, :search_trips, request, response, operation, options
|
652
|
+
yield response, operation if block_given?
|
653
|
+
return response
|
654
|
+
end
|
655
|
+
rescue ::GRPC::BadStatus => e
|
656
|
+
raise ::Google::Cloud::Error.from_error(e)
|
657
|
+
end
|
658
|
+
|
659
|
+
##
|
660
|
+
# Updates trip data.
|
661
|
+
#
|
662
|
+
# @overload update_trip(request, options = nil)
|
663
|
+
# Pass arguments to `update_trip` via a request object, either of type
|
664
|
+
# {::Google::Maps::FleetEngine::V1::UpdateTripRequest} or an equivalent Hash.
|
665
|
+
#
|
666
|
+
# @param request [::Google::Maps::FleetEngine::V1::UpdateTripRequest, ::Hash]
|
667
|
+
# A request object representing the call parameters. Required. To specify no
|
668
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
669
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
670
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
671
|
+
#
|
672
|
+
# @overload update_trip(header: nil, name: nil, trip: nil, update_mask: nil)
|
673
|
+
# Pass arguments to `update_trip` via keyword arguments. Note that at
|
674
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
675
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
676
|
+
#
|
677
|
+
# @param header [::Google::Maps::FleetEngine::V1::RequestHeader, ::Hash]
|
678
|
+
# The standard Fleet Engine request header.
|
679
|
+
# @param name [::String]
|
680
|
+
# Required. Must be in the format
|
681
|
+
# `providers/{provider}/trips/{trip}`. The provider must
|
682
|
+
# be the Project ID (for example, `sample-consumer-project`) of the Google
|
683
|
+
# Cloud Project of which the service account making this call is a member.
|
684
|
+
# @param trip [::Google::Maps::FleetEngine::V1::Trip, ::Hash]
|
685
|
+
# Required. The Trip associated with the update.
|
686
|
+
#
|
687
|
+
# The following fields are maintained by the Fleet Engine. Do not update
|
688
|
+
# them using Trip.update.
|
689
|
+
#
|
690
|
+
# * `current_route_segment`
|
691
|
+
# * `current_route_segment_end_point`
|
692
|
+
# * `current_route_segment_traffic`
|
693
|
+
# * `current_route_segment_traffic_version`
|
694
|
+
# * `current_route_segment_version`
|
695
|
+
# * `dropoff_time`
|
696
|
+
# * `eta_to_next_waypoint`
|
697
|
+
# * `intermediate_destinations_version`
|
698
|
+
# * `last_location`
|
699
|
+
# * `name`
|
700
|
+
# * `number_of_passengers`
|
701
|
+
# * `pickup_time`
|
702
|
+
# * `remaining_distance_meters`
|
703
|
+
# * `remaining_time_to_first_waypoint`
|
704
|
+
# * `remaining_waypoints`
|
705
|
+
# * `remaining_waypoints_version`
|
706
|
+
# * `route`
|
707
|
+
#
|
708
|
+
# When you update the `Trip.vehicle_id` for a shared trip, you must supply
|
709
|
+
# the list of `Trip.vehicle_waypoints` to specify the order of the remaining
|
710
|
+
# waypoints, otherwise the order will be undetermined.
|
711
|
+
#
|
712
|
+
# When you specify `Trip.vehicle_waypoints`, the list must contain all
|
713
|
+
# the remaining waypoints of the vehicle's trips, with no extra waypoints.
|
714
|
+
# You must order these waypoints such that for a given trip, the pickup
|
715
|
+
# point is before intermediate destinations, and all intermediate
|
716
|
+
# destinations come before the drop-off point. An `EXCLUSIVE` trip's
|
717
|
+
# waypoints must not interleave with any other trips.
|
718
|
+
# The `trip_id`, `waypoint_type` and `location` fields are used, and all
|
719
|
+
# other TripWaypoint fields in `vehicle_waypoints` are ignored.
|
720
|
+
#
|
721
|
+
# To avoid a race condition for trips with multiple destinations, you
|
722
|
+
# should provide `Trip.intermediate_destinations_version` when updating
|
723
|
+
# the trip status to `ENROUTE_TO_INTERMEDIATE_DESTINATION`. The
|
724
|
+
# `Trip.intermediate_destinations_version` passed must be consistent with
|
725
|
+
# Fleet Engine's version. If it isn't, the request fails.
|
726
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
727
|
+
# Required. The field mask indicating which fields in Trip to update.
|
728
|
+
# The `update_mask` must contain at least one field.
|
729
|
+
#
|
730
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
731
|
+
# @yieldparam response [::Google::Maps::FleetEngine::V1::Trip]
|
732
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
733
|
+
#
|
734
|
+
# @return [::Google::Maps::FleetEngine::V1::Trip]
|
735
|
+
#
|
736
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
737
|
+
#
|
738
|
+
# @example Basic example
|
739
|
+
# require "google/maps/fleet_engine/v1"
|
740
|
+
#
|
741
|
+
# # Create a client object. The client can be reused for multiple calls.
|
742
|
+
# client = Google::Maps::FleetEngine::V1::TripService::Client.new
|
743
|
+
#
|
744
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
745
|
+
# request = Google::Maps::FleetEngine::V1::UpdateTripRequest.new
|
746
|
+
#
|
747
|
+
# # Call the update_trip method.
|
748
|
+
# result = client.update_trip request
|
749
|
+
#
|
750
|
+
# # The returned object is of type Google::Maps::FleetEngine::V1::Trip.
|
751
|
+
# p result
|
752
|
+
#
|
753
|
+
def update_trip request, options = nil
|
754
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
755
|
+
|
756
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::V1::UpdateTripRequest
|
757
|
+
|
758
|
+
# Converts hash and nil to an options object
|
759
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
760
|
+
|
761
|
+
# Customize the options with defaults
|
762
|
+
metadata = @config.rpcs.update_trip.metadata.to_h
|
763
|
+
|
764
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
765
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
766
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
767
|
+
gapic_version: ::Google::Maps::FleetEngine::V1::VERSION
|
768
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
769
|
+
|
770
|
+
header_params = {}
|
771
|
+
if request.name &&
|
772
|
+
%r{^providers/[^/]+/?$}.match?(request.name)
|
773
|
+
header_params["provider_id"] = request.name
|
774
|
+
end
|
775
|
+
|
776
|
+
request_params_header = URI.encode_www_form header_params
|
777
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
778
|
+
|
779
|
+
options.apply_defaults timeout: @config.rpcs.update_trip.timeout,
|
780
|
+
metadata: metadata,
|
781
|
+
retry_policy: @config.rpcs.update_trip.retry_policy
|
782
|
+
|
783
|
+
options.apply_defaults timeout: @config.timeout,
|
784
|
+
metadata: @config.metadata,
|
785
|
+
retry_policy: @config.retry_policy
|
786
|
+
|
787
|
+
@trip_service_stub.call_rpc :update_trip, request, options: options do |response, operation|
|
788
|
+
yield response, operation if block_given?
|
789
|
+
return response
|
790
|
+
end
|
791
|
+
rescue ::GRPC::BadStatus => e
|
792
|
+
raise ::Google::Cloud::Error.from_error(e)
|
793
|
+
end
|
794
|
+
|
795
|
+
##
|
796
|
+
# Configuration class for the TripService API.
|
797
|
+
#
|
798
|
+
# This class represents the configuration for TripService,
|
799
|
+
# providing control over timeouts, retry behavior, logging, transport
|
800
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
801
|
+
# applied individually to specific RPCs. See
|
802
|
+
# {::Google::Maps::FleetEngine::V1::TripService::Client::Configuration::Rpcs}
|
803
|
+
# for a list of RPCs that can be configured independently.
|
804
|
+
#
|
805
|
+
# Configuration can be applied globally to all clients, or to a single client
|
806
|
+
# on construction.
|
807
|
+
#
|
808
|
+
# @example
|
809
|
+
#
|
810
|
+
# # Modify the global config, setting the timeout for
|
811
|
+
# # create_trip to 20 seconds,
|
812
|
+
# # and all remaining timeouts to 10 seconds.
|
813
|
+
# ::Google::Maps::FleetEngine::V1::TripService::Client.configure do |config|
|
814
|
+
# config.timeout = 10.0
|
815
|
+
# config.rpcs.create_trip.timeout = 20.0
|
816
|
+
# end
|
817
|
+
#
|
818
|
+
# # Apply the above configuration only to a new client.
|
819
|
+
# client = ::Google::Maps::FleetEngine::V1::TripService::Client.new do |config|
|
820
|
+
# config.timeout = 10.0
|
821
|
+
# config.rpcs.create_trip.timeout = 20.0
|
822
|
+
# end
|
823
|
+
#
|
824
|
+
# @!attribute [rw] endpoint
|
825
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
826
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
827
|
+
# @return [::String,nil]
|
828
|
+
# @!attribute [rw] credentials
|
829
|
+
# Credentials to send with calls. You may provide any of the following types:
|
830
|
+
# * (`String`) The path to a service account key file in JSON format
|
831
|
+
# * (`Hash`) A service account key as a Hash
|
832
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
833
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
834
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
835
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
836
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
837
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
838
|
+
# * (`nil`) indicating no credentials
|
839
|
+
# @return [::Object]
|
840
|
+
# @!attribute [rw] scope
|
841
|
+
# The OAuth scopes
|
842
|
+
# @return [::Array<::String>]
|
843
|
+
# @!attribute [rw] lib_name
|
844
|
+
# The library name as recorded in instrumentation and logging
|
845
|
+
# @return [::String]
|
846
|
+
# @!attribute [rw] lib_version
|
847
|
+
# The library version as recorded in instrumentation and logging
|
848
|
+
# @return [::String]
|
849
|
+
# @!attribute [rw] channel_args
|
850
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
851
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
852
|
+
# @return [::Hash]
|
853
|
+
# @!attribute [rw] interceptors
|
854
|
+
# An array of interceptors that are run before calls are executed.
|
855
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
856
|
+
# @!attribute [rw] timeout
|
857
|
+
# The call timeout in seconds.
|
858
|
+
# @return [::Numeric]
|
859
|
+
# @!attribute [rw] metadata
|
860
|
+
# Additional gRPC headers to be sent with the call.
|
861
|
+
# @return [::Hash{::Symbol=>::String}]
|
862
|
+
# @!attribute [rw] retry_policy
|
863
|
+
# The retry policy. The value is a hash with the following keys:
|
864
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
865
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
866
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
867
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
868
|
+
# trigger a retry.
|
869
|
+
# @return [::Hash]
|
870
|
+
# @!attribute [rw] quota_project
|
871
|
+
# A separate project against which to charge quota.
|
872
|
+
# @return [::String]
|
873
|
+
# @!attribute [rw] universe_domain
|
874
|
+
# The universe domain within which to make requests. This determines the
|
875
|
+
# default endpoint URL. The default value of nil uses the environment
|
876
|
+
# universe (usually the default "googleapis.com" universe).
|
877
|
+
# @return [::String,nil]
|
878
|
+
#
|
879
|
+
class Configuration
|
880
|
+
extend ::Gapic::Config
|
881
|
+
|
882
|
+
# @private
|
883
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
884
|
+
DEFAULT_ENDPOINT = "fleetengine.googleapis.com"
|
885
|
+
|
886
|
+
config_attr :endpoint, nil, ::String, nil
|
887
|
+
config_attr :credentials, nil do |value|
|
888
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
889
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
890
|
+
allowed.any? { |klass| klass === value }
|
891
|
+
end
|
892
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
893
|
+
config_attr :lib_name, nil, ::String, nil
|
894
|
+
config_attr :lib_version, nil, ::String, nil
|
895
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
896
|
+
config_attr :interceptors, nil, ::Array, nil
|
897
|
+
config_attr :timeout, nil, ::Numeric, nil
|
898
|
+
config_attr :metadata, nil, ::Hash, nil
|
899
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
900
|
+
config_attr :quota_project, nil, ::String, nil
|
901
|
+
config_attr :universe_domain, nil, ::String, nil
|
902
|
+
|
903
|
+
# @private
|
904
|
+
def initialize parent_config = nil
|
905
|
+
@parent_config = parent_config unless parent_config.nil?
|
906
|
+
|
907
|
+
yield self if block_given?
|
908
|
+
end
|
909
|
+
|
910
|
+
##
|
911
|
+
# Configurations for individual RPCs
|
912
|
+
# @return [Rpcs]
|
913
|
+
#
|
914
|
+
def rpcs
|
915
|
+
@rpcs ||= begin
|
916
|
+
parent_rpcs = nil
|
917
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
918
|
+
Rpcs.new parent_rpcs
|
919
|
+
end
|
920
|
+
end
|
921
|
+
|
922
|
+
##
|
923
|
+
# Configuration for the channel pool
|
924
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
925
|
+
#
|
926
|
+
def channel_pool
|
927
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
928
|
+
end
|
929
|
+
|
930
|
+
##
|
931
|
+
# Configuration RPC class for the TripService API.
|
932
|
+
#
|
933
|
+
# Includes fields providing the configuration for each RPC in this service.
|
934
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
935
|
+
# the following configuration fields:
|
936
|
+
#
|
937
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
938
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
939
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
940
|
+
# include the following keys:
|
941
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
942
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
943
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
944
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
945
|
+
# trigger a retry.
|
946
|
+
#
|
947
|
+
class Rpcs
|
948
|
+
##
|
949
|
+
# RPC-specific configuration for `create_trip`
|
950
|
+
# @return [::Gapic::Config::Method]
|
951
|
+
#
|
952
|
+
attr_reader :create_trip
|
953
|
+
##
|
954
|
+
# RPC-specific configuration for `get_trip`
|
955
|
+
# @return [::Gapic::Config::Method]
|
956
|
+
#
|
957
|
+
attr_reader :get_trip
|
958
|
+
##
|
959
|
+
# RPC-specific configuration for `report_billable_trip`
|
960
|
+
# @return [::Gapic::Config::Method]
|
961
|
+
#
|
962
|
+
attr_reader :report_billable_trip
|
963
|
+
##
|
964
|
+
# RPC-specific configuration for `search_trips`
|
965
|
+
# @return [::Gapic::Config::Method]
|
966
|
+
#
|
967
|
+
attr_reader :search_trips
|
968
|
+
##
|
969
|
+
# RPC-specific configuration for `update_trip`
|
970
|
+
# @return [::Gapic::Config::Method]
|
971
|
+
#
|
972
|
+
attr_reader :update_trip
|
973
|
+
|
974
|
+
# @private
|
975
|
+
def initialize parent_rpcs = nil
|
976
|
+
create_trip_config = parent_rpcs.create_trip if parent_rpcs.respond_to? :create_trip
|
977
|
+
@create_trip = ::Gapic::Config::Method.new create_trip_config
|
978
|
+
get_trip_config = parent_rpcs.get_trip if parent_rpcs.respond_to? :get_trip
|
979
|
+
@get_trip = ::Gapic::Config::Method.new get_trip_config
|
980
|
+
report_billable_trip_config = parent_rpcs.report_billable_trip if parent_rpcs.respond_to? :report_billable_trip
|
981
|
+
@report_billable_trip = ::Gapic::Config::Method.new report_billable_trip_config
|
982
|
+
search_trips_config = parent_rpcs.search_trips if parent_rpcs.respond_to? :search_trips
|
983
|
+
@search_trips = ::Gapic::Config::Method.new search_trips_config
|
984
|
+
update_trip_config = parent_rpcs.update_trip if parent_rpcs.respond_to? :update_trip
|
985
|
+
@update_trip = ::Gapic::Config::Method.new update_trip_config
|
986
|
+
|
987
|
+
yield self if block_given?
|
988
|
+
end
|
989
|
+
end
|
990
|
+
end
|
991
|
+
end
|
992
|
+
end
|
993
|
+
end
|
994
|
+
end
|
995
|
+
end
|
996
|
+
end
|