Class: Nozbe::User
- Inherits:
-
Object
- Object
- Nozbe::User
- Defined in:
- lib/nozbe/user.rb
Overview
User class
-
Represents a Nozbe-User
-
Used to login (= get a user_key from the email and the password)
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#key ⇒ Object
Returns the value of attribute key.
-
#password ⇒ Object
Returns the value of attribute password.
Instance Method Summary collapse
-
#initialize(email, password) ⇒ User
constructor
Default constructor, that used the user email and password.
-
#logged_in? ⇒ Boolean
Is the user currently logged_in ? - return true if the user_key is set (= not nil).
-
#login ⇒ Object
Log into Nozbe : - retrieve the user_key from the email and password, and return it.
Constructor Details
#initialize(email, password) ⇒ User
Default constructor, that used the user email and password
9 10 11 12 13 |
# File 'lib/nozbe/user.rb', line 9 def initialize(email, password) @email = email @password = password @key = nil end |
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
6 7 8 |
# File 'lib/nozbe/user.rb', line 6 def email @email end |
#key ⇒ Object
Returns the value of attribute key.
6 7 8 |
# File 'lib/nozbe/user.rb', line 6 def key @key end |
#password ⇒ Object
Returns the value of attribute password.
6 7 8 |
# File 'lib/nozbe/user.rb', line 6 def password @password end |
Instance Method Details
#logged_in? ⇒ Boolean
Is the user currently logged_in ?
-
return true if the user_key is set (= not nil)
23 24 25 |
# File 'lib/nozbe/user.rb', line 23 def logged_in?() not @key.nil? end |
#login ⇒ Object
Log into Nozbe :
-
retrieve the user_key from the email and password, and return it
17 18 19 |
# File 'lib/nozbe/user.rb', line 17 def login() @key = LoginApiCall.new(self).call end |