Class: ICWS::Status
- Inherits:
-
Object
- Object
- ICWS::Status
- Defined in:
- lib/icws/status/status.rb,
lib/icws/status/userstatus.rb,
lib/icws/status/statusmessage.rb
Overview
Status message handler
Defined Under Namespace
Classes: StatusMessage, UserStatus
Instance Method Summary collapse
-
#all_system_statuses ⇒ Array[StatusMessage]
Retreives all the statuses configured in the system.
-
#allowable_statuses(user_id) ⇒ Array[StatusMessage]
Retreives all the statuses for a given user.
-
#get_user_status(user_id) ⇒ StatusMessage
Retreives the current status for a given user.
-
#initialize(connection) ⇒ Status
constructor
Creates a new instance.
-
#set_user_status(user_id, status_id) ⇒ Object
Sets the current status for a given user.
Constructor Details
#initialize(connection) ⇒ Status
Creates a new instance
8 9 10 |
# File 'lib/icws/status/status.rb', line 8 def initialize(connection) @client = ICWS::Client.new connection end |
Instance Method Details
#all_system_statuses ⇒ Array[StatusMessage]
Retreives all the statuses configured in the system
13 14 15 16 17 18 |
# File 'lib/icws/status/status.rb', line 13 def all_system_statuses status_list = @client.get '/status/status-messages' statuses = [] status_list['statusMessageList'].each {|s| statuses.push ICWS::Status::StatusMessage.new(s)} return statuses end |
#allowable_statuses(user_id) ⇒ Array[StatusMessage]
Retreives all the statuses for a given user.
23 24 25 26 |
# File 'lib/icws/status/status.rb', line 23 def allowable_statuses (user_id) status = @client.get '/status/status-messages-user-access/' + user_id status['statusMessages'] end |
#get_user_status(user_id) ⇒ StatusMessage
Retreives the current status for a given user.
31 32 33 34 |
# File 'lib/icws/status/status.rb', line 31 def get_user_status(user_id) status = @client.get '/status/user-statuses/' + user_id ICWS::Status::UserStatus.new(status ) end |
#set_user_status(user_id, status_id) ⇒ Object
Sets the current status for a given user.
39 40 41 42 43 44 |
# File 'lib/icws/status/status.rb', line 39 def set_user_status(user_id, status_id) status_data = {} status_data[:statusId] = status_id @client.put '/status/user-statuses/' + user_id, status_data end |