Module: BrickFTP::API::Authentication

Defined in:
lib/brick_ftp/api/authentication.rb,
lib/brick_ftp/api/authentication/session.rb

Defined Under Namespace

Classes: Session

Constant Summary collapse

'BrickFTP'.freeze

Class Method Summary collapse

Class Method Details

Generate authentication cookie.

Parameters:

Returns:

  • (CGI::Cookie)

    authentication cookie.


11
12
13
# File 'lib/brick_ftp/api/authentication.rb', line 11

def self.cookie(session)
  CGI::Cookie.new(COOKIE_NAME, session.id)
end

.login(username, password) ⇒ Object

Alias for `BrickFTP::API::Authentication::Session.create`.

Parameters:

  • username (String)

    username of BrickFTP's user.

  • password (String)

    password of BrickFTP's user.


18
19
20
# File 'lib/brick_ftp/api/authentication.rb', line 18

def self.(username, password)
  Session.create(username: username, password: password)
end

.logoutObject

Alias for `BrickFTP::API::Authentication::Session#destroy`.


23
24
25
# File 'lib/brick_ftp/api/authentication.rb', line 23

def self.logout
  BrickFTP.config.session.destroy
end