Class: Twilio::REST::Content::V1::ContentContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Content::V1::ContentContext
- 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, ApprovalCreateListResponse, ApprovalCreatePage, ApprovalCreatePageMetadata, ApprovalFetchContext, ApprovalFetchInstance, ApprovalFetchInstanceMetadata, ApprovalFetchList, ApprovalFetchListResponse, ApprovalFetchPage, ApprovalFetchPageMetadata
Instance Method Summary collapse
-
#approval_create ⇒ ApprovalCreateList, ApprovalCreateContext
Access the approval_create.
-
#approval_fetch ⇒ ApprovalFetchList, ApprovalFetchContext
Access the approval_fetch.
-
#delete ⇒ Boolean
Delete the ContentInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the ContentInstanceMetadata.
-
#fetch ⇒ ContentInstance
Fetch the ContentInstance.
-
#fetch_with_metadata ⇒ ContentInstance
Fetch the ContentInstanceMetadata.
-
#initialize(version, sid) ⇒ ContentContext
constructor
Initialize the ContentContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(content_update_request: nil) ⇒ ContentInstance
Update the ContentInstance.
-
#update_with_metadata(content_update_request: nil) ⇒ ContentInstance
Update the ContentInstanceMetadata.
Constructor Details
#initialize(version, sid) ⇒ ContentContext
Initialize the ContentContext
1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1449 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_create ⇒ ApprovalCreateList, ApprovalCreateContext
Access the approval_create
1589 1590 1591 1592 1593 1594 1595 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1589 def approval_create unless @approval_create @approval_create = ApprovalCreateList.new( @version, content_sid: @solution[:sid], ) end @approval_create end |
#approval_fetch ⇒ ApprovalFetchList, ApprovalFetchContext
Access the approval_fetch
1600 1601 1602 1603 1604 1605 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1600 def approval_fetch ApprovalFetchContext.new( @version, @solution[:sid] ) end |
#delete ⇒ Boolean
Delete the ContentInstance
1464 1465 1466 1467 1468 1469 1470 1471 1472 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1464 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#delete_with_metadata ⇒ Boolean
Delete the ContentInstanceMetadata
1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1477 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) content_instance = ContentInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) ContentInstanceMetadata.new(@version, content_instance, response.headers, response.status_code) end |
#fetch ⇒ ContentInstance
Fetch the ContentInstance
1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1496 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 |
#fetch_with_metadata ⇒ ContentInstance
Fetch the ContentInstanceMetadata
1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1515 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) content_instance = ContentInstance.new( @version, response.body, sid: @solution[:sid], ) ContentInstanceMetadata.new( @version, content_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
1616 1617 1618 1619 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1616 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Content.V1.ContentContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
1609 1610 1611 1612 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1609 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
1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1541 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 |
#update_with_metadata(content_update_request: nil) ⇒ ContentInstance
Update the ContentInstanceMetadata
1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1562 def (content_update_request: nil ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) headers['Content-Type'] = 'application/json' response = @version.('PUT', @uri, headers: headers, data: content_update_request.to_json) content_instance = ContentInstance.new( @version, response.body, sid: @solution[:sid], ) ContentInstanceMetadata.new( @version, content_instance, response.headers, response.status_code ) end |