Class: Twilio::REST::Api::V2010::AccountContext::SipList::CredentialListContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb,
lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb

Defined Under Namespace

Classes: CredentialContext, CredentialInstance, CredentialInstanceMetadata, CredentialList, CredentialListResponse, CredentialPage, CredentialPageMetadata

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid, sid) ⇒ CredentialListContext

Initialize the CredentialListContext

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String)

    The unique id of the Account that is responsible for this resource.

  • sid (String)

    The credential list Sid that uniquely identifies this resource



221
222
223
224
225
226
227
228
229
230
231
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 221

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

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

    # Dependents
    @credentials = nil
end

Instance Method Details

#credentials(sid = :unset) ⇒ CredentialList, CredentialContext

Access the credentials

Returns:

Raises:

  • (ArgumentError)


374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 374

def credentials(sid=:unset)

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

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

    unless @credentials
        @credentials = CredentialList.new(
            @version, account_sid: @solution[:account_sid], credential_list_sid: @solution[:sid], )
    end

 @credentials
end

#deleteBoolean

Delete the CredentialListInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



235
236
237
238
239
240
241
242
243
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 235

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    

    @version.delete('DELETE', @uri, headers: headers)
end

#delete_with_metadataBoolean

Delete the CredentialListInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 248

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      credentialList_instance = CredentialListInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      .new(@version, credentialList_instance, response.headers, response.status_code)
end

#fetchCredentialListInstance

Fetch the CredentialListInstance

Returns:



267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 267

def fetch

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

#fetch_with_metadataCredentialListInstance

Fetch the CredentialListInstanceMetadata

Returns:



287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 287

def 

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

#inspectObject

Provide a detailed, user friendly representation



399
400
401
402
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 399

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

#to_sObject

Provide a user friendly representation



392
393
394
395
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 392

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

#update(friendly_name: nil) ⇒ CredentialListInstance

Update the CredentialListInstance

Parameters:

  • friendly_name (String) (defaults to: nil)

    A human readable descriptive text for a CredentialList, up to 64 characters long.

Returns:



314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 314

def update(
    friendly_name: nil
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
    })

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

#update_with_metadata(friendly_name: nil) ⇒ CredentialListInstance

Update the CredentialListInstanceMetadata

Parameters:

  • friendly_name (String) (defaults to: nil)

    A human readable descriptive text for a CredentialList, up to 64 characters long.

Returns:



341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 341

def (
  friendly_name: nil
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
    })

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