Class: Lifen::User

Inherits:
Base
  • Object
show all
Defined in:
lib/lifen/user.rb

Instance Method Summary collapse

Instance Method Details

#clientObject



44
45
46
# File 'lib/lifen/user.rb', line 44

def client
  UserAuthenticatedClient.new(token)
end

#create!Object



16
17
18
19
20
21
22
23
24
# File 'lib/lifen/user.rb', line 16

def create!
  authentication = Lifen::Authentication.new(user: self)
  authentication.register!

  self.token = authentication.token
  self.uuid = authentication.uuid

  self
end

#flowsObject



12
13
14
# File 'lib/lifen/user.rb', line 12

def flows
  Lifen::Flows.new(self).all
end

#refresh_tokenObject



26
27
28
29
30
31
32
33
# File 'lib/lifen/user.rb', line 26

def refresh_token
  authentication = Lifen::Authentication.new(user: self)
  authentication.refresh_token

  self.token = authentication.token

  self
end

#refresh_unread_messagesObject



35
36
37
38
39
40
41
42
# File 'lib/lifen/user.rb', line 35

def refresh_unread_messages
  status = Lifen::Status.new(user: self)
  status.refresh

  self.unread_messages = status.unread

  self
end