class Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkerContext::WorkerStatisticsContext

Public Class Methods

new(version, workspace_sid, worker_sid) click to toggle source

Initialize the WorkerStatisticsContext @param [Version] version Version that contains the resource @param [String] workspace_sid The SID of the Workspace with the WorkerChannel to

fetch.

@param [String] worker_sid The SID of the Worker with the WorkerChannel to

fetch.

@return [WorkerStatisticsContext] WorkerStatisticsContext

Calls superclass method Twilio::REST::InstanceContext::new
   # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb
81 def initialize(version, workspace_sid, worker_sid)
82   super(version)
83 
84   # Path Solution
85   @solution = {workspace_sid: workspace_sid, worker_sid: worker_sid, }
86   @uri = "/Workspaces/#{@solution[:workspace_sid]}/Workers/#{@solution[:worker_sid]}/Statistics"
87 end

Public Instance Methods

fetch(minutes: :unset, start_date: :unset, end_date: :unset, task_channel: :unset) click to toggle source

Fetch the WorkerStatisticsInstance @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 include usage that occurred on or before this date,

specified in GMT as an {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601]
date-time.

@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 [WorkerStatisticsInstance] Fetched WorkerStatisticsInstance

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb
103 def fetch(minutes: :unset, start_date: :unset, end_date: :unset, task_channel: :unset)
104   params = Twilio::Values.of({
105       'Minutes' => minutes,
106       'StartDate' => Twilio.serialize_iso8601_datetime(start_date),
107       'EndDate' => Twilio.serialize_iso8601_datetime(end_date),
108       'TaskChannel' => task_channel,
109   })
110 
111   payload = @version.fetch('GET', @uri, params: params)
112 
113   WorkerStatisticsInstance.new(
114       @version,
115       payload,
116       workspace_sid: @solution[:workspace_sid],
117       worker_sid: @solution[:worker_sid],
118   )
119 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb
130 def inspect
131   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
132   "#<Twilio.Taskrouter.V1.WorkerStatisticsContext #{context}>"
133 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb
123 def to_s
124   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
125   "#<Twilio.Taskrouter.V1.WorkerStatisticsContext #{context}>"
126 end