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
def
initialize
(
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 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, ornil
to disable logging explicitly.
Yields
- (Faraday::Connection)
Returns
- ( ClientStub ) — a new instance of ClientStub
#make_delete_request
def
make_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
def
make_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
def
make_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
def
make_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
def
make_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)