class Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkerContext::WorkerStatisticsInstance
Public Class Methods
Initialize the WorkerStatisticsInstance
@param [Version] version Version
that contains the resource @param [Hash] payload payload that contains response from Twilio
@param [String] workspace_sid
The SID of the Workspace that contains the
WorkerChannel.
@param [String] worker_sid
The SID of the Worker that contains the
WorkerChannel.
@return [WorkerStatisticsInstance] WorkerStatisticsInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb 146 def initialize(version, payload, workspace_sid: nil, worker_sid: nil) 147 super(version) 148 149 # Marshaled Properties 150 @properties = { 151 'account_sid' => payload['account_sid'], 152 'cumulative' => payload['cumulative'], 153 'worker_sid' => payload['worker_sid'], 154 'workspace_sid' => payload['workspace_sid'], 155 'url' => payload['url'], 156 } 157 158 # Context 159 @instance_context = nil 160 @params = {'workspace_sid' => workspace_sid, 'worker_sid' => worker_sid, } 161 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb 180 def account_sid 181 @properties['account_sid'] 182 end
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [WorkerStatisticsContext] WorkerStatisticsContext
for this WorkerStatisticsInstance
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb 167 def context 168 unless @instance_context 169 @instance_context = WorkerStatisticsContext.new( 170 @version, 171 @params['workspace_sid'], 172 @params['worker_sid'], 173 ) 174 end 175 @instance_context 176 end
@return [Hash] An object that contains the cumulative statistics for the Worker
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb 186 def cumulative 187 @properties['cumulative'] 188 end
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 222 def fetch(minutes: :unset, start_date: :unset, end_date: :unset, task_channel: :unset) 223 context.fetch( 224 minutes: minutes, 225 start_date: start_date, 226 end_date: end_date, 227 task_channel: task_channel, 228 ) 229 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb 240 def inspect 241 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 242 "<Twilio.Taskrouter.V1.WorkerStatisticsInstance #{values}>" 243 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb 233 def to_s 234 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 235 "<Twilio.Taskrouter.V1.WorkerStatisticsInstance #{values}>" 236 end
@return [String] The absolute URL of the WorkerChannel statistics resource
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb 204 def url 205 @properties['url'] 206 end
@return [String] The SID of the Worker that contains the WorkerChannel
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb 192 def worker_sid 193 @properties['worker_sid'] 194 end
@return [String] The SID of the Workspace that contains the WorkerChannel
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb 198 def workspace_sid 199 @properties['workspace_sid'] 200 end