twilio-ruby 5.41.0 → 5.42.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +28 -0
  3. data/{LICENSE.md → LICENSE} +0 -0
  4. data/PULL_REQUEST_TEMPLATE.md +3 -3
  5. data/README.md +2 -2
  6. data/lib/twilio-ruby/jwt/access_token.rb +7 -2
  7. data/lib/twilio-ruby/rest/bulkexports/v1/export/day.rb +5 -22
  8. data/lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb +25 -40
  9. data/lib/twilio-ruby/rest/insights.rb +8 -0
  10. data/lib/twilio-ruby/rest/insights/v1.rb +15 -0
  11. data/lib/twilio-ruby/rest/insights/v1/room.rb +487 -0
  12. data/lib/twilio-ruby/rest/insights/v1/room/participant.rb +385 -0
  13. data/lib/twilio-ruby/rest/ip_messaging.rb +8 -10
  14. data/lib/twilio-ruby/rest/ip_messaging/v1.rb +6 -8
  15. data/lib/twilio-ruby/rest/ip_messaging/v1/credential.rb +29 -68
  16. data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +198 -313
  17. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +32 -59
  18. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/invite.rb +23 -55
  19. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb +28 -71
  20. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb +31 -59
  21. data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +19 -39
  22. data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +29 -51
  23. data/lib/twilio-ruby/rest/ip_messaging/v1/service/user/user_channel.rb +12 -18
  24. data/lib/twilio-ruby/rest/ip_messaging/v2.rb +6 -6
  25. data/lib/twilio-ruby/rest/ip_messaging/v2/credential.rb +29 -66
  26. data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +116 -205
  27. data/lib/twilio-ruby/rest/ip_messaging/v2/service/binding.rb +23 -50
  28. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +41 -91
  29. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb +23 -50
  30. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/member.rb +42 -118
  31. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb +46 -100
  32. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/webhook.rb +36 -89
  33. data/lib/twilio-ruby/rest/ip_messaging/v2/service/role.rb +19 -41
  34. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb +29 -53
  35. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb +23 -53
  36. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb +27 -56
  37. data/lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb +5 -22
  38. data/lib/twilio-ruby/rest/preview/bulk_exports/export/export_custom_job.rb +21 -39
  39. data/lib/twilio-ruby/rest/verify/v2/form.rb +4 -4
  40. data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +3 -3
  41. data/lib/twilio-ruby/rest/verify/v2/service/entity.rb +20 -34
  42. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +22 -46
  43. data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +24 -42
  44. data/lib/twilio-ruby/rest/verify/v2/service/webhook.rb +4 -4
  45. data/lib/twilio-ruby/rest/video/v1/room.rb +20 -0
  46. data/lib/twilio-ruby/rest/video/v1/room/room_recording_rule.rb +150 -0
  47. data/lib/twilio-ruby/version.rb +1 -1
  48. data/spec/integration/bulkexports/v1/export/export_custom_job_spec.rb +4 -2
  49. data/spec/integration/events/v1/sink/sink_test_spec.rb +1 -1
  50. data/spec/integration/insights/v1/room/participant_spec.rb +149 -0
  51. data/spec/integration/insights/v1/room_spec.rb +164 -0
  52. data/spec/integration/ip_messaging/v1/credential_spec.rb +13 -13
  53. data/spec/integration/ip_messaging/v1/service/channel/invite_spec.rb +11 -11
  54. data/spec/integration/ip_messaging/v1/service/channel/member_spec.rb +14 -14
  55. data/spec/integration/ip_messaging/v1/service/channel/message_spec.rb +14 -14
  56. data/spec/integration/ip_messaging/v1/service/channel_spec.rb +25 -25
  57. data/spec/integration/ip_messaging/v1/service/role_spec.rb +13 -13
  58. data/spec/integration/ip_messaging/v1/service/user/user_channel_spec.rb +7 -7
  59. data/spec/integration/ip_messaging/v1/service/user_spec.rb +17 -17
  60. data/spec/integration/ip_messaging/v1/service_spec.rb +9 -9
  61. data/spec/integration/ip_messaging/v2/credential_spec.rb +13 -13
  62. data/spec/integration/ip_messaging/v2/service/binding_spec.rb +11 -11
  63. data/spec/integration/ip_messaging/v2/service/channel/invite_spec.rb +11 -11
  64. data/spec/integration/ip_messaging/v2/service/channel/member_spec.rb +13 -13
  65. data/spec/integration/ip_messaging/v2/service/channel/message_spec.rb +17 -17
  66. data/spec/integration/ip_messaging/v2/service/channel/webhook_spec.rb +15 -15
  67. data/spec/integration/ip_messaging/v2/service/channel_spec.rb +29 -29
  68. data/spec/integration/ip_messaging/v2/service/role_spec.rb +13 -13
  69. data/spec/integration/ip_messaging/v2/service/user/user_binding_spec.rb +9 -9
  70. data/spec/integration/ip_messaging/v2/service/user/user_channel_spec.rb +20 -20
  71. data/spec/integration/ip_messaging/v2/service/user_spec.rb +21 -21
  72. data/spec/integration/ip_messaging/v2/service_spec.rb +29 -29
  73. data/spec/integration/preview/bulk_exports/export/export_custom_job_spec.rb +4 -2
  74. data/spec/integration/verify/v2/service/entity/challenge_spec.rb +4 -12
  75. data/spec/integration/verify/v2/service/entity/factor_spec.rb +5 -15
  76. data/spec/integration/verify/v2/service/entity_spec.rb +4 -12
  77. data/spec/integration/video/v1/room/room_recording_rule_spec.rb +89 -0
  78. data/spec/integration/video/v1/room_spec.rb +10 -5
  79. data/spec/jwt/access_token_spec.rb +9 -1
  80. data/twilio-ruby.gemspec +1 -1
  81. metadata +13 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c548240307368086558968434b8b50b3ead23dbba48cb53ebc963eaf1e936702
4
- data.tar.gz: 937b105aaf095225ed79d78ebd26fd6801ada93882d7d548aa8cdcec7fe66276
3
+ metadata.gz: f9778eed7f661d600a460a4f11f0cc9c4ecb1f9327ae1fa0bc7f17701b45f783
4
+ data.tar.gz: 1efe2eaf64fed893801694ec1f9dd68a40ac98be3e444ef2989b7acf520331bc
5
5
  SHA512:
6
- metadata.gz: 6ee5a02adf682fe9f45ae37a6a514b5fb680fbc45e6c8bcf9425ee12c1f8a82e91e2716a0a9082977a1dab0f43e440a8a39eaf83f984548cff035903f9c137a9
7
- data.tar.gz: f1fc0070b27646e0f4eb75564837c0cb7dec03aea47622da9df32e996344dfd5b0482fce8548af8ca693a45b5548b9c2e888f9d1daafabc59fa331d14441921b
6
+ metadata.gz: 147bb2ba1d376c0d8f7e0335c0c744ba07696cf05ca1368a586750ec746692715a5415b1179c4b8485cec6e42670192704b288cf993cd25e8485888f348da2f4
7
+ data.tar.gz: 61de95cc6c57cf05b0acf95e6f4ab218402651d3fea976cb88f21527e868b184fb6a0ac9b278e3e6597c31e233b0391801d1d7f660a57c4468189f605a51bd15
data/CHANGES.md CHANGED
@@ -1,6 +1,34 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ [2020-11-05] Version 5.42.0
5
+ ---------------------------
6
+ **Library - Feature**
7
+ - [PR #537](https://github.com/twilio/twilio-ruby/pull/537): Add region to AccessToken. Thanks to [@ryan-rowland](https://github.com/ryan-rowland)!
8
+
9
+ **Api**
10
+ - Added `verify-push` to `usage_record` API
11
+
12
+ **Bulkexports**
13
+ - When creating a custom export the StartDay, EndDay, and FriendlyName fields were required but this was not reflected in the API documentation. The API itself failed the request without these fields. **(breaking change)**
14
+ - Added property descriptions for Custom Export create method
15
+ - Clarified WebhookUrl and WebhookMethod must be provided together for Custom Export
16
+
17
+ **Insights**
18
+ - Added video room and participant summary apis.
19
+
20
+ **Ip_messaging**
21
+ - Create separate definition for ip-messaging
22
+ - Restore v2 endpoints for ip-messaging
23
+
24
+ **Verify**
25
+ - Verify Push madurity were updated from `preview` to `beta`
26
+ - `twilio_sandbox_mode` header was removed from Verify Push resources **(breaking change)**
27
+
28
+ **Video**
29
+ - [Rooms] Add Recording Rules API
30
+
31
+
4
32
  [2020-10-14] Version 5.41.0
5
33
  ---------------------------
6
34
  **Ai**
File without changes
@@ -19,13 +19,13 @@ Closes #2
19
19
  A short description of what this PR does.
20
20
 
21
21
  ### Checklist
22
- - [ ] I acknowledge that all my contributions will be made under the project's license
22
+ - [x] I acknowledge that all my contributions will be made under the project's license
23
23
  - [ ] I have made a material change to the repo (functionality, testing, spelling, grammar)
24
- - [ ] I have read the [Contribution Guidelines](CONTRIBUTING.md) and my PR follows them
24
+ - [ ] I have read the [Contribution Guidelines](https://github.com/twilio/twilio-ruby/blob/main/CONTRIBUTING.md) and my PR follows them
25
25
  - [ ] I have titled the PR appropriately
26
26
  - [ ] I have updated my branch with the main branch
27
27
  - [ ] I have added tests that prove my fix is effective or that my feature works
28
- - [ ] I have added necessary documentation about the functionality in the appropriate .md file
28
+ - [ ] I have added the necessary documentation about the functionality in the appropriate .md file
29
29
  - [ ] I have added inline documentation to the code I modified
30
30
 
31
31
  If you have questions, please file a [support ticket](https://twilio.com/help/contact), or create a GitHub Issue in this repository.
data/README.md CHANGED
@@ -34,13 +34,13 @@ This library supports the following Ruby implementations:
34
34
  To install using [Bundler][bundler] grab the latest stable version:
35
35
 
36
36
  ```ruby
37
- gem 'twilio-ruby', '~> 5.41.0'
37
+ gem 'twilio-ruby', '~> 5.42.0'
38
38
  ```
39
39
 
40
40
  To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
41
41
 
42
42
  ```bash
43
- gem install twilio-ruby -v 5.41.0
43
+ gem install twilio-ruby -v 5.42.0
44
44
  ```
45
45
 
46
46
  To build and install the development branch yourself from the latest source:
@@ -20,7 +20,8 @@ module Twilio
20
20
  :grants,
21
21
  :nbf,
22
22
  :ttl,
23
- :valid_until
23
+ :valid_until,
24
+ :region
24
25
 
25
26
  def initialize(
26
27
  account_sid,
@@ -30,7 +31,8 @@ module Twilio
30
31
  identity: nil,
31
32
  nbf: nil,
32
33
  ttl: 3600,
33
- valid_until: nil
34
+ valid_until: nil,
35
+ region: nil
34
36
  )
35
37
  super(secret_key: secret,
36
38
  issuer: signing_key_sid,
@@ -46,6 +48,7 @@ module Twilio
46
48
  @grants = grants
47
49
  @ttl = ttl
48
50
  @valid_until = valid_until
51
+ @region = region
49
52
  end
50
53
 
51
54
  def add_grant(grant)
@@ -76,6 +79,8 @@ module Twilio
76
79
  cty: 'twilio-fpa;v=1'
77
80
  }
78
81
 
82
+ headers[:twr] = region unless region&.nil?
83
+
79
84
  headers
80
85
  end
81
86
 
@@ -31,8 +31,6 @@ module Twilio
31
31
  # Lists DayInstance records from the API as a list.
32
32
  # Unlike stream(), this operation is eager and will load `limit` records into
33
33
  # memory before returning.
34
- # @param [String] next_token The next_token
35
- # @param [String] previous_token The previous_token
36
34
  # @param [Integer] limit Upper limit for the number of records to return. stream()
37
35
  # guarantees to never return more than limit. Default is no limit
38
36
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -40,21 +38,14 @@ module Twilio
40
38
  # but a limit is defined, stream() will attempt to read the limit with the most
41
39
  # efficient page size, i.e. min(limit, 1000)
42
40
  # @return [Array] Array of up to limit results
43
- def list(next_token: :unset, previous_token: :unset, limit: nil, page_size: nil)
44
- self.stream(
45
- next_token: next_token,
46
- previous_token: previous_token,
47
- limit: limit,
48
- page_size: page_size
49
- ).entries
41
+ def list(limit: nil, page_size: nil)
42
+ self.stream(limit: limit, page_size: page_size).entries
50
43
  end
51
44
 
52
45
  ##
53
46
  # Streams DayInstance records from the API as an Enumerable.
54
47
  # This operation lazily loads records as efficiently as possible until the limit
55
48
  # is reached.
56
- # @param [String] next_token The next_token
57
- # @param [String] previous_token The previous_token
58
49
  # @param [Integer] limit Upper limit for the number of records to return. stream()
59
50
  # guarantees to never return more than limit. Default is no limit.
60
51
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -62,14 +53,10 @@ module Twilio
62
53
  # but a limit is defined, stream() will attempt to read the limit with the most
63
54
  # efficient page size, i.e. min(limit, 1000)
64
55
  # @return [Enumerable] Enumerable that will yield up to limit results
65
- def stream(next_token: :unset, previous_token: :unset, limit: nil, page_size: nil)
56
+ def stream(limit: nil, page_size: nil)
66
57
  limits = @version.read_limits(limit, page_size)
67
58
 
68
- page = self.page(
69
- next_token: next_token,
70
- previous_token: previous_token,
71
- page_size: limits[:page_size],
72
- )
59
+ page = self.page(page_size: limits[:page_size], )
73
60
 
74
61
  @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
75
62
  end
@@ -91,16 +78,12 @@ module Twilio
91
78
  ##
92
79
  # Retrieve a single page of DayInstance records from the API.
93
80
  # Request is executed immediately.
94
- # @param [String] next_token The next_token
95
- # @param [String] previous_token The previous_token
96
81
  # @param [String] page_token PageToken provided by the API
97
82
  # @param [Integer] page_number Page Number, this value is simply for client state
98
83
  # @param [Integer] page_size Number of records to return, defaults to 50
99
84
  # @return [Page] Page of DayInstance
100
- def page(next_token: :unset, previous_token: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
85
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
101
86
  params = Twilio::Values.of({
102
- 'NextToken' => next_token,
103
- 'PreviousToken' => previous_token,
104
87
  'PageToken' => page_token,
105
88
  'Page' => page_number,
106
89
  'PageSize' => page_size,
@@ -31,10 +31,6 @@ module Twilio
31
31
  # Lists ExportCustomJobInstance records from the API as a list.
32
32
  # Unlike stream(), this operation is eager and will load `limit` records into
33
33
  # memory before returning.
34
- # @param [String] next_token The token for the next page of job results, and may
35
- # be null if there are no more pages
36
- # @param [String] previous_token The token for the previous page of results, and
37
- # may be null if this is the first page
38
34
  # @param [Integer] limit Upper limit for the number of records to return. stream()
39
35
  # guarantees to never return more than limit. Default is no limit
40
36
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -42,23 +38,14 @@ module Twilio
42
38
  # but a limit is defined, stream() will attempt to read the limit with the most
43
39
  # efficient page size, i.e. min(limit, 1000)
44
40
  # @return [Array] Array of up to limit results
45
- def list(next_token: :unset, previous_token: :unset, limit: nil, page_size: nil)
46
- self.stream(
47
- next_token: next_token,
48
- previous_token: previous_token,
49
- limit: limit,
50
- page_size: page_size
51
- ).entries
41
+ def list(limit: nil, page_size: nil)
42
+ self.stream(limit: limit, page_size: page_size).entries
52
43
  end
53
44
 
54
45
  ##
55
46
  # Streams ExportCustomJobInstance records from the API as an Enumerable.
56
47
  # This operation lazily loads records as efficiently as possible until the limit
57
48
  # is reached.
58
- # @param [String] next_token The token for the next page of job results, and may
59
- # be null if there are no more pages
60
- # @param [String] previous_token The token for the previous page of results, and
61
- # may be null if this is the first page
62
49
  # @param [Integer] limit Upper limit for the number of records to return. stream()
63
50
  # guarantees to never return more than limit. Default is no limit.
64
51
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -66,14 +53,10 @@ module Twilio
66
53
  # but a limit is defined, stream() will attempt to read the limit with the most
67
54
  # efficient page size, i.e. min(limit, 1000)
68
55
  # @return [Enumerable] Enumerable that will yield up to limit results
69
- def stream(next_token: :unset, previous_token: :unset, limit: nil, page_size: nil)
56
+ def stream(limit: nil, page_size: nil)
70
57
  limits = @version.read_limits(limit, page_size)
71
58
 
72
- page = self.page(
73
- next_token: next_token,
74
- previous_token: previous_token,
75
- page_size: limits[:page_size],
76
- )
59
+ page = self.page(page_size: limits[:page_size], )
77
60
 
78
61
  @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
79
62
  end
@@ -95,18 +78,12 @@ module Twilio
95
78
  ##
96
79
  # Retrieve a single page of ExportCustomJobInstance records from the API.
97
80
  # Request is executed immediately.
98
- # @param [String] next_token The token for the next page of job results, and may
99
- # be null if there are no more pages
100
- # @param [String] previous_token The token for the previous page of results, and
101
- # may be null if this is the first page
102
81
  # @param [String] page_token PageToken provided by the API
103
82
  # @param [Integer] page_number Page Number, this value is simply for client state
104
83
  # @param [Integer] page_size Number of records to return, defaults to 50
105
84
  # @return [Page] Page of ExportCustomJobInstance
106
- def page(next_token: :unset, previous_token: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
85
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
107
86
  params = Twilio::Values.of({
108
- 'NextToken' => next_token,
109
- 'PreviousToken' => previous_token,
110
87
  'PageToken' => page_token,
111
88
  'Page' => page_number,
112
89
  'PageSize' => page_size,
@@ -132,18 +109,26 @@ module Twilio
132
109
 
133
110
  ##
134
111
  # Create the ExportCustomJobInstance
135
- # @param [String] friendly_name The friendly_name
136
- # @param [String] start_day The start_day
137
- # @param [String] end_day The end_day
138
- # @param [String] webhook_url The webhook_url
139
- # @param [String] webhook_method The webhook_method
140
- # @param [String] email The email
112
+ # @param [String] start_day The start day for the custom export specified as a
113
+ # string in the format of yyyy-mm-dd
114
+ # @param [String] end_day The end day for the custom export specified as a string
115
+ # in the format of yyyy-mm-dd. End day is inclusive and must be 2 days earlier
116
+ # than the current UTC day.
117
+ # @param [String] friendly_name The friendly name specified when creating the job
118
+ # @param [String] webhook_url The optional webhook url called on completion of the
119
+ # job. If this is supplied, `WebhookMethod` must also be supplied. If you set
120
+ # neither webhook nor email, you will have to check your job's status manually.
121
+ # @param [String] webhook_method This is the method used to call the webhook on
122
+ # completion of the job. If this is supplied, `WebhookUrl` must also be supplied.
123
+ # @param [String] email The optional email to send the completion notification to.
124
+ # You can set both webhook, and email, or one or the other. If you set neither,
125
+ # the job will run but you will have to query to determine your job's status.
141
126
  # @return [ExportCustomJobInstance] Created ExportCustomJobInstance
142
- def create(friendly_name: :unset, start_day: :unset, end_day: :unset, webhook_url: :unset, webhook_method: :unset, email: :unset)
127
+ def create(start_day: nil, end_day: nil, friendly_name: nil, webhook_url: :unset, webhook_method: :unset, email: :unset)
143
128
  data = Twilio::Values.of({
144
- 'FriendlyName' => friendly_name,
145
129
  'StartDay' => start_day,
146
130
  'EndDay' => end_day,
131
+ 'FriendlyName' => friendly_name,
147
132
  'WebhookUrl' => webhook_url,
148
133
  'WebhookMethod' => webhook_method,
149
134
  'Email' => email,
@@ -231,13 +216,13 @@ module Twilio
231
216
  end
232
217
 
233
218
  ##
234
- # @return [String] The start time for the export specified when creating the job
219
+ # @return [String] The start day for the custom export specified as a string in the format of yyyy-MM-dd
235
220
  def start_day
236
221
  @properties['start_day']
237
222
  end
238
223
 
239
224
  ##
240
- # @return [String] The end time for the export specified when creating the job
225
+ # @return [String] The end day for the custom export specified as a string in the format of yyyy-MM-dd. This will be the last day exported. For instance, to export a single day, choose the same day for start and end day. To export the first 4 days of July, you would set the start date to 2020-07-01 and the end date to 2020-07-04. The end date must be the UTC day before yesterday.
241
226
  def end_day
242
227
  @properties['end_day']
243
228
  end
@@ -261,13 +246,13 @@ module Twilio
261
246
  end
262
247
 
263
248
  ##
264
- # @return [String] The job_sid returned when the export was created
249
+ # @return [String] The unique job_sid returned when the custom export was created. This can be used to look up the status of the job.
265
250
  def job_sid
266
251
  @properties['job_sid']
267
252
  end
268
253
 
269
254
  ##
270
- # @return [Hash] The details
255
+ # @return [Hash] The details of a job state which is an object that contains a status string, a day count integer, and list of days in the job
271
256
  def details
272
257
  @properties['details']
273
258
  end
@@ -36,6 +36,14 @@ module Twilio
36
36
  self.v1.calls(sid)
37
37
  end
38
38
 
39
+ ##
40
+ # @param [String] room_sid The room_sid
41
+ # @return [Twilio::REST::Insights::V1::RoomInstance] if room_sid was passed.
42
+ # @return [Twilio::REST::Insights::V1::RoomList]
43
+ def rooms(room_sid=:unset)
44
+ self.v1.rooms(room_sid)
45
+ end
46
+
39
47
  ##
40
48
  # Provide a user friendly representation
41
49
  def to_s
@@ -16,6 +16,7 @@ module Twilio
16
16
  super
17
17
  @version = 'v1'
18
18
  @calls = nil
19
+ @rooms = nil
19
20
  end
20
21
 
21
22
  ##
@@ -32,6 +33,20 @@ module Twilio
32
33
  end
33
34
  end
34
35
 
36
+ ##
37
+ # @param [String] room_sid The room_sid
38
+ # @return [Twilio::REST::Insights::V1::RoomContext] if room_sid was passed.
39
+ # @return [Twilio::REST::Insights::V1::RoomList]
40
+ def rooms(room_sid=:unset)
41
+ if room_sid.nil?
42
+ raise ArgumentError, 'room_sid cannot be nil'
43
+ elsif room_sid == :unset
44
+ @rooms ||= RoomList.new self
45
+ else
46
+ RoomContext.new(self, room_sid)
47
+ end
48
+ end
49
+
35
50
  ##
36
51
  # Provide a user friendly representation
37
52
  def to_s
@@ -0,0 +1,487 @@
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 Insights < Domain
12
+ class V1 < Version
13
+ ##
14
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
15
+ class RoomList < ListResource
16
+ ##
17
+ # Initialize the RoomList
18
+ # @param [Version] version Version that contains the resource
19
+ # @return [RoomList] RoomList
20
+ def initialize(version)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {}
25
+ @uri = "/Video/Rooms"
26
+ end
27
+
28
+ ##
29
+ # Lists RoomInstance records from the API as a list.
30
+ # Unlike stream(), this operation is eager and will load `limit` records into
31
+ # memory before returning.
32
+ # @param [room.RoomType] room_type The room_type
33
+ # @param [room.Codec] codec The codec
34
+ # @param [String] room_name The room_name
35
+ # @param [Time] created_after The created_after
36
+ # @param [Time] created_before The created_before
37
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
38
+ # guarantees to never return more than limit. Default is no limit
39
+ # @param [Integer] page_size Number of records to fetch per request, when
40
+ # not set will use the default value of 50 records. If no page_size is defined
41
+ # but a limit is defined, stream() will attempt to read the limit with the most
42
+ # efficient page size, i.e. min(limit, 1000)
43
+ # @return [Array] Array of up to limit results
44
+ def list(room_type: :unset, codec: :unset, room_name: :unset, created_after: :unset, created_before: :unset, limit: nil, page_size: nil)
45
+ self.stream(
46
+ room_type: room_type,
47
+ codec: codec,
48
+ room_name: room_name,
49
+ created_after: created_after,
50
+ created_before: created_before,
51
+ limit: limit,
52
+ page_size: page_size
53
+ ).entries
54
+ end
55
+
56
+ ##
57
+ # Streams RoomInstance records from the API as an Enumerable.
58
+ # This operation lazily loads records as efficiently as possible until the limit
59
+ # is reached.
60
+ # @param [room.RoomType] room_type The room_type
61
+ # @param [room.Codec] codec The codec
62
+ # @param [String] room_name The room_name
63
+ # @param [Time] created_after The created_after
64
+ # @param [Time] created_before The created_before
65
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
66
+ # guarantees to never return more than limit. Default is no limit.
67
+ # @param [Integer] page_size Number of records to fetch per request, when
68
+ # not set will use the default value of 50 records. If no page_size is defined
69
+ # but a limit is defined, stream() will attempt to read the limit with the most
70
+ # efficient page size, i.e. min(limit, 1000)
71
+ # @return [Enumerable] Enumerable that will yield up to limit results
72
+ def stream(room_type: :unset, codec: :unset, room_name: :unset, created_after: :unset, created_before: :unset, limit: nil, page_size: nil)
73
+ limits = @version.read_limits(limit, page_size)
74
+
75
+ page = self.page(
76
+ room_type: room_type,
77
+ codec: codec,
78
+ room_name: room_name,
79
+ created_after: created_after,
80
+ created_before: created_before,
81
+ page_size: limits[:page_size],
82
+ )
83
+
84
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
85
+ end
86
+
87
+ ##
88
+ # When passed a block, yields RoomInstance records from the API.
89
+ # This operation lazily loads records as efficiently as possible until the limit
90
+ # is reached.
91
+ def each
92
+ limits = @version.read_limits
93
+
94
+ page = self.page(page_size: limits[:page_size], )
95
+
96
+ @version.stream(page,
97
+ limit: limits[:limit],
98
+ page_limit: limits[:page_limit]).each {|x| yield x}
99
+ end
100
+
101
+ ##
102
+ # Retrieve a single page of RoomInstance records from the API.
103
+ # Request is executed immediately.
104
+ # @param [room.RoomType] room_type The room_type
105
+ # @param [room.Codec] codec The codec
106
+ # @param [String] room_name The room_name
107
+ # @param [Time] created_after The created_after
108
+ # @param [Time] created_before The created_before
109
+ # @param [String] page_token PageToken provided by the API
110
+ # @param [Integer] page_number Page Number, this value is simply for client state
111
+ # @param [Integer] page_size Number of records to return, defaults to 50
112
+ # @return [Page] Page of RoomInstance
113
+ def page(room_type: :unset, codec: :unset, room_name: :unset, created_after: :unset, created_before: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
114
+ params = Twilio::Values.of({
115
+ 'RoomType' => Twilio.serialize_list(room_type) { |e| e },
116
+ 'Codec' => Twilio.serialize_list(codec) { |e| e },
117
+ 'RoomName' => room_name,
118
+ 'CreatedAfter' => Twilio.serialize_iso8601_datetime(created_after),
119
+ 'CreatedBefore' => Twilio.serialize_iso8601_datetime(created_before),
120
+ 'PageToken' => page_token,
121
+ 'Page' => page_number,
122
+ 'PageSize' => page_size,
123
+ })
124
+
125
+ response = @version.page('GET', @uri, params: params)
126
+
127
+ RoomPage.new(@version, response, @solution)
128
+ end
129
+
130
+ ##
131
+ # Retrieve a single page of RoomInstance records from the API.
132
+ # Request is executed immediately.
133
+ # @param [String] target_url API-generated URL for the requested results page
134
+ # @return [Page] Page of RoomInstance
135
+ def get_page(target_url)
136
+ response = @version.domain.request(
137
+ 'GET',
138
+ target_url
139
+ )
140
+ RoomPage.new(@version, response, @solution)
141
+ end
142
+
143
+ ##
144
+ # Provide a user friendly representation
145
+ def to_s
146
+ '#<Twilio.Insights.V1.RoomList>'
147
+ end
148
+ end
149
+
150
+ ##
151
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
152
+ class RoomPage < Page
153
+ ##
154
+ # Initialize the RoomPage
155
+ # @param [Version] version Version that contains the resource
156
+ # @param [Response] response Response from the API
157
+ # @param [Hash] solution Path solution for the resource
158
+ # @return [RoomPage] RoomPage
159
+ def initialize(version, response, solution)
160
+ super(version, response)
161
+
162
+ # Path Solution
163
+ @solution = solution
164
+ end
165
+
166
+ ##
167
+ # Build an instance of RoomInstance
168
+ # @param [Hash] payload Payload response from the API
169
+ # @return [RoomInstance] RoomInstance
170
+ def get_instance(payload)
171
+ RoomInstance.new(@version, payload, )
172
+ end
173
+
174
+ ##
175
+ # Provide a user friendly representation
176
+ def to_s
177
+ '<Twilio.Insights.V1.RoomPage>'
178
+ end
179
+ end
180
+
181
+ ##
182
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
183
+ class RoomContext < InstanceContext
184
+ ##
185
+ # Initialize the RoomContext
186
+ # @param [Version] version Version that contains the resource
187
+ # @param [String] room_sid The room_sid
188
+ # @return [RoomContext] RoomContext
189
+ def initialize(version, room_sid)
190
+ super(version)
191
+
192
+ # Path Solution
193
+ @solution = {room_sid: room_sid, }
194
+ @uri = "/Video/Rooms/#{@solution[:room_sid]}"
195
+
196
+ # Dependents
197
+ @participants = nil
198
+ end
199
+
200
+ ##
201
+ # Fetch the RoomInstance
202
+ # @return [RoomInstance] Fetched RoomInstance
203
+ def fetch
204
+ payload = @version.fetch('GET', @uri)
205
+
206
+ RoomInstance.new(@version, payload, room_sid: @solution[:room_sid], )
207
+ end
208
+
209
+ ##
210
+ # Access the participants
211
+ # @return [ParticipantList]
212
+ # @return [ParticipantContext] if participant_sid was passed.
213
+ def participants(participant_sid=:unset)
214
+ raise ArgumentError, 'participant_sid cannot be nil' if participant_sid.nil?
215
+
216
+ if participant_sid != :unset
217
+ return ParticipantContext.new(@version, @solution[:room_sid], participant_sid, )
218
+ end
219
+
220
+ unless @participants
221
+ @participants = ParticipantList.new(@version, room_sid: @solution[:room_sid], )
222
+ end
223
+
224
+ @participants
225
+ end
226
+
227
+ ##
228
+ # Provide a user friendly representation
229
+ def to_s
230
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
231
+ "#<Twilio.Insights.V1.RoomContext #{context}>"
232
+ end
233
+
234
+ ##
235
+ # Provide a detailed, user friendly representation
236
+ def inspect
237
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
238
+ "#<Twilio.Insights.V1.RoomContext #{context}>"
239
+ end
240
+ end
241
+
242
+ ##
243
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
244
+ class RoomInstance < InstanceResource
245
+ ##
246
+ # Initialize the RoomInstance
247
+ # @param [Version] version Version that contains the resource
248
+ # @param [Hash] payload payload that contains response from Twilio
249
+ # @param [String] room_sid The room_sid
250
+ # @return [RoomInstance] RoomInstance
251
+ def initialize(version, payload, room_sid: nil)
252
+ super(version)
253
+
254
+ # Marshaled Properties
255
+ @properties = {
256
+ 'account_sid' => payload['account_sid'],
257
+ 'room_sid' => payload['room_sid'],
258
+ 'room_name' => payload['room_name'],
259
+ 'create_time' => Twilio.deserialize_iso8601_datetime(payload['create_time']),
260
+ 'end_time' => Twilio.deserialize_iso8601_datetime(payload['end_time']),
261
+ 'room_type' => payload['room_type'],
262
+ 'room_status' => payload['room_status'],
263
+ 'status_callback' => payload['status_callback'],
264
+ 'status_callback_method' => payload['status_callback_method'],
265
+ 'created_method' => payload['created_method'],
266
+ 'end_reason' => payload['end_reason'],
267
+ 'max_participants' => payload['max_participants'] == nil ? payload['max_participants'] : payload['max_participants'].to_i,
268
+ 'unique_participants' => payload['unique_participants'] == nil ? payload['unique_participants'] : payload['unique_participants'].to_i,
269
+ 'unique_participant_identities' => payload['unique_participant_identities'] == nil ? payload['unique_participant_identities'] : payload['unique_participant_identities'].to_i,
270
+ 'concurrent_participants' => payload['concurrent_participants'] == nil ? payload['concurrent_participants'] : payload['concurrent_participants'].to_i,
271
+ 'max_concurrent_participants' => payload['max_concurrent_participants'] == nil ? payload['max_concurrent_participants'] : payload['max_concurrent_participants'].to_i,
272
+ 'codecs' => payload['codecs'],
273
+ 'media_region' => payload['media_region'],
274
+ 'duration_sec' => payload['duration_sec'].to_i,
275
+ 'total_participant_duration_sec' => payload['total_participant_duration_sec'].to_i,
276
+ 'total_recording_duration_sec' => payload['total_recording_duration_sec'].to_i,
277
+ 'processing_state' => payload['processing_state'],
278
+ 'recording_enabled' => payload['recording_enabled'],
279
+ 'edge_location' => payload['edge_location'],
280
+ 'url' => payload['url'],
281
+ 'links' => payload['links'],
282
+ }
283
+
284
+ # Context
285
+ @instance_context = nil
286
+ @params = {'room_sid' => room_sid || @properties['room_sid'], }
287
+ end
288
+
289
+ ##
290
+ # Generate an instance context for the instance, the context is capable of
291
+ # performing various actions. All instance actions are proxied to the context
292
+ # @return [RoomContext] RoomContext for this RoomInstance
293
+ def context
294
+ unless @instance_context
295
+ @instance_context = RoomContext.new(@version, @params['room_sid'], )
296
+ end
297
+ @instance_context
298
+ end
299
+
300
+ ##
301
+ # @return [String] The account_sid
302
+ def account_sid
303
+ @properties['account_sid']
304
+ end
305
+
306
+ ##
307
+ # @return [String] The room_sid
308
+ def room_sid
309
+ @properties['room_sid']
310
+ end
311
+
312
+ ##
313
+ # @return [String] The room_name
314
+ def room_name
315
+ @properties['room_name']
316
+ end
317
+
318
+ ##
319
+ # @return [Time] The create_time
320
+ def create_time
321
+ @properties['create_time']
322
+ end
323
+
324
+ ##
325
+ # @return [Time] The end_time
326
+ def end_time
327
+ @properties['end_time']
328
+ end
329
+
330
+ ##
331
+ # @return [room.RoomType] The room_type
332
+ def room_type
333
+ @properties['room_type']
334
+ end
335
+
336
+ ##
337
+ # @return [room.RoomStatus] The room_status
338
+ def room_status
339
+ @properties['room_status']
340
+ end
341
+
342
+ ##
343
+ # @return [String] The status_callback
344
+ def status_callback
345
+ @properties['status_callback']
346
+ end
347
+
348
+ ##
349
+ # @return [String] The status_callback_method
350
+ def status_callback_method
351
+ @properties['status_callback_method']
352
+ end
353
+
354
+ ##
355
+ # @return [room.CreatedMethod] The created_method
356
+ def created_method
357
+ @properties['created_method']
358
+ end
359
+
360
+ ##
361
+ # @return [room.EndReason] The end_reason
362
+ def end_reason
363
+ @properties['end_reason']
364
+ end
365
+
366
+ ##
367
+ # @return [String] The max_participants
368
+ def max_participants
369
+ @properties['max_participants']
370
+ end
371
+
372
+ ##
373
+ # @return [String] The unique_participants
374
+ def unique_participants
375
+ @properties['unique_participants']
376
+ end
377
+
378
+ ##
379
+ # @return [String] The unique_participant_identities
380
+ def unique_participant_identities
381
+ @properties['unique_participant_identities']
382
+ end
383
+
384
+ ##
385
+ # @return [String] The concurrent_participants
386
+ def concurrent_participants
387
+ @properties['concurrent_participants']
388
+ end
389
+
390
+ ##
391
+ # @return [String] The max_concurrent_participants
392
+ def max_concurrent_participants
393
+ @properties['max_concurrent_participants']
394
+ end
395
+
396
+ ##
397
+ # @return [room.Codec] The codecs
398
+ def codecs
399
+ @properties['codecs']
400
+ end
401
+
402
+ ##
403
+ # @return [room.TwilioRealm] The media_region
404
+ def media_region
405
+ @properties['media_region']
406
+ end
407
+
408
+ ##
409
+ # @return [String] The duration_sec
410
+ def duration_sec
411
+ @properties['duration_sec']
412
+ end
413
+
414
+ ##
415
+ # @return [String] The total_participant_duration_sec
416
+ def total_participant_duration_sec
417
+ @properties['total_participant_duration_sec']
418
+ end
419
+
420
+ ##
421
+ # @return [String] The total_recording_duration_sec
422
+ def total_recording_duration_sec
423
+ @properties['total_recording_duration_sec']
424
+ end
425
+
426
+ ##
427
+ # @return [room.ProcessingState] The processing_state
428
+ def processing_state
429
+ @properties['processing_state']
430
+ end
431
+
432
+ ##
433
+ # @return [Boolean] The recording_enabled
434
+ def recording_enabled
435
+ @properties['recording_enabled']
436
+ end
437
+
438
+ ##
439
+ # @return [room.EdgeLocation] The edge_location
440
+ def edge_location
441
+ @properties['edge_location']
442
+ end
443
+
444
+ ##
445
+ # @return [String] The url
446
+ def url
447
+ @properties['url']
448
+ end
449
+
450
+ ##
451
+ # @return [String] The links
452
+ def links
453
+ @properties['links']
454
+ end
455
+
456
+ ##
457
+ # Fetch the RoomInstance
458
+ # @return [RoomInstance] Fetched RoomInstance
459
+ def fetch
460
+ context.fetch
461
+ end
462
+
463
+ ##
464
+ # Access the participants
465
+ # @return [participants] participants
466
+ def participants
467
+ context.participants
468
+ end
469
+
470
+ ##
471
+ # Provide a user friendly representation
472
+ def to_s
473
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
474
+ "<Twilio.Insights.V1.RoomInstance #{values}>"
475
+ end
476
+
477
+ ##
478
+ # Provide a detailed, user friendly representation
479
+ def inspect
480
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
481
+ "<Twilio.Insights.V1.RoomInstance #{values}>"
482
+ end
483
+ end
484
+ end
485
+ end
486
+ end
487
+ end