class ElectricSlide::AgentStrategy::LongestIdle
Public Class Methods
new()
click to toggle source
# File lib/electric_slide/agent_strategy/longest_idle.rb, line 6 def initialize @free_agents = [] # Needed to keep track of waiting order end
Public Instance Methods
<<(agent)
click to toggle source
# File lib/electric_slide/agent_strategy/longest_idle.rb, line 29 def <<(agent) @free_agents << agent unless @free_agents.include?(agent) end
agent_available?()
click to toggle source
Checks whether an agent is available to take a call @return [Boolean] True if an agent is available
# File lib/electric_slide/agent_strategy/longest_idle.rb, line 12 def agent_available? @free_agents.count > 0 end
available_agent_summary()
click to toggle source
Returns a count of the number of available agents @return [Hash] Hash of information about available agents This strategy only returns the count of agents available with :total
# File lib/electric_slide/agent_strategy/longest_idle.rb, line 19 def available_agent_summary { total: @free_agents.count } end
checkout_agent()
click to toggle source
Assigns the first available agent, marking the agent :on_call @return {Agent}
# File lib/electric_slide/agent_strategy/longest_idle.rb, line 25 def checkout_agent @free_agents.shift end
delete(agent)
click to toggle source
# File lib/electric_slide/agent_strategy/longest_idle.rb, line 33 def delete(agent) @free_agents.delete(agent) end