gapic-common - Class Gapic::Rest::ClientStub (v1.2.0)
Stay organized with collections
Save and categorize content based on your preferences.
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)->ClientStubInitializes 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::ErrorAdded for backwards compatibility. Default istrue. All REST clients (except for old versions ofgoogle-cloud-compute-v1) should explicitly set this parameter tofalse. -
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, ornilto disable logging explicitly.
Yields
- (Faraday::Connection)
Returns
- (ClientStub) — a new instance of ClientStub
#make_delete_request
defmake_delete_request(uri:,params:{},options:{},method_name:nil)->Faraday::ResponseMakes 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::ResponseMakes 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::ResponseMakes 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::ResponseMakes 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::ResponseMakes 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)