Module: Yext::Api::Concerns::FaradayConnection

Extended by:
ActiveSupport::Concern
Included in:
Utils::ApiBase
Defined in:
lib/yext/api/concerns/faraday_connection.rb

Overview

This module defines methods that set the connection for a Spyke class.

The default connection is to the sandbox or the API based on the value of the configuration sandbox setting.

A class function live_api is provided to allow LiveApi module classes to use the live endpoint.

Class Method Summary collapse

Class Method Details

.faraday_connection(url) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/yext/api/concerns/faraday_connection.rb', line 32

def faraday_connection(url)
  Faraday.new(url: url) do |c|
    c.request :json
    c.request :retry,
              max:                 2,
              interval:            0.05,
              interval_randomness: 0.5,
              backoff_factor:      2

    add_middleware(c)

    c.adapter Faraday.default_adapter
  end
end