Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::TaskQueueContext::TaskQueueCumulativeStatisticsContext

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

Instance Method Summary collapse

Constructor Details

#initialize(version, workspace_sid, task_queue_sid) ⇒ TaskQueueCumulativeStatisticsContext

Initialize the TaskQueueCumulativeStatisticsContext

Parameters:

  • version (Version)

    Version that contains the resource

  • workspace_sid (String)

    The SID of the Workspace with the TaskQueue to fetch.

  • task_queue_sid (String)

    The SID of the TaskQueue for which to fetch statistics.



54
55
56
57
58
59
60
61
62
63
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.rb', line 54

def initialize(version, workspace_sid, task_queue_sid)
    super(version)
    

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

    
end

Instance Method Details

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

Fetch the TaskQueueCumulativeStatisticsInstance

Parameters:

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

    Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](en.wikipedia.org/wiki/ISO_8601) date-time.

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

    Only calculate statistics since this many minutes in the past. The default is 15 minutes.

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

    Only calculate statistics from this date and time and later, specified in [ISO 8601](en.wikipedia.org/wiki/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.

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

    A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. TaskRouter will calculate statistics on up to 10,000 Tasks/Reservations for any given threshold.

Returns:



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.rb', line 72

def fetch(
    end_date: :unset, 
    minutes: :unset, 
    start_date: :unset, 
    task_channel: :unset, 
    split_by_wait_time: :unset
)

    params = Twilio::Values.of({
        'EndDate' => Twilio.serialize_iso8601_datetime(end_date),
        'Minutes' => minutes,
        'StartDate' => Twilio.serialize_iso8601_datetime(start_date),
        'TaskChannel' => task_channel,
        'SplitByWaitTime' => split_by_wait_time,
    })
    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, params: params, headers: headers)
    TaskQueueCumulativeStatisticsInstance.new(
        @version,
        payload,
        workspace_sid: @solution[:workspace_sid],
        task_queue_sid: @solution[:task_queue_sid],
    )
end

#fetch_with_metadata(end_date: :unset, minutes: :unset, start_date: :unset, task_channel: :unset, split_by_wait_time: :unset) ⇒ TaskQueueCumulativeStatisticsInstance

Fetch the TaskQueueCumulativeStatisticsInstanceMetadata

Parameters:

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

    Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](en.wikipedia.org/wiki/ISO_8601) date-time.

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

    Only calculate statistics since this many minutes in the past. The default is 15 minutes.

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

    Only calculate statistics from this date and time and later, specified in [ISO 8601](en.wikipedia.org/wiki/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.

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

    A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. TaskRouter will calculate statistics on up to 10,000 Tasks/Reservations for any given threshold.

Returns:



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.rb', line 110

def (
  end_date: :unset, 
  minutes: :unset, 
  start_date: :unset, 
  task_channel: :unset, 
  split_by_wait_time: :unset
)

    params = Twilio::Values.of({
        'EndDate' => Twilio.serialize_iso8601_datetime(end_date),
        'Minutes' => minutes,
        'StartDate' => Twilio.serialize_iso8601_datetime(start_date),
        'TaskChannel' => task_channel,
        'SplitByWaitTime' => split_by_wait_time,
    })
    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, params: params, headers: headers)
    task_queue_cumulative_statistics_instance = TaskQueueCumulativeStatisticsInstance.new(
        @version,
        response.body,
        workspace_sid: @solution[:workspace_sid],
        task_queue_sid: @solution[:task_queue_sid],
    )
    .new(
        @version,
        task_queue_cumulative_statistics_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



156
157
158
159
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.rb', line 156

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

#to_sObject

Provide a user friendly representation



149
150
151
152
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.rb', line 149

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