Class: Twilio::REST::Api::V2010::AccountContext::CallContext::StreamInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/call/stream.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, account_sid: nil, call_sid: nil, sid: nil) ⇒ StreamInstance

Initialize the StreamInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String) (defaults to: nil)

    The SID of the Account that created this Stream resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
# File 'lib/twilio-ruby/rest/api/v2010/account/call/stream.rb', line 768

def initialize(version, payload , account_sid: nil, call_sid: nil, sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'account_sid' => payload['account_sid'],
        'call_sid' => payload['call_sid'],
        'name' => payload['name'],
        'status' => payload['status'],
        'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
        'uri' => payload['uri'],
    }

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

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created this Stream resource.

Returns:



806
807
808
# File 'lib/twilio-ruby/rest/api/v2010/account/call/stream.rb', line 806

def 
    @properties['account_sid']
end

#call_sidString

Returns The SID of the [Call](www.twilio.com/docs/voice/api/call-resource) the Stream resource is associated with.

Returns:



812
813
814
# File 'lib/twilio-ruby/rest/api/v2010/account/call/stream.rb', line 812

def call_sid
    @properties['call_sid']
end

#contextStreamContext

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

Returns:



791
792
793
794
795
796
# File 'lib/twilio-ruby/rest/api/v2010/account/call/stream.rb', line 791

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

#date_updatedTime

Returns The date and time in GMT that this resource was last updated, specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



830
831
832
# File 'lib/twilio-ruby/rest/api/v2010/account/call/stream.rb', line 830

def date_updated
    @properties['date_updated']
end

#inspectObject

Provide a detailed, user friendly representation



862
863
864
865
# File 'lib/twilio-ruby/rest/api/v2010/account/call/stream.rb', line 862

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

#nameString

Returns The user-specified name of this Stream, if one was given when the Stream was created. This may be used to stop the Stream.

Returns:

  • (String)

    The user-specified name of this Stream, if one was given when the Stream was created. This may be used to stop the Stream.



818
819
820
# File 'lib/twilio-ruby/rest/api/v2010/account/call/stream.rb', line 818

def name
    @properties['name']
end

#sidString

Returns The SID of the Stream resource.

Returns:

  • (String)

    The SID of the Stream resource.



800
801
802
# File 'lib/twilio-ruby/rest/api/v2010/account/call/stream.rb', line 800

def sid
    @properties['sid']
end

#statusStatus

Returns:

  • (Status)


824
825
826
# File 'lib/twilio-ruby/rest/api/v2010/account/call/stream.rb', line 824

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



855
856
857
858
# File 'lib/twilio-ruby/rest/api/v2010/account/call/stream.rb', line 855

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

#update(status: nil) ⇒ StreamInstance

Update the StreamInstance

Parameters:

  • status (UpdateStatus) (defaults to: nil)

Returns:



844
845
846
847
848
849
850
851
# File 'lib/twilio-ruby/rest/api/v2010/account/call/stream.rb', line 844

def update(
    status: nil
)

    context.update(
        status: status, 
    )
end

#uriString

Returns The URI of the resource, relative to ‘api.twilio.com`.

Returns:

  • (String)

    The URI of the resource, relative to ‘api.twilio.com`.



836
837
838
# File 'lib/twilio-ruby/rest/api/v2010/account/call/stream.rb', line 836

def uri
    @properties['uri']
end