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

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

Defined Under Namespace

Classes: 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 fetch.



135
136
137
138
139
140
141
142
143
144
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 135

def initialize(version, sid)
    super(version)

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

    # Dependents
    @approval_fetch = nil
end

Instance Method Details

#approval_fetchApprovalFetchList, ApprovalFetchContext

Access the approval_fetch



170
171
172
173
174
175
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 170

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

#deleteBoolean

Delete the ContentInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



148
149
150
151
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 148

def delete

    @version.delete('DELETE', @uri)
end

#fetchContentInstance

Fetch the ContentInstance

Returns:



156
157
158
159
160
161
162
163
164
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 156

def fetch

    payload = @version.fetch('GET', @uri)
    ContentInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



186
187
188
189
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 186

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

#to_sObject

Provide a user friendly representation



179
180
181
182
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 179

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