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

Public Class Methods

new(version, service_sid, sid) click to toggle source

Initialize the SyncStreamContext @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] with the Sync Stream
resource to fetch.

@param [String] sid The SID of the Stream resource to fetch. @return [SyncStreamContext] SyncStreamContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb
173 def initialize(version, service_sid, sid)
174   super(version)
175 
176   # Path Solution
177   @solution = {service_sid: service_sid, sid: sid, }
178   @uri = "/Services/#{@solution[:service_sid]}/Streams/#{@solution[:sid]}"
179 
180   # Dependents
181   @stream_messages = nil
182 end

Public Instance Methods

delete() click to toggle source

Delete the SyncStreamInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb
201 def delete
202    @version.delete('DELETE', @uri)
203 end
fetch() click to toggle source

Fetch the SyncStreamInstance @return [SyncStreamInstance] Fetched SyncStreamInstance

    # File lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb
187 def fetch
188   payload = @version.fetch('GET', @uri)
189 
190   SyncStreamInstance.new(
191       @version,
192       payload,
193       service_sid: @solution[:service_sid],
194       sid: @solution[:sid],
195   )
196 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb
249 def inspect
250   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
251   "#<Twilio.Sync.V1.SyncStreamContext #{context}>"
252 end
stream_messages() click to toggle source

Access the stream_messages @return [StreamMessageList] @return [StreamMessageContext]

    # File lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb
228 def stream_messages
229   unless @stream_messages
230     @stream_messages = StreamMessageList.new(
231         @version,
232         service_sid: @solution[:service_sid],
233         stream_sid: @solution[:sid],
234     )
235   end
236 
237   @stream_messages
238 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb
242 def to_s
243   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
244   "#<Twilio.Sync.V1.SyncStreamContext #{context}>"
245 end
update(ttl: :unset) click to toggle source

Update the SyncStreamInstance @param [String] ttl How long, {in

seconds}[https://www.twilio.com/docs/sync/limits#sync-payload-limits], before
the Stream expires and is deleted (time-to-live).

@return [SyncStreamInstance] Updated SyncStreamInstance

    # File lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb
211 def update(ttl: :unset)
212   data = Twilio::Values.of({'Ttl' => ttl, })
213 
214   payload = @version.update('POST', @uri, data: data)
215 
216   SyncStreamInstance.new(
217       @version,
218       payload,
219       service_sid: @solution[:service_sid],
220       sid: @solution[:sid],
221   )
222 end