Class: Twilio::REST::Sync::V1::ServiceContext::SyncStreamContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Sync::V1::ServiceContext::SyncStreamContext
- Defined in:
- lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb,
lib/twilio-ruby/rest/sync/v1/service/sync_stream/stream_message.rb
Defined Under Namespace
Classes: StreamMessageInstance, StreamMessageList, StreamMessageListResponse, StreamMessagePage, StreamMessagePageMetadata
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the SyncStreamInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the SyncStreamInstanceMetadata.
-
#fetch ⇒ SyncStreamInstance
Fetch the SyncStreamInstance.
-
#fetch_with_metadata ⇒ SyncStreamInstance
Fetch the SyncStreamInstanceMetadata.
-
#initialize(version, service_sid, sid) ⇒ SyncStreamContext
constructor
Initialize the SyncStreamContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#stream_messages ⇒ StreamMessageList, StreamMessageContext
Access the stream_messages.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(ttl: :unset) ⇒ SyncStreamInstance
Update the SyncStreamInstance.
-
#update_with_metadata(ttl: :unset) ⇒ SyncStreamInstance
Update the SyncStreamInstanceMetadata.
Constructor Details
#initialize(version, service_sid, sid) ⇒ SyncStreamContext
Initialize the SyncStreamContext
234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb', line 234 def initialize(version, service_sid, sid) super(version) # Path Solution @solution = { service_sid: service_sid, sid: sid, } @uri = "/Services/#{@solution[:service_sid]}/Streams/#{@solution[:sid]}" # Dependents @stream_messages = nil end |
Instance Method Details
#delete ⇒ Boolean
Delete the SyncStreamInstance
248 249 250 251 252 253 254 255 256 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb', line 248 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#delete_with_metadata ⇒ Boolean
Delete the SyncStreamInstanceMetadata
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb', line 261 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) syncStream_instance = SyncStreamInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) SyncStreamInstanceMetadata.new(@version, syncStream_instance, response.headers, response.status_code) end |
#fetch ⇒ SyncStreamInstance
Fetch the SyncStreamInstance
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb', line 280 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) SyncStreamInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ SyncStreamInstance
Fetch the SyncStreamInstanceMetadata
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb', line 300 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) sync_stream_instance = SyncStreamInstance.new( @version, response.body, service_sid: @solution[:service_sid], sid: @solution[:sid], ) SyncStreamInstanceMetadata.new( @version, sync_stream_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
404 405 406 407 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb', line 404 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Sync.V1.SyncStreamContext #{context}>" end |
#stream_messages ⇒ StreamMessageList, StreamMessageContext
Access the stream_messages
387 388 389 390 391 392 393 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb', line 387 def unless @stream_messages @stream_messages = StreamMessageList.new( @version, service_sid: @solution[:service_sid], stream_sid: @solution[:sid], ) end @stream_messages end |
#to_s ⇒ Object
Provide a user friendly representation
397 398 399 400 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb', line 397 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Sync.V1.SyncStreamContext #{context}>" end |
#update(ttl: :unset) ⇒ SyncStreamInstance
Update the SyncStreamInstance
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb', line 327 def update( ttl: :unset ) data = Twilio::Values.of({ 'Ttl' => ttl, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) SyncStreamInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |
#update_with_metadata(ttl: :unset) ⇒ SyncStreamInstance
Update the SyncStreamInstanceMetadata
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb', line 354 def ( ttl: :unset ) data = Twilio::Values.of({ 'Ttl' => ttl, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) sync_stream_instance = SyncStreamInstance.new( @version, response.body, service_sid: @solution[:service_sid], sid: @solution[:sid], ) SyncStreamInstanceMetadata.new( @version, sync_stream_instance, response.headers, response.status_code ) end |