Module: Foauth

Defined in:
lib/foauth.rb,
lib/foauth/version.rb

Defined Under Namespace

Classes: Proxy

Constant Summary collapse

VERSION =
"0.4.0"

Class Method Summary collapse

Class Method Details

.new(email = ENV['FOAUTH_EMAIL'], password = ENV['FOAUTH_PASSWORD']) {|builder| ... } ⇒ Faraday::Connection

Creates a new Faraday instance using the given email and password.

Parameters:

  • email (String) (defaults to: ENV['FOAUTH_EMAIL'])

    Your foauth.org email address.

  • password (String) (defaults to: ENV['FOAUTH_PASSWORD'])

    Your foauth.org password.

Yields:

  • (builder)

    Passes the Faraday::Builder instance to the block if given.

Returns:

  • (Faraday::Connection)

    Configured to proxy requests to foauth.org.



13
14
15
16
17
18
19
20
# File 'lib/foauth.rb', line 13

def self.new(email = ENV['FOAUTH_EMAIL'], password = ENV['FOAUTH_PASSWORD'])
  Faraday.new do |builder|
    builder.request :foauth_proxy
    builder.request :basic_auth, email, password
    builder.adapter Faraday.default_adapter
    yield builder if block_given?
  end
end