Class: Geoiq::Auth

Inherits:
Object
  • Object
show all
Defined in:
lib/geoiq/auth.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, username, password) ⇒ Auth

Returns a new instance of Auth.



5
6
7
# File 'lib/geoiq/auth.rb', line 5

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

Instance Attribute Details

#passwordObject

Returns the value of attribute password.



3
4
5
# File 'lib/geoiq/auth.rb', line 3

def password
  @password
end

#sslObject

Returns the value of attribute ssl.



3
4
5
# File 'lib/geoiq/auth.rb', line 3

def ssl
  @ssl
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/geoiq/auth.rb', line 3

def url
  @url
end

#usernameObject

Returns the value of attribute username.



3
4
5
# File 'lib/geoiq/auth.rb', line 3

def username
  @username
end

Instance Method Details

#basic_authObject



13
14
15
# File 'lib/geoiq/auth.rb', line 13

def basic_auth
  Base64.encode64("#{username}:#{password}").delete("\r\n")
end

#hostObject



17
18
19
# File 'lib/geoiq/auth.rb', line 17

def host
  @url
end

#valid?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/geoiq/auth.rb', line 9

def valid?
  !url.nil? && !username.nil? && !password.nil?
end