Class: Authentise::Session
- Inherits:
-
Object
- Object
- Authentise::Session
- Defined in:
- lib/authentise/session.rb
Overview
Represents a user’s session to use the API with a session cookie
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(username: nil, password: nil) ⇒ Session
constructor
A new instance of Session.
Constructor Details
#initialize(username: nil, password: nil) ⇒ Session
Returns a new instance of Session.
10 11 12 13 14 |
# File 'lib/authentise/session.rb', line 10 def initialize(username: nil, password: nil) @username = username @password = password end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
6 7 8 |
# File 'lib/authentise/session.rb', line 6 def password @password end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
6 7 8 |
# File 'lib/authentise/session.rb', line 6 def token @token end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
6 7 8 |
# File 'lib/authentise/session.rb', line 6 def username @username end |
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/authentise/session.rb', line 16 def create response = API::Users.create_session( username: username, password: password, ) @token = response[:token] true end |