twilio-ruby 5.2.3 → 5.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +26 -0
  3. data/README.md +3 -3
  4. data/UPGRADE.md +30 -0
  5. data/lib/twilio-ruby.rb +0 -18
  6. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +2 -2
  7. data/lib/twilio-ruby/rest/chat/v2/service.rb +24 -2
  8. data/lib/twilio-ruby/rest/chat/v2/service/channel/message.rb +5 -3
  9. data/lib/twilio-ruby/rest/client.rb +3 -3
  10. data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +24 -2
  11. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb +5 -3
  12. data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +12 -12
  13. data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +38 -0
  14. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb +40 -0
  15. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.rb +350 -0
  16. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb +264 -0
  17. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.rb +10 -2
  18. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.rb +15 -3
  19. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +38 -0
  20. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb +6 -2
  21. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb +274 -0
  22. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.rb +213 -0
  23. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_statistics.rb +14 -10
  24. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb +40 -0
  25. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.rb +357 -0
  26. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.rb +243 -0
  27. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb +10 -2
  28. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb +339 -0
  29. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_real_time_statistics.rb +239 -0
  30. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb +10 -2
  31. data/lib/twilio-ruby/rest/video/v1/room.rb +7 -0
  32. data/lib/twilio-ruby/security/request_validator.rb +1 -1
  33. data/lib/twilio-ruby/version.rb +1 -1
  34. data/spec/integration/chat/v2/service/channel/message_spec.rb +41 -7
  35. data/spec/integration/chat/v2/service_spec.rb +8 -0
  36. data/spec/integration/ip_messaging/v2/service/channel/message_spec.rb +41 -7
  37. data/spec/integration/ip_messaging/v2/service_spec.rb +8 -0
  38. data/spec/integration/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics_spec.rb +94 -0
  39. data/spec/integration/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics_spec.rb +79 -0
  40. data/spec/integration/taskrouter/v1/workspace/task_queue_spec.rb +8 -0
  41. data/spec/integration/taskrouter/v1/workspace/worker/worker_statistics_spec.rb +21 -38
  42. data/spec/integration/taskrouter/v1/workspace/worker/workers_cumulative_statistics_spec.rb +87 -0
  43. data/spec/integration/taskrouter/v1/workspace/worker/workers_real_time_statistics_spec.rb +68 -0
  44. data/spec/integration/taskrouter/v1/workspace/worker/workers_statistics_spec.rb +34 -61
  45. data/spec/integration/taskrouter/v1/workspace/worker_spec.rb +8 -0
  46. data/spec/integration/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics_spec.rb +95 -0
  47. data/spec/integration/taskrouter/v1/workspace/workflow/workflow_real_time_statistics_spec.rb +55 -0
  48. data/spec/integration/taskrouter/v1/workspace/workflow_spec.rb +12 -4
  49. data/spec/integration/taskrouter/v1/workspace/workspace_cumulative_statistics_spec.rb +92 -0
  50. data/spec/integration/taskrouter/v1/workspace/workspace_real_time_statistics_spec.rb +70 -0
  51. data/spec/integration/taskrouter/v1/workspace_spec.rb +8 -0
  52. data/spec/integration/video/v1/room_spec.rb +12 -0
  53. data/spec/security/request_validator_spec.rb +0 -28
  54. data/spec/twilio_spec.rb +0 -15
  55. metadata +28 -9
  56. data/lib/rack/twilio_webhook_authentication.rb +0 -46
  57. data/lib/twilio-ruby/util/configuration.rb +0 -7
  58. data/spec/rack/twilio_webhook_authentication_spec.rb +0 -106
  59. data/spec/util/configuration_spec.rb +0 -15
@@ -225,6 +225,8 @@ module Twilio
225
225
  # Dependents
226
226
  @task_queues_statistics = nil
227
227
  @task_queue_statistics = nil
228
+ @task_queue_real_time_statistics = nil
229
+ @task_queue_cumulative_statistics = nil
228
230
  end
229
231
 
230
232
  ##
@@ -314,6 +316,30 @@ module Twilio
314
316
  )
315
317
  end
316
318
 
319
+ ##
320
+ # Access the task_queue_real_time_statistics
321
+ # @return [TaskQueueRealTimeStatisticsList]
322
+ # @return [TaskQueueRealTimeStatisticsContext]
323
+ def task_queue_real_time_statistics
324
+ TaskQueueRealTimeStatisticsContext.new(
325
+ @version,
326
+ @solution[:workspace_sid],
327
+ @solution[:sid],
328
+ )
329
+ end
330
+
331
+ ##
332
+ # Access the task_queue_cumulative_statistics
333
+ # @return [TaskQueueCumulativeStatisticsList]
334
+ # @return [TaskQueueCumulativeStatisticsContext]
335
+ def task_queue_cumulative_statistics
336
+ TaskQueueCumulativeStatisticsContext.new(
337
+ @version,
338
+ @solution[:workspace_sid],
339
+ @solution[:sid],
340
+ )
341
+ end
342
+
317
343
  ##
318
344
  # Provide a user friendly representation
319
345
  def to_s
@@ -513,6 +539,20 @@ module Twilio
513
539
  context.task_queue_statistics
514
540
  end
515
541
 
542
+ ##
543
+ # Access the task_queue_real_time_statistics
544
+ # @return [task_queue_real_time_statistics] task_queue_real_time_statistics
545
+ def task_queue_real_time_statistics
546
+ context.task_queue_real_time_statistics
547
+ end
548
+
549
+ ##
550
+ # Access the task_queue_cumulative_statistics
551
+ # @return [task_queue_cumulative_statistics] task_queue_cumulative_statistics
552
+ def task_queue_cumulative_statistics
553
+ context.task_queue_cumulative_statistics
554
+ end
555
+
516
556
  ##
517
557
  # Provide a user friendly representation
518
558
  def to_s
@@ -0,0 +1,350 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Taskrouter < Domain
10
+ class V1 < Version
11
+ class WorkspaceContext < InstanceContext
12
+ class TaskQueueContext < InstanceContext
13
+ class TaskQueueCumulativeStatisticsList < ListResource
14
+ ##
15
+ # Initialize the TaskQueueCumulativeStatisticsList
16
+ # @param [Version] version Version that contains the resource
17
+ # @param [String] workspace_sid The workspace_sid
18
+ # @param [String] task_queue_sid The task_queue_sid
19
+ # @return [TaskQueueCumulativeStatisticsList] TaskQueueCumulativeStatisticsList
20
+ def initialize(version, workspace_sid: nil, task_queue_sid: nil)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {
25
+ workspace_sid: workspace_sid,
26
+ task_queue_sid: task_queue_sid
27
+ }
28
+ end
29
+
30
+ ##
31
+ # Provide a user friendly representation
32
+ def to_s
33
+ '#<Twilio.Taskrouter.V1.TaskQueueCumulativeStatisticsList>'
34
+ end
35
+ end
36
+
37
+ class TaskQueueCumulativeStatisticsPage < Page
38
+ ##
39
+ # Initialize the TaskQueueCumulativeStatisticsPage
40
+ # @param [Version] version Version that contains the resource
41
+ # @param [Response] response Response from the API
42
+ # @param [Hash] solution Path solution for the resource
43
+ # @return [TaskQueueCumulativeStatisticsPage] TaskQueueCumulativeStatisticsPage
44
+ def initialize(version, response, solution)
45
+ super(version, response)
46
+
47
+ # Path Solution
48
+ @solution = solution
49
+ end
50
+
51
+ ##
52
+ # Build an instance of TaskQueueCumulativeStatisticsInstance
53
+ # @param [Hash] payload Payload response from the API
54
+ # @return [TaskQueueCumulativeStatisticsInstance] TaskQueueCumulativeStatisticsInstance
55
+ def get_instance(payload)
56
+ TaskQueueCumulativeStatisticsInstance.new(
57
+ @version,
58
+ payload,
59
+ workspace_sid: @solution[:workspace_sid],
60
+ task_queue_sid: @solution[:task_queue_sid],
61
+ )
62
+ end
63
+
64
+ ##
65
+ # Provide a user friendly representation
66
+ def to_s
67
+ '<Twilio.Taskrouter.V1.TaskQueueCumulativeStatisticsPage>'
68
+ end
69
+ end
70
+
71
+ class TaskQueueCumulativeStatisticsContext < InstanceContext
72
+ ##
73
+ # Initialize the TaskQueueCumulativeStatisticsContext
74
+ # @param [Version] version Version that contains the resource
75
+ # @param [String] workspace_sid The workspace_sid
76
+ # @param [String] task_queue_sid The task_queue_sid
77
+ # @return [TaskQueueCumulativeStatisticsContext] TaskQueueCumulativeStatisticsContext
78
+ def initialize(version, workspace_sid, task_queue_sid)
79
+ super(version)
80
+
81
+ # Path Solution
82
+ @solution = {
83
+ workspace_sid: workspace_sid,
84
+ task_queue_sid: task_queue_sid,
85
+ }
86
+ @uri = "/Workspaces/#{@solution[:workspace_sid]}/TaskQueues/#{@solution[:task_queue_sid]}/CumulativeStatistics"
87
+ end
88
+
89
+ ##
90
+ # Fetch a TaskQueueCumulativeStatisticsInstance
91
+ # @param [Time] end_date The end_date
92
+ # @param [String] minutes The minutes
93
+ # @param [Time] start_date The start_date
94
+ # @param [String] task_channel The task_channel
95
+ # @param [String] split_by_wait_time The split_by_wait_time
96
+ # @return [TaskQueueCumulativeStatisticsInstance] Fetched TaskQueueCumulativeStatisticsInstance
97
+ def fetch(end_date: :unset, minutes: :unset, start_date: :unset, task_channel: :unset, split_by_wait_time: :unset)
98
+ params = Twilio::Values.of({
99
+ 'EndDate' => Twilio.serialize_iso8601_datetime(end_date),
100
+ 'Minutes' => minutes,
101
+ 'StartDate' => Twilio.serialize_iso8601_datetime(start_date),
102
+ 'TaskChannel' => task_channel,
103
+ 'SplitByWaitTime' => split_by_wait_time,
104
+ })
105
+
106
+ payload = @version.fetch(
107
+ 'GET',
108
+ @uri,
109
+ params,
110
+ )
111
+
112
+ TaskQueueCumulativeStatisticsInstance.new(
113
+ @version,
114
+ payload,
115
+ workspace_sid: @solution[:workspace_sid],
116
+ task_queue_sid: @solution[:task_queue_sid],
117
+ )
118
+ end
119
+
120
+ ##
121
+ # Provide a user friendly representation
122
+ def to_s
123
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
124
+ "#<Twilio.Taskrouter.V1.TaskQueueCumulativeStatisticsContext #{context}>"
125
+ end
126
+ end
127
+
128
+ class TaskQueueCumulativeStatisticsInstance < InstanceResource
129
+ ##
130
+ # Initialize the TaskQueueCumulativeStatisticsInstance
131
+ # @param [Version] version Version that contains the resource
132
+ # @param [Hash] payload payload that contains response from Twilio
133
+ # @param [String] workspace_sid The workspace_sid
134
+ # @param [String] task_queue_sid The task_queue_sid
135
+ # @return [TaskQueueCumulativeStatisticsInstance] TaskQueueCumulativeStatisticsInstance
136
+ def initialize(version, payload, workspace_sid: nil, task_queue_sid: nil)
137
+ super(version)
138
+
139
+ # Marshaled Properties
140
+ @properties = {
141
+ 'account_sid' => payload['account_sid'],
142
+ 'avg_task_acceptance_time' => payload['avg_task_acceptance_time'].to_i,
143
+ 'start_time' => Twilio.deserialize_iso8601_datetime(payload['start_time']),
144
+ 'end_time' => Twilio.deserialize_iso8601_datetime(payload['end_time']),
145
+ 'reservations_created' => payload['reservations_created'].to_i,
146
+ 'reservations_accepted' => payload['reservations_accepted'].to_i,
147
+ 'reservations_rejected' => payload['reservations_rejected'].to_i,
148
+ 'reservations_timed_out' => payload['reservations_timed_out'].to_i,
149
+ 'reservations_canceled' => payload['reservations_canceled'].to_i,
150
+ 'reservations_rescinded' => payload['reservations_rescinded'].to_i,
151
+ 'split_by_wait_time' => payload['split_by_wait_time'],
152
+ 'task_queue_sid' => payload['task_queue_sid'],
153
+ 'wait_duration_until_accepted' => payload['wait_duration_until_accepted'],
154
+ 'wait_duration_until_canceled' => payload['wait_duration_until_canceled'],
155
+ 'tasks_canceled' => payload['tasks_canceled'].to_i,
156
+ 'tasks_completed' => payload['tasks_completed'].to_i,
157
+ 'tasks_deleted' => payload['tasks_deleted'].to_i,
158
+ 'tasks_entered' => payload['tasks_entered'].to_i,
159
+ 'tasks_moved' => payload['tasks_moved'].to_i,
160
+ 'workspace_sid' => payload['workspace_sid'],
161
+ 'url' => payload['url'],
162
+ }
163
+
164
+ # Context
165
+ @instance_context = nil
166
+ @params = {
167
+ 'workspace_sid' => workspace_sid,
168
+ 'task_queue_sid' => task_queue_sid,
169
+ }
170
+ end
171
+
172
+ ##
173
+ # Generate an instance context for the instance, the context is capable of
174
+ # performing various actions. All instance actions are proxied to the context
175
+ # @return [TaskQueueCumulativeStatisticsContext] TaskQueueCumulativeStatisticsContext for this TaskQueueCumulativeStatisticsInstance
176
+ def context
177
+ unless @instance_context
178
+ @instance_context = TaskQueueCumulativeStatisticsContext.new(
179
+ @version,
180
+ @params['workspace_sid'],
181
+ @params['task_queue_sid'],
182
+ )
183
+ end
184
+ @instance_context
185
+ end
186
+
187
+ ##
188
+ # @return [String] The account_sid
189
+ def account_sid
190
+ @properties['account_sid']
191
+ end
192
+
193
+ ##
194
+ # @return [String] The avg_task_acceptance_time
195
+ def avg_task_acceptance_time
196
+ @properties['avg_task_acceptance_time']
197
+ end
198
+
199
+ ##
200
+ # @return [Time] The start_time
201
+ def start_time
202
+ @properties['start_time']
203
+ end
204
+
205
+ ##
206
+ # @return [Time] The end_time
207
+ def end_time
208
+ @properties['end_time']
209
+ end
210
+
211
+ ##
212
+ # @return [String] The reservations_created
213
+ def reservations_created
214
+ @properties['reservations_created']
215
+ end
216
+
217
+ ##
218
+ # @return [String] The reservations_accepted
219
+ def reservations_accepted
220
+ @properties['reservations_accepted']
221
+ end
222
+
223
+ ##
224
+ # @return [String] The reservations_rejected
225
+ def reservations_rejected
226
+ @properties['reservations_rejected']
227
+ end
228
+
229
+ ##
230
+ # @return [String] The reservations_timed_out
231
+ def reservations_timed_out
232
+ @properties['reservations_timed_out']
233
+ end
234
+
235
+ ##
236
+ # @return [String] The reservations_canceled
237
+ def reservations_canceled
238
+ @properties['reservations_canceled']
239
+ end
240
+
241
+ ##
242
+ # @return [String] The reservations_rescinded
243
+ def reservations_rescinded
244
+ @properties['reservations_rescinded']
245
+ end
246
+
247
+ ##
248
+ # @return [Hash] The split_by_wait_time
249
+ def split_by_wait_time
250
+ @properties['split_by_wait_time']
251
+ end
252
+
253
+ ##
254
+ # @return [String] The task_queue_sid
255
+ def task_queue_sid
256
+ @properties['task_queue_sid']
257
+ end
258
+
259
+ ##
260
+ # @return [Hash] The wait_duration_until_accepted
261
+ def wait_duration_until_accepted
262
+ @properties['wait_duration_until_accepted']
263
+ end
264
+
265
+ ##
266
+ # @return [Hash] The wait_duration_until_canceled
267
+ def wait_duration_until_canceled
268
+ @properties['wait_duration_until_canceled']
269
+ end
270
+
271
+ ##
272
+ # @return [String] The tasks_canceled
273
+ def tasks_canceled
274
+ @properties['tasks_canceled']
275
+ end
276
+
277
+ ##
278
+ # @return [String] The tasks_completed
279
+ def tasks_completed
280
+ @properties['tasks_completed']
281
+ end
282
+
283
+ ##
284
+ # @return [String] The tasks_deleted
285
+ def tasks_deleted
286
+ @properties['tasks_deleted']
287
+ end
288
+
289
+ ##
290
+ # @return [String] The tasks_entered
291
+ def tasks_entered
292
+ @properties['tasks_entered']
293
+ end
294
+
295
+ ##
296
+ # @return [String] The tasks_moved
297
+ def tasks_moved
298
+ @properties['tasks_moved']
299
+ end
300
+
301
+ ##
302
+ # @return [String] The workspace_sid
303
+ def workspace_sid
304
+ @properties['workspace_sid']
305
+ end
306
+
307
+ ##
308
+ # @return [String] The url
309
+ def url
310
+ @properties['url']
311
+ end
312
+
313
+ ##
314
+ # Fetch a TaskQueueCumulativeStatisticsInstance
315
+ # @param [Time] end_date The end_date
316
+ # @param [String] minutes The minutes
317
+ # @param [Time] start_date The start_date
318
+ # @param [String] task_channel The task_channel
319
+ # @param [String] split_by_wait_time The split_by_wait_time
320
+ # @return [TaskQueueCumulativeStatisticsInstance] Fetched TaskQueueCumulativeStatisticsInstance
321
+ def fetch(end_date: :unset, minutes: :unset, start_date: :unset, task_channel: :unset, split_by_wait_time: :unset)
322
+ context.fetch(
323
+ end_date: end_date,
324
+ minutes: minutes,
325
+ start_date: start_date,
326
+ task_channel: task_channel,
327
+ split_by_wait_time: split_by_wait_time,
328
+ )
329
+ end
330
+
331
+ ##
332
+ # Provide a user friendly representation
333
+ def to_s
334
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
335
+ "<Twilio.Taskrouter.V1.TaskQueueCumulativeStatisticsInstance #{values}>"
336
+ end
337
+
338
+ ##
339
+ # Provide a detailed, user friendly representation
340
+ def inspect
341
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
342
+ "<Twilio.Taskrouter.V1.TaskQueueCumulativeStatisticsInstance #{values}>"
343
+ end
344
+ end
345
+ end
346
+ end
347
+ end
348
+ end
349
+ end
350
+ end
@@ -0,0 +1,264 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Taskrouter < Domain
10
+ class V1 < Version
11
+ class WorkspaceContext < InstanceContext
12
+ class TaskQueueContext < InstanceContext
13
+ class TaskQueueRealTimeStatisticsList < ListResource
14
+ ##
15
+ # Initialize the TaskQueueRealTimeStatisticsList
16
+ # @param [Version] version Version that contains the resource
17
+ # @param [String] workspace_sid The workspace_sid
18
+ # @param [String] task_queue_sid The task_queue_sid
19
+ # @return [TaskQueueRealTimeStatisticsList] TaskQueueRealTimeStatisticsList
20
+ def initialize(version, workspace_sid: nil, task_queue_sid: nil)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {
25
+ workspace_sid: workspace_sid,
26
+ task_queue_sid: task_queue_sid
27
+ }
28
+ end
29
+
30
+ ##
31
+ # Provide a user friendly representation
32
+ def to_s
33
+ '#<Twilio.Taskrouter.V1.TaskQueueRealTimeStatisticsList>'
34
+ end
35
+ end
36
+
37
+ class TaskQueueRealTimeStatisticsPage < Page
38
+ ##
39
+ # Initialize the TaskQueueRealTimeStatisticsPage
40
+ # @param [Version] version Version that contains the resource
41
+ # @param [Response] response Response from the API
42
+ # @param [Hash] solution Path solution for the resource
43
+ # @return [TaskQueueRealTimeStatisticsPage] TaskQueueRealTimeStatisticsPage
44
+ def initialize(version, response, solution)
45
+ super(version, response)
46
+
47
+ # Path Solution
48
+ @solution = solution
49
+ end
50
+
51
+ ##
52
+ # Build an instance of TaskQueueRealTimeStatisticsInstance
53
+ # @param [Hash] payload Payload response from the API
54
+ # @return [TaskQueueRealTimeStatisticsInstance] TaskQueueRealTimeStatisticsInstance
55
+ def get_instance(payload)
56
+ TaskQueueRealTimeStatisticsInstance.new(
57
+ @version,
58
+ payload,
59
+ workspace_sid: @solution[:workspace_sid],
60
+ task_queue_sid: @solution[:task_queue_sid],
61
+ )
62
+ end
63
+
64
+ ##
65
+ # Provide a user friendly representation
66
+ def to_s
67
+ '<Twilio.Taskrouter.V1.TaskQueueRealTimeStatisticsPage>'
68
+ end
69
+ end
70
+
71
+ class TaskQueueRealTimeStatisticsContext < InstanceContext
72
+ ##
73
+ # Initialize the TaskQueueRealTimeStatisticsContext
74
+ # @param [Version] version Version that contains the resource
75
+ # @param [String] workspace_sid The workspace_sid
76
+ # @param [String] task_queue_sid The task_queue_sid
77
+ # @return [TaskQueueRealTimeStatisticsContext] TaskQueueRealTimeStatisticsContext
78
+ def initialize(version, workspace_sid, task_queue_sid)
79
+ super(version)
80
+
81
+ # Path Solution
82
+ @solution = {
83
+ workspace_sid: workspace_sid,
84
+ task_queue_sid: task_queue_sid,
85
+ }
86
+ @uri = "/Workspaces/#{@solution[:workspace_sid]}/TaskQueues/#{@solution[:task_queue_sid]}/RealTimeStatistics"
87
+ end
88
+
89
+ ##
90
+ # Fetch a TaskQueueRealTimeStatisticsInstance
91
+ # @param [String] task_channel The task_channel
92
+ # @return [TaskQueueRealTimeStatisticsInstance] Fetched TaskQueueRealTimeStatisticsInstance
93
+ def fetch(task_channel: :unset)
94
+ params = Twilio::Values.of({
95
+ 'TaskChannel' => task_channel,
96
+ })
97
+
98
+ payload = @version.fetch(
99
+ 'GET',
100
+ @uri,
101
+ params,
102
+ )
103
+
104
+ TaskQueueRealTimeStatisticsInstance.new(
105
+ @version,
106
+ payload,
107
+ workspace_sid: @solution[:workspace_sid],
108
+ task_queue_sid: @solution[:task_queue_sid],
109
+ )
110
+ end
111
+
112
+ ##
113
+ # Provide a user friendly representation
114
+ def to_s
115
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
116
+ "#<Twilio.Taskrouter.V1.TaskQueueRealTimeStatisticsContext #{context}>"
117
+ end
118
+ end
119
+
120
+ class TaskQueueRealTimeStatisticsInstance < InstanceResource
121
+ ##
122
+ # Initialize the TaskQueueRealTimeStatisticsInstance
123
+ # @param [Version] version Version that contains the resource
124
+ # @param [Hash] payload payload that contains response from Twilio
125
+ # @param [String] workspace_sid The workspace_sid
126
+ # @param [String] task_queue_sid The task_queue_sid
127
+ # @return [TaskQueueRealTimeStatisticsInstance] TaskQueueRealTimeStatisticsInstance
128
+ def initialize(version, payload, workspace_sid: nil, task_queue_sid: nil)
129
+ super(version)
130
+
131
+ # Marshaled Properties
132
+ @properties = {
133
+ 'account_sid' => payload['account_sid'],
134
+ 'activity_statistics' => payload['activity_statistics'],
135
+ 'longest_task_waiting_age' => payload['longest_task_waiting_age'].to_i,
136
+ 'task_queue_sid' => payload['task_queue_sid'],
137
+ 'tasks_by_priority' => payload['tasks_by_priority'],
138
+ 'tasks_by_status' => payload['tasks_by_status'],
139
+ 'total_available_workers' => payload['total_available_workers'].to_i,
140
+ 'total_eligible_workers' => payload['total_eligible_workers'].to_i,
141
+ 'total_tasks' => payload['total_tasks'].to_i,
142
+ 'workspace_sid' => payload['workspace_sid'],
143
+ 'url' => payload['url'],
144
+ }
145
+
146
+ # Context
147
+ @instance_context = nil
148
+ @params = {
149
+ 'workspace_sid' => workspace_sid,
150
+ 'task_queue_sid' => task_queue_sid,
151
+ }
152
+ end
153
+
154
+ ##
155
+ # Generate an instance context for the instance, the context is capable of
156
+ # performing various actions. All instance actions are proxied to the context
157
+ # @return [TaskQueueRealTimeStatisticsContext] TaskQueueRealTimeStatisticsContext for this TaskQueueRealTimeStatisticsInstance
158
+ def context
159
+ unless @instance_context
160
+ @instance_context = TaskQueueRealTimeStatisticsContext.new(
161
+ @version,
162
+ @params['workspace_sid'],
163
+ @params['task_queue_sid'],
164
+ )
165
+ end
166
+ @instance_context
167
+ end
168
+
169
+ ##
170
+ # @return [String] The account_sid
171
+ def account_sid
172
+ @properties['account_sid']
173
+ end
174
+
175
+ ##
176
+ # @return [Hash] The activity_statistics
177
+ def activity_statistics
178
+ @properties['activity_statistics']
179
+ end
180
+
181
+ ##
182
+ # @return [String] The longest_task_waiting_age
183
+ def longest_task_waiting_age
184
+ @properties['longest_task_waiting_age']
185
+ end
186
+
187
+ ##
188
+ # @return [String] The task_queue_sid
189
+ def task_queue_sid
190
+ @properties['task_queue_sid']
191
+ end
192
+
193
+ ##
194
+ # @return [Hash] The tasks_by_priority
195
+ def tasks_by_priority
196
+ @properties['tasks_by_priority']
197
+ end
198
+
199
+ ##
200
+ # @return [Hash] The tasks_by_status
201
+ def tasks_by_status
202
+ @properties['tasks_by_status']
203
+ end
204
+
205
+ ##
206
+ # @return [String] The total_available_workers
207
+ def total_available_workers
208
+ @properties['total_available_workers']
209
+ end
210
+
211
+ ##
212
+ # @return [String] The total_eligible_workers
213
+ def total_eligible_workers
214
+ @properties['total_eligible_workers']
215
+ end
216
+
217
+ ##
218
+ # @return [String] The total_tasks
219
+ def total_tasks
220
+ @properties['total_tasks']
221
+ end
222
+
223
+ ##
224
+ # @return [String] The workspace_sid
225
+ def workspace_sid
226
+ @properties['workspace_sid']
227
+ end
228
+
229
+ ##
230
+ # @return [String] The url
231
+ def url
232
+ @properties['url']
233
+ end
234
+
235
+ ##
236
+ # Fetch a TaskQueueRealTimeStatisticsInstance
237
+ # @param [String] task_channel The task_channel
238
+ # @return [TaskQueueRealTimeStatisticsInstance] Fetched TaskQueueRealTimeStatisticsInstance
239
+ def fetch(task_channel: :unset)
240
+ context.fetch(
241
+ task_channel: task_channel,
242
+ )
243
+ end
244
+
245
+ ##
246
+ # Provide a user friendly representation
247
+ def to_s
248
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
249
+ "<Twilio.Taskrouter.V1.TaskQueueRealTimeStatisticsInstance #{values}>"
250
+ end
251
+
252
+ ##
253
+ # Provide a detailed, user friendly representation
254
+ def inspect
255
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
256
+ "<Twilio.Taskrouter.V1.TaskQueueRealTimeStatisticsInstance #{values}>"
257
+ end
258
+ end
259
+ end
260
+ end
261
+ end
262
+ end
263
+ end
264
+ end