Class: Twilio::REST::Sync::V1::ServiceContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Sync::V1::ServiceContext
- Defined in:
- lib/twilio-ruby/rest/sync/v1/service.rb,
lib/twilio-ruby/rest/sync/v1/service/document.rb,
lib/twilio-ruby/rest/sync/v1/service/sync_map.rb,
lib/twilio-ruby/rest/sync/v1/service/sync_list.rb,
lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb,
lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb,
lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb,
lib/twilio-ruby/rest/sync/v1/service/sync_stream/stream_message.rb,
lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb,
lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb,
lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_permission.rb
Defined Under Namespace
Classes: DocumentContext, DocumentInstance, DocumentInstanceMetadata, DocumentList, DocumentListResponse, DocumentPage, DocumentPageMetadata, SyncListContext, SyncListInstance, SyncListInstanceMetadata, SyncListList, SyncListListResponse, SyncListPage, SyncListPageMetadata, SyncMapContext, SyncMapInstance, SyncMapInstanceMetadata, SyncMapList, SyncMapListResponse, SyncMapPage, SyncMapPageMetadata, SyncStreamContext, SyncStreamInstance, SyncStreamInstanceMetadata, SyncStreamList, SyncStreamListResponse, SyncStreamPage, SyncStreamPageMetadata
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the ServiceInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the ServiceInstanceMetadata.
-
#documents(sid = :unset) ⇒ DocumentList, DocumentContext
Access the documents.
-
#fetch ⇒ ServiceInstance
Fetch the ServiceInstance.
-
#fetch_with_metadata ⇒ ServiceInstance
Fetch the ServiceInstanceMetadata.
-
#initialize(version, sid) ⇒ ServiceContext
constructor
Initialize the ServiceContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#sync_lists(sid = :unset) ⇒ SyncListList, SyncListContext
Access the sync_lists.
-
#sync_maps(sid = :unset) ⇒ SyncMapList, SyncMapContext
Access the sync_maps.
-
#sync_streams(sid = :unset) ⇒ SyncStreamList, SyncStreamContext
Access the sync_streams.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(webhook_url: :unset, friendly_name: :unset, reachability_webhooks_enabled: :unset, acl_enabled: :unset, reachability_debouncing_enabled: :unset, reachability_debouncing_window: :unset, webhooks_from_rest_enabled: :unset) ⇒ ServiceInstance
Update the ServiceInstance.
-
#update_with_metadata(webhook_url: :unset, friendly_name: :unset, reachability_webhooks_enabled: :unset, acl_enabled: :unset, reachability_debouncing_enabled: :unset, reachability_debouncing_window: :unset, webhooks_from_rest_enabled: :unset) ⇒ ServiceInstance
Update the ServiceInstanceMetadata.
Constructor Details
#initialize(version, sid) ⇒ ServiceContext
Initialize the ServiceContext
251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 251 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Services/#{@solution[:sid]}" # Dependents @sync_streams = nil @sync_lists = nil @sync_maps = nil @documents = nil end |
Instance Method Details
#delete ⇒ Boolean
Delete the ServiceInstance
268 269 270 271 272 273 274 275 276 |
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 268 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 ServiceInstanceMetadata
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 |
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 281 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) service_instance = ServiceInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) ServiceInstanceMetadata.new(@version, service_instance, response.headers, response.status_code) end |
#documents(sid = :unset) ⇒ DocumentList, DocumentContext
Access the documents
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 |
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 496 def documents(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return DocumentContext.new(@version, @solution[:sid],sid ) end unless @documents @documents = DocumentList.new( @version, service_sid: @solution[:sid], ) end @documents end |
#fetch ⇒ ServiceInstance
Fetch the ServiceInstance
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 300 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) ServiceInstance.new( @version, payload, sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ ServiceInstance
Fetch the ServiceInstanceMetadata
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 319 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) service_instance = ServiceInstance.new( @version, response.body, sid: @solution[:sid], ) ServiceInstanceMetadata.new( @version, service_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
521 522 523 524 |
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 521 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Sync.V1.ServiceContext #{context}>" end |
#sync_lists(sid = :unset) ⇒ SyncListList, SyncListContext
Access the sync_lists
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 |
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 458 def sync_lists(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return SyncListContext.new(@version, @solution[:sid],sid ) end unless @sync_lists @sync_lists = SyncListList.new( @version, service_sid: @solution[:sid], ) end @sync_lists end |
#sync_maps(sid = :unset) ⇒ SyncMapList, SyncMapContext
Access the sync_maps
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 |
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 477 def sync_maps(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return SyncMapContext.new(@version, @solution[:sid],sid ) end unless @sync_maps @sync_maps = SyncMapList.new( @version, service_sid: @solution[:sid], ) end @sync_maps end |
#sync_streams(sid = :unset) ⇒ SyncStreamList, SyncStreamContext
Access the sync_streams
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 |
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 439 def sync_streams(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return SyncStreamContext.new(@version, @solution[:sid],sid ) end unless @sync_streams @sync_streams = SyncStreamList.new( @version, service_sid: @solution[:sid], ) end @sync_streams end |
#to_s ⇒ Object
Provide a user friendly representation
514 515 516 517 |
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 514 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Sync.V1.ServiceContext #{context}>" end |
#update(webhook_url: :unset, friendly_name: :unset, reachability_webhooks_enabled: :unset, acl_enabled: :unset, reachability_debouncing_enabled: :unset, reachability_debouncing_window: :unset, webhooks_from_rest_enabled: :unset) ⇒ ServiceInstance
Update the ServiceInstance
351 352 353 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 382 383 |
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 351 def update( webhook_url: :unset, friendly_name: :unset, reachability_webhooks_enabled: :unset, acl_enabled: :unset, reachability_debouncing_enabled: :unset, reachability_debouncing_window: :unset, webhooks_from_rest_enabled: :unset ) data = Twilio::Values.of({ 'WebhookUrl' => webhook_url, 'FriendlyName' => friendly_name, 'ReachabilityWebhooksEnabled' => reachability_webhooks_enabled, 'AclEnabled' => acl_enabled, 'ReachabilityDebouncingEnabled' => reachability_debouncing_enabled, 'ReachabilityDebouncingWindow' => reachability_debouncing_window, 'WebhooksFromRestEnabled' => webhooks_from_rest_enabled, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) ServiceInstance.new( @version, payload, sid: @solution[:sid], ) end |
#update_with_metadata(webhook_url: :unset, friendly_name: :unset, reachability_webhooks_enabled: :unset, acl_enabled: :unset, reachability_debouncing_enabled: :unset, reachability_debouncing_window: :unset, webhooks_from_rest_enabled: :unset) ⇒ ServiceInstance
Update the ServiceInstanceMetadata
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 |
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 395 def ( webhook_url: :unset, friendly_name: :unset, reachability_webhooks_enabled: :unset, acl_enabled: :unset, reachability_debouncing_enabled: :unset, reachability_debouncing_window: :unset, webhooks_from_rest_enabled: :unset ) data = Twilio::Values.of({ 'WebhookUrl' => webhook_url, 'FriendlyName' => friendly_name, 'ReachabilityWebhooksEnabled' => reachability_webhooks_enabled, 'AclEnabled' => acl_enabled, 'ReachabilityDebouncingEnabled' => reachability_debouncing_enabled, 'ReachabilityDebouncingWindow' => reachability_debouncing_window, 'WebhooksFromRestEnabled' => webhooks_from_rest_enabled, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) service_instance = ServiceInstance.new( @version, response.body, sid: @solution[:sid], ) ServiceInstanceMetadata.new( @version, service_instance, response.headers, response.status_code ) end |