# frozen_string_literal: true require 'truelayer/faraday_auth' module Truelayer class Configuration BASE_URLS = { production: 'https://api.truelayer.com', sandbox: 'https://api.truelayer-sandbox.com' }.freeze AUTH_URLS = { production: 'https://auth.truelayer.com', sandbox: 'https://auth.truelayer-sandbox.com' }.freeze attr_accessor :client_id, :client_secret, :environment, :debug, :verbose def initialize @client_id = '' @client_secret = '' @environment = :sandbox # can be either :sandbox or :production @debug = false @verbose = false return if Faraday::Request.fetch_middleware(:truelayer_auth) Faraday::Request.register_middleware truelayer_auth: -> { Truelayer::FaradayAuth } end def base_url BASE_URLS[environment.to_sym] end def auth_url AUTH_URLS[environment.to_sym] end end end