gapic-common - Class Gapic::Rest::ClientStub (v1.2.0)

Reference documentation and code samples for the gapic-common class Gapic::Rest::ClientStub.

A class for making REST calls through Faraday ClientStub's responsibilities:

  • wrap Faraday methods with a bounded explicit interface
  • store service endpoint and create full url for the request
  • store credentials and add auth information to the request

Inherits

  • Object

Methods

#initialize

definitialize(credentials:,endpoint:nil,endpoint_template:nil,universe_domain:nil,numeric_enums:false,raise_faraday_errors:true,logging_system:nil,service_name:nil,logger::default)->ClientStub

Initializes with an endpoint and credentials

Parameters
  • endpoint (String) (defaults to: nil) — The endpoint of the API. Overrides any endpoint_template.
  • endpoint_template (String) (defaults to: nil) — The endpoint of the API, where the universe domain component of the hostname is marked by the string in the constant UniverseDomainConcerns::ENDPOINT_SUBSTITUTION .
  • universe_domain (String) (defaults to: nil) — The universe domain in which calls should be made. Defaults to googleapis.com.
  • credentials (Google::Auth::Credentials) — Credentials to send with calls in form of a googleauth credentials object. (see the googleauth docs)
  • numeric_enums (Boolean) (defaults to: false) — Whether to signal the server to JSON-encode enums as ints
  • raise_faraday_errors (Boolean) (defaults to: true) — Whether to raise Faraday errors instead of wrapping them in Gapic::Rest::Error Added for backwards compatibility. Default is true. All REST clients (except for old versions of google-cloud-compute-v1) should explicitly set this parameter to false.
  • logger (Logger, :default, nil) (defaults to: :default) — An explicit logger to use, or one of the values :default (the default) to construct a default logger, or nil to disable logging explicitly.
Yields
  • (Faraday::Connection)
Returns

#make_delete_request

defmake_delete_request(uri:,params:{},options:{},method_name:nil)->Faraday::Response

Makes a DELETE request

Parameters
  • uri (String) — uri to send this request to
  • params (Hash) (defaults to: {}) — query string parameters for the request
  • options (::Gapic::CallOptions, Hash) (defaults to: {}) — gapic options to be applied to the REST call. Currently only timeout and headers are supported.
Returns
  • (Faraday::Response)

#make_get_request

defmake_get_request(uri:,params:{},options:{},method_name:nil)->Faraday::Response

Makes a GET request

Parameters
  • uri (String) — uri to send this request to
  • params (Hash) (defaults to: {}) — query string parameters for the request
  • options (::Gapic::CallOptions, Hash) (defaults to: {}) — gapic options to be applied to the REST call. Currently only timeout and headers are supported.
Returns
  • (Faraday::Response)

#make_patch_request

defmake_patch_request(uri:,body:,params:{},options:{},method_name:nil)->Faraday::Response

Makes a PATCH request

Parameters
  • uri (String) — uri to send this request to
  • body (String) — a body to send with the request, nil for requests without a body
  • params (Hash) (defaults to: {}) — query string parameters for the request
  • options (::Gapic::CallOptions, Hash) (defaults to: {}) — gapic options to be applied to the REST call. Currently only timeout and headers are supported.
Returns
  • (Faraday::Response)

#make_post_request

defmake_post_request(uri:,body:nil,params:{},options:{},method_name:nil)->Faraday::Response

Makes a POST request

Parameters
  • uri (String) — uri to send this request to
  • body (String) (defaults to: nil) — a body to send with the request, nil for requests without a body
  • params (Hash) (defaults to: {}) — query string parameters for the request
  • options (::Gapic::CallOptions, Hash) (defaults to: {}) — gapic options to be applied to the REST call. Currently only timeout and headers are supported.
Returns
  • (Faraday::Response)

#make_put_request

defmake_put_request(uri:,body:nil,params:{},options:{},method_name:nil)->Faraday::Response

Makes a PUT request

Parameters
  • uri (String) — uri to send this request to
  • body (String) (defaults to: nil) — a body to send with the request, nil for requests without a body
  • params (Hash) (defaults to: {}) — query string parameters for the request
  • options (::Gapic::CallOptions, Hash) (defaults to: {}) — gapic options to be applied to the REST call. Currently only timeout and headers are supported.
Returns
  • (Faraday::Response)

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月30日 UTC.