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

Public Class Methods

new(version, payload, workspace_sid: nil) click to toggle source

Initialize the WorkersCumulativeStatisticsInstance @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

Workers.

@return [WorkersCumulativeStatisticsInstance] WorkersCumulativeStatisticsInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb
129 def initialize(version, payload, workspace_sid: nil)
130   super(version)
131 
132   # Marshaled Properties
133   @properties = {
134       'account_sid' => payload['account_sid'],
135       'start_time' => Twilio.deserialize_iso8601_datetime(payload['start_time']),
136       'end_time' => Twilio.deserialize_iso8601_datetime(payload['end_time']),
137       'activity_durations' => payload['activity_durations'],
138       'reservations_created' => payload['reservations_created'].to_i,
139       'reservations_accepted' => payload['reservations_accepted'].to_i,
140       'reservations_rejected' => payload['reservations_rejected'].to_i,
141       'reservations_timed_out' => payload['reservations_timed_out'].to_i,
142       'reservations_canceled' => payload['reservations_canceled'].to_i,
143       'reservations_rescinded' => payload['reservations_rescinded'].to_i,
144       'workspace_sid' => payload['workspace_sid'],
145       'url' => payload['url'],
146   }
147 
148   # Context
149   @instance_context = nil
150   @params = {'workspace_sid' => workspace_sid, }
151 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The SID of the Account that created the resource

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb
166 def account_sid
167   @properties['account_sid']
168 end
activity_durations() click to toggle source

@return [Array] The minimum, average, maximum, and total time that Workers spent in each Activity

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb
184 def activity_durations
185   @properties['activity_durations']
186 end
context() click to toggle source

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [WorkersCumulativeStatisticsContext] WorkersCumulativeStatisticsContext for this WorkersCumulativeStatisticsInstance

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb
157 def context
158   unless @instance_context
159     @instance_context = WorkersCumulativeStatisticsContext.new(@version, @params['workspace_sid'], )
160   end
161   @instance_context
162 end
end_time() click to toggle source

@return [Time] The end of the interval during which these statistics were calculated

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb
178 def end_time
179   @properties['end_time']
180 end
fetch(end_date: :unset, minutes: :unset, start_date: :unset, task_channel: :unset) click to toggle source

Fetch the WorkersCumulativeStatisticsInstance @param [Time] end_date Only calculate statistics from this date and time and

earlier, specified in {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601] format.

@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 [String] task_channel Only calculate cumulative statistics on this

TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`,
`sms`, or `default`.

@return [WorkersCumulativeStatisticsInstance] Fetched WorkersCumulativeStatisticsInstance

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb
249 def fetch(end_date: :unset, minutes: :unset, start_date: :unset, task_channel: :unset)
250   context.fetch(
251       end_date: end_date,
252       minutes: minutes,
253       start_date: start_date,
254       task_channel: task_channel,
255   )
256 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb
267 def inspect
268   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
269   "<Twilio.Taskrouter.V1.WorkersCumulativeStatisticsInstance #{values}>"
270 end
reservations_accepted() click to toggle source

@return [String] The total number of Reservations that were accepted

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb
196 def reservations_accepted
197   @properties['reservations_accepted']
198 end
reservations_canceled() click to toggle source

@return [String] The total number of Reservations that were canceled

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb
214 def reservations_canceled
215   @properties['reservations_canceled']
216 end
reservations_created() click to toggle source

@return [String] The total number of Reservations that were created

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb
190 def reservations_created
191   @properties['reservations_created']
192 end
reservations_rejected() click to toggle source

@return [String] The total number of Reservations that were rejected

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb
202 def reservations_rejected
203   @properties['reservations_rejected']
204 end
reservations_rescinded() click to toggle source

@return [String] The total number of Reservations that were rescinded

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb
220 def reservations_rescinded
221   @properties['reservations_rescinded']
222 end
reservations_timed_out() click to toggle source

@return [String] The total number of Reservations that were timed out

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb
208 def reservations_timed_out
209   @properties['reservations_timed_out']
210 end
start_time() click to toggle source

@return [Time] The beginning of the interval during which these statistics were calculated

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb
172 def start_time
173   @properties['start_time']
174 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb
260 def to_s
261   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
262   "<Twilio.Taskrouter.V1.WorkersCumulativeStatisticsInstance #{values}>"
263 end
url() click to toggle source

@return [String] The absolute URL of the Workers statistics resource

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb
232 def url
233   @properties['url']
234 end
workspace_sid() click to toggle source

@return [String] The SID of the Workspace that contains the Workers

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb
226 def workspace_sid
227   @properties['workspace_sid']
228 end