class Twilio::REST::FlexApi::V1::ChannelList

Public Class Methods

new(version) click to toggle source

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

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

Public Instance Methods

create(flex_flow_sid: nil, identity: nil, chat_user_friendly_name: nil, chat_friendly_name: nil, target: :unset, chat_unique_name: :unset, pre_engagement_data: :unset, task_sid: :unset, task_attributes: :unset, long_lived: :unset) click to toggle source

Create the ChannelInstance @param [String] flex_flow_sid The SID of the Flex Flow. @param [String] identity The `identity` value that uniquely identifies the new

resource's chat User.

@param [String] chat_user_friendly_name The chat participant's friendly name. @param [String] chat_friendly_name The chat channel's friendly name. @param [String] target The Target Contact Identity, for example the phone number

of an SMS.

@param [String] chat_unique_name The chat channel's unique name. @param [String] pre_engagement_data The pre-engagement data. @param [String] task_sid The SID of the TaskRouter Task. Only valid when

integration type is `task`. `null` for integration types `studio` & `external`

@param [String] task_attributes The Task attributes to be added for the

TaskRouter Task.

@param [Boolean] long_lived Whether to create the channel as long-lived. @return [ChannelInstance] Created ChannelInstance

    # File lib/twilio-ruby/rest/flex_api/v1/channel.rb
123 def create(flex_flow_sid: nil, identity: nil, chat_user_friendly_name: nil, chat_friendly_name: nil, target: :unset, chat_unique_name: :unset, pre_engagement_data: :unset, task_sid: :unset, task_attributes: :unset, long_lived: :unset)
124   data = Twilio::Values.of({
125       'FlexFlowSid' => flex_flow_sid,
126       'Identity' => identity,
127       'ChatUserFriendlyName' => chat_user_friendly_name,
128       'ChatFriendlyName' => chat_friendly_name,
129       'Target' => target,
130       'ChatUniqueName' => chat_unique_name,
131       'PreEngagementData' => pre_engagement_data,
132       'TaskSid' => task_sid,
133       'TaskAttributes' => task_attributes,
134       'LongLived' => long_lived,
135   })
136 
137   payload = @version.create('POST', @uri, data: data)
138 
139   ChannelInstance.new(@version, payload, )
140 end
each() { |x| ... } click to toggle source

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

   # File lib/twilio-ruby/rest/flex_api/v1/channel.rb
64 def each
65   limits = @version.read_limits
66 
67   page = self.page(page_size: limits[:page_size], )
68 
69   @version.stream(page,
70                   limit: limits[:limit],
71                   page_limit: limits[:page_limit]).each {|x| yield x}
72 end
get_page(target_url) click to toggle source

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

    # File lib/twilio-ruby/rest/flex_api/v1/channel.rb
 98 def get_page(target_url)
 99   response = @version.domain.request(
100       'GET',
101       target_url
102   )
103   ChannelPage.new(@version, response, @solution)
104 end
list(limit: nil, page_size: nil) click to toggle source

Lists ChannelInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @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/flex_api/v1/channel.rb
37 def list(limit: nil, page_size: nil)
38   self.stream(limit: limit, page_size: page_size).entries
39 end
page(page_token: :unset, page_number: :unset, page_size: :unset) click to toggle source

Retrieve a single page of ChannelInstance records from the API. Request is executed immediately. @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 ChannelInstance

   # File lib/twilio-ruby/rest/flex_api/v1/channel.rb
81 def page(page_token: :unset, page_number: :unset, page_size: :unset)
82   params = Twilio::Values.of({
83       'PageToken' => page_token,
84       'Page' => page_number,
85       'PageSize' => page_size,
86   })
87 
88   response = @version.page('GET', @uri, params: params)
89 
90   ChannelPage.new(@version, response, @solution)
91 end
stream(limit: nil, page_size: nil) click to toggle source

Streams ChannelInstance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @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/flex_api/v1/channel.rb
52 def stream(limit: nil, page_size: nil)
53   limits = @version.read_limits(limit, page_size)
54 
55   page = self.page(page_size: limits[:page_size], )
56 
57   @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
58 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/flex_api/v1/channel.rb
144 def to_s
145   '#<Twilio.FlexApi.V1.ChannelList>'
146 end