def connect uri
      Faraday.new(:url => "#{uri.scheme}://#{uri.host}") do |faraday|
        faraday.request :multipart
        faraday.request :url_encoded
        # faraday.use FaradayMiddleware::FollowRedirects, limit: 3
        faraday.use :cookie_jar
        faraday.response :logger                  # log requests to STDOUT
        faraday.adapter  Faraday.default_adapter  # make requests with Net::HTTP
      end
    end
def connect uri
      Faraday.new(:url => "#{uri.scheme}://#{uri.host}") do |faraday|
        faraday.request :multipart
        faraday.request :url_encoded
        # faraday.use FaradayMiddleware::FollowRedirects, limit: 3
        faraday.use :cookie_jar
        faraday.response :logger                  # log requests to STDOUT
        faraday.adapter  Faraday.default_adapter  # make requests with Net::HTTP
      end
    end
Establish Faraday connection