def initialize(app, token = nil, options = {})
super(app)
options, token = token, nil if token.is_a? Hash
@token = token && token.to_s
@param_name = options.fetch(:param_name, PARAM_NAME).to_s
@token_type = options.fetch(:token_type, TOKEN_TYPE).to_s
if @token_type == 'param' && @param_name.empty?
raise ArgumentError, ":param_name can't be blank"
end
if options[:token_type].nil?
warn "\nWarning: FaradayMiddleware::OAuth2 initialized with default "\
"token_type - token will be added as both a query string parameter "\
"and an Authorization header. In the next major release, tokens will "\
"be added exclusively as an Authorization header by default. Please "\
"visit https://github.com/lostisland/faraday_middleware/wiki for more information."
end
end