Class: Nozbe::User

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#emailObject

Returns the value of attribute email.



6
7
8
# File 'lib/nozbe/user.rb', line 6

def email
  @email
end

#keyObject

Returns the value of attribute key.



6
7
8
# File 'lib/nozbe/user.rb', line 6

def key
  @key
end

#passwordObject

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)

Returns:

  • (Boolean)


23
24
25
# File 'lib/nozbe/user.rb', line 23

def logged_in?()
  not @key.nil?
end

#loginObject

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 ()
  @key = LoginApiCall.new(self).call
end