1.5.0 (latest) 1.4.1 1.3.0 1.2.0 1.1.0 1.0.1 0.26.0 0.25.0 0.24.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

## Includes

- [Gapic::LoggingConcerns](https://docs.cloud.google.com/ruby/docs/reference/gapic-common/latest/Gapic-LoggingConcerns)
- [Gapic::UniverseDomainConcerns](https://docs.cloud.google.com/ruby/docs/reference/gapic-common/latest/Gapic-UniverseDomainConcerns)

## 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](https://docs.cloud.google.com/ruby/docs/reference/gapic-common/latest/Gapic-UniverseDomainConcerns#Gapic__UniverseDomainConcerns__ENDPOINT_SUBSTITUTION "Gapic::UniverseDomainConcerns::ENDPOINT_SUBSTITUTION (constant)").
- **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](https://googleapis.dev/ruby/googleauth/latest/index.html))
- **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**

- ([ClientStub](https://docs.cloud.google.com/ruby/docs/reference/gapic-common/latest/Gapic-Rest-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](https://docs.cloud.google.com/ruby/docs/reference/gapic-common/latest/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](https://docs.cloud.google.com/ruby/docs/reference/gapic-common/latest/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](https://docs.cloud.google.com/ruby/docs/reference/gapic-common/latest/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](https://docs.cloud.google.com/ruby/docs/reference/gapic-common/latest/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](https://docs.cloud.google.com/ruby/docs/reference/gapic-common/latest/Gapic-CallOptions), Hash) *(defaults to: {})* --- gapic options to be applied to the REST call. Currently only timeout and headers are supported.
**Returns**

- (Faraday::Response)