twilio-ruby 5.13.0 → 5.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES.md +18 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +8 -8
  5. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +1 -5
  6. data/lib/twilio-ruby/rest/api/v2010/account/conference/recording.rb +8 -8
  7. data/lib/twilio-ruby/rest/client.rb +7 -0
  8. data/lib/twilio-ruby/rest/preview/marketplace.rb +13 -13
  9. data/lib/twilio-ruby/rest/preview.rb +8 -21
  10. data/lib/twilio-ruby/rest/video/v1/composition.rb +1 -1
  11. data/lib/twilio-ruby/rest/video/v1/composition_hook.rb +626 -0
  12. data/lib/twilio-ruby/rest/video/v1.rb +32 -16
  13. data/lib/twilio-ruby/rest/video.rb +18 -9
  14. data/lib/twilio-ruby/rest/{preview/permissions → voice/v1}/voice_permission/bulk_country_update.rb +12 -11
  15. data/lib/twilio-ruby/rest/{preview/permissions → voice/v1}/voice_permission/country/highrisk_special_prefix.rb +14 -14
  16. data/lib/twilio-ruby/rest/{preview/permissions → voice/v1}/voice_permission/country.rb +57 -45
  17. data/lib/twilio-ruby/rest/{preview/permissions → voice/v1}/voice_permission.rb +6 -6
  18. data/lib/twilio-ruby/rest/{preview/permissions.rb → voice/v1.rb} +6 -6
  19. data/lib/twilio-ruby/rest/voice.rb +44 -0
  20. data/lib/twilio-ruby/version.rb +1 -1
  21. data/spec/integration/video/v1/composition_hook_spec.rb +410 -0
  22. data/spec/integration/{preview/permissions → voice/v1}/voice_permission/bulk_country_update_spec.rb +5 -5
  23. data/spec/integration/{preview/permissions → voice/v1}/voice_permission/country/highrisk_special_prefix_spec.rb +9 -9
  24. data/spec/integration/{preview/permissions → voice/v1}/voice_permission/country_spec.rb +16 -16
  25. data/spec/integration/{preview/permissions → voice/v1}/voice_permission_spec.rb +0 -0
  26. metadata +20 -19
  27. data/lib/twilio-ruby/rest/preview/permissions/voice_permission/settings.rb +0 -197
  28. data/spec/integration/preview/permissions/voice_permission/settings_spec.rb +0 -77
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f4ce16d26c62514428db1b1c37f62028e0f7ee7a
4
- data.tar.gz: a56c95b413a42d40568a9b9bff97324106ae5eec
2
+ SHA256:
3
+ metadata.gz: b283a5a375b8c792fdbecff0c19851d34fe3fb4a2b2909e6c41ef66224831061
4
+ data.tar.gz: 36684ae1b0e4354ab6bba18c10bf636716e0084a4b6c08c3e0e5e8f055262e51
5
5
  SHA512:
6
- metadata.gz: d26d08ff46decea3088152be428ea457a0a32b8f479f17948527821e4b102869ecbb2b27e4ffe5ad7c49702f34822a2e475b2e3f4c28575c131649769220a9d3
7
- data.tar.gz: 447f2b394fab6112de58c3784f85bac91f128777592b40f90336d10164d8a7b30595fb46e946e34e41161b52491d754e71b74a88a57106246ef21d949390fc56
6
+ metadata.gz: 5a214307f7f74ba3ec34042448afd90e559603400bf25c37541c5be7d9235c809a2ad06f471b40d92f3330ed69045e7be19bb7c10cf9f939e1f96898389d6021
7
+ data.tar.gz: b98cb6532290b313e508a09400090184c1e79abf4ca97ad33b886044c50c154caca88482e482d470378a430cfa1370a1886967716eb2e7c2d19c6fbe6346ce94
data/CHANGES.md CHANGED
@@ -1,6 +1,24 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ [2018-09-28] Version 5.14.0
5
+ ----------------------------
6
+ **Api**
7
+ - Set `call_sid_to_coach` parameter in participant to be `preview`
8
+
9
+ **Preview**
10
+ - Renamed response headers for Challenge and Factors Signatures
11
+ - Supported `totp` in Authy preview endpoints
12
+ - Allowed `latest` in Authy Challenges endpoints
13
+
14
+ **Video**
15
+ - [Composer] Add Composition Hook resources
16
+
17
+ **Voice**
18
+ - changed path param name from parent_iso_code to iso_code for highrisk_special_prefixes api **(breaking change)**
19
+ - added geo permissions public api
20
+
21
+
4
22
  [2018-09-20] Version 5.13.0
5
23
  ----------------------------
6
24
  **Preview**
data/README.md CHANGED
@@ -27,13 +27,13 @@ in-line code documentation here in the library.
27
27
  To install using [Bundler][bundler] grab the latest stable version:
28
28
 
29
29
  ```ruby
30
- gem 'twilio-ruby', '~> 5.13.0'
30
+ gem 'twilio-ruby', '~> 5.14.0'
31
31
  ```
32
32
 
33
33
  To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
34
34
 
35
35
  ```bash
36
- gem install twilio-ruby -v 5.13.0
36
+ gem install twilio-ruby -v 5.14.0
37
37
  ```
38
38
 
39
39
  To build and install the development branch yourself from the latest source:
@@ -239,10 +239,10 @@ module Twilio
239
239
  # Update the RecordingInstance
240
240
  # @param [recording.Status] status The status to change the recording to.
241
241
  # Possible values: `stopped`, `paused`, `in-progress`
242
- # @param [String] pause_behavior Possible values: `skip` or `silence`. `skip` will
243
- # result in no recording at all during the pause period. `silence` will replace
244
- # the actual audio of the call with silence during the pause period. Defaults to
245
- # `silence`
242
+ # @param [String] pause_behavior Only applicable when setting Status parameter to
243
+ # `paused`. Possible values: `skip` or `silence`. `skip` will result in no
244
+ # recording at all during the pause period. `silence` will replace the actual
245
+ # audio of the call with silence during the pause period. Defaults to `silence`
246
246
  # @return [RecordingInstance] Updated RecordingInstance
247
247
  def update(status: nil, pause_behavior: :unset)
248
248
  data = Twilio::Values.of({'Status' => status, 'PauseBehavior' => pause_behavior, })
@@ -461,10 +461,10 @@ module Twilio
461
461
  # Update the RecordingInstance
462
462
  # @param [recording.Status] status The status to change the recording to.
463
463
  # Possible values: `stopped`, `paused`, `in-progress`
464
- # @param [String] pause_behavior Possible values: `skip` or `silence`. `skip` will
465
- # result in no recording at all during the pause period. `silence` will replace
466
- # the actual audio of the call with silence during the pause period. Defaults to
467
- # `silence`
464
+ # @param [String] pause_behavior Only applicable when setting Status parameter to
465
+ # `paused`. Possible values: `skip` or `silence`. `skip` will result in no
466
+ # recording at all during the pause period. `silence` will replace the actual
467
+ # audio of the call with silence during the pause period. Defaults to `silence`
468
468
  # @return [RecordingInstance] Updated RecordingInstance
469
469
  def update(status: nil, pause_behavior: :unset)
470
470
  context.update(status: status, pause_behavior: pause_behavior, )
@@ -124,11 +124,8 @@ module Twilio
124
124
  # specified in the `ConferenceRecordingStatusCallback` attribute. Available values
125
125
  # are `in-progress`, `completed`, `failed`. To specify multiple values, separate
126
126
  # them with a space. Defaults to `in-progress`, `completed`, `failed`.
127
- # @param [String] call_sid_to_coach The string that uniquely identifies the
128
- # participant that is being `coached`, i.e. the only participant who can hear the
129
- # participant that is in `coach` mode.
130
127
  # @return [ParticipantInstance] Newly created ParticipantInstance
131
- def create(from: nil, to: nil, status_callback: :unset, status_callback_method: :unset, status_callback_event: :unset, timeout: :unset, record: :unset, muted: :unset, beep: :unset, start_conference_on_enter: :unset, end_conference_on_exit: :unset, wait_url: :unset, wait_method: :unset, early_media: :unset, max_participants: :unset, conference_record: :unset, conference_trim: :unset, conference_status_callback: :unset, conference_status_callback_method: :unset, conference_status_callback_event: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, sip_auth_username: :unset, sip_auth_password: :unset, region: :unset, conference_recording_status_callback: :unset, conference_recording_status_callback_method: :unset, recording_status_callback_event: :unset, conference_recording_status_callback_event: :unset, call_sid_to_coach: :unset)
128
+ def create(from: nil, to: nil, status_callback: :unset, status_callback_method: :unset, status_callback_event: :unset, timeout: :unset, record: :unset, muted: :unset, beep: :unset, start_conference_on_enter: :unset, end_conference_on_exit: :unset, wait_url: :unset, wait_method: :unset, early_media: :unset, max_participants: :unset, conference_record: :unset, conference_trim: :unset, conference_status_callback: :unset, conference_status_callback_method: :unset, conference_status_callback_event: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, sip_auth_username: :unset, sip_auth_password: :unset, region: :unset, conference_recording_status_callback: :unset, conference_recording_status_callback_method: :unset, recording_status_callback_event: :unset, conference_recording_status_callback_event: :unset)
132
129
  data = Twilio::Values.of({
133
130
  'From' => from,
134
131
  'To' => to,
@@ -160,7 +157,6 @@ module Twilio
160
157
  'ConferenceRecordingStatusCallbackMethod' => conference_recording_status_callback_method,
161
158
  'RecordingStatusCallbackEvent' => Twilio.serialize_list(recording_status_callback_event) { |e| e },
162
159
  'ConferenceRecordingStatusCallbackEvent' => Twilio.serialize_list(conference_recording_status_callback_event) { |e| e },
163
- 'CallSidToCoach' => call_sid_to_coach,
164
160
  })
165
161
 
166
162
  payload = @version.create(
@@ -197,10 +197,10 @@ module Twilio
197
197
  # Update the RecordingInstance
198
198
  # @param [recording.Status] status The status to change the recording to.
199
199
  # Possible values: `stopped`, `paused`, `in-progress`
200
- # @param [String] pause_behavior Possible values: `skip` or `silence`. `skip` will
201
- # result in no recording at all during the pause period. `silence` will replace
202
- # the actual audio of the call with silence during the pause period. Defaults to
203
- # `silence`
200
+ # @param [String] pause_behavior Only applicable when setting Status parameter to
201
+ # `paused`. Possible values: `skip` or `silence`. `skip` will result in no
202
+ # recording at all during the pause period. `silence` will replace the actual
203
+ # audio of the call with silence during the pause period. Defaults to `silence`
204
204
  # @return [RecordingInstance] Updated RecordingInstance
205
205
  def update(status: nil, pause_behavior: :unset)
206
206
  data = Twilio::Values.of({'Status' => status, 'PauseBehavior' => pause_behavior, })
@@ -423,10 +423,10 @@ module Twilio
423
423
  # Update the RecordingInstance
424
424
  # @param [recording.Status] status The status to change the recording to.
425
425
  # Possible values: `stopped`, `paused`, `in-progress`
426
- # @param [String] pause_behavior Possible values: `skip` or `silence`. `skip` will
427
- # result in no recording at all during the pause period. `silence` will replace
428
- # the actual audio of the call with silence during the pause period. Defaults to
429
- # `silence`
426
+ # @param [String] pause_behavior Only applicable when setting Status parameter to
427
+ # `paused`. Possible values: `skip` or `silence`. `skip` will result in no
428
+ # recording at all during the pause period. `silence` will replace the actual
429
+ # audio of the call with silence during the pause period. Defaults to `silence`
430
430
  # @return [RecordingInstance] Updated RecordingInstance
431
431
  def update(status: nil, pause_behavior: :unset)
432
432
  context.update(status: status, pause_behavior: pause_behavior, )
@@ -44,6 +44,7 @@ module Twilio
44
44
  @sync = nil
45
45
  @studio = nil
46
46
  @verify = nil
47
+ @voice = nil
47
48
  end
48
49
 
49
50
  ##
@@ -208,6 +209,12 @@ module Twilio
208
209
  @verify ||= Verify.new self
209
210
  end
210
211
 
212
+ ##
213
+ # Access the Voice Twilio Domain
214
+ def voice
215
+ @voice ||= Voice.new self
216
+ end
217
+
211
218
  ##
212
219
  # @param [String] sid A 34 character string that uniquely identifies this address.
213
220
  # @return [Twilio::REST::Api::V2010::AccountContext::AddressInstance] if sid was passed.
@@ -15,37 +15,37 @@ module Twilio
15
15
  def initialize(domain)
16
16
  super
17
17
  @version = 'marketplace'
18
- @installed_add_ons = nil
19
18
  @available_add_ons = nil
19
+ @installed_add_ons = nil
20
20
  end
21
21
 
22
22
  ##
23
- # @param [String] sid The Installed Add-on Sid that uniquely identifies this
23
+ # @param [String] sid The Available Add-on Sid that uniquely identifies this
24
24
  # resource
25
- # @return [Twilio::REST::Preview::Marketplace::InstalledAddOnContext] if sid was passed.
26
- # @return [Twilio::REST::Preview::Marketplace::InstalledAddOnList]
27
- def installed_add_ons(sid=:unset)
25
+ # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnContext] if sid was passed.
26
+ # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnList]
27
+ def available_add_ons(sid=:unset)
28
28
  if sid.nil?
29
29
  raise ArgumentError, 'sid cannot be nil'
30
30
  elsif sid == :unset
31
- @installed_add_ons ||= InstalledAddOnList.new self
31
+ @available_add_ons ||= AvailableAddOnList.new self
32
32
  else
33
- InstalledAddOnContext.new(self, sid)
33
+ AvailableAddOnContext.new(self, sid)
34
34
  end
35
35
  end
36
36
 
37
37
  ##
38
- # @param [String] sid The Available Add-on Sid that uniquely identifies this
38
+ # @param [String] sid The Installed Add-on Sid that uniquely identifies this
39
39
  # resource
40
- # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnContext] if sid was passed.
41
- # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnList]
42
- def available_add_ons(sid=:unset)
40
+ # @return [Twilio::REST::Preview::Marketplace::InstalledAddOnContext] if sid was passed.
41
+ # @return [Twilio::REST::Preview::Marketplace::InstalledAddOnList]
42
+ def installed_add_ons(sid=:unset)
43
43
  if sid.nil?
44
44
  raise ArgumentError, 'sid cannot be nil'
45
45
  elsif sid == :unset
46
- @available_add_ons ||= AvailableAddOnList.new self
46
+ @installed_add_ons ||= InstalledAddOnList.new self
47
47
  else
48
- AvailableAddOnContext.new(self, sid)
48
+ InstalledAddOnContext.new(self, sid)
49
49
  end
50
50
  end
51
51
 
@@ -28,7 +28,6 @@ module Twilio
28
28
  @sync = nil
29
29
  @understand = nil
30
30
  @wireless = nil
31
- @permissions = nil
32
31
  end
33
32
 
34
33
  ##
@@ -85,12 +84,6 @@ module Twilio
85
84
  @wireless ||= Wireless.new self
86
85
  end
87
86
 
88
- ##
89
- # Version permissions of preview
90
- def permissions
91
- @permissions ||= Permissions.new self
92
- end
93
-
94
87
  ##
95
88
  # @param [String] sid The sid
96
89
  # @return [Twilio::REST::Preview::Sync::ServiceInstance] if sid was passed.
@@ -142,6 +135,14 @@ module Twilio
142
135
  self.hosted_numbers.hosted_number_orders(sid)
143
136
  end
144
137
 
138
+ ##
139
+ # @param [String] sid A 34 character string that uniquely identifies this Add-on.
140
+ # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnInstance] if sid was passed.
141
+ # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnList]
142
+ def available_add_ons(sid=:unset)
143
+ self.marketplace.available_add_ons(sid)
144
+ end
145
+
145
146
  ##
146
147
  # @param [String] sid 34 character string that uniquely identifies the Add-on.
147
148
  # This Sid can also be found in the Console on that specific Add-ons page as the
@@ -152,14 +153,6 @@ module Twilio
152
153
  self.marketplace.installed_add_ons(sid)
153
154
  end
154
155
 
155
- ##
156
- # @param [String] sid A 34 character string that uniquely identifies this Add-on.
157
- # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnInstance] if sid was passed.
158
- # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnList]
159
- def available_add_ons(sid=:unset)
160
- self.marketplace.available_add_ons(sid)
161
- end
162
-
163
156
  ##
164
157
  # @param [String] sid A 34 character string that uniquely identifies this
165
158
  # resource.
@@ -193,12 +186,6 @@ module Twilio
193
186
  self.wireless.sims(sid)
194
187
  end
195
188
 
196
- ##
197
- # @return [Twilio::REST::Preview::Permissions::VoicePermissionInstance]
198
- def voice_permissions
199
- self.permissions.voice_permissions()
200
- end
201
-
202
189
  ##
203
190
  # Provide a user friendly representation
204
191
  def to_s
@@ -157,7 +157,7 @@ module Twilio
157
157
  # * Zero or more `ParticipantSid`
158
158
  # * Zero or more Track names. These can be specified using wildcards (e.g.
159
159
  # `student*`). The use of `[*]` has semantics "all if any" meaning zero or more
160
- # (i.e. all) depending on whether the target room had video tracks.
160
+ # (i.e. all) depending on whether the target room had audio tracks.
161
161
  # @param [String] audio_sources_excluded An array of audio sources to exclude from
162
162
  # the Composition. Any new Composition shall include all audio sources specified
163
163
  # in `AudioSources` except for the ones specified in `AudioSourcesExcluded`. This
@@ -0,0 +1,626 @@
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 Video < 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 CompositionHookList < ListResource
16
+ ##
17
+ # Initialize the CompositionHookList
18
+ # @param [Version] version Version that contains the resource
19
+ # @return [CompositionHookList] CompositionHookList
20
+ def initialize(version)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {}
25
+ @uri = "/CompositionHooks"
26
+ end
27
+
28
+ ##
29
+ # Lists CompositionHookInstance 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 [Boolean] enabled Only show Composition Hooks that are enabled or
33
+ # disabled.
34
+ # @param [Time] date_created_after Only show Composition Hooks created on or after
35
+ # this ISO8601 date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`.
36
+ # @param [Time] date_created_before Only show Composition Hooks created before
37
+ # this this ISO8601 date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`.
38
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
39
+ # guarantees to never return more than limit. Default is no limit
40
+ # @param [Integer] page_size Number of records to fetch per request, when
41
+ # not set will use the default value of 50 records. If no page_size is defined
42
+ # but a limit is defined, stream() will attempt to read the limit with the most
43
+ # efficient page size, i.e. min(limit, 1000)
44
+ # @return [Array] Array of up to limit results
45
+ def list(enabled: :unset, date_created_after: :unset, date_created_before: :unset, limit: nil, page_size: nil)
46
+ self.stream(
47
+ enabled: enabled,
48
+ date_created_after: date_created_after,
49
+ date_created_before: date_created_before,
50
+ limit: limit,
51
+ page_size: page_size
52
+ ).entries
53
+ end
54
+
55
+ ##
56
+ # Streams CompositionHookInstance records from the API as an Enumerable.
57
+ # This operation lazily loads records as efficiently as possible until the limit
58
+ # is reached.
59
+ # @param [Boolean] enabled Only show Composition Hooks that are enabled or
60
+ # disabled.
61
+ # @param [Time] date_created_after Only show Composition Hooks created on or after
62
+ # this ISO8601 date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`.
63
+ # @param [Time] date_created_before Only show Composition Hooks created before
64
+ # this this ISO8601 date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`.
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(enabled: :unset, date_created_after: :unset, date_created_before: :unset, limit: nil, page_size: nil)
73
+ limits = @version.read_limits(limit, page_size)
74
+
75
+ page = self.page(
76
+ enabled: enabled,
77
+ date_created_after: date_created_after,
78
+ date_created_before: date_created_before,
79
+ page_size: limits[:page_size],
80
+ )
81
+
82
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
83
+ end
84
+
85
+ ##
86
+ # When passed a block, yields CompositionHookInstance records from the API.
87
+ # This operation lazily loads records as efficiently as possible until the limit
88
+ # is reached.
89
+ def each
90
+ limits = @version.read_limits
91
+
92
+ page = self.page(page_size: limits[:page_size], )
93
+
94
+ @version.stream(page,
95
+ limit: limits[:limit],
96
+ page_limit: limits[:page_limit]).each {|x| yield x}
97
+ end
98
+
99
+ ##
100
+ # Retrieve a single page of CompositionHookInstance records from the API.
101
+ # Request is executed immediately.
102
+ # @param [Boolean] enabled Only show Composition Hooks that are enabled or
103
+ # disabled.
104
+ # @param [Time] date_created_after Only show Composition Hooks created on or after
105
+ # this ISO8601 date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`.
106
+ # @param [Time] date_created_before Only show Composition Hooks created before
107
+ # this this ISO8601 date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`.
108
+ # @param [String] page_token PageToken provided by the API
109
+ # @param [Integer] page_number Page Number, this value is simply for client state
110
+ # @param [Integer] page_size Number of records to return, defaults to 50
111
+ # @return [Page] Page of CompositionHookInstance
112
+ def page(enabled: :unset, date_created_after: :unset, date_created_before: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
113
+ params = Twilio::Values.of({
114
+ 'Enabled' => enabled,
115
+ 'DateCreatedAfter' => Twilio.serialize_iso8601_datetime(date_created_after),
116
+ 'DateCreatedBefore' => Twilio.serialize_iso8601_datetime(date_created_before),
117
+ 'PageToken' => page_token,
118
+ 'Page' => page_number,
119
+ 'PageSize' => page_size,
120
+ })
121
+ response = @version.page(
122
+ 'GET',
123
+ @uri,
124
+ params
125
+ )
126
+ CompositionHookPage.new(@version, response, @solution)
127
+ end
128
+
129
+ ##
130
+ # Retrieve a single page of CompositionHookInstance records from the API.
131
+ # Request is executed immediately.
132
+ # @param [String] target_url API-generated URL for the requested results page
133
+ # @return [Page] Page of CompositionHookInstance
134
+ def get_page(target_url)
135
+ response = @version.domain.request(
136
+ 'GET',
137
+ target_url
138
+ )
139
+ CompositionHookPage.new(@version, response, @solution)
140
+ end
141
+
142
+ ##
143
+ # Retrieve a single page of CompositionHookInstance records from the API.
144
+ # Request is executed immediately.
145
+ # @param [String] friendly_name Friendly name of the Composition Hook to be shown
146
+ # in the console.
147
+ # @param [Boolean] enabled When activated, the Composition Hook is enabled and a
148
+ # composition will be triggered for every Video room completed by this account
149
+ # from this point onwards; `false` indicates the Composition Hook is left
150
+ # inactive.
151
+ # @param [Hash] video_layout A JSON object defining the video layout of the
152
+ # Composition Hook in terms of regions. See the section [Managing Video
153
+ # Layouts](#managing-video-layouts) below for further information.
154
+ # @param [String] audio_sources An array of audio sources to merge. All the
155
+ # specified sources must belong to the same Group Room. It can include:
156
+ # * Zero or more Track names. These can be specified using wildcards (e.g.
157
+ # `student*`). The use of `[*]` has semantics "all if any" meaning zero or more
158
+ # (i.e. all) depending on whether the Group Room had audio tracks.
159
+ # @param [String] audio_sources_excluded An array of audio sources to exclude from
160
+ # the Composition Hook. Any new Composition triggered by the Composition Hook
161
+ # shall include all audio sources specified in `AudioSources` except for the ones
162
+ # specified in `AudioSourcesExcluded`. This parameter may include:
163
+ # * Zero or more Track names. These can be specified using wildcards (e.g.
164
+ # `student*`)
165
+ # @param [String] resolution A string representing the numbers of pixels for rows
166
+ # (width) and columns (height) of the generated composed video. This string must
167
+ # have the format `{width}x{height}`. This parameter must comply with the
168
+ # following constraints:
169
+ # * `width >= 16 && width <= 1280`
170
+ # * `height >= 16 && height <= 1280`
171
+ # * `width * height <= 921,600`
172
+ # Typical values are:
173
+ # * HD = `1280x720`
174
+ # * PAL = `1024x576`
175
+ # * VGA = `640x480`
176
+ # * CIF = `320x240`
177
+ # Note that the `Resolution` implicitly imposes an aspect ratio to the resulting
178
+ # composition. When the original video tracks get constrained by this aspect ratio
179
+ # they are scaled-down to fit. You can find detailed information in the [Managing
180
+ # Video Layouts](#managing-video-layouts) section. Defaults to `640x480`.
181
+ # @param [composition_hook.Format] format Container format of the Composition
182
+ # media files created by the Composition Hook. Can be any of the following: `mp4`,
183
+ # `webm`. The use of `mp4` or `webm` makes mandatory the specification of
184
+ # `AudioSources` and/or one `VideoLayout` element containing a valid
185
+ # `video_sources` list, otherwise an error is fired. Defaults to `webm`.
186
+ # @param [String] status_callback A URL that Twilio sends asynchronous webhook
187
+ # requests to on every composition event. If not provided, status callback events
188
+ # will not be dispatched.
189
+ # @param [String] status_callback_method HTTP method Twilio should use when
190
+ # requesting the above URL. Defaults to `POST`.
191
+ # @param [Boolean] trim When activated, clips all the intervals where there is no
192
+ # active media in the Compositions triggered by the Composition Hook. This results
193
+ # in shorter compositions in cases when the Room was created but no Participant
194
+ # joined for some time, or if all the Participants left the room and joined at a
195
+ # later stage, as those gaps will be removed. You can find further information in
196
+ # the [Managing Video Layouts](#managing-video-layouts) section. Defaults to
197
+ # `true`.
198
+ # @return [CompositionHookInstance] Newly created CompositionHookInstance
199
+ 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)
200
+ data = Twilio::Values.of({
201
+ 'FriendlyName' => friendly_name,
202
+ 'Enabled' => enabled,
203
+ 'VideoLayout' => Twilio.serialize_object(video_layout),
204
+ 'AudioSources' => Twilio.serialize_list(audio_sources) { |e| e },
205
+ 'AudioSourcesExcluded' => Twilio.serialize_list(audio_sources_excluded) { |e| e },
206
+ 'Resolution' => resolution,
207
+ 'Format' => format,
208
+ 'StatusCallback' => status_callback,
209
+ 'StatusCallbackMethod' => status_callback_method,
210
+ 'Trim' => trim,
211
+ })
212
+
213
+ payload = @version.create(
214
+ 'POST',
215
+ @uri,
216
+ data: data
217
+ )
218
+
219
+ CompositionHookInstance.new(@version, payload, )
220
+ end
221
+
222
+ ##
223
+ # Provide a user friendly representation
224
+ def to_s
225
+ '#<Twilio.Video.V1.CompositionHookList>'
226
+ end
227
+ end
228
+
229
+ ##
230
+ # 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.
231
+ class CompositionHookPage < Page
232
+ ##
233
+ # Initialize the CompositionHookPage
234
+ # @param [Version] version Version that contains the resource
235
+ # @param [Response] response Response from the API
236
+ # @param [Hash] solution Path solution for the resource
237
+ # @return [CompositionHookPage] CompositionHookPage
238
+ def initialize(version, response, solution)
239
+ super(version, response)
240
+
241
+ # Path Solution
242
+ @solution = solution
243
+ end
244
+
245
+ ##
246
+ # Build an instance of CompositionHookInstance
247
+ # @param [Hash] payload Payload response from the API
248
+ # @return [CompositionHookInstance] CompositionHookInstance
249
+ def get_instance(payload)
250
+ CompositionHookInstance.new(@version, payload, )
251
+ end
252
+
253
+ ##
254
+ # Provide a user friendly representation
255
+ def to_s
256
+ '<Twilio.Video.V1.CompositionHookPage>'
257
+ end
258
+ end
259
+
260
+ ##
261
+ # 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.
262
+ class CompositionHookContext < InstanceContext
263
+ ##
264
+ # Initialize the CompositionHookContext
265
+ # @param [Version] version Version that contains the resource
266
+ # @param [String] sid The Composition Hook Sid that uniquely identifies the
267
+ # Composition Hook to fetch.
268
+ # @return [CompositionHookContext] CompositionHookContext
269
+ def initialize(version, sid)
270
+ super(version)
271
+
272
+ # Path Solution
273
+ @solution = {sid: sid, }
274
+ @uri = "/CompositionHooks/#{@solution[:sid]}"
275
+ end
276
+
277
+ ##
278
+ # Fetch a CompositionHookInstance
279
+ # @return [CompositionHookInstance] Fetched CompositionHookInstance
280
+ def fetch
281
+ params = Twilio::Values.of({})
282
+
283
+ payload = @version.fetch(
284
+ 'GET',
285
+ @uri,
286
+ params,
287
+ )
288
+
289
+ CompositionHookInstance.new(@version, payload, sid: @solution[:sid], )
290
+ end
291
+
292
+ ##
293
+ # Deletes the CompositionHookInstance
294
+ # @return [Boolean] true if delete succeeds, true otherwise
295
+ def delete
296
+ @version.delete('delete', @uri)
297
+ end
298
+
299
+ ##
300
+ # Update the CompositionHookInstance
301
+ # @param [String] friendly_name Friendly name of the Composition Hook to be shown
302
+ # in the console.
303
+ # @param [Boolean] enabled When activated, the Composition Hook is enabled and a
304
+ # composition will be triggered for every Video room completed by this account
305
+ # from this point onwards; `false` indicates the Composition Hook is left
306
+ # inactive.
307
+ # @param [Hash] video_layout A JSON object defining the video layout of the
308
+ # Composition Hook in terms of regions. See the section [Managing Video
309
+ # Layouts](#managing-video-layouts) below for further information.
310
+ # @param [String] audio_sources An array of audio sources to merge. All the
311
+ # specified sources must belong to the same Group Room. It can include:
312
+ # * Zero or more Track names. These can be specified using wildcards (e.g.
313
+ # `student*`). The use of `[*]` has semantics "all if any" meaning zero or more
314
+ # (i.e. all) depending on whether the Group Room had audio tracks.
315
+ # @param [String] audio_sources_excluded An array of audio sources to exclude from
316
+ # the Composition Hook. Any new Composition triggered by the Composition Hook
317
+ # shall include all audio sources specified in `AudioSources` except for the ones
318
+ # specified in `AudioSourcesExcluded`. This parameter may include:
319
+ # * Zero or more Track names. These can be specified using wildcards (e.g.
320
+ # `student*`)
321
+ # @param [Boolean] trim When activated, clips all the intervals where there is no
322
+ # active media in the Compositions triggered by the Composition Hook. This results
323
+ # in shorter compositions in cases when the Room was created but no Participant
324
+ # joined for some time, or if all the Participants left the room and joined at a
325
+ # later stage, as those gaps will be removed. You can find further information in
326
+ # the [Managing Video Layouts](#managing-video-layouts) section. Defaults to
327
+ # `true`.
328
+ # @param [composition_hook.Format] format Container format of the Composition
329
+ # media files created by the Composition Hook. Can be any of the following: `mp4`,
330
+ # `webm`. The use of `mp4` or `webm` makes mandatory the specification of
331
+ # `AudioSources` and/or one `VideoLayout` element containing a valid
332
+ # `video_sources` list, otherwise an error is fired. Defaults to `webm`.
333
+ # @param [String] resolution A string representing the numbers of pixels for rows
334
+ # (width) and columns (height) of the generated composed video. This string must
335
+ # have the format `{width}x{height}`. This parameter must comply with the
336
+ # following constraints:
337
+ # * `width >= 16 && width <= 1280`
338
+ # * `height >= 16 && height <= 1280`
339
+ # * `width * height <= 921,600`
340
+ # Typical values are:
341
+ # * HD = `1280x720`
342
+ # * PAL = `1024x576`
343
+ # * VGA = `640x480`
344
+ # * CIF = `320x240`
345
+ # Note that the `Resolution` implicitly imposes an aspect ratio to the resulting
346
+ # composition. When the original video tracks get constrained by this aspect ratio
347
+ # they are scaled-down to fit. You can find detailed information in the [Managing
348
+ # Video Layouts](#managing-video-layouts) section. Defaults to `640x480`.
349
+ # @param [String] status_callback A URL that Twilio sends asynchronous webhook
350
+ # requests to on every composition event. If not provided, status callback events
351
+ # will not be dispatched.
352
+ # @param [String] status_callback_method HTTP method Twilio should use when
353
+ # requesting the above URL. Defaults to `POST`.
354
+ # @return [CompositionHookInstance] Updated CompositionHookInstance
355
+ def update(friendly_name: nil, enabled: :unset, video_layout: :unset, audio_sources: :unset, audio_sources_excluded: :unset, trim: :unset, format: :unset, resolution: :unset, status_callback: :unset, status_callback_method: :unset)
356
+ data = Twilio::Values.of({
357
+ 'FriendlyName' => friendly_name,
358
+ 'Enabled' => enabled,
359
+ 'VideoLayout' => Twilio.serialize_object(video_layout),
360
+ 'AudioSources' => Twilio.serialize_list(audio_sources) { |e| e },
361
+ 'AudioSourcesExcluded' => Twilio.serialize_list(audio_sources_excluded) { |e| e },
362
+ 'Trim' => trim,
363
+ 'Format' => format,
364
+ 'Resolution' => resolution,
365
+ 'StatusCallback' => status_callback,
366
+ 'StatusCallbackMethod' => status_callback_method,
367
+ })
368
+
369
+ payload = @version.update(
370
+ 'POST',
371
+ @uri,
372
+ data: data,
373
+ )
374
+
375
+ CompositionHookInstance.new(@version, payload, sid: @solution[:sid], )
376
+ end
377
+
378
+ ##
379
+ # Provide a user friendly representation
380
+ def to_s
381
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
382
+ "#<Twilio.Video.V1.CompositionHookContext #{context}>"
383
+ end
384
+ end
385
+
386
+ ##
387
+ # 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.
388
+ class CompositionHookInstance < InstanceResource
389
+ ##
390
+ # Initialize the CompositionHookInstance
391
+ # @param [Version] version Version that contains the resource
392
+ # @param [Hash] payload payload that contains response from Twilio
393
+ # @param [String] sid The Composition Hook Sid that uniquely identifies the
394
+ # Composition Hook to fetch.
395
+ # @return [CompositionHookInstance] CompositionHookInstance
396
+ def initialize(version, payload, sid: nil)
397
+ super(version)
398
+
399
+ # Marshaled Properties
400
+ @properties = {
401
+ 'account_sid' => payload['account_sid'],
402
+ 'friendly_name' => payload['friendly_name'],
403
+ 'enabled' => payload['enabled'],
404
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
405
+ 'date_updated' => payload['date_updated'],
406
+ 'sid' => payload['sid'],
407
+ 'audio_sources' => payload['audio_sources'],
408
+ 'audio_sources_excluded' => payload['audio_sources_excluded'],
409
+ 'video_layout' => payload['video_layout'],
410
+ 'resolution' => payload['resolution'],
411
+ 'trim' => payload['trim'],
412
+ 'format' => payload['format'],
413
+ 'status_callback' => payload['status_callback'],
414
+ 'status_callback_method' => payload['status_callback_method'],
415
+ 'url' => payload['url'],
416
+ }
417
+
418
+ # Context
419
+ @instance_context = nil
420
+ @params = {'sid' => sid || @properties['sid'], }
421
+ end
422
+
423
+ ##
424
+ # Generate an instance context for the instance, the context is capable of
425
+ # performing various actions. All instance actions are proxied to the context
426
+ # @return [CompositionHookContext] CompositionHookContext for this CompositionHookInstance
427
+ def context
428
+ unless @instance_context
429
+ @instance_context = CompositionHookContext.new(@version, @params['sid'], )
430
+ end
431
+ @instance_context
432
+ end
433
+
434
+ ##
435
+ # @return [String] Twilio Account SID.
436
+ def account_sid
437
+ @properties['account_sid']
438
+ end
439
+
440
+ ##
441
+ # @return [String] Friendly name of the Composition Hook to be shown in the console.
442
+ def friendly_name
443
+ @properties['friendly_name']
444
+ end
445
+
446
+ ##
447
+ # @return [Boolean] Boolean flag for activating the Composition Hook.
448
+ def enabled
449
+ @properties['enabled']
450
+ end
451
+
452
+ ##
453
+ # @return [Time] Date when the Composition Hook Resource was created.
454
+ def date_created
455
+ @properties['date_created']
456
+ end
457
+
458
+ ##
459
+ # @return [String] Date when the Composition Hook was last updated.
460
+ def date_updated
461
+ @properties['date_updated']
462
+ end
463
+
464
+ ##
465
+ # @return [String] A 34-character string that uniquely identifies this Composition Hook.
466
+ def sid
467
+ @properties['sid']
468
+ end
469
+
470
+ ##
471
+ # @return [String] A list of audio sources related to this Composition Hook.
472
+ def audio_sources
473
+ @properties['audio_sources']
474
+ end
475
+
476
+ ##
477
+ # @return [String] A list of audio sources excluded related to this Composition Hook.
478
+ def audio_sources_excluded
479
+ @properties['audio_sources_excluded']
480
+ end
481
+
482
+ ##
483
+ # @return [Hash] The JSON video layout description.
484
+ def video_layout
485
+ @properties['video_layout']
486
+ end
487
+
488
+ ##
489
+ # @return [String] Pixel resolution of the composed video.
490
+ def resolution
491
+ @properties['resolution']
492
+ end
493
+
494
+ ##
495
+ # @return [Boolean] Boolean flag for clipping intervals that have no media.
496
+ def trim
497
+ @properties['trim']
498
+ end
499
+
500
+ ##
501
+ # @return [composition_hook.Format] The file format for the Compositions triggered by the Composition Hook.
502
+ def format
503
+ @properties['format']
504
+ end
505
+
506
+ ##
507
+ # @return [String] The status_callback
508
+ def status_callback
509
+ @properties['status_callback']
510
+ end
511
+
512
+ ##
513
+ # @return [String] The status_callback_method
514
+ def status_callback_method
515
+ @properties['status_callback_method']
516
+ end
517
+
518
+ ##
519
+ # @return [String] The absolute URL for this resource.
520
+ def url
521
+ @properties['url']
522
+ end
523
+
524
+ ##
525
+ # Fetch a CompositionHookInstance
526
+ # @return [CompositionHookInstance] Fetched CompositionHookInstance
527
+ def fetch
528
+ context.fetch
529
+ end
530
+
531
+ ##
532
+ # Deletes the CompositionHookInstance
533
+ # @return [Boolean] true if delete succeeds, true otherwise
534
+ def delete
535
+ context.delete
536
+ end
537
+
538
+ ##
539
+ # Update the CompositionHookInstance
540
+ # @param [String] friendly_name Friendly name of the Composition Hook to be shown
541
+ # in the console.
542
+ # @param [Boolean] enabled When activated, the Composition Hook is enabled and a
543
+ # composition will be triggered for every Video room completed by this account
544
+ # from this point onwards; `false` indicates the Composition Hook is left
545
+ # inactive.
546
+ # @param [Hash] video_layout A JSON object defining the video layout of the
547
+ # Composition Hook in terms of regions. See the section [Managing Video
548
+ # Layouts](#managing-video-layouts) below for further information.
549
+ # @param [String] audio_sources An array of audio sources to merge. All the
550
+ # specified sources must belong to the same Group Room. It can include:
551
+ # * Zero or more Track names. These can be specified using wildcards (e.g.
552
+ # `student*`). The use of `[*]` has semantics "all if any" meaning zero or more
553
+ # (i.e. all) depending on whether the Group Room had audio tracks.
554
+ # @param [String] audio_sources_excluded An array of audio sources to exclude from
555
+ # the Composition Hook. Any new Composition triggered by the Composition Hook
556
+ # shall include all audio sources specified in `AudioSources` except for the ones
557
+ # specified in `AudioSourcesExcluded`. This parameter may include:
558
+ # * Zero or more Track names. These can be specified using wildcards (e.g.
559
+ # `student*`)
560
+ # @param [Boolean] trim When activated, clips all the intervals where there is no
561
+ # active media in the Compositions triggered by the Composition Hook. This results
562
+ # in shorter compositions in cases when the Room was created but no Participant
563
+ # joined for some time, or if all the Participants left the room and joined at a
564
+ # later stage, as those gaps will be removed. You can find further information in
565
+ # the [Managing Video Layouts](#managing-video-layouts) section. Defaults to
566
+ # `true`.
567
+ # @param [composition_hook.Format] format Container format of the Composition
568
+ # media files created by the Composition Hook. Can be any of the following: `mp4`,
569
+ # `webm`. The use of `mp4` or `webm` makes mandatory the specification of
570
+ # `AudioSources` and/or one `VideoLayout` element containing a valid
571
+ # `video_sources` list, otherwise an error is fired. Defaults to `webm`.
572
+ # @param [String] resolution A string representing the numbers of pixels for rows
573
+ # (width) and columns (height) of the generated composed video. This string must
574
+ # have the format `{width}x{height}`. This parameter must comply with the
575
+ # following constraints:
576
+ # * `width >= 16 && width <= 1280`
577
+ # * `height >= 16 && height <= 1280`
578
+ # * `width * height <= 921,600`
579
+ # Typical values are:
580
+ # * HD = `1280x720`
581
+ # * PAL = `1024x576`
582
+ # * VGA = `640x480`
583
+ # * CIF = `320x240`
584
+ # Note that the `Resolution` implicitly imposes an aspect ratio to the resulting
585
+ # composition. When the original video tracks get constrained by this aspect ratio
586
+ # they are scaled-down to fit. You can find detailed information in the [Managing
587
+ # Video Layouts](#managing-video-layouts) section. Defaults to `640x480`.
588
+ # @param [String] status_callback A URL that Twilio sends asynchronous webhook
589
+ # requests to on every composition event. If not provided, status callback events
590
+ # will not be dispatched.
591
+ # @param [String] status_callback_method HTTP method Twilio should use when
592
+ # requesting the above URL. Defaults to `POST`.
593
+ # @return [CompositionHookInstance] Updated CompositionHookInstance
594
+ def update(friendly_name: nil, enabled: :unset, video_layout: :unset, audio_sources: :unset, audio_sources_excluded: :unset, trim: :unset, format: :unset, resolution: :unset, status_callback: :unset, status_callback_method: :unset)
595
+ context.update(
596
+ friendly_name: friendly_name,
597
+ enabled: enabled,
598
+ video_layout: video_layout,
599
+ audio_sources: audio_sources,
600
+ audio_sources_excluded: audio_sources_excluded,
601
+ trim: trim,
602
+ format: format,
603
+ resolution: resolution,
604
+ status_callback: status_callback,
605
+ status_callback_method: status_callback_method,
606
+ )
607
+ end
608
+
609
+ ##
610
+ # Provide a user friendly representation
611
+ def to_s
612
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
613
+ "<Twilio.Video.V1.CompositionHookInstance #{values}>"
614
+ end
615
+
616
+ ##
617
+ # Provide a detailed, user friendly representation
618
+ def inspect
619
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
620
+ "<Twilio.Video.V1.CompositionHookInstance #{values}>"
621
+ end
622
+ end
623
+ end
624
+ end
625
+ end
626
+ end