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

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/content/v1/content.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].

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

  • sid (String) (defaults to: nil)

    The Twilio-provided string that uniquely identifies the Content resource to fetch.



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 215

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 that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource



268
269
270
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 268

def 
  @properties['account_sid']
end

#approval_fetchapproval_fetch

Access the approval_fetch

Returns:



325
326
327
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 325

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:



241
242
243
244
245
246
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 241

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

#date_createdTime

Returns The RFC 2822 date and time in GMT that the resource was created.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT that the resource was created



250
251
252
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 250

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The RFC 2822 date and time in GMT that the resource was last updated.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT that the resource was last updated



256
257
258
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 256

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the ContentInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise



318
319
320
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 318

def delete
  context.delete
end

#fetchContentInstance

Fetch the ContentInstance

Returns:



311
312
313
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 311

def fetch
  context.fetch
end

#friendly_nameString

Returns A string name used to describe the Content resource.

Returns:

  • (String)

    A string name used to describe the Content resource



274
275
276
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 274

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



338
339
340
341
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 338

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

#languageString

Returns Two-letter language code identifying the language the Content resource is in.

Returns:

  • (String)

    Two-letter language code identifying the language the Content resource is in.



280
281
282
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 280

def language
  @properties['language']
end

Returns A list of links related to the Content resource.

Returns:

  • (String)

    A list of links related to the Content resource



304
305
306
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 304

def links
  @properties['links']
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource



262
263
264
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 262

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



331
332
333
334
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 331

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

#typesHash

Returns The Content types (e.g. twilio/text) for this Content resource.

Returns:

  • (Hash)

    The Content types (e.g. twilio/text) for this Content resource



292
293
294
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 292

def types
  @properties['types']
end

#urlString

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

Returns:



298
299
300
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 298

def url
  @properties['url']
end

#variablesHash

Returns Defines the default placeholder values for variables included in the Content resource.

Returns:

  • (Hash)

    Defines the default placeholder values for variables included in the Content resource



286
287
288
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 286

def variables
  @properties['variables']
end