Class: Twilio::REST::Content::V1::ContentInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/content/v1/content.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ ContentInstance

Initialize the ContentInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this Content resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1776

def initialize(version, payload , sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'sid' => payload['sid'],
        'account_sid' => payload['account_sid'],
        'friendly_name' => payload['friendly_name'],
        'language' => payload['language'],
        'variables' => payload['variables'],
        'types' => payload['types'],
        'url' => payload['url'],
        'links' => payload['links'],
    }

    # Context
    @instance_context = nil
    @params = { 'sid' => sid  || @properties['sid']  , }
end

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/usage/api/account) that created Content resource.

Returns:



1830
1831
1832
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1830

def 
    @properties['account_sid']
end

#approval_createapproval_create

Access the approval_create

Returns:



1901
1902
1903
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1901

def approval_create
    context.approval_create
end

#approval_fetchapproval_fetch

Access the approval_fetch

Returns:



1908
1909
1910
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1908

def approval_fetch
    context.approval_fetch
end

#contextContentContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



1803
1804
1805
1806
1807
1808
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1803

def context
    unless @instance_context
        @instance_context = ContentContext.new(@version , @params['sid'])
    end
    @instance_context
end

#date_createdTime

Returns The date and time in GMT that the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



1812
1813
1814
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1812

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT that the resource was last updated specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



1818
1819
1820
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1818

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the ContentInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



1873
1874
1875
1876
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1873

def delete

    context.delete
end

#fetchContentInstance

Fetch the ContentInstance

Returns:



1881
1882
1883
1884
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1881

def fetch

    context.fetch
end

#friendly_nameString

Returns A string name used to describe the Content resource. Not visible to the end recipient.

Returns:

  • (String)

    A string name used to describe the Content resource. Not visible to the end recipient.



1836
1837
1838
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1836

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



1921
1922
1923
1924
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1921

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Content.V1.ContentInstance #{values}>"
end

#languageString

Returns Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in.

Returns:

  • (String)

    Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in.



1842
1843
1844
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1842

def language
    @properties['language']
end

Returns A list of links related to the Content resource, such as approval_fetch and approval_create.

Returns:

  • (Hash)

    A list of links related to the Content resource, such as approval_fetch and approval_create



1866
1867
1868
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1866

def links
    @properties['links']
end

#sidString

Returns The unique string that that we created to identify the Content resource.

Returns:

  • (String)

    The unique string that that we created to identify the Content resource.



1824
1825
1826
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1824

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



1914
1915
1916
1917
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1914

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Content.V1.ContentInstance #{values}>"
end

#typesHash

Returns The [Content types](www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource.

Returns:



1854
1855
1856
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1854

def types
    @properties['types']
end

#update(content_update_request: nil) ⇒ ContentInstance

Update the ContentInstance

Parameters:

  • content_update_request (ContentUpdateRequest) (defaults to: nil)

Returns:



1890
1891
1892
1893
1894
1895
1896
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1890

def update(content_update_request: nil
)

    context.update(
        content_update_request: content_update_request, 
    )
end

#urlString

Returns The URL of the resource, relative to ‘content.twilio.com`.

Returns:



1860
1861
1862
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1860

def url
    @properties['url']
end

#variablesHash

Returns Defines the default placeholder values for variables included in the Content resource. e.g. "Customer_Name".

Returns:

  • (Hash)

    Defines the default placeholder values for variables included in the Content resource. e.g. "Customer_Name".



1848
1849
1850
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 1848

def variables
    @properties['variables']
end