twilio-ruby 5.31.4 → 5.31.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +9 -0
  3. data/.rubocop_todo.yml +0 -11
  4. data/CHANGES.md +38 -0
  5. data/README.md +2 -2
  6. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +27 -1
  7. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +5 -1
  8. data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +7 -0
  9. data/lib/twilio-ruby/rest/messaging.rb +0 -15
  10. data/lib/twilio-ruby/rest/messaging/v1.rb +0 -22
  11. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/regulation.rb +322 -0
  12. data/lib/twilio-ruby/rest/studio/v2/flow.rb +49 -0
  13. data/lib/twilio-ruby/rest/studio/v2/flow/execution.rb +427 -0
  14. data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_context.rb +224 -0
  15. data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step.rb +387 -0
  16. data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step/execution_step_context.rb +239 -0
  17. data/lib/twilio-ruby/rest/studio/v2/flow/test_user.rb +215 -0
  18. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +10 -3
  19. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.rb +7 -0
  20. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb +14 -0
  21. data/lib/twilio-ruby/rest/verify/v2/service.rb +5 -3
  22. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +5 -4
  23. data/lib/twilio-ruby/version.rb +1 -1
  24. data/spec/integration/api/v2010/account/call_spec.rb +30 -10
  25. data/spec/integration/api/v2010/account/conference/participant_spec.rb +29 -0
  26. data/spec/integration/api/v2010/account/notification_spec.rb +1 -1
  27. data/spec/integration/api/v2010/account_spec.rb +45 -0
  28. data/spec/integration/flex_api/v1/configuration_spec.rb +3 -0
  29. data/spec/integration/numbers/v2/regulatory_compliance/regulation_spec.rb +183 -0
  30. data/spec/integration/studio/v2/flow/execution/execution_context_spec.rb +51 -0
  31. data/spec/integration/studio/v2/flow/execution/execution_step/execution_step_context_spec.rb +54 -0
  32. data/spec/integration/studio/v2/flow/execution/execution_step_spec.rb +101 -0
  33. data/spec/integration/studio/v2/flow/execution_spec.rb +169 -0
  34. data/spec/integration/studio/v2/flow/test_user_spec.rb +86 -0
  35. data/spec/integration/studio/v2/flow_spec.rb +16 -4
  36. data/spec/integration/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics_spec.rb +6 -0
  37. data/spec/integration/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics_spec.rb +2 -0
  38. data/spec/integration/taskrouter/v1/workspace/task_spec.rb +4 -0
  39. data/twilio-ruby.gemspec +1 -1
  40. metadata +22 -19
  41. data/lib/twilio-ruby/rest/messaging/v1/session.rb +0 -513
  42. data/lib/twilio-ruby/rest/messaging/v1/session/message.rb +0 -439
  43. data/lib/twilio-ruby/rest/messaging/v1/session/participant.rb +0 -458
  44. data/lib/twilio-ruby/rest/messaging/v1/session/webhook.rb +0 -444
  45. data/lib/twilio-ruby/rest/messaging/v1/webhook.rb +0 -299
  46. data/spec/integration/messaging/v1/session/message_spec.rb +0 -238
  47. data/spec/integration/messaging/v1/session/participant_spec.rb +0 -256
  48. data/spec/integration/messaging/v1/session/webhook_spec.rb +0 -300
  49. data/spec/integration/messaging/v1/session_spec.rb +0 -227
  50. data/spec/integration/messaging/v1/webhook_spec.rb +0 -94
@@ -45,11 +45,14 @@ describe 'Flow' do
45
45
  "commit_message": null,
46
46
  "valid": true,
47
47
  "errors": [],
48
+ "webhook_url": "http://webhooks.twilio.com/v1/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
48
49
  "date_created": "2017-11-06T12:00:00Z",
49
50
  "date_updated": null,
50
51
  "url": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
51
52
  "links": {
52
- "revisions": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Revisions"
53
+ "test_users": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TestUsers",
54
+ "revisions": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Revisions",
55
+ "executions": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Executions"
53
56
  }
54
57
  }
55
58
  ]
@@ -92,11 +95,14 @@ describe 'Flow' do
92
95
  "commit_message": null,
93
96
  "valid": true,
94
97
  "errors": [],
98
+ "webhook_url": "http://webhooks.twilio.com/v1/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
95
99
  "date_created": "2017-11-06T12:00:00Z",
96
100
  "date_updated": "2017-11-06T12:00:00Z",
97
101
  "url": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
98
102
  "links": {
99
- "revisions": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Revisions"
103
+ "test_users": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TestUsers",
104
+ "revisions": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Revisions",
105
+ "executions": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Executions"
100
106
  }
101
107
  }
102
108
  ]
@@ -147,11 +153,14 @@ describe 'Flow' do
147
153
  "commit_message": null,
148
154
  "valid": null,
149
155
  "errors": null,
156
+ "webhook_url": "http://webhooks.twilio.com/v1/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
150
157
  "date_created": "2017-11-06T12:00:00Z",
151
158
  "date_updated": "2017-11-06T12:00:00Z",
152
159
  "url": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
153
160
  "links": {
154
- "revisions": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Revisions"
161
+ "test_users": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TestUsers",
162
+ "revisions": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Revisions",
163
+ "executions": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Executions"
155
164
  }
156
165
  }
157
166
  ]
@@ -195,11 +204,14 @@ describe 'Flow' do
195
204
  "commit_message": "commit",
196
205
  "valid": true,
197
206
  "errors": [],
207
+ "webhook_url": "http://webhooks.twilio.com/v1/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
198
208
  "date_created": "2017-11-06T12:00:00Z",
199
209
  "date_updated": null,
200
210
  "url": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
201
211
  "links": {
202
- "revisions": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Revisions"
212
+ "test_users": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TestUsers",
213
+ "revisions": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Revisions",
214
+ "executions": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Executions"
203
215
  }
204
216
  }
205
217
  ]
@@ -54,6 +54,12 @@ describe 'TaskQueueCumulativeStatistics' do
54
54
  "max": 0,
55
55
  "total": 0
56
56
  },
57
+ "wait_duration_in_queue_until_accepted": {
58
+ "avg": 0,
59
+ "min": 0,
60
+ "max": 0,
61
+ "total": 0
62
+ },
57
63
  "split_by_wait_time": {
58
64
  "5": {
59
65
  "above": {
@@ -33,6 +33,8 @@ describe 'TaskQueueRealTimeStatistics' do
33
33
  {
34
34
  "longest_task_waiting_age": 100,
35
35
  "longest_task_waiting_sid": "WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
36
+ "longest_relative_task_age_in_queue": 100,
37
+ "longest_relative_task_sid_in_queue": "WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
36
38
  "task_queue_sid": "WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
37
39
  "tasks_by_status": {
38
40
  "reserved": 0,
@@ -36,6 +36,7 @@ describe 'Task' do
36
36
  "attributes": "{\\"body\\": \\"hello\\"}",
37
37
  "date_created": "2014-05-14T18:50:02Z",
38
38
  "date_updated": "2014-05-15T07:26:06Z",
39
+ "task_queue_entered_date": "2014-05-14T18:50:02Z",
39
40
  "priority": 0,
40
41
  "reason": "Test Reason",
41
42
  "sid": "WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
@@ -92,6 +93,7 @@ describe 'Task' do
92
93
  "attributes": "{\\"body\\": \\"hello\\"}",
93
94
  "date_created": "2014-05-14T18:50:02Z",
94
95
  "date_updated": "2014-05-15T07:26:06Z",
96
+ "task_queue_entered_date": "2014-05-14T18:50:02Z",
95
97
  "priority": 0,
96
98
  "reason": "Test Reason",
97
99
  "sid": "WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
@@ -187,6 +189,7 @@ describe 'Task' do
187
189
  "attributes": "{\\"body\\": \\"hello\\"}",
188
190
  "date_created": "2014-05-14T14:26:54Z",
189
191
  "date_updated": "2014-05-15T16:03:42Z",
192
+ "task_queue_entered_date": "2014-05-14T14:26:54Z",
190
193
  "priority": 0,
191
194
  "reason": "Test Reason",
192
195
  "sid": "WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
@@ -295,6 +298,7 @@ describe 'Task' do
295
298
  "attributes": "{\\"body\\": \\"attributes\\"}",
296
299
  "date_created": "2014-05-14T18:50:02Z",
297
300
  "date_updated": "2014-05-15T07:26:06Z",
301
+ "task_queue_entered_date": null,
298
302
  "priority": 1,
299
303
  "reason": "Test Reason",
300
304
  "sid": "WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
data/twilio-ruby.gemspec CHANGED
@@ -31,6 +31,6 @@ Gem::Specification.new do |spec|
31
31
  spec.add_dependency('rubysl') if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
32
32
 
33
33
  spec.add_development_dependency 'bundler', '>= 1.5', '< 3.0'
34
- spec.add_development_dependency 'rubocop', '~> 0.79.0'
34
+ spec.add_development_dependency 'rubocop', '~> 0.80.0'
35
35
  spec.add_development_dependency 'yard', '~> 0.9.9'
36
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twilio-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.31.4
4
+ version: 5.31.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Twilio API Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-05 00:00:00.000000000 Z
11
+ date: 2020-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -90,14 +90,14 @@ dependencies:
90
90
  requirements:
91
91
  - - "~>"
92
92
  - !ruby/object:Gem::Version
93
- version: 0.79.0
93
+ version: 0.80.0
94
94
  type: :development
95
95
  prerelease: false
96
96
  version_requirements: !ruby/object:Gem::Requirement
97
97
  requirements:
98
98
  - - "~>"
99
99
  - !ruby/object:Gem::Version
100
- version: 0.79.0
100
+ version: 0.80.0
101
101
  - !ruby/object:Gem::Dependency
102
102
  name: yard
103
103
  requirement: !ruby/object:Gem::Requirement
@@ -349,11 +349,6 @@ files:
349
349
  - lib/twilio-ruby/rest/messaging/v1/service/alpha_sender.rb
350
350
  - lib/twilio-ruby/rest/messaging/v1/service/phone_number.rb
351
351
  - lib/twilio-ruby/rest/messaging/v1/service/short_code.rb
352
- - lib/twilio-ruby/rest/messaging/v1/session.rb
353
- - lib/twilio-ruby/rest/messaging/v1/session/message.rb
354
- - lib/twilio-ruby/rest/messaging/v1/session/participant.rb
355
- - lib/twilio-ruby/rest/messaging/v1/session/webhook.rb
356
- - lib/twilio-ruby/rest/messaging/v1/webhook.rb
357
352
  - lib/twilio-ruby/rest/monitor.rb
358
353
  - lib/twilio-ruby/rest/monitor/v1.rb
359
354
  - lib/twilio-ruby/rest/monitor/v1/alert.rb
@@ -371,6 +366,7 @@ files:
371
366
  - lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.rb
372
367
  - lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/end_user.rb
373
368
  - lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/end_user_type.rb
369
+ - lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/regulation.rb
374
370
  - lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb
375
371
  - lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document_type.rb
376
372
  - lib/twilio-ruby/rest/preview.rb
@@ -481,7 +477,12 @@ files:
481
477
  - lib/twilio-ruby/rest/studio/v1/flow/execution/execution_step/execution_step_context.rb
482
478
  - lib/twilio-ruby/rest/studio/v2.rb
483
479
  - lib/twilio-ruby/rest/studio/v2/flow.rb
480
+ - lib/twilio-ruby/rest/studio/v2/flow/execution.rb
481
+ - lib/twilio-ruby/rest/studio/v2/flow/execution/execution_context.rb
482
+ - lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step.rb
483
+ - lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step/execution_step_context.rb
484
484
  - lib/twilio-ruby/rest/studio/v2/flow/flow_revision.rb
485
+ - lib/twilio-ruby/rest/studio/v2/flow/test_user.rb
485
486
  - lib/twilio-ruby/rest/studio/v2/flow_validate.rb
486
487
  - lib/twilio-ruby/rest/sync.rb
487
488
  - lib/twilio-ruby/rest/sync/v1.rb
@@ -739,11 +740,6 @@ files:
739
740
  - spec/integration/messaging/v1/service/phone_number_spec.rb
740
741
  - spec/integration/messaging/v1/service/short_code_spec.rb
741
742
  - spec/integration/messaging/v1/service_spec.rb
742
- - spec/integration/messaging/v1/session/message_spec.rb
743
- - spec/integration/messaging/v1/session/participant_spec.rb
744
- - spec/integration/messaging/v1/session/webhook_spec.rb
745
- - spec/integration/messaging/v1/session_spec.rb
746
- - spec/integration/messaging/v1/webhook_spec.rb
747
743
  - spec/integration/monitor/v1/alert_spec.rb
748
744
  - spec/integration/monitor/v1/event_spec.rb
749
745
  - spec/integration/notify/v1/credential_spec.rb
@@ -754,6 +750,7 @@ files:
754
750
  - spec/integration/numbers/v2/regulatory_compliance/bundle_spec.rb
755
751
  - spec/integration/numbers/v2/regulatory_compliance/end_user_spec.rb
756
752
  - spec/integration/numbers/v2/regulatory_compliance/end_user_type_spec.rb
753
+ - spec/integration/numbers/v2/regulatory_compliance/regulation_spec.rb
757
754
  - spec/integration/numbers/v2/regulatory_compliance/supporting_document_spec.rb
758
755
  - spec/integration/numbers/v2/regulatory_compliance/supporting_document_type_spec.rb
759
756
  - spec/integration/numbers/v2/regulatory_compliance_spec.rb
@@ -845,7 +842,12 @@ files:
845
842
  - spec/integration/studio/v1/flow/execution/execution_step_spec.rb
846
843
  - spec/integration/studio/v1/flow/execution_spec.rb
847
844
  - spec/integration/studio/v1/flow_spec.rb
845
+ - spec/integration/studio/v2/flow/execution/execution_context_spec.rb
846
+ - spec/integration/studio/v2/flow/execution/execution_step/execution_step_context_spec.rb
847
+ - spec/integration/studio/v2/flow/execution/execution_step_spec.rb
848
+ - spec/integration/studio/v2/flow/execution_spec.rb
848
849
  - spec/integration/studio/v2/flow/flow_revision_spec.rb
850
+ - spec/integration/studio/v2/flow/test_user_spec.rb
849
851
  - spec/integration/studio/v2/flow_spec.rb
850
852
  - spec/integration/studio/v2/flow_validate_spec.rb
851
853
  - spec/integration/sync/v1/service/document/document_permission_spec.rb
@@ -1128,11 +1130,6 @@ test_files:
1128
1130
  - spec/integration/messaging/v1/service/phone_number_spec.rb
1129
1131
  - spec/integration/messaging/v1/service/short_code_spec.rb
1130
1132
  - spec/integration/messaging/v1/service_spec.rb
1131
- - spec/integration/messaging/v1/session/message_spec.rb
1132
- - spec/integration/messaging/v1/session/participant_spec.rb
1133
- - spec/integration/messaging/v1/session/webhook_spec.rb
1134
- - spec/integration/messaging/v1/session_spec.rb
1135
- - spec/integration/messaging/v1/webhook_spec.rb
1136
1133
  - spec/integration/monitor/v1/alert_spec.rb
1137
1134
  - spec/integration/monitor/v1/event_spec.rb
1138
1135
  - spec/integration/notify/v1/credential_spec.rb
@@ -1143,6 +1140,7 @@ test_files:
1143
1140
  - spec/integration/numbers/v2/regulatory_compliance/bundle_spec.rb
1144
1141
  - spec/integration/numbers/v2/regulatory_compliance/end_user_spec.rb
1145
1142
  - spec/integration/numbers/v2/regulatory_compliance/end_user_type_spec.rb
1143
+ - spec/integration/numbers/v2/regulatory_compliance/regulation_spec.rb
1146
1144
  - spec/integration/numbers/v2/regulatory_compliance/supporting_document_spec.rb
1147
1145
  - spec/integration/numbers/v2/regulatory_compliance/supporting_document_type_spec.rb
1148
1146
  - spec/integration/numbers/v2/regulatory_compliance_spec.rb
@@ -1234,7 +1232,12 @@ test_files:
1234
1232
  - spec/integration/studio/v1/flow/execution/execution_step_spec.rb
1235
1233
  - spec/integration/studio/v1/flow/execution_spec.rb
1236
1234
  - spec/integration/studio/v1/flow_spec.rb
1235
+ - spec/integration/studio/v2/flow/execution/execution_context_spec.rb
1236
+ - spec/integration/studio/v2/flow/execution/execution_step/execution_step_context_spec.rb
1237
+ - spec/integration/studio/v2/flow/execution/execution_step_spec.rb
1238
+ - spec/integration/studio/v2/flow/execution_spec.rb
1237
1239
  - spec/integration/studio/v2/flow/flow_revision_spec.rb
1240
+ - spec/integration/studio/v2/flow/test_user_spec.rb
1238
1241
  - spec/integration/studio/v2/flow_spec.rb
1239
1242
  - spec/integration/studio/v2/flow_validate_spec.rb
1240
1243
  - spec/integration/sync/v1/service/document/document_permission_spec.rb
@@ -1,513 +0,0 @@
1
- ##
2
- # This code was generated by
3
- # \ / _ _ _| _ _
4
- # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
- # / /
6
- #
7
- # frozen_string_literal: true
8
-
9
- module Twilio
10
- module REST
11
- class Messaging < Domain
12
- class V1 < Version
13
- ##
14
- # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
15
- class SessionList < ListResource
16
- ##
17
- # Initialize the SessionList
18
- # @param [Version] version Version that contains the resource
19
- # @return [SessionList] SessionList
20
- def initialize(version)
21
- super(version)
22
-
23
- # Path Solution
24
- @solution = {}
25
- @uri = "/Sessions"
26
- end
27
-
28
- ##
29
- # Retrieve a single page of SessionInstance records from the API.
30
- # Request is executed immediately.
31
- # @param [String] messaging_service_sid The SID of the [Messaging
32
- # Service](https://www.twilio.com/docs/sms/services/api) the session belongs to.
33
- # @param [String] friendly_name A descriptive string that you create to describe
34
- # the resource. It can be up to 64 characters long.
35
- # @param [String] attributes A JSON string that stores application-specific data.
36
- # @param [Time] date_created The date, specified in [ISO
37
- # 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource
38
- # as the date it was created.
39
- # @param [Time] date_updated The date, specified in [ISO
40
- # 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource
41
- # as the date it was last updated.
42
- # @param [String] created_by The Identity of the session's creator. If the Session
43
- # was created through the API, the value will be `system`
44
- # @return [SessionInstance] Newly created SessionInstance
45
- def create(messaging_service_sid: nil, friendly_name: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, created_by: :unset)
46
- data = Twilio::Values.of({
47
- 'MessagingServiceSid' => messaging_service_sid,
48
- 'FriendlyName' => friendly_name,
49
- 'Attributes' => attributes,
50
- 'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
51
- 'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
52
- 'CreatedBy' => created_by,
53
- })
54
-
55
- payload = @version.create(
56
- 'POST',
57
- @uri,
58
- data: data
59
- )
60
-
61
- SessionInstance.new(@version, payload, )
62
- end
63
-
64
- ##
65
- # Lists SessionInstance records from the API as a list.
66
- # Unlike stream(), this operation is eager and will load `limit` records into
67
- # memory before returning.
68
- # @param [Integer] limit Upper limit for the number of records to return. stream()
69
- # guarantees to never return more than limit. Default is no limit
70
- # @param [Integer] page_size Number of records to fetch per request, when
71
- # not set will use the default value of 50 records. If no page_size is defined
72
- # but a limit is defined, stream() will attempt to read the limit with the most
73
- # efficient page size, i.e. min(limit, 1000)
74
- # @return [Array] Array of up to limit results
75
- def list(limit: nil, page_size: nil)
76
- self.stream(limit: limit, page_size: page_size).entries
77
- end
78
-
79
- ##
80
- # Streams SessionInstance records from the API as an Enumerable.
81
- # This operation lazily loads records as efficiently as possible until the limit
82
- # is reached.
83
- # @param [Integer] limit Upper limit for the number of records to return. stream()
84
- # guarantees to never return more than limit. Default is no limit.
85
- # @param [Integer] page_size Number of records to fetch per request, when
86
- # not set will use the default value of 50 records. If no page_size is defined
87
- # but a limit is defined, stream() will attempt to read the limit with the most
88
- # efficient page size, i.e. min(limit, 1000)
89
- # @return [Enumerable] Enumerable that will yield up to limit results
90
- def stream(limit: nil, page_size: nil)
91
- limits = @version.read_limits(limit, page_size)
92
-
93
- page = self.page(page_size: limits[:page_size], )
94
-
95
- @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
96
- end
97
-
98
- ##
99
- # When passed a block, yields SessionInstance records from the API.
100
- # This operation lazily loads records as efficiently as possible until the limit
101
- # is reached.
102
- def each
103
- limits = @version.read_limits
104
-
105
- page = self.page(page_size: limits[:page_size], )
106
-
107
- @version.stream(page,
108
- limit: limits[:limit],
109
- page_limit: limits[:page_limit]).each {|x| yield x}
110
- end
111
-
112
- ##
113
- # Retrieve a single page of SessionInstance records from the API.
114
- # Request is executed immediately.
115
- # @param [String] page_token PageToken provided by the API
116
- # @param [Integer] page_number Page Number, this value is simply for client state
117
- # @param [Integer] page_size Number of records to return, defaults to 50
118
- # @return [Page] Page of SessionInstance
119
- def page(page_token: :unset, page_number: :unset, page_size: :unset)
120
- params = Twilio::Values.of({
121
- 'PageToken' => page_token,
122
- 'Page' => page_number,
123
- 'PageSize' => page_size,
124
- })
125
- response = @version.page(
126
- 'GET',
127
- @uri,
128
- params
129
- )
130
- SessionPage.new(@version, response, @solution)
131
- end
132
-
133
- ##
134
- # Retrieve a single page of SessionInstance records from the API.
135
- # Request is executed immediately.
136
- # @param [String] target_url API-generated URL for the requested results page
137
- # @return [Page] Page of SessionInstance
138
- def get_page(target_url)
139
- response = @version.domain.request(
140
- 'GET',
141
- target_url
142
- )
143
- SessionPage.new(@version, response, @solution)
144
- end
145
-
146
- ##
147
- # Provide a user friendly representation
148
- def to_s
149
- '#<Twilio.Messaging.V1.SessionList>'
150
- end
151
- end
152
-
153
- ##
154
- # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
155
- class SessionPage < Page
156
- ##
157
- # Initialize the SessionPage
158
- # @param [Version] version Version that contains the resource
159
- # @param [Response] response Response from the API
160
- # @param [Hash] solution Path solution for the resource
161
- # @return [SessionPage] SessionPage
162
- def initialize(version, response, solution)
163
- super(version, response)
164
-
165
- # Path Solution
166
- @solution = solution
167
- end
168
-
169
- ##
170
- # Build an instance of SessionInstance
171
- # @param [Hash] payload Payload response from the API
172
- # @return [SessionInstance] SessionInstance
173
- def get_instance(payload)
174
- SessionInstance.new(@version, payload, )
175
- end
176
-
177
- ##
178
- # Provide a user friendly representation
179
- def to_s
180
- '<Twilio.Messaging.V1.SessionPage>'
181
- end
182
- end
183
-
184
- ##
185
- # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
186
- class SessionContext < InstanceContext
187
- ##
188
- # Initialize the SessionContext
189
- # @param [Version] version Version that contains the resource
190
- # @param [String] sid The SID of the Session resource to fetch.
191
- # @return [SessionContext] SessionContext
192
- def initialize(version, sid)
193
- super(version)
194
-
195
- # Path Solution
196
- @solution = {sid: sid, }
197
- @uri = "/Sessions/#{@solution[:sid]}"
198
-
199
- # Dependents
200
- @participants = nil
201
- @messages = nil
202
- @webhooks = nil
203
- end
204
-
205
- ##
206
- # Fetch a SessionInstance
207
- # @return [SessionInstance] Fetched SessionInstance
208
- def fetch
209
- params = Twilio::Values.of({})
210
-
211
- payload = @version.fetch(
212
- 'GET',
213
- @uri,
214
- params,
215
- )
216
-
217
- SessionInstance.new(@version, payload, sid: @solution[:sid], )
218
- end
219
-
220
- ##
221
- # Deletes the SessionInstance
222
- # @return [Boolean] true if delete succeeds, false otherwise
223
- def delete
224
- @version.delete('delete', @uri)
225
- end
226
-
227
- ##
228
- # Update the SessionInstance
229
- # @param [String] friendly_name A descriptive string that you create to describe
230
- # the resource. It can be up to 64 characters long.
231
- # @param [String] attributes A JSON string that stores application-specific data.
232
- # @param [Time] date_created The date, specified in [ISO
233
- # 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource
234
- # as the date it was created.
235
- # @param [Time] date_updated The date, specified in [ISO
236
- # 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource
237
- # as the date it was last updated.
238
- # @param [String] created_by The Identity of the session's creator. If the Session
239
- # was created through the API, the value will be `system`
240
- # @return [SessionInstance] Updated SessionInstance
241
- def update(friendly_name: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, created_by: :unset)
242
- data = Twilio::Values.of({
243
- 'FriendlyName' => friendly_name,
244
- 'Attributes' => attributes,
245
- 'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
246
- 'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
247
- 'CreatedBy' => created_by,
248
- })
249
-
250
- payload = @version.update(
251
- 'POST',
252
- @uri,
253
- data: data,
254
- )
255
-
256
- SessionInstance.new(@version, payload, sid: @solution[:sid], )
257
- end
258
-
259
- ##
260
- # Access the participants
261
- # @return [ParticipantList]
262
- # @return [ParticipantContext] if sid was passed.
263
- def participants(sid=:unset)
264
- raise ArgumentError, 'sid cannot be nil' if sid.nil?
265
-
266
- if sid != :unset
267
- return ParticipantContext.new(@version, @solution[:sid], sid, )
268
- end
269
-
270
- unless @participants
271
- @participants = ParticipantList.new(@version, session_sid: @solution[:sid], )
272
- end
273
-
274
- @participants
275
- end
276
-
277
- ##
278
- # Access the messages
279
- # @return [MessageList]
280
- # @return [MessageContext] if sid was passed.
281
- def messages(sid=:unset)
282
- raise ArgumentError, 'sid cannot be nil' if sid.nil?
283
-
284
- if sid != :unset
285
- return MessageContext.new(@version, @solution[:sid], sid, )
286
- end
287
-
288
- unless @messages
289
- @messages = MessageList.new(@version, session_sid: @solution[:sid], )
290
- end
291
-
292
- @messages
293
- end
294
-
295
- ##
296
- # Access the webhooks
297
- # @return [WebhookList]
298
- # @return [WebhookContext] if sid was passed.
299
- def webhooks(sid=:unset)
300
- raise ArgumentError, 'sid cannot be nil' if sid.nil?
301
-
302
- if sid != :unset
303
- return WebhookContext.new(@version, @solution[:sid], sid, )
304
- end
305
-
306
- unless @webhooks
307
- @webhooks = WebhookList.new(@version, session_sid: @solution[:sid], )
308
- end
309
-
310
- @webhooks
311
- end
312
-
313
- ##
314
- # Provide a user friendly representation
315
- def to_s
316
- context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
317
- "#<Twilio.Messaging.V1.SessionContext #{context}>"
318
- end
319
-
320
- ##
321
- # Provide a detailed, user friendly representation
322
- def inspect
323
- context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
324
- "#<Twilio.Messaging.V1.SessionContext #{context}>"
325
- end
326
- end
327
-
328
- ##
329
- # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
330
- class SessionInstance < InstanceResource
331
- ##
332
- # Initialize the SessionInstance
333
- # @param [Version] version Version that contains the resource
334
- # @param [Hash] payload payload that contains response from Twilio
335
- # @param [String] sid The SID of the Session resource to fetch.
336
- # @return [SessionInstance] SessionInstance
337
- def initialize(version, payload, sid: nil)
338
- super(version)
339
-
340
- # Marshaled Properties
341
- @properties = {
342
- 'sid' => payload['sid'],
343
- 'account_sid' => payload['account_sid'],
344
- 'service_sid' => payload['service_sid'],
345
- 'messaging_service_sid' => payload['messaging_service_sid'],
346
- 'friendly_name' => payload['friendly_name'],
347
- 'attributes' => payload['attributes'],
348
- 'created_by' => payload['created_by'],
349
- 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
350
- 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
351
- 'url' => payload['url'],
352
- 'links' => payload['links'],
353
- }
354
-
355
- # Context
356
- @instance_context = nil
357
- @params = {'sid' => sid || @properties['sid'], }
358
- end
359
-
360
- ##
361
- # Generate an instance context for the instance, the context is capable of
362
- # performing various actions. All instance actions are proxied to the context
363
- # @return [SessionContext] SessionContext for this SessionInstance
364
- def context
365
- unless @instance_context
366
- @instance_context = SessionContext.new(@version, @params['sid'], )
367
- end
368
- @instance_context
369
- end
370
-
371
- ##
372
- # @return [String] The unique string that identifies the resource
373
- def sid
374
- @properties['sid']
375
- end
376
-
377
- ##
378
- # @return [String] The SID of the Account that created the resource
379
- def account_sid
380
- @properties['account_sid']
381
- end
382
-
383
- ##
384
- # @return [String] The SID of the Service that the resource is associated with
385
- def service_sid
386
- @properties['service_sid']
387
- end
388
-
389
- ##
390
- # @return [String] The SID of the SMS Service the session belongs to
391
- def messaging_service_sid
392
- @properties['messaging_service_sid']
393
- end
394
-
395
- ##
396
- # @return [String] The string that you assigned to describe the resource
397
- def friendly_name
398
- @properties['friendly_name']
399
- end
400
-
401
- ##
402
- # @return [String] The JSON string that stores application-specific data
403
- def attributes
404
- @properties['attributes']
405
- end
406
-
407
- ##
408
- # @return [String] The Identity of the session's creator
409
- def created_by
410
- @properties['created_by']
411
- end
412
-
413
- ##
414
- # @return [Time] The ISO 8601 date and time in GMT when the resource was created
415
- def date_created
416
- @properties['date_created']
417
- end
418
-
419
- ##
420
- # @return [Time] The ISO 8601 date and time in GMT when the resource was last updated
421
- def date_updated
422
- @properties['date_updated']
423
- end
424
-
425
- ##
426
- # @return [String] The absolute URL of the session
427
- def url
428
- @properties['url']
429
- end
430
-
431
- ##
432
- # @return [String] The absolute URLs of the Participants, Interactions, and Messages for the Session
433
- def links
434
- @properties['links']
435
- end
436
-
437
- ##
438
- # Fetch a SessionInstance
439
- # @return [SessionInstance] Fetched SessionInstance
440
- def fetch
441
- context.fetch
442
- end
443
-
444
- ##
445
- # Deletes the SessionInstance
446
- # @return [Boolean] true if delete succeeds, false otherwise
447
- def delete
448
- context.delete
449
- end
450
-
451
- ##
452
- # Update the SessionInstance
453
- # @param [String] friendly_name A descriptive string that you create to describe
454
- # the resource. It can be up to 64 characters long.
455
- # @param [String] attributes A JSON string that stores application-specific data.
456
- # @param [Time] date_created The date, specified in [ISO
457
- # 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource
458
- # as the date it was created.
459
- # @param [Time] date_updated The date, specified in [ISO
460
- # 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource
461
- # as the date it was last updated.
462
- # @param [String] created_by The Identity of the session's creator. If the Session
463
- # was created through the API, the value will be `system`
464
- # @return [SessionInstance] Updated SessionInstance
465
- def update(friendly_name: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, created_by: :unset)
466
- context.update(
467
- friendly_name: friendly_name,
468
- attributes: attributes,
469
- date_created: date_created,
470
- date_updated: date_updated,
471
- created_by: created_by,
472
- )
473
- end
474
-
475
- ##
476
- # Access the participants
477
- # @return [participants] participants
478
- def participants
479
- context.participants
480
- end
481
-
482
- ##
483
- # Access the messages
484
- # @return [messages] messages
485
- def messages
486
- context.messages
487
- end
488
-
489
- ##
490
- # Access the webhooks
491
- # @return [webhooks] webhooks
492
- def webhooks
493
- context.webhooks
494
- end
495
-
496
- ##
497
- # Provide a user friendly representation
498
- def to_s
499
- values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
500
- "<Twilio.Messaging.V1.SessionInstance #{values}>"
501
- end
502
-
503
- ##
504
- # Provide a detailed, user friendly representation
505
- def inspect
506
- values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
507
- "<Twilio.Messaging.V1.SessionInstance #{values}>"
508
- end
509
- end
510
- end
511
- end
512
- end
513
- end