Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkerContext::WorkersCumulativeStatisticsContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, workspace_sid) ⇒ WorkersCumulativeStatisticsContext

Initialize the WorkersCumulativeStatisticsContext

Parameters:

  • version (Version)

    Version that contains the resource

  • workspace_sid (String)

    The SID of the Workspace with the resource to fetch.


72
73
74
75
76
77
78
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb', line 72

def initialize(version, workspace_sid)
  super(version)

  # Path Solution
  @solution = {workspace_sid: workspace_sid, }
  @uri = "/Workspaces/#{@solution[:workspace_sid]}/Workers/CumulativeStatistics"
end

Instance Method Details

#fetch(end_date: :unset, minutes: :unset, start_date: :unset, task_channel: :unset) ⇒ WorkersCumulativeStatisticsInstance

Fetch the WorkersCumulativeStatisticsInstance

Parameters:

  • end_date (Time) (defaults to: :unset)

    Only calculate statistics from this date and time and earlier, specified in ISO 8601 format.

  • minutes (String) (defaults to: :unset)

    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.

  • start_date (Time) (defaults to: :unset)

    Only calculate statistics from this date and time and later, specified in ISO 8601 format.

  • task_channel (String) (defaults to: :unset)

    Only calculate cumulative statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`.

Returns:


93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb', line 93

def fetch(end_date: :unset, minutes: :unset, start_date: :unset, task_channel: :unset)
  params = Twilio::Values.of({
      'EndDate' => Twilio.serialize_iso8601_datetime(end_date),
      'Minutes' => minutes,
      'StartDate' => Twilio.serialize_iso8601_datetime(start_date),
      'TaskChannel' => task_channel,
  })

  payload = @version.fetch('GET', @uri, params: params)

  WorkersCumulativeStatisticsInstance.new(@version, payload, workspace_sid: @solution[:workspace_sid], )
end

#inspectObject

Provide a detailed, user friendly representation


115
116
117
118
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb', line 115

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Taskrouter.V1.WorkersCumulativeStatisticsContext #{context}>"
end

#to_sObject

Provide a user friendly representation


108
109
110
111
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb', line 108

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Taskrouter.V1.WorkersCumulativeStatisticsContext #{context}>"
end