class Pinnacle::AsyncRequestClient
def get_headers
-
(Hash{String => String})
-
def get_headers headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "rcs", "X-Fern-SDK-Version": "1.0.15" } headers["PINNACLE-API-Key"] = ((@api_key.is_a? Method) ? @api_key.call : @api_key) unless @api_key.nil? headers end
def get_url(request_options: nil)
-
(String)
-
Parameters:
-
request_options
(Pinnacle::RequestOptions
) --
def get_url(request_options: nil) request_options&.base_url || @default_environment || @base_url end
def initialize(api_key:, base_url: nil, environment: Pinnacle::Environment::DEFAULT, max_retries: nil,
-
(Pinnacle::AsyncRequestClient)
-
Parameters:
-
api_key
(String
) -- -
timeout_in_seconds
(Long
) -- -
max_retries
(Long
) -- The number of times to retry a failed request, defaults to 2. -
environment
(Pinnacle::Environment
) -- -
base_url
(String
) --
def initialize(api_key:, base_url: nil, environment: Pinnacle::Environment::DEFAULT, max_retries: nil, timeout_in_seconds: nil) @default_environment = environment @base_url = environment || base_url @api_key = api_key @conn = Faraday.new do |faraday| faraday.request :json faraday.response :raise_error, include_request: true faraday.adapter :async_http faraday.request :retry, { max: max_retries } unless max_retries.nil? faraday.options.timeout = timeout_in_seconds unless timeout_in_seconds.nil? end end