Class: Geoiq::Auth
- Inherits:
-
Object
- Object
- Geoiq::Auth
- Defined in:
- lib/geoiq/auth.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
Returns the value of attribute password.
-
#ssl ⇒ Object
Returns the value of attribute ssl.
-
#url ⇒ Object
Returns the value of attribute url.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #basic_auth ⇒ Object
- #host ⇒ Object
-
#initialize(url, username, password) ⇒ Auth
constructor
A new instance of Auth.
- #valid? ⇒ Boolean
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
#password ⇒ Object
Returns the value of attribute password.
3 4 5 |
# File 'lib/geoiq/auth.rb', line 3 def password @password end |
#ssl ⇒ Object
Returns the value of attribute ssl.
3 4 5 |
# File 'lib/geoiq/auth.rb', line 3 def ssl @ssl end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/geoiq/auth.rb', line 3 def url @url end |
#username ⇒ Object
Returns the value of attribute username.
3 4 5 |
# File 'lib/geoiq/auth.rb', line 3 def username @username end |
Instance Method Details
#basic_auth ⇒ Object
13 14 15 |
# File 'lib/geoiq/auth.rb', line 13 def basic_auth Base64.encode64("#{username}:#{password}").delete("\r\n") end |
#host ⇒ Object
17 18 19 |
# File 'lib/geoiq/auth.rb', line 17 def host @url end |
#valid? ⇒ Boolean
9 10 11 |
# File 'lib/geoiq/auth.rb', line 9 def valid? !url.nil? && !username.nil? && !password.nil? end |