def set_auth(uri, username = nil, password = nil)
      connection = Faraday.new url: uri, ssl: {verify: false} do |faraday|
        faraday.adapter http_engine
        faraday.proxy(ENV['http_proxy']) if ENV['http_proxy']
      end
      connection.basic_auth username, password if username
      connection
    end
def set_auth(uri, username = nil, password = nil)
      connection = Faraday.new url: uri, ssl: {verify: false} do |faraday|
        faraday.adapter http_engine
        faraday.proxy(ENV['http_proxy']) if ENV['http_proxy']
      end
      connection.basic_auth username, password if username
      connection
    end
Note that this configuration turns SSL certificate verification off.
 To set up the adapter for your environment see:
 https://github.com/lostisland/faraday/wiki/Setting-up-SSL-certificates