class Twilio::REST::Sync::V1::ServiceContext::SyncStreamContext::StreamMessageList

Public Class Methods

new(version, service_sid: nil, stream_sid: nil) click to toggle source

Initialize the StreamMessageList @param [Version] version Version that contains the resource @param [String] service_sid The SID of the {Sync

Service}[https://www.twilio.com/docs/sync/api/service] the resource is
associated with.

@param [String] stream_sid The unique string that we created to identify the

Sync Stream resource.

@return [StreamMessageList] StreamMessageList

Calls superclass method Twilio::REST::ListResource::new
   # File lib/twilio-ruby/rest/sync/v1/service/sync_stream/stream_message.rb
25 def initialize(version, service_sid: nil, stream_sid: nil)
26   super(version)
27 
28   # Path Solution
29   @solution = {service_sid: service_sid, stream_sid: stream_sid}
30   @uri = "/Services/#{@solution[:service_sid]}/Streams/#{@solution[:stream_sid]}/Messages"
31 end

Public Instance Methods

create(data: nil) click to toggle source

Create the StreamMessageInstance @param [Hash] data A JSON string that represents an arbitrary, schema-less

object that makes up the Stream Message body. Can be up to 4 KiB in length.

@return [StreamMessageInstance] Created StreamMessageInstance

   # File lib/twilio-ruby/rest/sync/v1/service/sync_stream/stream_message.rb
38 def create(data: nil)
39   data = Twilio::Values.of({'Data' => Twilio.serialize_object(data), })
40 
41   payload = @version.create('POST', @uri, data: data)
42 
43   StreamMessageInstance.new(
44       @version,
45       payload,
46       service_sid: @solution[:service_sid],
47       stream_sid: @solution[:stream_sid],
48   )
49 end
to_s() click to toggle source

Provide a user friendly representation

   # File lib/twilio-ruby/rest/sync/v1/service/sync_stream/stream_message.rb
53 def to_s
54   '#<Twilio.Sync.V1.StreamMessageList>'
55 end