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

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

Defined Under Namespace

Classes: ParticipantContext, ParticipantInstance, ParticipantList, ParticipantPage, RecordingContext, RecordingInstance, RecordingList, RecordingPage

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid, sid) ⇒ ConferenceContext

Initialize the ConferenceContext

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String)

    The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Conference resource(s) to update.

  • sid (String)

    The Twilio-provided string that uniquely identifies the Conference resource to update



187
188
189
190
191
192
193
194
195
196
197
# File 'lib/twilio-ruby/rest/api/v2010/account/conference.rb', line 187

def initialize(version, , sid)
    super(version)

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

    # Dependents
    @recordings = nil
    @participants = nil
end

Instance Method Details

#fetchConferenceInstance

Fetch the ConferenceInstance

Returns:



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/twilio-ruby/rest/api/v2010/account/conference.rb', line 201

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    ConferenceInstance.new(
        @version,
        payload,
        account_sid: @solution[:account_sid],
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



299
300
301
302
# File 'lib/twilio-ruby/rest/api/v2010/account/conference.rb', line 299

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Api.V2010.ConferenceContext #{context}>"
end

#participants(call_sid = :unset) ⇒ ParticipantList, ParticipantContext

Access the participants

Returns:

Raises:

  • (ArgumentError)


274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/twilio-ruby/rest/api/v2010/account/conference.rb', line 274

def participants(call_sid=:unset)

    raise ArgumentError, 'call_sid cannot be nil' if call_sid.nil?

    if call_sid != :unset
        return ParticipantContext.new(@version, @solution[:account_sid], @solution[:sid],call_sid )
    end

    unless @participants
        @participants = ParticipantList.new(
            @version, account_sid: @solution[:account_sid], conference_sid: @solution[:sid], )
    end

 @participants
end

#recordings(sid = :unset) ⇒ RecordingList, RecordingContext

Access the recordings

Returns:

Raises:

  • (ArgumentError)


255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/twilio-ruby/rest/api/v2010/account/conference.rb', line 255

def recordings(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return RecordingContext.new(@version, @solution[:account_sid], @solution[:sid],sid )
    end

    unless @recordings
        @recordings = RecordingList.new(
            @version, account_sid: @solution[:account_sid], conference_sid: @solution[:sid], )
    end

 @recordings
end

#to_sObject

Provide a user friendly representation



292
293
294
295
# File 'lib/twilio-ruby/rest/api/v2010/account/conference.rb', line 292

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Api.V2010.ConferenceContext #{context}>"
end

#update(status: :unset, announce_url: :unset, announce_method: :unset) ⇒ ConferenceInstance

Update the ConferenceInstance

Parameters:

  • status (UpdateStatus) (defaults to: :unset)
  • announce_url (String) (defaults to: :unset)

    The URL we should call to announce something into the conference. The URL may return an MP3 file, a WAV file, or a TwiML document that contains ‘<Play>`, `<Say>`, `<Pause>`, or `<Redirect>` verbs.

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

    The HTTP method used to call ‘announce_url`. Can be: `GET` or `POST` and the default is `POST`

Returns:



224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/twilio-ruby/rest/api/v2010/account/conference.rb', line 224

def update(
    status: :unset, 
    announce_url: :unset, 
    announce_method: :unset
)

    data = Twilio::Values.of({
        'Status' => status,
        'AnnounceUrl' => announce_url,
        'AnnounceMethod' => announce_method,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    ConferenceInstance.new(
        @version,
        payload,
        account_sid: @solution[:account_sid],
        sid: @solution[:sid],
    )
end