class Gapic::Rest::ClientStub
def initialize credentials:,
- Yield: -
Parameters:
-
logger
(Logger, :default, nil
) -- An explicit logger to use, or one -
raise_faraday_errors
(Boolean
) -- -
numeric_enums
(Boolean
) -- Whether to signal the server to JSON-encode enums as ints -
credentials
(Google::Auth::Credentials
) -- -
universe_domain
(String
) -- The universe domain in which calls -
endpoint_template
(String
) -- The endpoint of the API, where the -
endpoint
(String
) -- The endpoint of the API. Overrides any endpoint_template.
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 setup_universe_domain universe_domain: universe_domain, endpoint: endpoint, endpoint_template: endpoint_template, credentials: credentials endpoint_url = self.endpoint endpoint_url = "https://#{endpoint_url}" unless /^https?:/.match? endpoint_url endpoint_url = endpoint_url.sub %r{/$}, "" setup_logging logger: logger, system_name: logging_system, service: service_name, endpoint: endpoint_url, client_id: object_id @numeric_enums = numeric_enums @raise_faraday_errors = raise_faraday_errors @connection = Faraday.new url: endpoint_url do |conn| conn.headers = { "Content-Type" => "application/json" } conn.request :google_authorization, self.credentials unless self.credentials.is_a? ::Symbol conn.request :retry conn.response :raise_error conn.adapter :net_http end yield @connection if block_given? end