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



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

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 (Object) (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:



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# 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),
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.create('POST', @uri, data: data, headers: headers)
    StreamMessageInstance.new(
        @version,
        payload,
        service_sid: @solution[:service_sid],
        stream_sid: @solution[:stream_sid],
    )
end

#to_sObject

Provide a user friendly representation



67
68
69
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream/stream_message.rb', line 67

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