Class: Twilio::REST::Preview::Proxy::ServiceInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Preview::Proxy::ServiceInstance
- Defined in:
- lib/twilio-ruby/rest/preview/proxy/service.rb
Overview
PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].
Instance Method Summary collapse
-
#account_sid ⇒ String
Account Sid.
-
#auto_create ⇒ Boolean
Boolean flag specifying whether to auto-create threads.
-
#callback_url ⇒ String
URL Twilio will request for callbacks.
-
#context ⇒ ServiceContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#date_created ⇒ Time
The date this Service was created.
-
#date_updated ⇒ Time
The date this Service was updated.
-
#delete ⇒ Boolean
Deletes the ServiceInstance.
-
#fetch ⇒ ServiceInstance
Fetch a ServiceInstance.
-
#friendly_name ⇒ String
A human readable description of this resource.
-
#initialize(version, payload, sid: nil) ⇒ ServiceInstance
constructor
Initialize the ServiceInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#links ⇒ String
Nested resource URLs.
-
#phone_numbers ⇒ phone_numbers
Access the phone_numbers.
-
#sessions ⇒ sessions
Access the sessions.
-
#short_codes ⇒ short_codes
Access the short_codes.
-
#sid ⇒ String
A string that uniquely identifies this Service.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, auto_create: :unset, callback_url: :unset) ⇒ ServiceInstance
Update the ServiceInstance.
-
#url ⇒ String
The URL of this resource.
Constructor Details
#initialize(version, payload, sid: nil) ⇒ ServiceInstance
Initialize the ServiceInstance
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 |
# File 'lib/twilio-ruby/rest/preview/proxy/service.rb', line 355 def initialize(version, payload, sid: nil) super(version) # Marshaled Properties @properties = { 'sid' => payload['sid'], 'friendly_name' => payload['friendly_name'], 'account_sid' => payload['account_sid'], 'auto_create' => payload['auto_create'], 'callback_url' => payload['callback_url'], 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 'url' => payload['url'], 'links' => payload['links'], } # Context @instance_context = nil @params = { 'sid' => sid || @properties['sid'], } end |
Instance Method Details
#account_sid ⇒ String
Returns Account Sid.
406 407 408 |
# File 'lib/twilio-ruby/rest/preview/proxy/service.rb', line 406 def account_sid @properties['account_sid'] end |
#auto_create ⇒ Boolean
Returns Boolean flag specifying whether to auto-create threads.
412 413 414 |
# File 'lib/twilio-ruby/rest/preview/proxy/service.rb', line 412 def auto_create @properties['auto_create'] end |
#callback_url ⇒ String
Returns URL Twilio will request for callbacks.
418 419 420 |
# File 'lib/twilio-ruby/rest/preview/proxy/service.rb', line 418 def callback_url @properties['callback_url'] end |
#context ⇒ ServiceContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
382 383 384 385 386 387 388 389 390 |
# File 'lib/twilio-ruby/rest/preview/proxy/service.rb', line 382 def context unless @instance_context @instance_context = ServiceContext.new( @version, @params['sid'], ) end @instance_context end |
#date_created ⇒ Time
Returns The date this Service was created.
424 425 426 |
# File 'lib/twilio-ruby/rest/preview/proxy/service.rb', line 424 def date_created @properties['date_created'] end |
#date_updated ⇒ Time
Returns The date this Service was updated.
430 431 432 |
# File 'lib/twilio-ruby/rest/preview/proxy/service.rb', line 430 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Deletes the ServiceInstance
456 457 458 |
# File 'lib/twilio-ruby/rest/preview/proxy/service.rb', line 456 def delete context.delete end |
#fetch ⇒ ServiceInstance
Fetch a ServiceInstance
449 450 451 |
# File 'lib/twilio-ruby/rest/preview/proxy/service.rb', line 449 def fetch context.fetch end |
#friendly_name ⇒ String
Returns A human readable description of this resource.
400 401 402 |
# File 'lib/twilio-ruby/rest/preview/proxy/service.rb', line 400 def friendly_name @properties['friendly_name'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
507 508 509 510 |
# File 'lib/twilio-ruby/rest/preview/proxy/service.rb', line 507 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Preview.Proxy.ServiceInstance #{values}>" end |
#links ⇒ String
Returns Nested resource URLs.
442 443 444 |
# File 'lib/twilio-ruby/rest/preview/proxy/service.rb', line 442 def links @properties['links'] end |
#phone_numbers ⇒ phone_numbers
Access the phone_numbers
487 488 489 |
# File 'lib/twilio-ruby/rest/preview/proxy/service.rb', line 487 def phone_numbers context.phone_numbers end |
#sessions ⇒ sessions
Access the sessions
480 481 482 |
# File 'lib/twilio-ruby/rest/preview/proxy/service.rb', line 480 def sessions context.sessions end |
#short_codes ⇒ short_codes
Access the short_codes
494 495 496 |
# File 'lib/twilio-ruby/rest/preview/proxy/service.rb', line 494 def short_codes context.short_codes end |
#sid ⇒ String
Returns A string that uniquely identifies this Service.
394 395 396 |
# File 'lib/twilio-ruby/rest/preview/proxy/service.rb', line 394 def sid @properties['sid'] end |
#to_s ⇒ Object
Provide a user friendly representation
500 501 502 503 |
# File 'lib/twilio-ruby/rest/preview/proxy/service.rb', line 500 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Preview.Proxy.ServiceInstance #{values}>" end |
#update(friendly_name: :unset, auto_create: :unset, callback_url: :unset) ⇒ ServiceInstance
Update the ServiceInstance
469 470 471 472 473 474 475 |
# File 'lib/twilio-ruby/rest/preview/proxy/service.rb', line 469 def update(friendly_name: :unset, auto_create: :unset, callback_url: :unset) context.update( friendly_name: friendly_name, auto_create: auto_create, callback_url: callback_url, ) end |
#url ⇒ String
Returns The URL of this resource.
436 437 438 |
# File 'lib/twilio-ruby/rest/preview/proxy/service.rb', line 436 def url @properties['url'] end |