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

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/sync/v1/service/sync_stream/stream_message.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid: nil, stream_sid: nil) ⇒ StreamMessageList

Initialize the StreamMessageList

Parameters:

  • version (Version)

    Version that contains the resource

  • service_sid (String) (defaults to: nil)

    The SID of the [Sync Service](www.twilio.com/docs/sync/api/service) the resource is associated with.

  • stream_sid (String) (defaults to: nil)

    The unique string that we created to identify the Sync Stream resource.



27
28
29
30
31
32
33
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream/stream_message.rb', line 27

def initialize(version, service_sid: nil, stream_sid: nil)
  super(version)

  # Path Solution
  @solution = {service_sid: service_sid, stream_sid: stream_sid}
  @uri = "/Services/#{@solution[:service_sid]}/Streams/#{@solution[:stream_sid]}/Messages"
end

Instance Method Details

#create(data: nil) ⇒ StreamMessageInstance

Create the StreamMessageInstance

Parameters:

  • data (Hash) (defaults to: nil)

    A JSON string that represents an arbitrary, schema-less object that makes up the Stream Message body. Can be up to 4KB in length.

Returns:



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream/stream_message.rb', line 40

def create(data: nil)
  data = Twilio::Values.of({'Data' => Twilio.serialize_object(data), })

  payload = @version.create('POST', @uri, data: data)

  StreamMessageInstance.new(
      @version,
      payload,
      service_sid: @solution[:service_sid],
      stream_sid: @solution[:stream_sid],
  )
end

#to_sObject

Provide a user friendly representation



55
56
57
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream/stream_message.rb', line 55

def to_s
  '#<Twilio.Sync.V1.StreamMessageList>'
end