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.



573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 573

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:



599
600
601
602
603
604
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 599

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.



608
609
610
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 608

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.



614
615
616
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 614

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the SinkInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



663
664
665
666
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 663

def delete

    context.delete
end

#descriptionString

Returns A human readable description for the Sink.

Returns:

  • (String)

    A human readable description for the Sink



620
621
622
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 620

def description
    @properties['description']
end

#fetchSinkInstance

Fetch the SinkInstance

Returns:



671
672
673
674
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 671

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



712
713
714
715
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 712

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.



656
657
658
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 656

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.



626
627
628
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 626

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.



632
633
634
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 632

def sink_configuration
    @properties['sink_configuration']
end

#sink_testsink_test

Access the sink_test

Returns:



692
693
694
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 692

def sink_test
    context.sink_test
end

#sink_typeSinkType

Returns:

  • (SinkType)


638
639
640
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 638

def sink_type
    @properties['sink_type']
end

#sink_validatesink_validate

Access the sink_validate

Returns:



699
700
701
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 699

def sink_validate
    context.sink_validate
end

#statusStatus

Returns:

  • (Status)


644
645
646
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 644

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



705
706
707
708
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 705

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:



680
681
682
683
684
685
686
687
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 680

def update(
    description: nil
)

    context.update(
        description: description, 
    )
end

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



650
651
652
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 650

def url
    @properties['url']
end