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 unique SID identifier of the Service Instance that hosts this Message Stream.

  • stream_sid (String) (defaults to: nil)

    The unique 34-character SID identifier of the Message Stream.



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

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

Retrieve a single page of StreamMessageInstance records from the API. Request is executed immediately.

Parameters:

  • data (Hash) (defaults to: nil)

    The body of the Stream Message. Arbitrary JSON object, maximum size 4KB.

Returns:



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# 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



59
60
61
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream/stream_message.rb', line 59

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