Class: Twilio::REST::Content::V1::ContentContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/content/v1/content.rb,
lib/twilio-ruby/rest/content/v1/content/approval_fetch.rb,
lib/twilio-ruby/rest/content/v1/content/approval_create.rb

Defined Under Namespace

Classes: ApprovalCreateInstance, ApprovalCreateList, ApprovalCreatePage, ApprovalFetchContext, ApprovalFetchInstance, ApprovalFetchList, ApprovalFetchPage

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ ContentContext

Initialize the ContentContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

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



1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1400

def initialize(version, sid)
    super(version)

    # Path Solution
    @solution = { sid: sid,  }
    @uri = "/Content/#{@solution[:sid]}"

    # Dependents
    @approval_create = nil
    @approval_fetch = nil
end

Instance Method Details

#approval_createApprovalCreateList, ApprovalCreateContext

Access the approval_create

Returns:



1467
1468
1469
1470
1471
1472
1473
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1467

def approval_create
  unless @approval_create
    @approval_create = ApprovalCreateList.new(
            @version, content_sid: @solution[:sid], )
  end
  @approval_create
end

#approval_fetchApprovalFetchList, ApprovalFetchContext

Access the approval_fetch



1478
1479
1480
1481
1482
1483
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1478

def approval_fetch
    ApprovalFetchContext.new(
            @version,
            @solution[:sid]
            )
end

#deleteBoolean

Delete the ContentInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



1414
1415
1416
1417
1418
1419
1420
1421
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1414

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetchContentInstance

Fetch the ContentInstance

Returns:



1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1426

def fetch

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

#inspectObject

Provide a detailed, user friendly representation



1494
1495
1496
1497
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1494

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

#to_sObject

Provide a user friendly representation



1487
1488
1489
1490
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1487

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

#update(content_update_request: nil) ⇒ ContentInstance

Update the ContentInstance

Parameters:

  • content_update_request (ContentUpdateRequest) (defaults to: nil)

Returns:



1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1446

def update(content_update_request: nil
)

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