lib/lifen/user.rb in lifen-0.1.3 vs lib/lifen/user.rb in lifen-0.1.4
- old
+ new
@@ -5,10 +5,11 @@
attribute :token, String
attribute :email, String
attribute :last_name, String
attribute :first_name, String
+ attribute :unread_messages, Integer, default: 0
def flows
Lifen::Flows.new(self).all
end
@@ -25,9 +26,18 @@
def refresh_token
authentication = Lifen::Authentication.new(user: self)
authentication.refresh_token
self.token = authentication.token
+
+ self
+ end
+
+ def refresh_unread_messages
+ status = Lifen::Status.new(user: self)
+ status.refresh
+
+ self.unread_messages = status.unread
self
end
def client
\ No newline at end of file