Class: Telephony::Jobs::AgentOffline
- Inherits:
-
Object
- Object
- Telephony::Jobs::AgentOffline
- Defined in:
- lib/telephony/jobs/agent_offline.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Instance Method Summary collapse
- #failure ⇒ Object
-
#initialize(id, timestamp) ⇒ AgentOffline
constructor
A new instance of AgentOffline.
- #perform ⇒ Object
- #update_status ⇒ Object
Constructor Details
#initialize(id, timestamp) ⇒ AgentOffline
Returns a new instance of AgentOffline.
6 7 8 9 |
# File 'lib/telephony/jobs/agent_offline.rb', line 6 def initialize id, @id = id = end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/telephony/jobs/agent_offline.rb', line 4 def id @id end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
4 5 6 |
# File 'lib/telephony/jobs/agent_offline.rb', line 4 def end |
Instance Method Details
#failure ⇒ Object
21 22 23 24 25 |
# File 'lib/telephony/jobs/agent_offline.rb', line 21 def failure Rails.logger.error "#{self.class}: #{self.as_json}" ActiveSupport::Notifications .instrument("telephony.agent_offline_failure", self) end |
#perform ⇒ Object
17 18 19 |
# File 'lib/telephony/jobs/agent_offline.rb', line 17 def perform update_status end |
#update_status ⇒ Object
11 12 13 14 15 |
# File 'lib/telephony/jobs/agent_offline.rb', line 11 def update_status Agent.find_with_lock(id) do |agent| agent.update_status_by_event Agent::OFFLINE, end end |