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

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 the resource is associated with.

  • stream_sid (String) (defaults to: nil)

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


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

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 4 KiB in length.

Returns:


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

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


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

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