Class: Twilio::REST::Webhooks::V1::AuthProfileContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, auth_profile_id) ⇒ AuthProfileContext

Initialize the AuthProfileContext

Parameters:

  • version (Version) —

    Version that contains the resource

  • auth_profile_id (String)


332
333
334
335
336
337
338
339
340
341
342
# File 'lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb', line 332

def initialize(version, auth_profile_id)
    
    apiV1Version = ApiV1Version.new version.domain, version
    super(apiV1Version)

    # Path Solution
    @solution = { auth_profile_id: auth_profile_id,  }
    @uri = "/Webhooks/AuthProfiles/#{@solution[:auth_profile_id]}"

    
end

Instance Method Details

#delete ⇒ Boolean

Delete the AuthProfileInstance

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



346
347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb', line 346

def delete

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

#delete_with_metadata ⇒ Boolean

Delete the AuthProfileInstanceMetadata

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# File 'lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb', line 364

def 

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

#fetch ⇒ AuthProfileInstance

Fetch the AuthProfileInstance

Returns:



383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb', line 383

def fetch

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

#fetch_with_metadata ⇒ AuthProfileInstance

Fetch the AuthProfileInstanceMetadata

Returns:



402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
# File 'lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb', line 402

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
     headers['Accept'] = '*/*'
    response = @version.('GET', @uri, headers: headers)
    auth_profile_instance = AuthProfileInstance.new(
        @version,
        response.body,
        auth_profile_id: @solution[:auth_profile_id],
    )
    AuthProfileInstanceMetadata.new(
        @version,
        auth_profile_instance,
        response.headers,
        response.status_code
    )
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



482
483
484
485
# File 'lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb', line 482

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

#patch(patch_auth_profile: nil) ⇒ AuthProfileInstance

Patch the AuthProfileInstance

Parameters:

  • patch_auth_profile (PatchAuthProfile) (defaults to: nil)

Returns:



428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
# File 'lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb', line 428

def patch(patch_auth_profile: nil
)

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    headers['Content-Type'] = 'application/json'
    
    
    
     headers['Accept'] = '*/*'
    payload = @version.patch('PATCH', @uri, headers: headers, data: patch_auth_profile.to_json)
    AuthProfileInstance.new(
        @version,
        payload,
        auth_profile_id: @solution[:auth_profile_id],
    )
end

#patch_with_metadata(patch_auth_profile: nil) ⇒ AuthProfileInstance

Patch the AuthProfileInstanceMetadata

Parameters:

  • patch_auth_profile (PatchAuthProfile) (defaults to: nil)

Returns:



449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
# File 'lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb', line 449

def (patch_auth_profile: nil
)

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    headers['Content-Type'] = 'application/json'
    
    
    
     headers['Accept'] = '*/*'
    response = @version.('PATCH', @uri, headers: headers, data: patch_auth_profile.to_json)
    auth_profile_instance = AuthProfileInstance.new(
        @version,
        response.body,
        auth_profile_id: @solution[:auth_profile_id],
    )
    AuthProfileInstanceMetadata.new(
        @version,
        auth_profile_instance,
        response.headers,
        response.status_code
    )
end

#to_s ⇒ Object

Provide a user friendly representation



475
476
477
478
# File 'lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb', line 475

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