twilio-ruby 5.19.0 → 5.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +13 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/api.rb +16 -13
  5. data/lib/twilio-ruby/rest/api/v2010/account/address.rb +85 -88
  6. data/lib/twilio-ruby/rest/api/v2010/account/address/dependent_phone_number.rb +4 -4
  7. data/lib/twilio-ruby/rest/api/v2010/account/application.rb +135 -146
  8. data/lib/twilio-ruby/rest/api/v2010/account/authorized_connect_app.rb +21 -17
  9. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb +14 -8
  10. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/local.rb +150 -166
  11. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/machine_to_machine.rb +174 -79
  12. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/mobile.rb +147 -160
  13. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/national.rb +174 -79
  14. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/shared_cost.rb +174 -79
  15. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/toll_free.rb +147 -160
  16. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/voip.rb +174 -79
  17. data/lib/twilio-ruby/rest/api/v2010/account/connect_app.rb +51 -51
  18. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +246 -251
  19. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb +31 -26
  20. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.rb +34 -26
  21. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +109 -112
  22. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +108 -112
  23. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +108 -112
  24. data/lib/twilio-ruby/rest/api/v2010/account/message/feedback.rb +21 -11
  25. data/lib/twilio-ruby/rest/api/v2010/account/new_key.rb +7 -6
  26. data/lib/twilio-ruby/rest/api/v2010/account/new_signing_key.rb +7 -6
  27. data/lib/twilio-ruby/rest/api/v2010/account/notification.rb +32 -25
  28. data/lib/twilio-ruby/rest/api/v2010/account/outgoing_caller_id.rb +36 -36
  29. data/lib/twilio-ruby/rest/api/v2010/account/sip.rb +2 -1
  30. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb +70 -66
  31. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types.rb +10 -10
  32. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_calls_mapping.rb +14 -14
  33. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_calls_mapping/auth_calls_credential_list_mapping.rb +26 -23
  34. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_calls_mapping/auth_calls_ip_access_control_list_mapping.rb +26 -23
  35. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_registrations_mapping.rb +12 -12
  36. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_registrations_mapping/auth_registrations_credential_list_mapping.rb +26 -23
  37. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/credential_list_mapping.rb +4 -4
  38. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.rb +4 -4
  39. data/lib/twilio-ruby/rest/api/v2010/account/token.rb +11 -9
  40. data/lib/twilio-ruby/rest/api/v2010/account/usage.rb +2 -1
  41. data/lib/twilio-ruby/rest/api/v2010/account/usage/record.rb +56 -47
  42. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/all_time.rb +59 -44
  43. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/daily.rb +59 -44
  44. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/last_month.rb +59 -47
  45. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/monthly.rb +59 -44
  46. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/this_month.rb +59 -44
  47. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/today.rb +59 -44
  48. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/yearly.rb +59 -44
  49. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/yesterday.rb +59 -44
  50. data/lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb +76 -74
  51. data/lib/twilio-ruby/rest/authy.rb +8 -8
  52. data/lib/twilio-ruby/rest/authy/v1.rb +15 -15
  53. data/lib/twilio-ruby/rest/client.rb +16 -13
  54. data/lib/twilio-ruby/rest/messaging.rb +15 -0
  55. data/lib/twilio-ruby/rest/messaging/v1.rb +23 -0
  56. data/lib/twilio-ruby/rest/messaging/v1/session.rb +482 -0
  57. data/lib/twilio-ruby/rest/messaging/v1/session/message.rb +434 -0
  58. data/lib/twilio-ruby/rest/messaging/v1/session/participant.rb +458 -0
  59. data/lib/twilio-ruby/rest/messaging/v1/webhook.rb +285 -0
  60. data/lib/twilio-ruby/rest/preview.rb +8 -8
  61. data/lib/twilio-ruby/rest/preview/marketplace.rb +13 -13
  62. data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +3 -2
  63. data/lib/twilio-ruby/rest/video.rb +9 -9
  64. data/lib/twilio-ruby/rest/video/v1.rb +16 -16
  65. data/lib/twilio-ruby/rest/video/v1/composition.rb +7 -6
  66. data/lib/twilio-ruby/rest/video/v1/composition_hook.rb +37 -21
  67. data/lib/twilio-ruby/rest/video/v1/recording.rb +12 -3
  68. data/lib/twilio-ruby/security/request_validator.rb +2 -2
  69. data/lib/twilio-ruby/version.rb +1 -1
  70. data/spec/integration/messaging/v1/session/message_spec.rb +238 -0
  71. data/spec/integration/messaging/v1/session/participant_spec.rb +256 -0
  72. data/spec/integration/messaging/v1/session_spec.rb +223 -0
  73. data/spec/integration/messaging/v1/webhook_spec.rb +92 -0
  74. data/spec/integration/video/v1/composition_hook_spec.rb +1 -1
  75. data/spec/security/request_validator_spec.rb +5 -7
  76. metadata +14 -2
@@ -154,8 +154,8 @@ module Twilio
154
154
  # @param [String] room_sid Group Room SID owning the media tracks to be used as
155
155
  # Composition sources.
156
156
  # @param [Hash] video_layout A JSON object defining the video layout of the
157
- # Composition in terms of regions. See the section [Managing Video
158
- # Layouts](#managing-video-layouts) below for further information.
157
+ # Composition in terms of regions. See the section [Specifying Video
158
+ # Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) below for further information.
159
159
  # @param [String] audio_sources An array of audio sources to merge. All the
160
160
  # specified sources must belong to the same Group Room. It can include:
161
161
  #
@@ -193,8 +193,9 @@ module Twilio
193
193
  #
194
194
  # Note that the `Resolution` implicitly imposes an aspect ratio to the resulting
195
195
  # composition. When the original video tracks get constrained by this aspect ratio
196
- # they are scaled-down to fit. You can find detailed information in the [Managing
197
- # Video Layouts](#managing-video-layouts) section. Defaults to `640x480`.
196
+ # they are scaled-down to fit. You can find detailed information in the
197
+ # [Specifying Video
198
+ # Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) section. Defaults to `640x480`.
198
199
  # @param [composition.Format] format Container format of the Composition media
199
200
  # file. Can be any of the following: `mp4`, `webm`. The use of `mp4` or `webm`
200
201
  # makes mandatory the specification of `AudioSources` and/or one `VideoLayout`
@@ -209,8 +210,8 @@ module Twilio
209
210
  # there is no active media. This results in shorter compositions in cases when the
210
211
  # Room was created but no Participant joined for some time, or if all the
211
212
  # Participants left the room and joined at a later stage, as those gaps will be
212
- # removed. You can find further information in the [Managing Video
213
- # Layouts](#managing-video-layouts) section. Defaults to `true`.
213
+ # removed. You can find further information in the [Specifying Video
214
+ # Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) section. Defaults to `true`.
214
215
  # @return [CompositionInstance] Newly created CompositionInstance
215
216
  def create(room_sid: :unset, video_layout: :unset, audio_sources: :unset, audio_sources_excluded: :unset, resolution: :unset, format: :unset, status_callback: :unset, status_callback_method: :unset, trim: :unset)
216
217
  data = Twilio::Values.of({
@@ -37,6 +37,10 @@ module Twilio
37
37
  # @param [Time] date_created_before Only show Composition Hooks created before
38
38
  # this ISO8601 date-time with timezone, given as `YYYY-MM-DDThh:mm:ss+|-hh:mm` or
39
39
  # `YYYY-MM-DDThh:mm:ssZ`.
40
+ # @param [String] friendly_name Only show Composition Hooks with friendly name
41
+ # that match this case-insensitive string, of up to 100 characters in length.
42
+ # Filtering by partial friendly names is allowed, using wildcards (e.g.
43
+ # `*my*hook*`).
40
44
  # @param [Integer] limit Upper limit for the number of records to return. stream()
41
45
  # guarantees to never return more than limit. Default is no limit
42
46
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -44,11 +48,12 @@ module Twilio
44
48
  # but a limit is defined, stream() will attempt to read the limit with the most
45
49
  # efficient page size, i.e. min(limit, 1000)
46
50
  # @return [Array] Array of up to limit results
47
- def list(enabled: :unset, date_created_after: :unset, date_created_before: :unset, limit: nil, page_size: nil)
51
+ def list(enabled: :unset, date_created_after: :unset, date_created_before: :unset, friendly_name: :unset, limit: nil, page_size: nil)
48
52
  self.stream(
49
53
  enabled: enabled,
50
54
  date_created_after: date_created_after,
51
55
  date_created_before: date_created_before,
56
+ friendly_name: friendly_name,
52
57
  limit: limit,
53
58
  page_size: page_size
54
59
  ).entries
@@ -66,6 +71,10 @@ module Twilio
66
71
  # @param [Time] date_created_before Only show Composition Hooks created before
67
72
  # this ISO8601 date-time with timezone, given as `YYYY-MM-DDThh:mm:ss+|-hh:mm` or
68
73
  # `YYYY-MM-DDThh:mm:ssZ`.
74
+ # @param [String] friendly_name Only show Composition Hooks with friendly name
75
+ # that match this case-insensitive string, of up to 100 characters in length.
76
+ # Filtering by partial friendly names is allowed, using wildcards (e.g.
77
+ # `*my*hook*`).
69
78
  # @param [Integer] limit Upper limit for the number of records to return. stream()
70
79
  # guarantees to never return more than limit. Default is no limit.
71
80
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -73,13 +82,14 @@ module Twilio
73
82
  # but a limit is defined, stream() will attempt to read the limit with the most
74
83
  # efficient page size, i.e. min(limit, 1000)
75
84
  # @return [Enumerable] Enumerable that will yield up to limit results
76
- def stream(enabled: :unset, date_created_after: :unset, date_created_before: :unset, limit: nil, page_size: nil)
85
+ def stream(enabled: :unset, date_created_after: :unset, date_created_before: :unset, friendly_name: :unset, limit: nil, page_size: nil)
77
86
  limits = @version.read_limits(limit, page_size)
78
87
 
79
88
  page = self.page(
80
89
  enabled: enabled,
81
90
  date_created_after: date_created_after,
82
91
  date_created_before: date_created_before,
92
+ friendly_name: friendly_name,
83
93
  page_size: limits[:page_size],
84
94
  )
85
95
 
@@ -111,15 +121,20 @@ module Twilio
111
121
  # @param [Time] date_created_before Only show Composition Hooks created before
112
122
  # this ISO8601 date-time with timezone, given as `YYYY-MM-DDThh:mm:ss+|-hh:mm` or
113
123
  # `YYYY-MM-DDThh:mm:ssZ`.
124
+ # @param [String] friendly_name Only show Composition Hooks with friendly name
125
+ # that match this case-insensitive string, of up to 100 characters in length.
126
+ # Filtering by partial friendly names is allowed, using wildcards (e.g.
127
+ # `*my*hook*`).
114
128
  # @param [String] page_token PageToken provided by the API
115
129
  # @param [Integer] page_number Page Number, this value is simply for client state
116
130
  # @param [Integer] page_size Number of records to return, defaults to 50
117
131
  # @return [Page] Page of CompositionHookInstance
118
- def page(enabled: :unset, date_created_after: :unset, date_created_before: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
132
+ def page(enabled: :unset, date_created_after: :unset, date_created_before: :unset, friendly_name: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
119
133
  params = Twilio::Values.of({
120
134
  'Enabled' => enabled,
121
135
  'DateCreatedAfter' => Twilio.serialize_iso8601_datetime(date_created_after),
122
136
  'DateCreatedBefore' => Twilio.serialize_iso8601_datetime(date_created_before),
137
+ 'FriendlyName' => friendly_name,
123
138
  'PageToken' => page_token,
124
139
  'Page' => page_number,
125
140
  'PageSize' => page_size,
@@ -155,8 +170,8 @@ module Twilio
155
170
  # will be triggered for every completed Group Room on this account. When `false`,
156
171
  # the Composition Hook never triggers.
157
172
  # @param [Hash] video_layout A JSON object defining the video layout of the
158
- # Composition Hook in terms of regions. See the section [Managing Video
159
- # Layouts](#managing-video-layouts) below for further information.
173
+ # Composition Hook in terms of regions. See the section [Specifying Video
174
+ # Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for further information.
160
175
  # @param [String] audio_sources An array of audio sources to merge. All the
161
176
  # specified sources must belong to the same Group Room. It can include zero or
162
177
  # more Track names. These can be specified using wildcards (e.g. `student*`). The
@@ -185,8 +200,9 @@ module Twilio
185
200
  #
186
201
  # Note that the `Resolution` implicitly imposes an aspect ratio to the resulting
187
202
  # composition. When the original video tracks get constrained by this aspect ratio
188
- # they are scaled-down to fit. You can find detailed information in the [Managing
189
- # Video Layouts](#managing-video-layouts) section. Defaults to `640x480`.
203
+ # they are scaled-down to fit. You can find detailed information in the
204
+ # [Specifying Video
205
+ # Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) section. Defaults to `640x480`.
190
206
  # @param [composition_hook.Format] format Container format of the Composition
191
207
  # media files created by the Composition Hook. Can be any of the following: `mp4`,
192
208
  # `webm`. The use of `mp4` or `webm` makes mandatory the specification of
@@ -202,8 +218,8 @@ module Twilio
202
218
  # in shorter compositions in cases when the Room was created but no Participant
203
219
  # joined for some time, or if all the Participants left the room and joined at a
204
220
  # later stage, as those gaps will be removed. You can find further information in
205
- # the [Managing Video Layouts](#managing-video-layouts) section. Defaults to
206
- # `true`.
221
+ # the [Specifying Video
222
+ # Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) section. Defaults to `true`.
207
223
  # @return [CompositionHookInstance] Newly created CompositionHookInstance
208
224
  def create(friendly_name: nil, enabled: :unset, video_layout: :unset, audio_sources: :unset, audio_sources_excluded: :unset, resolution: :unset, format: :unset, status_callback: :unset, status_callback_method: :unset, trim: :unset)
209
225
  data = Twilio::Values.of({
@@ -314,8 +330,8 @@ module Twilio
314
330
  # will be triggered for every completed Group Room on this account. When `false`,
315
331
  # the Composition Hook never triggers.
316
332
  # @param [Hash] video_layout A JSON object defining the video layout of the
317
- # Composition Hook in terms of regions. See the section [Managing Video
318
- # Layouts](#managing-video-layouts) below for further information.
333
+ # Composition Hook in terms of regions. See the section [Specifying Video
334
+ # Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for further information.
319
335
  # @param [String] audio_sources An array of audio sources to merge. All the
320
336
  # specified sources must belong to the same Group Room. It can include zero or
321
337
  # more Track names. These can be specified using wildcards (e.g. `student*`). The
@@ -331,8 +347,8 @@ module Twilio
331
347
  # in shorter compositions in cases when the Room was created but no Participant
332
348
  # joined for some time, or if all the Participants left the room and joined at a
333
349
  # later stage, as those gaps will be removed. You can find further information in
334
- # the [Managing Video Layouts](#managing-video-layouts) section. Defaults to
335
- # `true`.
350
+ # the [Specifying Video
351
+ # Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) section. Defaults to `true`.
336
352
  # @param [composition_hook.Format] format Container format of the Composition
337
353
  # media files created by the Composition Hook. Can be any of the following: `mp4`,
338
354
  # `webm`. The use of `mp4` or `webm` makes mandatory the specification of
@@ -346,8 +362,8 @@ module Twilio
346
362
  # = `1024x576`, VGA = `640x480`, CIF = `320x240`. Note that the `Resolution`
347
363
  # implicitly imposes an aspect ratio to the resulting composition. When the
348
364
  # original video tracks get constrained by this aspect ratio they are scaled-down
349
- # to fit. You can find detailed information in the [Managing Video
350
- # Layouts](#managing-video-layouts) section. Defaults to `640x480`.
365
+ # to fit. You can find detailed information in the [Specifying Video
366
+ # Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) section. Defaults to `640x480`.
351
367
  # @param [String] status_callback A URL that Twilio sends asynchronous webhook
352
368
  # requests to on every composition event. If not provided, status callback events
353
369
  # will not be dispatched.
@@ -546,8 +562,8 @@ module Twilio
546
562
  # will be triggered for every completed Group Room on this account. When `false`,
547
563
  # the Composition Hook never triggers.
548
564
  # @param [Hash] video_layout A JSON object defining the video layout of the
549
- # Composition Hook in terms of regions. See the section [Managing Video
550
- # Layouts](#managing-video-layouts) below for further information.
565
+ # Composition Hook in terms of regions. See the section [Specifying Video
566
+ # Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for further information.
551
567
  # @param [String] audio_sources An array of audio sources to merge. All the
552
568
  # specified sources must belong to the same Group Room. It can include zero or
553
569
  # more Track names. These can be specified using wildcards (e.g. `student*`). The
@@ -563,8 +579,8 @@ module Twilio
563
579
  # in shorter compositions in cases when the Room was created but no Participant
564
580
  # joined for some time, or if all the Participants left the room and joined at a
565
581
  # later stage, as those gaps will be removed. You can find further information in
566
- # the [Managing Video Layouts](#managing-video-layouts) section. Defaults to
567
- # `true`.
582
+ # the [Specifying Video
583
+ # Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) section. Defaults to `true`.
568
584
  # @param [composition_hook.Format] format Container format of the Composition
569
585
  # media files created by the Composition Hook. Can be any of the following: `mp4`,
570
586
  # `webm`. The use of `mp4` or `webm` makes mandatory the specification of
@@ -578,8 +594,8 @@ module Twilio
578
594
  # = `1024x576`, VGA = `640x480`, CIF = `320x240`. Note that the `Resolution`
579
595
  # implicitly imposes an aspect ratio to the resulting composition. When the
580
596
  # original video tracks get constrained by this aspect ratio they are scaled-down
581
- # to fit. You can find detailed information in the [Managing Video
582
- # Layouts](#managing-video-layouts) section. Defaults to `640x480`.
597
+ # to fit. You can find detailed information in the [Specifying Video
598
+ # Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) section. Defaults to `640x480`.
583
599
  # @param [String] status_callback A URL that Twilio sends asynchronous webhook
584
600
  # requests to on every composition event. If not provided, status callback events
585
601
  # will not be dispatched.
@@ -38,6 +38,8 @@ module Twilio
38
38
  # @param [Time] date_created_before Only show Recordings that started before this
39
39
  # ISO8601 date-time with timezone, given as `YYYY-MM-DDThh:mm:ss+|-hh:mm` or
40
40
  # `YYYY-MM-DDThh:mm:ssZ`.
41
+ # @param [recording.Type] media_type Only show Recordings that have this media
42
+ # type. Can be either `audio` or `video`.
41
43
  # @param [Integer] limit Upper limit for the number of records to return. stream()
42
44
  # guarantees to never return more than limit. Default is no limit
43
45
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -45,13 +47,14 @@ module Twilio
45
47
  # but a limit is defined, stream() will attempt to read the limit with the most
46
48
  # efficient page size, i.e. min(limit, 1000)
47
49
  # @return [Array] Array of up to limit results
48
- def list(status: :unset, source_sid: :unset, grouping_sid: :unset, date_created_after: :unset, date_created_before: :unset, limit: nil, page_size: nil)
50
+ def list(status: :unset, source_sid: :unset, grouping_sid: :unset, date_created_after: :unset, date_created_before: :unset, media_type: :unset, limit: nil, page_size: nil)
49
51
  self.stream(
50
52
  status: status,
51
53
  source_sid: source_sid,
52
54
  grouping_sid: grouping_sid,
53
55
  date_created_after: date_created_after,
54
56
  date_created_before: date_created_before,
57
+ media_type: media_type,
55
58
  limit: limit,
56
59
  page_size: page_size
57
60
  ).entries
@@ -72,6 +75,8 @@ module Twilio
72
75
  # @param [Time] date_created_before Only show Recordings that started before this
73
76
  # ISO8601 date-time with timezone, given as `YYYY-MM-DDThh:mm:ss+|-hh:mm` or
74
77
  # `YYYY-MM-DDThh:mm:ssZ`.
78
+ # @param [recording.Type] media_type Only show Recordings that have this media
79
+ # type. Can be either `audio` or `video`.
75
80
  # @param [Integer] limit Upper limit for the number of records to return. stream()
76
81
  # guarantees to never return more than limit. Default is no limit.
77
82
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -79,7 +84,7 @@ module Twilio
79
84
  # but a limit is defined, stream() will attempt to read the limit with the most
80
85
  # efficient page size, i.e. min(limit, 1000)
81
86
  # @return [Enumerable] Enumerable that will yield up to limit results
82
- def stream(status: :unset, source_sid: :unset, grouping_sid: :unset, date_created_after: :unset, date_created_before: :unset, limit: nil, page_size: nil)
87
+ def stream(status: :unset, source_sid: :unset, grouping_sid: :unset, date_created_after: :unset, date_created_before: :unset, media_type: :unset, limit: nil, page_size: nil)
83
88
  limits = @version.read_limits(limit, page_size)
84
89
 
85
90
  page = self.page(
@@ -88,6 +93,7 @@ module Twilio
88
93
  grouping_sid: grouping_sid,
89
94
  date_created_after: date_created_after,
90
95
  date_created_before: date_created_before,
96
+ media_type: media_type,
91
97
  page_size: limits[:page_size],
92
98
  )
93
99
 
@@ -122,17 +128,20 @@ module Twilio
122
128
  # @param [Time] date_created_before Only show Recordings that started before this
123
129
  # ISO8601 date-time with timezone, given as `YYYY-MM-DDThh:mm:ss+|-hh:mm` or
124
130
  # `YYYY-MM-DDThh:mm:ssZ`.
131
+ # @param [recording.Type] media_type Only show Recordings that have this media
132
+ # type. Can be either `audio` or `video`.
125
133
  # @param [String] page_token PageToken provided by the API
126
134
  # @param [Integer] page_number Page Number, this value is simply for client state
127
135
  # @param [Integer] page_size Number of records to return, defaults to 50
128
136
  # @return [Page] Page of RecordingInstance
129
- def page(status: :unset, source_sid: :unset, grouping_sid: :unset, date_created_after: :unset, date_created_before: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
137
+ def page(status: :unset, source_sid: :unset, grouping_sid: :unset, date_created_after: :unset, date_created_before: :unset, media_type: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
130
138
  params = Twilio::Values.of({
131
139
  'Status' => status,
132
140
  'SourceSid' => source_sid,
133
141
  'GroupingSid' => Twilio.serialize_list(grouping_sid) { |e| e },
134
142
  'DateCreatedAfter' => Twilio.serialize_iso8601_datetime(date_created_after),
135
143
  'DateCreatedBefore' => Twilio.serialize_iso8601_datetime(date_created_before),
144
+ 'MediaType' => media_type,
136
145
  'PageToken' => page_token,
137
146
  'Page' => page_number,
138
147
  'PageSize' => page_size,
@@ -42,10 +42,10 @@ module Twilio
42
42
  #
43
43
  # @param [String] body String to hash
44
44
  #
45
- # @return [String] A base64-encoded SHA256 of the body string
45
+ # @return [String] A hex-encoded SHA256 of the body string
46
46
  def build_hash_for(body)
47
47
  hasher = OpenSSL::Digest.new('sha256')
48
- Base64.encode64(hasher.digest(body)).strip
48
+ hasher.hexdigest(body)
49
49
  end
50
50
 
51
51
  ##
@@ -1,3 +1,3 @@
1
1
  module Twilio
2
- VERSION = '5.19.0'
2
+ VERSION = '5.20.0'
3
3
  end
@@ -0,0 +1,238 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ require 'spec_helper.rb'
10
+
11
+ describe 'Message' do
12
+ it "can fetch" do
13
+ @holodeck.mock(Twilio::Response.new(500, ''))
14
+
15
+ expect {
16
+ @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
17
+ .messages('IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
18
+ }.to raise_exception(Twilio::REST::TwilioError)
19
+
20
+ values = {}
21
+ expect(
22
+ @holodeck.has_request?(Holodeck::Request.new(
23
+ method: 'get',
24
+ url: 'https://messaging.twilio.com/v1/Sessions/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
25
+ ))).to eq(true)
26
+ end
27
+
28
+ it "receives fetch responses" do
29
+ @holodeck.mock(Twilio::Response.new(
30
+ 200,
31
+ %q[
32
+ {
33
+ "sid": "IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
34
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
35
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
36
+ "session_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
37
+ "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
38
+ "body": "Hello",
39
+ "attributes": "{}",
40
+ "author": "system",
41
+ "date_created": "2016-03-24T20:37:57Z",
42
+ "date_updated": "2016-03-24T20:37:57Z",
43
+ "index": 0,
44
+ "url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
45
+ }
46
+ ]
47
+ ))
48
+
49
+ actual = @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
50
+ .messages('IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
51
+
52
+ expect(actual).to_not eq(nil)
53
+ end
54
+
55
+ it "can create" do
56
+ @holodeck.mock(Twilio::Response.new(500, ''))
57
+
58
+ expect {
59
+ @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
60
+ .messages.create()
61
+ }.to raise_exception(Twilio::REST::TwilioError)
62
+
63
+ values = {}
64
+ expect(
65
+ @holodeck.has_request?(Holodeck::Request.new(
66
+ method: 'post',
67
+ url: 'https://messaging.twilio.com/v1/Sessions/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages',
68
+ ))).to eq(true)
69
+ end
70
+
71
+ it "receives create responses" do
72
+ @holodeck.mock(Twilio::Response.new(
73
+ 201,
74
+ %q[
75
+ {
76
+ "sid": "IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
77
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
78
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
79
+ "session_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
80
+ "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
81
+ "body": "Hello",
82
+ "attributes": "{ \\"foo\\": \\"bar\\" }",
83
+ "author": "message author",
84
+ "date_created": "2015-12-16T22:18:37Z",
85
+ "date_updated": "2015-12-16T22:18:38Z",
86
+ "index": 0,
87
+ "url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
88
+ }
89
+ ]
90
+ ))
91
+
92
+ actual = @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
93
+ .messages.create()
94
+
95
+ expect(actual).to_not eq(nil)
96
+ end
97
+
98
+ it "can update" do
99
+ @holodeck.mock(Twilio::Response.new(500, ''))
100
+
101
+ expect {
102
+ @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
103
+ .messages('IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
104
+ }.to raise_exception(Twilio::REST::TwilioError)
105
+
106
+ values = {}
107
+ expect(
108
+ @holodeck.has_request?(Holodeck::Request.new(
109
+ method: 'post',
110
+ url: 'https://messaging.twilio.com/v1/Sessions/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
111
+ ))).to eq(true)
112
+ end
113
+
114
+ it "receives update responses" do
115
+ @holodeck.mock(Twilio::Response.new(
116
+ 200,
117
+ %q[
118
+ {
119
+ "sid": "IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
120
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
121
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
122
+ "session_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
123
+ "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
124
+ "body": "Hello",
125
+ "attributes": "{ \\"foo\\": \\"bar\\" }",
126
+ "author": "message author",
127
+ "date_created": "2015-12-16T22:18:37Z",
128
+ "date_updated": "2015-12-16T22:18:38Z",
129
+ "index": 0,
130
+ "url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
131
+ }
132
+ ]
133
+ ))
134
+
135
+ actual = @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
136
+ .messages('IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
137
+
138
+ expect(actual).to_not eq(nil)
139
+ end
140
+
141
+ it "can read" do
142
+ @holodeck.mock(Twilio::Response.new(500, ''))
143
+
144
+ expect {
145
+ @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
146
+ .messages.list()
147
+ }.to raise_exception(Twilio::REST::TwilioError)
148
+
149
+ values = {}
150
+ expect(
151
+ @holodeck.has_request?(Holodeck::Request.new(
152
+ method: 'get',
153
+ url: 'https://messaging.twilio.com/v1/Sessions/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages',
154
+ ))).to eq(true)
155
+ end
156
+
157
+ it "receives read_full responses" do
158
+ @holodeck.mock(Twilio::Response.new(
159
+ 200,
160
+ %q[
161
+ {
162
+ "meta": {
163
+ "page": 0,
164
+ "page_size": 50,
165
+ "first_page_url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages?PageSize=50&Page=0",
166
+ "previous_page_url": null,
167
+ "url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages?PageSize=50&Page=0",
168
+ "next_page_url": null,
169
+ "key": "messages"
170
+ },
171
+ "messages": [
172
+ {
173
+ "sid": "IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
174
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
175
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
176
+ "session_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
177
+ "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
178
+ "body": "Hello",
179
+ "attributes": "{}",
180
+ "author": "system",
181
+ "date_created": "2016-03-24T20:37:57Z",
182
+ "date_updated": "2016-03-24T20:37:57Z",
183
+ "index": 0,
184
+ "url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
185
+ },
186
+ {
187
+ "sid": "IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
188
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
189
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
190
+ "session_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
191
+ "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
192
+ "body": "Hello",
193
+ "attributes": "{}",
194
+ "author": "system",
195
+ "date_created": "2016-03-24T20:37:57Z",
196
+ "date_updated": "2016-03-24T20:37:57Z",
197
+ "index": 0,
198
+ "url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
199
+ }
200
+ ]
201
+ }
202
+ ]
203
+ ))
204
+
205
+ actual = @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
206
+ .messages.list()
207
+
208
+ expect(actual).to_not eq(nil)
209
+ end
210
+
211
+ it "can delete" do
212
+ @holodeck.mock(Twilio::Response.new(500, ''))
213
+
214
+ expect {
215
+ @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
216
+ .messages('IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
217
+ }.to raise_exception(Twilio::REST::TwilioError)
218
+
219
+ values = {}
220
+ expect(
221
+ @holodeck.has_request?(Holodeck::Request.new(
222
+ method: 'delete',
223
+ url: 'https://messaging.twilio.com/v1/Sessions/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
224
+ ))).to eq(true)
225
+ end
226
+
227
+ it "receives delete responses" do
228
+ @holodeck.mock(Twilio::Response.new(
229
+ 204,
230
+ nil,
231
+ ))
232
+
233
+ actual = @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
234
+ .messages('IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
235
+
236
+ expect(actual).to eq(true)
237
+ end
238
+ end