Class: Twilio::REST::Api::V2010::AccountContext::ConferenceContext::ParticipantList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid: nil, conference_sid: nil) ⇒ ParticipantList

Initialize the ParticipantList

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String) (defaults to: nil)

    The unique id of the Account that created this conference

  • conference_sid (String) (defaults to: nil)

    A 34 character string that identifies the conference this participant is in



22
23
24
25
26
27
28
29
30
31
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 22

def initialize(version, account_sid: nil, conference_sid: nil)
  super(version)

  # Path Solution
  @solution = {
      account_sid: ,
      conference_sid: conference_sid
  }
  @uri = "/Accounts/#{@solution[:account_sid]}/Conferences/#{@solution[:conference_sid]}/Participants.json"
end

Instance Method Details

#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) ⇒ ParticipantInstance

Retrieve a single page of ParticipantInstance records from the API. Request is executed immediately.

Parameters:

  • from (String) (defaults to: nil)

    The from

  • to (String) (defaults to: nil)

    The to

  • status_callback (String) (defaults to: :unset)

    The status_callback

  • status_callback_method (String) (defaults to: :unset)

    The status_callback_method

  • status_callback_event (String) (defaults to: :unset)

    The status_callback_event

  • timeout (String) (defaults to: :unset)

    The timeout

  • record (Boolean) (defaults to: :unset)

    The record

  • muted (Boolean) (defaults to: :unset)

    The muted

  • beep (String) (defaults to: :unset)

    The beep

  • start_conference_on_enter (Boolean) (defaults to: :unset)

    The start_conference_on_enter

  • end_conference_on_exit (Boolean) (defaults to: :unset)

    The end_conference_on_exit

  • wait_url (String) (defaults to: :unset)

    The wait_url

  • wait_method (String) (defaults to: :unset)

    The wait_method

  • early_media (Boolean) (defaults to: :unset)

    The early_media

  • max_participants (String) (defaults to: :unset)

    The max_participants

  • conference_record (String) (defaults to: :unset)

    The conference_record

  • conference_trim (String) (defaults to: :unset)

    The conference_trim

  • conference_status_callback (String) (defaults to: :unset)

    The conference_status_callback

  • conference_status_callback_method (String) (defaults to: :unset)

    The conference_status_callback_method

  • conference_status_callback_event (String) (defaults to: :unset)

    The conference_status_callback_event

  • recording_channels (String) (defaults to: :unset)

    The recording_channels

  • recording_status_callback (String) (defaults to: :unset)

    The recording_status_callback

  • recording_status_callback_method (String) (defaults to: :unset)

    The recording_status_callback_method

  • sip_auth_username (String) (defaults to: :unset)

    The sip_auth_username

  • sip_auth_password (String) (defaults to: :unset)

    The sip_auth_password

  • region (String) (defaults to: :unset)

    The region

  • conference_recording_status_callback (String) (defaults to: :unset)

    The conference_recording_status_callback

  • conference_recording_status_callback_method (String) (defaults to: :unset)

    The conference_recording_status_callback_method

Returns:



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 70

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)
  data = Twilio::Values.of({
      'From' => from,
      'To' => to,
      'StatusCallback' => status_callback,
      'StatusCallbackMethod' => status_callback_method,
      'StatusCallbackEvent' => status_callback_event,
      'Timeout' => timeout,
      'Record' => record,
      'Muted' => muted,
      'Beep' => beep,
      'StartConferenceOnEnter' => start_conference_on_enter,
      'EndConferenceOnExit' => end_conference_on_exit,
      'WaitUrl' => wait_url,
      'WaitMethod' => wait_method,
      'EarlyMedia' => early_media,
      'MaxParticipants' => max_participants,
      'ConferenceRecord' => conference_record,
      'ConferenceTrim' => conference_trim,
      'ConferenceStatusCallback' => conference_status_callback,
      'ConferenceStatusCallbackMethod' => conference_status_callback_method,
      'ConferenceStatusCallbackEvent' => conference_status_callback_event,
      'RecordingChannels' => recording_channels,
      'RecordingStatusCallback' => recording_status_callback,
      'RecordingStatusCallbackMethod' => recording_status_callback_method,
      'SipAuthUsername' => sip_auth_username,
      'SipAuthPassword' => sip_auth_password,
      'Region' => region,
      'ConferenceRecordingStatusCallback' => conference_recording_status_callback,
      'ConferenceRecordingStatusCallbackMethod' => conference_recording_status_callback_method,
  })

  payload = @version.create(
      'POST',
      @uri,
      data: data
  )

  ParticipantInstance.new(
      @version,
      payload,
      account_sid: @solution[:account_sid],
      conference_sid: @solution[:conference_sid],
  )
end

#eachObject

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



167
168
169
170
171
172
173
174
175
176
177
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 167

def each
  limits = @version.read_limits

  page = self.page(
      page_size: limits[:page_size],
  )

  @version.stream(page,
                  limit: limits[:limit],
                  page_limit: limits[:page_limit]).each {|x| yield x}
end

#get_page(target_url) ⇒ Page

Retrieve a single page of ParticipantInstance records from the API. Request is executed immediately.

Parameters:

  • target_url (String)

    API-generated URL for the requested results page

Returns:

  • (Page)

    Page of ParticipantInstance



209
210
211
212
213
214
215
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 209

def get_page(target_url)
  response = @version.domain.request(
      'GET',
      target_url
  )
  ParticipantPage.new(@version, response, @solution)
end

#list(muted: :unset, hold: :unset, limit: nil, page_size: nil) ⇒ Array

Lists ParticipantInstance records from the API as a list. Unlike stream(), this operation is eager and will load ‘limit` records into memory before returning.

Parameters:

  • muted (Boolean) (defaults to: :unset)

    Only show participants that are muted or unmuted

  • hold (Boolean) (defaults to: :unset)

    The hold

  • limit (Integer) (defaults to: nil)

    Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit

  • page_size (Integer) (defaults to: nil)

    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)

Returns:

  • (Array)

    Array of up to limit results



129
130
131
132
133
134
135
136
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 129

def list(muted: :unset, hold: :unset, limit: nil, page_size: nil)
  self.stream(
      muted: muted,
      hold: hold,
      limit: limit,
      page_size: page_size
  ).entries
end

#page(muted: :unset, hold: :unset, page_token: :unset, page_number: :unset, page_size: :unset) ⇒ Page

Retrieve a single page of ParticipantInstance records from the API. Request is executed immediately.

Parameters:

  • muted (Boolean) (defaults to: :unset)

    Only show participants that are muted or unmuted

  • hold (Boolean) (defaults to: :unset)

    The hold

  • page_token (String) (defaults to: :unset)

    PageToken provided by the API

  • page_number (Integer) (defaults to: :unset)

    Page Number, this value is simply for client state

  • page_size (Integer) (defaults to: :unset)

    Number of records to return, defaults to 50

Returns:

  • (Page)

    Page of ParticipantInstance



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 188

def page(muted: :unset, hold: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
  params = Twilio::Values.of({
      'Muted' => muted,
      'Hold' => hold,
      'PageToken' => page_token,
      'Page' => page_number,
      'PageSize' => page_size,
  })
  response = @version.page(
      'GET',
      @uri,
      params
  )
  ParticipantPage.new(@version, response, @solution)
end

#stream(muted: :unset, hold: :unset, limit: nil, page_size: nil) ⇒ Enumerable

Streams ParticipantInstance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached.

Parameters:

  • muted (Boolean) (defaults to: :unset)

    Only show participants that are muted or unmuted

  • hold (Boolean) (defaults to: :unset)

    The hold

  • limit (Integer) (defaults to: nil)

    Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit.

  • page_size (Integer) (defaults to: nil)

    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)

Returns:

  • (Enumerable)

    Enumerable that will yield up to limit results



151
152
153
154
155
156
157
158
159
160
161
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 151

def stream(muted: :unset, hold: :unset, limit: nil, page_size: nil)
  limits = @version.read_limits(limit, page_size)

  page = self.page(
      muted: muted,
      hold: hold,
      page_size: limits[:page_size],
  )

  @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
end

#to_sObject

Provide a user friendly representation



219
220
221
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 219

def to_s
  '#<Twilio.Api.V2010.ParticipantList>'
end