class Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkerList::WorkersStatisticsContext
Public Class Methods
Initialize the WorkersStatisticsContext
@param [Version] version Version
that contains the resource @param [String] workspace_sid The SID of the Workspace with the Worker to fetch. @return [WorkersStatisticsContext] WorkersStatisticsContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_statistics.rb 70 def initialize(version, workspace_sid) 71 super(version) 72 73 # Path Solution 74 @solution = {workspace_sid: workspace_sid, } 75 @uri = "/Workspaces/#{@solution[:workspace_sid]}/Workers/Statistics" 76 end
Public Instance Methods
Fetch the WorkersStatisticsInstance
@param [String] minutes Only calculate statistics since this many minutes in the
past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends.
@param [Time] start_date Only calculate statistics from this date and time and
later, specified in {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601] format.
@param [Time] end_date Only calculate statistics from this date and time and
earlier, specified in GMT as an {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601] date-time.
@param [String] task_queue_sid The SID of the TaskQueue for which to fetch
Worker statistics.
@param [String] task_queue_name The `friendly_name` of the TaskQueue for which
to fetch Worker statistics.
@param [String] friendly_name Only include Workers with `friendly_name` values
that match this parameter.
@param [String] task_channel Only calculate statistics on this TaskChannel. Can
be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`.
@return [WorkersStatisticsInstance] Fetched WorkersStatisticsInstance
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_statistics.rb 98 def fetch(minutes: :unset, start_date: :unset, end_date: :unset, task_queue_sid: :unset, task_queue_name: :unset, friendly_name: :unset, task_channel: :unset) 99 params = Twilio::Values.of({ 100 'Minutes' => minutes, 101 'StartDate' => Twilio.serialize_iso8601_datetime(start_date), 102 'EndDate' => Twilio.serialize_iso8601_datetime(end_date), 103 'TaskQueueSid' => task_queue_sid, 104 'TaskQueueName' => task_queue_name, 105 'FriendlyName' => friendly_name, 106 'TaskChannel' => task_channel, 107 }) 108 109 payload = @version.fetch('GET', @uri, params: params) 110 111 WorkersStatisticsInstance.new(@version, payload, workspace_sid: @solution[:workspace_sid], ) 112 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_statistics.rb 123 def inspect 124 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 125 "#<Twilio.Taskrouter.V1.WorkersStatisticsContext #{context}>" 126 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_statistics.rb 116 def to_s 117 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 118 "#<Twilio.Taskrouter.V1.WorkersStatisticsContext #{context}>" 119 end