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

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

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid, credential_list_sid, sid) ⇒ CredentialContext

Initialize the CredentialContext

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String)

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

  • credential_list_sid (String)

    The unique id that identifies the credential list that includes this credential.

  • sid (String)

    The unique id that identifies the resource to update.



231
232
233
234
235
236
237
238
239
240
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 231

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

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

    
end

Instance Method Details

#deleteBoolean

Delete the CredentialInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



244
245
246
247
248
249
250
251
252
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 244

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 CredentialInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 257

def 

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

#fetchCredentialInstance

Fetch the CredentialInstance

Returns:



276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 276

def fetch

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

#fetch_with_metadataCredentialInstance

Fetch the CredentialInstanceMetadata

Returns:



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 297

def 

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

#inspectObject

Provide a detailed, user friendly representation



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

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

#to_sObject

Provide a user friendly representation



386
387
388
389
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 386

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

#update(password: :unset) ⇒ CredentialInstance

Update the CredentialInstance

Parameters:

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

    The password that the username will use when authenticating SIP requests. The password must be a minimum of 12 characters, contain at least 1 digit, and have mixed case. (eg IWasAtSignal2018)

Returns:



325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 325

def update(
    password: :unset
)

    data = Twilio::Values.of({
        'Password' => password,
    })

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

#update_with_metadata(password: :unset) ⇒ CredentialInstance

Update the CredentialInstanceMetadata

Parameters:

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

    The password that the username will use when authenticating SIP requests. The password must be a minimum of 12 characters, contain at least 1 digit, and have mixed case. (eg IWasAtSignal2018)

Returns:



353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 353

def (
  password: :unset
)

    data = Twilio::Values.of({
        'Password' => password,
    })

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