lib/baremetrics_api/client.rb
# Returns the raw Faraday connection configured using the current configuration
Returns the raw Faraday connection configured using the current configuration
Returns the raw Faraday connection configured using the current configuration
def connection
      ensure_valid_configuration
      host = configuration.sandbox ? Constants::SANDBOX_API_HOST : Constants::API_HOST
      Faraday.new(host, headers: { authorization: "Bearer #{configuration.api_key}", content_type: 'application/json', accept: 'application/json' }) do |f|
        f.request :json
        f.response :logger if configuration.log_traffic
        f.use Faraday::RateChecker
        f.adapter :httpclient
      end
    end
def connection ensure_valid_configuration host = configuration . sandbox ? Constants :: SANDBOX_API_HOST : Constants :: API_HOST Faraday . new ( host , headers : { authorization : "Bearer #{configuration.api_key}" , content_type : 'application/json' , accept : 'application/json' } ) do | f | f . request :json f . response :logger if configuration . log_traffic f . use Faraday :: RateChecker f . adapter :httpclient end end
Returns the raw Faraday connection configured using the current configuration
Returns the raw Faraday connection configured using the current configuration