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
226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb', line 226 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 = nil end |
Instance Method Details
#delete ⇒ Boolean
Delete the SyncStreamInstance
240 241 242 243 244 245 246 247 248 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb', line 240 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
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb', line 253 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
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb', line 272 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
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb', line 292 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
396 397 398 399 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb', line 396 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Sync.V1.SyncStreamContext #{context}>" end |
#stream_messages ⇒ StreamMessageList, StreamMessageContext
Access the stream_messages
379 380 381 382 383 384 385 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb', line 379 def unless = StreamMessageList.new( @version, service_sid: @solution[:service_sid], stream_sid: @solution[:sid], ) end end |
#to_s ⇒ Object
Provide a user friendly representation
389 390 391 392 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb', line 389 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Sync.V1.SyncStreamContext #{context}>" end |
#update(ttl: :unset) ⇒ SyncStreamInstance
Update the SyncStreamInstance
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb', line 319 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
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb', line 346 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 |