google-maps-isochrones-v1 0.a → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,455 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 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/isochrones/v1/isochrones_service_pb"
21
+ require "google/maps/isochrones/v1/isochrone_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Maps
25
+ module Isochrones
26
+ module V1
27
+ module IsochroneService
28
+ module Rest
29
+ ##
30
+ # REST client for the IsochroneService service.
31
+ #
32
+ # Service for calculating isochrones. An isochrone is an area of reachability
33
+ # from a given origin point within a specified travel time.
34
+ #
35
+ class Client
36
+ # @private
37
+ API_VERSION = ""
38
+
39
+ # @private
40
+ DEFAULT_ENDPOINT_TEMPLATE = "isochrones.$UNIVERSE_DOMAIN$"
41
+
42
+ include Paths
43
+
44
+ # @private
45
+ attr_reader :isochrone_service_stub
46
+
47
+ ##
48
+ # Configure the IsochroneService Client class.
49
+ #
50
+ # See {::Google::Maps::Isochrones::V1::IsochroneService::Rest::Client::Configuration}
51
+ # for a description of the configuration fields.
52
+ #
53
+ # @example
54
+ #
55
+ # # Modify the configuration for all IsochroneService clients
56
+ # ::Google::Maps::Isochrones::V1::IsochroneService::Rest::Client.configure do |config|
57
+ # config.timeout = 10.0
58
+ # end
59
+ #
60
+ # @yield [config] Configure the Client client.
61
+ # @yieldparam config [Client::Configuration]
62
+ #
63
+ # @return [Client::Configuration]
64
+ #
65
+ def self.configure
66
+ @configure ||= begin
67
+ namespace = ["Google", "Maps", "Isochrones", "V1"]
68
+ parent_config = while namespace.any?
69
+ parent_name = namespace.join "::"
70
+ parent_const = const_get parent_name
71
+ break parent_const.configure if parent_const.respond_to? :configure
72
+ namespace.pop
73
+ end
74
+ default_config = Client::Configuration.new parent_config
75
+
76
+ default_config.rpcs.generate_isochrone.timeout = 60.0
77
+ default_config.rpcs.generate_isochrone.retry_policy = {
78
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
79
+ }
80
+
81
+ default_config
82
+ end
83
+ yield @configure if block_given?
84
+ @configure
85
+ end
86
+
87
+ ##
88
+ # Configure the IsochroneService Client instance.
89
+ #
90
+ # The configuration is set to the derived mode, meaning that values can be changed,
91
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
92
+ # should be made on {Client.configure}.
93
+ #
94
+ # See {::Google::Maps::Isochrones::V1::IsochroneService::Rest::Client::Configuration}
95
+ # for a description of the configuration fields.
96
+ #
97
+ # @yield [config] Configure the Client client.
98
+ # @yieldparam config [Client::Configuration]
99
+ #
100
+ # @return [Client::Configuration]
101
+ #
102
+ def configure
103
+ yield @config if block_given?
104
+ @config
105
+ end
106
+
107
+ ##
108
+ # The effective universe domain
109
+ #
110
+ # @return [String]
111
+ #
112
+ def universe_domain
113
+ @isochrone_service_stub.universe_domain
114
+ end
115
+
116
+ ##
117
+ # Create a new IsochroneService REST client object.
118
+ #
119
+ # @example
120
+ #
121
+ # # Create a client using the default configuration
122
+ # client = ::Google::Maps::Isochrones::V1::IsochroneService::Rest::Client.new
123
+ #
124
+ # # Create a client using a custom configuration
125
+ # client = ::Google::Maps::Isochrones::V1::IsochroneService::Rest::Client.new do |config|
126
+ # config.timeout = 10.0
127
+ # end
128
+ #
129
+ # @yield [config] Configure the IsochroneService client.
130
+ # @yieldparam config [Client::Configuration]
131
+ #
132
+ def initialize
133
+ # Create the configuration object
134
+ @config = Configuration.new Client.configure
135
+
136
+ # Yield the configuration if needed
137
+ yield @config if block_given?
138
+
139
+ # Create credentials
140
+ credentials = @config.credentials
141
+ # Use self-signed JWT if the endpoint is unchanged from default,
142
+ # but only if the default endpoint does not have a region prefix.
143
+ enable_self_signed_jwt = @config.endpoint.nil? ||
144
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
145
+ !@config.endpoint.split(".").first.include?("-"))
146
+ credentials ||= Credentials.default scope: @config.scope,
147
+ enable_self_signed_jwt: enable_self_signed_jwt
148
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
149
+ credentials = Credentials.new credentials, scope: @config.scope
150
+ end
151
+
152
+ @quota_project_id = @config.quota_project
153
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
154
+
155
+ @isochrone_service_stub = ::Google::Maps::Isochrones::V1::IsochroneService::Rest::ServiceStub.new(
156
+ endpoint: @config.endpoint,
157
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
158
+ universe_domain: @config.universe_domain,
159
+ credentials: credentials,
160
+ logger: @config.logger
161
+ )
162
+
163
+ @isochrone_service_stub.logger(stub: true)&.info do |entry|
164
+ entry.set_system_name
165
+ entry.set_service
166
+ entry.message = "Created client for #{entry.service}"
167
+ entry.set_credentials_fields credentials
168
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
169
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
170
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
171
+ end
172
+ end
173
+
174
+ ##
175
+ # The logger used for request/response debug logging.
176
+ #
177
+ # @return [Logger]
178
+ #
179
+ def logger
180
+ @isochrone_service_stub.logger
181
+ end
182
+
183
+ # Service calls
184
+
185
+ ##
186
+ # Calculates and returns a single isochrone for a given set of parameters.
187
+ #
188
+ # @overload generate_isochrone(request, options = nil)
189
+ # Pass arguments to `generate_isochrone` via a request object, either of type
190
+ # {::Google::Maps::Isochrones::V1::GenerateIsochroneRequest} or an equivalent Hash.
191
+ #
192
+ # @param request [::Google::Maps::Isochrones::V1::GenerateIsochroneRequest, ::Hash]
193
+ # A request object representing the call parameters. Required. To specify no
194
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
195
+ # @param options [::Gapic::CallOptions, ::Hash]
196
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
197
+ #
198
+ # @overload generate_isochrone(location: nil, place: nil, travel_duration: nil, travel_mode: nil, travel_direction: nil, routing_preference: nil, enable_smoothing: nil, polygon_fidelity: nil)
199
+ # Pass arguments to `generate_isochrone` via keyword arguments. Note that at
200
+ # least one keyword argument is required. To specify no parameters, or to keep all
201
+ # the default parameter values, pass an empty Hash as a request object (see above).
202
+ #
203
+ # @param location [::Google::Type::LatLng, ::Hash]
204
+ # The origin as a latitude/longitude coordinate.
205
+ #
206
+ # Note: The following parameters are mutually exclusive: `location`, `place`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
207
+ # @param place [::String]
208
+ # The resource name of a place, in the `places/{place_id}` format.
209
+ #
210
+ # Note: The following parameters are mutually exclusive: `place`, `location`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
211
+ # @param travel_duration [::Google::Protobuf::Duration, ::Hash]
212
+ # Required. The travel time for the isochrone calculation. The value must
213
+ # be positive and is capped at 7200 seconds (120 minutes).
214
+ # For DRIVE mode, the maximum allowed duration is 3600 seconds (60 minutes).
215
+ # @param travel_mode [::Google::Maps::Isochrones::V1::GenerateIsochroneRequest::TravelMode]
216
+ # Required. The mode of transportation.
217
+ # @param travel_direction [::Google::Maps::Isochrones::V1::GenerateIsochroneRequest::TravelDirection]
218
+ # Required. The direction of travel.
219
+ # @param routing_preference [::Google::Maps::Isochrones::V1::GenerateIsochroneRequest::RoutingPreference]
220
+ # Optional. Specifies the preference for how to route. Defaults to
221
+ # TRAFFIC_UNAWARE.
222
+ # @param enable_smoothing [::Boolean]
223
+ # Optional. Specifies whether to smooth the edges of the resulting isochrone
224
+ # polygons.
225
+ # @param polygon_fidelity [::Google::Maps::Isochrones::V1::GenerateIsochroneRequest::PolygonFidelity]
226
+ # Optional. Controls the precision of the generated polygon.
227
+ # Defaults to POLYGON_FIDELITY_UNSPECIFIED.
228
+ # @yield [result, operation] Access the result along with the TransportOperation object
229
+ # @yieldparam result [::Google::Maps::Isochrones::V1::GenerateIsochroneResponse]
230
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
231
+ #
232
+ # @return [::Google::Maps::Isochrones::V1::GenerateIsochroneResponse]
233
+ #
234
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
235
+ #
236
+ # @example Basic example
237
+ # require "google/maps/isochrones/v1"
238
+ #
239
+ # # Create a client object. The client can be reused for multiple calls.
240
+ # client = Google::Maps::Isochrones::V1::IsochroneService::Rest::Client.new
241
+ #
242
+ # # Create a request. To set request fields, pass in keyword arguments.
243
+ # request = Google::Maps::Isochrones::V1::GenerateIsochroneRequest.new
244
+ #
245
+ # # Call the generate_isochrone method.
246
+ # result = client.generate_isochrone request
247
+ #
248
+ # # The returned object is of type Google::Maps::Isochrones::V1::GenerateIsochroneResponse.
249
+ # p result
250
+ #
251
+ def generate_isochrone request, options = nil
252
+ raise ::ArgumentError, "request must be provided" if request.nil?
253
+
254
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::Isochrones::V1::GenerateIsochroneRequest
255
+
256
+ # Converts hash and nil to an options object
257
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
258
+
259
+ # Customize the options with defaults
260
+ call_metadata = @config.rpcs.generate_isochrone.metadata.to_h
261
+
262
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
263
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
264
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
265
+ gapic_version: ::Google::Maps::Isochrones::V1::VERSION,
266
+ transports_version_send: [:rest]
267
+
268
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
269
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
270
+
271
+ options.apply_defaults timeout: @config.rpcs.generate_isochrone.timeout,
272
+ metadata: call_metadata,
273
+ retry_policy: @config.rpcs.generate_isochrone.retry_policy
274
+
275
+ options.apply_defaults timeout: @config.timeout,
276
+ metadata: @config.metadata,
277
+ retry_policy: @config.retry_policy
278
+
279
+ @isochrone_service_stub.generate_isochrone request, options do |result, operation|
280
+ yield result, operation if block_given?
281
+ end
282
+ rescue ::Gapic::Rest::Error => e
283
+ raise ::Google::Cloud::Error.from_error(e)
284
+ end
285
+
286
+ ##
287
+ # Configuration class for the IsochroneService REST API.
288
+ #
289
+ # This class represents the configuration for IsochroneService REST,
290
+ # providing control over timeouts, retry behavior, logging, transport
291
+ # parameters, and other low-level controls. Certain parameters can also be
292
+ # applied individually to specific RPCs. See
293
+ # {::Google::Maps::Isochrones::V1::IsochroneService::Rest::Client::Configuration::Rpcs}
294
+ # for a list of RPCs that can be configured independently.
295
+ #
296
+ # Configuration can be applied globally to all clients, or to a single client
297
+ # on construction.
298
+ #
299
+ # @example
300
+ #
301
+ # # Modify the global config, setting the timeout for
302
+ # # generate_isochrone to 20 seconds,
303
+ # # and all remaining timeouts to 10 seconds.
304
+ # ::Google::Maps::Isochrones::V1::IsochroneService::Rest::Client.configure do |config|
305
+ # config.timeout = 10.0
306
+ # config.rpcs.generate_isochrone.timeout = 20.0
307
+ # end
308
+ #
309
+ # # Apply the above configuration only to a new client.
310
+ # client = ::Google::Maps::Isochrones::V1::IsochroneService::Rest::Client.new do |config|
311
+ # config.timeout = 10.0
312
+ # config.rpcs.generate_isochrone.timeout = 20.0
313
+ # end
314
+ #
315
+ # @!attribute [rw] endpoint
316
+ # A custom service endpoint, as a hostname or hostname:port. The default is
317
+ # nil, indicating to use the default endpoint in the current universe domain.
318
+ # @return [::String,nil]
319
+ # @!attribute [rw] credentials
320
+ # Credentials to send with calls. You may provide any of the following types:
321
+ # * (`String`) The path to a service account key file in JSON format
322
+ # * (`Hash`) A service account key as a Hash
323
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
324
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
325
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
326
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
327
+ # * (`nil`) indicating no credentials
328
+ #
329
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
330
+ # external source for authentication to Google Cloud, you must validate it before
331
+ # providing it to a Google API client library. Providing an unvalidated credential
332
+ # configuration to Google APIs can compromise the security of your systems and data.
333
+ # For more information, refer to [Validate credential configurations from external
334
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
335
+ # @return [::Object]
336
+ # @!attribute [rw] scope
337
+ # The OAuth scopes
338
+ # @return [::Array<::String>]
339
+ # @!attribute [rw] lib_name
340
+ # The library name as recorded in instrumentation and logging
341
+ # @return [::String]
342
+ # @!attribute [rw] lib_version
343
+ # The library version as recorded in instrumentation and logging
344
+ # @return [::String]
345
+ # @!attribute [rw] timeout
346
+ # The call timeout in seconds.
347
+ # @return [::Numeric]
348
+ # @!attribute [rw] metadata
349
+ # Additional headers to be sent with the call.
350
+ # @return [::Hash{::Symbol=>::String}]
351
+ # @!attribute [rw] retry_policy
352
+ # The retry policy. The value is a hash with the following keys:
353
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
354
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
355
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
356
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
357
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
358
+ # trigger a retry.
359
+ # @return [::Hash]
360
+ # @!attribute [rw] quota_project
361
+ # A separate project against which to charge quota.
362
+ # @return [::String]
363
+ # @!attribute [rw] universe_domain
364
+ # The universe domain within which to make requests. This determines the
365
+ # default endpoint URL. The default value of nil uses the environment
366
+ # universe (usually the default "googleapis.com" universe).
367
+ # @return [::String,nil]
368
+ # @!attribute [rw] logger
369
+ # A custom logger to use for request/response debug logging, or the value
370
+ # `:default` (the default) to construct a default logger, or `nil` to
371
+ # explicitly disable logging.
372
+ # @return [::Logger,:default,nil]
373
+ #
374
+ class Configuration
375
+ extend ::Gapic::Config
376
+
377
+ # @private
378
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
379
+ DEFAULT_ENDPOINT = "isochrones.googleapis.com"
380
+
381
+ config_attr :endpoint, nil, ::String, nil
382
+ config_attr :credentials, nil do |value|
383
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
384
+ allowed.any? { |klass| klass === value }
385
+ end
386
+ config_attr :scope, nil, ::String, ::Array, nil
387
+ config_attr :lib_name, nil, ::String, nil
388
+ config_attr :lib_version, nil, ::String, nil
389
+ config_attr :timeout, nil, ::Numeric, nil
390
+ config_attr :metadata, nil, ::Hash, nil
391
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
392
+ config_attr :quota_project, nil, ::String, nil
393
+ config_attr :universe_domain, nil, ::String, nil
394
+ config_attr :logger, :default, ::Logger, nil, :default
395
+
396
+ # @private
397
+ def initialize parent_config = nil
398
+ @parent_config = parent_config unless parent_config.nil?
399
+
400
+ yield self if block_given?
401
+ end
402
+
403
+ ##
404
+ # Configurations for individual RPCs
405
+ # @return [Rpcs]
406
+ #
407
+ def rpcs
408
+ @rpcs ||= begin
409
+ parent_rpcs = nil
410
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
411
+ Rpcs.new parent_rpcs
412
+ end
413
+ end
414
+
415
+ ##
416
+ # Configuration RPC class for the IsochroneService API.
417
+ #
418
+ # Includes fields providing the configuration for each RPC in this service.
419
+ # Each configuration object is of type `Gapic::Config::Method` and includes
420
+ # the following configuration fields:
421
+ #
422
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
423
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
424
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
425
+ # include the following keys:
426
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
427
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
428
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
429
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
430
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
431
+ # trigger a retry.
432
+ #
433
+ class Rpcs
434
+ ##
435
+ # RPC-specific configuration for `generate_isochrone`
436
+ # @return [::Gapic::Config::Method]
437
+ #
438
+ attr_reader :generate_isochrone
439
+
440
+ # @private
441
+ def initialize parent_rpcs = nil
442
+ generate_isochrone_config = parent_rpcs.generate_isochrone if parent_rpcs.respond_to? :generate_isochrone
443
+ @generate_isochrone = ::Gapic::Config::Method.new generate_isochrone_config
444
+
445
+ yield self if block_given?
446
+ end
447
+ end
448
+ end
449
+ end
450
+ end
451
+ end
452
+ end
453
+ end
454
+ end
455
+ end
@@ -0,0 +1,141 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 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/maps/isochrones/v1/isochrones_service_pb"
20
+
21
+ module Google
22
+ module Maps
23
+ module Isochrones
24
+ module V1
25
+ module IsochroneService
26
+ module Rest
27
+ ##
28
+ # REST service stub for the IsochroneService service.
29
+ # Service stub contains baseline method implementations
30
+ # including transcoding, making the REST call, and deserialing the response.
31
+ #
32
+ class ServiceStub
33
+ # @private
34
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
35
+ # These require statements are intentionally placed here to initialize
36
+ # the REST modules only when it's required.
37
+ require "gapic/rest"
38
+
39
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
40
+ endpoint_template: endpoint_template,
41
+ universe_domain: universe_domain,
42
+ credentials: credentials,
43
+ numeric_enums: true,
44
+ service_name: self.class,
45
+ raise_faraday_errors: false,
46
+ logger: logger
47
+ end
48
+
49
+ ##
50
+ # The effective universe domain
51
+ #
52
+ # @return [String]
53
+ #
54
+ def universe_domain
55
+ @client_stub.universe_domain
56
+ end
57
+
58
+ ##
59
+ # The effective endpoint
60
+ #
61
+ # @return [String]
62
+ #
63
+ def endpoint
64
+ @client_stub.endpoint
65
+ end
66
+
67
+ ##
68
+ # The logger used for request/response debug logging.
69
+ #
70
+ # @return [Logger]
71
+ #
72
+ def logger stub: false
73
+ stub ? @client_stub.stub_logger : @client_stub.logger
74
+ end
75
+
76
+ ##
77
+ # Baseline implementation for the generate_isochrone REST call
78
+ #
79
+ # @param request_pb [::Google::Maps::Isochrones::V1::GenerateIsochroneRequest]
80
+ # A request object representing the call parameters. Required.
81
+ # @param options [::Gapic::CallOptions]
82
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
83
+ #
84
+ # @yield [result, operation] Access the result along with the TransportOperation object
85
+ # @yieldparam result [::Google::Maps::Isochrones::V1::GenerateIsochroneResponse]
86
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
87
+ #
88
+ # @return [::Google::Maps::Isochrones::V1::GenerateIsochroneResponse]
89
+ # A result object deserialized from the server's reply
90
+ def generate_isochrone request_pb, options = nil
91
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
92
+
93
+ verb, uri, query_string_params, body = ServiceStub.transcode_generate_isochrone_request request_pb
94
+ query_string_params = if query_string_params.any?
95
+ query_string_params.to_h { |p| p.split "=", 2 }
96
+ else
97
+ {}
98
+ end
99
+
100
+ response = @client_stub.make_http_request(
101
+ verb,
102
+ uri: uri,
103
+ body: body || "",
104
+ params: query_string_params,
105
+ method_name: "generate_isochrone",
106
+ options: options
107
+ )
108
+ operation = ::Gapic::Rest::TransportOperation.new response
109
+ result = ::Google::Maps::Isochrones::V1::GenerateIsochroneResponse.decode_json response.body, ignore_unknown_fields: true
110
+ catch :response do
111
+ yield result, operation if block_given?
112
+ result
113
+ end
114
+ end
115
+
116
+ ##
117
+ # @private
118
+ #
119
+ # GRPC transcoding helper method for the generate_isochrone REST call
120
+ #
121
+ # @param request_pb [::Google::Maps::Isochrones::V1::GenerateIsochroneRequest]
122
+ # A request object representing the call parameters. Required.
123
+ # @return [Array(String, [String, nil], Hash{String => String})]
124
+ # Uri, Body, Query string parameters
125
+ def self.transcode_generate_isochrone_request request_pb
126
+ transcoder = Gapic::Rest::GrpcTranscoder.new
127
+ .with_bindings(
128
+ uri_method: :post,
129
+ uri_template: "/v1/isochrones:generate",
130
+ body: "*",
131
+ matches: []
132
+ )
133
+ transcoder.transcode request_pb
134
+ end
135
+ end
136
+ end
137
+ end
138
+ end
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 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 "gapic/rest"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/maps/isochrones/v1/version"
24
+
25
+ require "google/maps/isochrones/v1/isochrone_service/credentials"
26
+ require "google/maps/isochrones/v1/isochrone_service/paths"
27
+ require "google/maps/isochrones/v1/isochrone_service/rest/client"
28
+
29
+ module Google
30
+ module Maps
31
+ module Isochrones
32
+ module V1
33
+ ##
34
+ # Service for calculating isochrones. An isochrone is an area of reachability
35
+ # from a given origin point within a specified travel time.
36
+ #
37
+ # To load this service and instantiate a REST client:
38
+ #
39
+ # require "google/maps/isochrones/v1/isochrone_service/rest"
40
+ # client = ::Google::Maps::Isochrones::V1::IsochroneService::Rest::Client.new
41
+ #
42
+ module IsochroneService
43
+ # Client for the REST transport
44
+ module Rest
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+
52
+ helper_path = ::File.join __dir__, "rest", "helpers.rb"
53
+ require "google/maps/isochrones/v1/isochrone_service/rest/helpers" if ::File.file? helper_path