Module: Vertebrae::Authorization

Included in:
Configuration, Connection
Defined in:
lib/vertebrae/authorization.rb

Instance Method Summary collapse

Instance Method Details

#authenticated?Boolean

Check whether authentication credentials are present

Returns:

  • (Boolean)


14
15
16
# File 'lib/vertebrae/authorization.rb', line 14

def authenticated?
  (username? && password?)
end

#authenticationObject



22
23
24
# File 'lib/vertebrae/authorization.rb', line 22

def authentication
  { :basic_auth => basic_auth }
end

#basic_authObject



18
19
20
# File 'lib/vertebrae/authorization.rb', line 18

def basic_auth
  "#{username}:#{password}"
end

#password?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/vertebrae/authorization.rb', line 9

def password?
  password.present?
end

#username?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/vertebrae/authorization.rb', line 5

def username?
  username.present?
end