Class: Twilio::REST::Events::V1::SinkInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the SinkInstance

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 Sink resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 299

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']),
        'description' => payload['description'],
        'sid' => payload['sid'],
        'sink_configuration' => payload['sink_configuration'],
        'sink_type' => payload['sink_type'],
        'status' => payload['status'],
        'url' => payload['url'],
        'links' => payload['links'],
    }

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

Instance Method Details

#contextSinkContext

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

Returns:



324
325
326
327
328
329
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 324

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

#date_createdTime

Returns The date that this Sink was created, given in ISO 8601 format.

Returns:

  • (Time)

    The date that this Sink was created, given in ISO 8601 format.



333
334
335
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 333

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date that this Sink was updated, given in ISO 8601 format.

Returns:

  • (Time)

    The date that this Sink was updated, given in ISO 8601 format.



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

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the SinkInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



388
389
390
391
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 388

def delete

    context.delete
end

#descriptionString

Returns A human readable description for the Sink.

Returns:

  • (String)

    A human readable description for the Sink



345
346
347
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 345

def description
    @properties['description']
end

#fetchSinkInstance

Fetch the SinkInstance

Returns:



396
397
398
399
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 396

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



437
438
439
440
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 437

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

Returns Contains a dictionary of URL links to nested resources of this Sink.

Returns:

  • (Hash)

    Contains a dictionary of URL links to nested resources of this Sink.



381
382
383
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 381

def links
    @properties['links']
end

#sidString

Returns A 34 character string that uniquely identifies this Sink.

Returns:

  • (String)

    A 34 character string that uniquely identifies this Sink.



351
352
353
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 351

def sid
    @properties['sid']
end

#sink_configurationHash

Returns The information required for Twilio to connect to the provided Sink encoded as JSON.

Returns:

  • (Hash)

    The information required for Twilio to connect to the provided Sink encoded as JSON.



357
358
359
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 357

def sink_configuration
    @properties['sink_configuration']
end

#sink_testsink_test

Access the sink_test

Returns:



417
418
419
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 417

def sink_test
    context.sink_test
end

#sink_typeSinkType

Returns:

  • (SinkType)


363
364
365
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 363

def sink_type
    @properties['sink_type']
end

#sink_validatesink_validate

Access the sink_validate

Returns:



424
425
426
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 424

def sink_validate
    context.sink_validate
end

#statusStatus

Returns:

  • (Status)


369
370
371
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 369

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



430
431
432
433
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 430

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

#update(description: nil) ⇒ SinkInstance

Update the SinkInstance

Parameters:

  • description (String) (defaults to: nil)

    A human readable description for the Sink **This value should not contain PII.**

Returns:



405
406
407
408
409
410
411
412
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 405

def update(
    description: nil
)

    context.update(
        description: description, 
    )
end

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



375
376
377
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 375

def url
    @properties['url']
end