Module: StatusHelper::Redis

Included in:
Lita::Handlers::Status
Defined in:
lib/status_helper/redis.rb

Instance Method Summary collapse

Instance Method Details

#delete_status(user) ⇒ Object



11
12
13
# File 'lib/status_helper/redis.rb', line 11

def delete_status(user)
  redis.hdel format_status(user), 'message'
end

#fetch_password(user) ⇒ Object



19
20
21
# File 'lib/status_helper/redis.rb', line 19

def fetch_password(user)
  redis.hget format_status(user), 'password'
end

#fetch_status(user) ⇒ Object



7
8
9
# File 'lib/status_helper/redis.rb', line 7

def fetch_status(user)
  redis.hget format_status(user), 'message'
end

#format_status(user) ⇒ Object



27
28
29
# File 'lib/status_helper/redis.rb', line 27

def format_status(user)
  "status_#{user.id}"
end

#remove_password(user) ⇒ Object



23
24
25
# File 'lib/status_helper/redis.rb', line 23

def remove_password(user)
  redis.hdel format_status(user), 'password'
end

#retrieve_keysObject



31
32
33
# File 'lib/status_helper/redis.rb', line 31

def retrieve_keys
  redis.keys 'status_*'
end

#store_password(user, password) ⇒ Object



15
16
17
# File 'lib/status_helper/redis.rb', line 15

def store_password(user, password)
  redis.hset format_status(user), 'password', password
end

#store_status(user, message) ⇒ Object



3
4
5
# File 'lib/status_helper/redis.rb', line 3

def store_status(user, message)
  redis.hset format_status(user), 'message', "#{message} -- #{Time.new}"
end