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.



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

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



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

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

#deleteBoolean

Delete the ContentInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



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

def delete

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

#fetchContentInstance

Fetch the ContentInstance

Returns:



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

def fetch

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

#inspectObject

Provide a detailed, user friendly representation



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

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

#to_sObject

Provide a user friendly representation



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

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