class Twilio::REST::Notify::V1::ServiceInstance
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Public Class Methods
Initialize the ServiceInstance
@param [Version] version Version
that contains the resource @param [Hash] payload payload that contains response from Twilio
@param [String] sid The Twilio-provided string that uniquely identifies the
Service resource to fetch.
@return [ServiceInstance] ServiceInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/notify/v1/service.rb 367 def initialize(version, payload, sid: nil) 368 super(version) 369 370 # Marshaled Properties 371 @properties = { 372 'sid' => payload['sid'], 373 'account_sid' => payload['account_sid'], 374 'friendly_name' => payload['friendly_name'], 375 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 376 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 377 'apn_credential_sid' => payload['apn_credential_sid'], 378 'gcm_credential_sid' => payload['gcm_credential_sid'], 379 'fcm_credential_sid' => payload['fcm_credential_sid'], 380 'messaging_service_sid' => payload['messaging_service_sid'], 381 'facebook_messenger_page_id' => payload['facebook_messenger_page_id'], 382 'default_apn_notification_protocol_version' => payload['default_apn_notification_protocol_version'], 383 'default_gcm_notification_protocol_version' => payload['default_gcm_notification_protocol_version'], 384 'default_fcm_notification_protocol_version' => payload['default_fcm_notification_protocol_version'], 385 'log_enabled' => payload['log_enabled'], 386 'url' => payload['url'], 387 'links' => payload['links'], 388 'alexa_skill_id' => payload['alexa_skill_id'], 389 'default_alexa_notification_protocol_version' => payload['default_alexa_notification_protocol_version'], 390 'delivery_callback_url' => payload['delivery_callback_url'], 391 'delivery_callback_enabled' => payload['delivery_callback_enabled'], 392 } 393 394 # Context 395 @instance_context = nil 396 @params = {'sid' => sid || @properties['sid'], } 397 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/notify/v1/service.rb 418 def account_sid 419 @properties['account_sid'] 420 end
@return [String] Deprecated
# File lib/twilio-ruby/rest/notify/v1/service.rb 508 def alexa_skill_id 509 @properties['alexa_skill_id'] 510 end
@return [String] The SID of the Credential to use for APN Bindings
# File lib/twilio-ruby/rest/notify/v1/service.rb 442 def apn_credential_sid 443 @properties['apn_credential_sid'] 444 end
Access the bindings @return [bindings] bindings
# File lib/twilio-ruby/rest/notify/v1/service.rb 604 def bindings 605 context.bindings 606 end
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [ServiceContext] ServiceContext
for this ServiceInstance
# File lib/twilio-ruby/rest/notify/v1/service.rb 403 def context 404 unless @instance_context 405 @instance_context = ServiceContext.new(@version, @params['sid'], ) 406 end 407 @instance_context 408 end
@return [Time] The RFC 2822 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/notify/v1/service.rb 430 def date_created 431 @properties['date_created'] 432 end
@return [Time] The RFC 2822 date and time in GMT when the resource was last updated
# File lib/twilio-ruby/rest/notify/v1/service.rb 436 def date_updated 437 @properties['date_updated'] 438 end
@return [String] Deprecated
# File lib/twilio-ruby/rest/notify/v1/service.rb 514 def default_alexa_notification_protocol_version 515 @properties['default_alexa_notification_protocol_version'] 516 end
@return [String] The protocol version to use for sending APNS notifications
# File lib/twilio-ruby/rest/notify/v1/service.rb 472 def default_apn_notification_protocol_version 473 @properties['default_apn_notification_protocol_version'] 474 end
@return [String] The protocol version to use for sending FCM notifications
# File lib/twilio-ruby/rest/notify/v1/service.rb 484 def default_fcm_notification_protocol_version 485 @properties['default_fcm_notification_protocol_version'] 486 end
@return [String] The protocol version to use for sending GCM notifications
# File lib/twilio-ruby/rest/notify/v1/service.rb 478 def default_gcm_notification_protocol_version 479 @properties['default_gcm_notification_protocol_version'] 480 end
Delete the ServiceInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/notify/v1/service.rb 533 def delete 534 context.delete 535 end
@return [Boolean] Enable delivery callbacks
# File lib/twilio-ruby/rest/notify/v1/service.rb 526 def delivery_callback_enabled 527 @properties['delivery_callback_enabled'] 528 end
@return [String] Webhook URL
# File lib/twilio-ruby/rest/notify/v1/service.rb 520 def delivery_callback_url 521 @properties['delivery_callback_url'] 522 end
@return [String] Deprecated
# File lib/twilio-ruby/rest/notify/v1/service.rb 466 def facebook_messenger_page_id 467 @properties['facebook_messenger_page_id'] 468 end
@return [String] The SID of the Credential to use for FCM Bindings
# File lib/twilio-ruby/rest/notify/v1/service.rb 454 def fcm_credential_sid 455 @properties['fcm_credential_sid'] 456 end
Fetch the ServiceInstance
@return [ServiceInstance] Fetched ServiceInstance
# File lib/twilio-ruby/rest/notify/v1/service.rb 540 def fetch 541 context.fetch 542 end
@return [String] The string that you assigned to describe the resource
# File lib/twilio-ruby/rest/notify/v1/service.rb 424 def friendly_name 425 @properties['friendly_name'] 426 end
@return [String] The SID of the Credential to use for GCM Bindings
# File lib/twilio-ruby/rest/notify/v1/service.rb 448 def gcm_credential_sid 449 @properties['gcm_credential_sid'] 450 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/notify/v1/service.rb 624 def inspect 625 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 626 "<Twilio.Notify.V1.ServiceInstance #{values}>" 627 end
@return [String] The URLs of the resources related to the service
# File lib/twilio-ruby/rest/notify/v1/service.rb 502 def links 503 @properties['links'] 504 end
@return [Boolean] Whether to log notifications
# File lib/twilio-ruby/rest/notify/v1/service.rb 490 def log_enabled 491 @properties['log_enabled'] 492 end
@return [String] The SID of the Messaging
Service to use for SMS Bindings
# File lib/twilio-ruby/rest/notify/v1/service.rb 460 def messaging_service_sid 461 @properties['messaging_service_sid'] 462 end
Access the notifications @return [notifications] notifications
# File lib/twilio-ruby/rest/notify/v1/service.rb 611 def notifications 612 context.notifications 613 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/notify/v1/service.rb 412 def sid 413 @properties['sid'] 414 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/notify/v1/service.rb 617 def to_s 618 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 619 "<Twilio.Notify.V1.ServiceInstance #{values}>" 620 end
Update the ServiceInstance
@param [String] friendly_name
A descriptive string that you create to describe
the resource. It can be up to 64 characters long.
@param [String] apn_credential_sid
The SID of the
{Credential}[https://www.twilio.com/docs/notify/api/credential-resource] to use for APN Bindings.
@param [String] gcm_credential_sid
The SID of the
{Credential}[https://www.twilio.com/docs/notify/api/credential-resource] to use for GCM Bindings.
@param [String] messaging_service_sid
The SID of the {Messaging
Service}[https://www.twilio.com/docs/sms/send-messages#messaging-services] to use for SMS Bindings. This parameter must be set in order to send SMS notifications.
@param [String] facebook_messenger_page_id
Deprecated. @param [String] default_apn_notification_protocol_version
The protocol version
to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a {Binding}[https://www.twilio.com/docs/notify/api/binding-resource] resource.
@param [String] default_gcm_notification_protocol_version
The protocol version
to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a {Binding}[https://www.twilio.com/docs/notify/api/binding-resource] resource.
@param [String] fcm_credential_sid
The SID of the
{Credential}[https://www.twilio.com/docs/notify/api/credential-resource] to use for FCM Bindings.
@param [String] default_fcm_notification_protocol_version
The protocol version
to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a {Binding}[https://www.twilio.com/docs/notify/api/binding-resource] resource.
@param [Boolean] log_enabled
Whether to log notifications. Can be: `true` or
`false` and the default is `true`.
@param [String] alexa_skill_id
Deprecated. @param [String] default_alexa_notification_protocol_version
Deprecated. @param [String] delivery_callback_url
URL to send delivery status callback. @param [Boolean] delivery_callback_enabled
Callback configuration that enables
delivery callbacks, default false
@return [ServiceInstance] Updated ServiceInstance
# File lib/twilio-ruby/rest/notify/v1/service.rb 582 def update(friendly_name: :unset, apn_credential_sid: :unset, gcm_credential_sid: :unset, messaging_service_sid: :unset, facebook_messenger_page_id: :unset, default_apn_notification_protocol_version: :unset, default_gcm_notification_protocol_version: :unset, fcm_credential_sid: :unset, default_fcm_notification_protocol_version: :unset, log_enabled: :unset, alexa_skill_id: :unset, default_alexa_notification_protocol_version: :unset, delivery_callback_url: :unset, delivery_callback_enabled: :unset) 583 context.update( 584 friendly_name: friendly_name, 585 apn_credential_sid: apn_credential_sid, 586 gcm_credential_sid: gcm_credential_sid, 587 messaging_service_sid: messaging_service_sid, 588 facebook_messenger_page_id: facebook_messenger_page_id, 589 default_apn_notification_protocol_version: default_apn_notification_protocol_version, 590 default_gcm_notification_protocol_version: default_gcm_notification_protocol_version, 591 fcm_credential_sid: fcm_credential_sid, 592 default_fcm_notification_protocol_version: default_fcm_notification_protocol_version, 593 log_enabled: log_enabled, 594 alexa_skill_id: alexa_skill_id, 595 default_alexa_notification_protocol_version: default_alexa_notification_protocol_version, 596 delivery_callback_url: delivery_callback_url, 597 delivery_callback_enabled: delivery_callback_enabled, 598 ) 599 end
@return [String] The absolute URL of the Service resource
# File lib/twilio-ruby/rest/notify/v1/service.rb 496 def url 497 @properties['url'] 498 end