Class: Neo4j::Http::AuthToken

Inherits:
Object
  • Object
show all
Defined in:
lib/neo4j/http/auth_token.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username, password) ⇒ AuthToken

Returns a new instance of AuthToken.



10
11
12
13
# File 'lib/neo4j/http/auth_token.rb', line 10

def initialize(username, password)
  @username = username
  @password = password
end

Class Method Details

.token(username, password) ⇒ Object



6
7
8
# File 'lib/neo4j/http/auth_token.rb', line 6

def self.token(username, password)
  new(username, password).token
end

Instance Method Details

#tokenObject



16
17
18
19
20
# File 'lib/neo4j/http/auth_token.rb', line 16

def token
  return "" if @username.blank? || @password.blank?

  Base64.encode64("#{@username}:#{@password}")
end