class Twilio::REST::Video::V1::CompositionHookList

Public Class Methods

new(version) click to toggle source

Initialize the CompositionHookList @param [Version] version Version that contains the resource @return [CompositionHookList] CompositionHookList

Calls superclass method Twilio::REST::ListResource::new
   # File lib/twilio-ruby/rest/video/v1/composition_hook.rb
18 def initialize(version)
19   super(version)
20 
21   # Path Solution
22   @solution = {}
23   @uri = "/CompositionHooks"
24 end

Public Instance Methods

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) click to toggle source

Create the CompositionHookInstance @param [String] friendly_name A descriptive string that you create to describe

the resource. It can be up to  100 characters long and it must be unique within
the account.

@param [Boolean] enabled Whether the composition hook is active. When `true`,

the composition hook will be triggered for every completed Group Room in the
account. When `false`, the composition hook will never be triggered.

@param [Hash] video_layout An object that describes the video layout of the

composition hook in terms of regions. See {Specifying Video
Layouts}[https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts]
for more info.

@param [Array] audio_sources An array of track names from the same group

room to merge into the compositions created by the composition hook. Can include
zero or more track names. A composition triggered by the composition hook
includes all audio sources specified in `audio_sources` except those specified
in `audio_sources_excluded`. The track names in this parameter can include an
asterisk as a wild card character, which matches zero or more characters in a
track name. For example, `student*` includes tracks named `student` as well as
`studentTeam`.

@param [Array] audio_sources_excluded An array of track names to

exclude. A composition triggered by the composition hook includes all audio
sources specified in `audio_sources` except for those specified in
`audio_sources_excluded`. The track names in this parameter can include an
asterisk as a wild card character, which matches zero or more characters in a
track name. For example, `student*` excludes `student` as well as `studentTeam`.
This parameter can also be empty.

@param [String] resolution A string that describes the columns (width) and rows

(height) of the generated composed video in pixels. Defaults to `640x480`.
The string's format is `{width}x{height}` where:

* 16 <= `{width}` <= 1280
* 16 <= `{height}` <= 1280
* `{width}` * `{height}` <= 921,600

Typical values are:

* HD = `1280x720`
* PAL = `1024x576`
* VGA = `640x480`
* CIF = `320x240`

Note that the `resolution` imposes an aspect ratio to the resulting composition.
When the original video tracks are constrained by the aspect ratio, they are
scaled to fit. See {Specifying Video
Layouts}[https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts]
for more info.

@param [composition_hook.Format] format The container format of the media files

used by the compositions created by the composition hook. Can be: `mp4` or
`webm` and the default is `webm`. If `mp4` or `webm`, `audio_sources` must have
one or more tracks and/or a `video_layout` element must contain a valid
`video_sources` list, otherwise an error occurs.

@param [String] status_callback The URL we should call using the

`status_callback_method` to send status information to your application on every
composition event. If not provided, status callback events will not be
dispatched.

@param [String] status_callback_method The HTTP method we should use to call

`status_callback`. Can be: `POST` or `GET` and the default is `POST`.

@param [Boolean] trim Whether to clip the intervals where there is no active

media in the Compositions triggered by the composition hook. The default is
`true`. Compositions with `trim` enabled are shorter when the Room is created
and no Participant joins for a while as well as if all the Participants leave
the room and join later, because those gaps will be removed. See {Specifying
Video
Layouts}[https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts]
for more info.

@return [CompositionHookInstance] Created CompositionHookInstance

    # File lib/twilio-ruby/rest/video/v1/composition_hook.rb
223 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)
224   data = Twilio::Values.of({
225       'FriendlyName' => friendly_name,
226       'Enabled' => enabled,
227       'VideoLayout' => Twilio.serialize_object(video_layout),
228       'AudioSources' => Twilio.serialize_list(audio_sources) { |e| e },
229       'AudioSourcesExcluded' => Twilio.serialize_list(audio_sources_excluded) { |e| e },
230       'Resolution' => resolution,
231       'Format' => format,
232       'StatusCallback' => status_callback,
233       'StatusCallbackMethod' => status_callback_method,
234       'Trim' => trim,
235   })
236 
237   payload = @version.create('POST', @uri, data: data)
238 
239   CompositionHookInstance.new(@version, payload, )
240 end
each() { |x| ... } click to toggle source

When passed a block, yields CompositionHookInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.

    # File lib/twilio-ruby/rest/video/v1/composition_hook.rb
 99 def each
100   limits = @version.read_limits
101 
102   page = self.page(page_size: limits[:page_size], )
103 
104   @version.stream(page,
105                   limit: limits[:limit],
106                   page_limit: limits[:page_limit]).each {|x| yield x}
107 end
get_page(target_url) click to toggle source

Retrieve a single page of CompositionHookInstance records from the API. Request is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page of CompositionHookInstance

    # File lib/twilio-ruby/rest/video/v1/composition_hook.rb
148 def get_page(target_url)
149   response = @version.domain.request(
150       'GET',
151       target_url
152   )
153   CompositionHookPage.new(@version, response, @solution)
154 end
list(enabled: :unset, date_created_after: :unset, date_created_before: :unset, friendly_name: :unset, limit: nil, page_size: nil) click to toggle source

Lists CompositionHookInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [Boolean] enabled Read only CompositionHook resources with an `enabled`

value that matches this parameter.

@param [Time] date_created_after Read only CompositionHook resources created on

or after this {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601] datetime with
time zone.

@param [Time] date_created_before Read only CompositionHook resources created

before this {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601] datetime with
time zone.

@param [String] friendly_name Read only CompositionHook resources with friendly

names that match this string. The match is not case sensitive and can include
asterisk `*` characters as wildcard match.

@param [Integer] limit Upper limit for the number of records to return. stream()

guarantees to never return more than limit.  Default is no limit

@param [Integer] page_size Number of records to fetch per request, when

not set will use the default value of 50 records.  If no page_size is defined
but a limit is defined, stream() will attempt to read the limit with the most
efficient page size, i.e. min(limit, 1000)

@return [Array] Array of up to limit results

   # File lib/twilio-ruby/rest/video/v1/composition_hook.rb
48 def list(enabled: :unset, date_created_after: :unset, date_created_before: :unset, friendly_name: :unset, limit: nil, page_size: nil)
49   self.stream(
50       enabled: enabled,
51       date_created_after: date_created_after,
52       date_created_before: date_created_before,
53       friendly_name: friendly_name,
54       limit: limit,
55       page_size: page_size
56   ).entries
57 end
page(enabled: :unset, date_created_after: :unset, date_created_before: :unset, friendly_name: :unset, page_token: :unset, page_number: :unset, page_size: :unset) click to toggle source

Retrieve a single page of CompositionHookInstance records from the API. Request is executed immediately. @param [Boolean] enabled Read only CompositionHook resources with an `enabled`

value that matches this parameter.

@param [Time] date_created_after Read only CompositionHook resources created on

or after this {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601] datetime with
time zone.

@param [Time] date_created_before Read only CompositionHook resources created

before this {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601] datetime with
time zone.

@param [String] friendly_name Read only CompositionHook resources with friendly

names that match this string. The match is not case sensitive and can include
asterisk `*` characters as wildcard match.

@param [String] page_token PageToken provided by the API @param [Integer] page_number Page Number, this value is simply for client state @param [Integer] page_size Number of records to return, defaults to 50 @return [Page] Page of CompositionHookInstance

    # File lib/twilio-ruby/rest/video/v1/composition_hook.rb
127 def page(enabled: :unset, date_created_after: :unset, date_created_before: :unset, friendly_name: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
128   params = Twilio::Values.of({
129       'Enabled' => enabled,
130       'DateCreatedAfter' => Twilio.serialize_iso8601_datetime(date_created_after),
131       'DateCreatedBefore' => Twilio.serialize_iso8601_datetime(date_created_before),
132       'FriendlyName' => friendly_name,
133       'PageToken' => page_token,
134       'Page' => page_number,
135       'PageSize' => page_size,
136   })
137 
138   response = @version.page('GET', @uri, params: params)
139 
140   CompositionHookPage.new(@version, response, @solution)
141 end
stream(enabled: :unset, date_created_after: :unset, date_created_before: :unset, friendly_name: :unset, limit: nil, page_size: nil) click to toggle source

Streams CompositionHookInstance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [Boolean] enabled Read only CompositionHook resources with an `enabled`

value that matches this parameter.

@param [Time] date_created_after Read only CompositionHook resources created on

or after this {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601] datetime with
time zone.

@param [Time] date_created_before Read only CompositionHook resources created

before this {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601] datetime with
time zone.

@param [String] friendly_name Read only CompositionHook resources with friendly

names that match this string. The match is not case sensitive and can include
asterisk `*` characters as wildcard match.

@param [Integer] limit Upper limit for the number of records to return. stream()

guarantees to never return more than limit. Default is no limit.

@param [Integer] page_size Number of records to fetch per request, when

not set will use the default value of 50 records. If no page_size is defined
but a limit is defined, stream() will attempt to read the limit with the most
efficient page size, i.e. min(limit, 1000)

@return [Enumerable] Enumerable that will yield up to limit results

   # File lib/twilio-ruby/rest/video/v1/composition_hook.rb
81 def stream(enabled: :unset, date_created_after: :unset, date_created_before: :unset, friendly_name: :unset, limit: nil, page_size: nil)
82   limits = @version.read_limits(limit, page_size)
83 
84   page = self.page(
85       enabled: enabled,
86       date_created_after: date_created_after,
87       date_created_before: date_created_before,
88       friendly_name: friendly_name,
89       page_size: limits[:page_size],
90   )
91 
92   @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
93 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/video/v1/composition_hook.rb
244 def to_s
245   '#<Twilio.Video.V1.CompositionHookList>'
246 end