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, ApprovalCreatePage, ApprovalFetchContext, ApprovalFetchInstance, ApprovalFetchInstanceMetadata, ApprovalFetchList, ApprovalFetchListResponse, ApprovalFetchPage
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
1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1463 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
1603 1604 1605 1606 1607 1608 1609 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1603 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
1614 1615 1616 1617 1618 1619 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1614 def approval_fetch ApprovalFetchContext.new( @version, @solution[:sid] ) end |
#delete ⇒ Boolean
Delete the ContentInstance
1478 1479 1480 1481 1482 1483 1484 1485 1486 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1478 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
1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1491 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
1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1510 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
1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1529 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
1630 1631 1632 1633 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1630 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Content.V1.ContentContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
1623 1624 1625 1626 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1623 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
1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1555 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
1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 |
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1576 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 |