class Twilio::REST::Notify::V1::ServiceContext

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Public Class Methods

new(version, sid) click to toggle source

Initialize the ServiceContext @param [Version] version Version that contains the resource @param [String] sid The Twilio-provided string that uniquely identifies the

Service resource to fetch.

@return [ServiceContext] ServiceContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/notify/v1/service.rb
223 def initialize(version, sid)
224   super(version)
225 
226   # Path Solution
227   @solution = {sid: sid, }
228   @uri = "/Services/#{@solution[:sid]}"
229 
230   # Dependents
231   @bindings = nil
232   @notifications = nil
233 end

Public Instance Methods

bindings(sid=:unset) click to toggle source

Access the bindings @return [BindingList] @return [BindingContext] if sid was passed.

    # File lib/twilio-ruby/rest/notify/v1/service.rb
316 def bindings(sid=:unset)
317   raise ArgumentError, 'sid cannot be nil' if sid.nil?
318 
319   if sid != :unset
320     return BindingContext.new(@version, @solution[:sid], sid, )
321   end
322 
323   unless @bindings
324     @bindings = BindingList.new(@version, service_sid: @solution[:sid], )
325   end
326 
327   @bindings
328 end
delete() click to toggle source

Delete the ServiceInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/notify/v1/service.rb
238 def delete
239    @version.delete('DELETE', @uri)
240 end
fetch() click to toggle source

Fetch the ServiceInstance @return [ServiceInstance] Fetched ServiceInstance

    # File lib/twilio-ruby/rest/notify/v1/service.rb
245 def fetch
246   payload = @version.fetch('GET', @uri)
247 
248   ServiceInstance.new(@version, payload, sid: @solution[:sid], )
249 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/notify/v1/service.rb
351 def inspect
352   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
353   "#<Twilio.Notify.V1.ServiceContext #{context}>"
354 end
notifications() click to toggle source

Access the notifications @return [NotificationList] @return [NotificationContext]

    # File lib/twilio-ruby/rest/notify/v1/service.rb
334 def notifications
335   unless @notifications
336     @notifications = NotificationList.new(@version, service_sid: @solution[:sid], )
337   end
338 
339   @notifications
340 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/notify/v1/service.rb
344 def to_s
345   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
346   "#<Twilio.Notify.V1.ServiceContext #{context}>"
347 end
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) click to toggle source

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
289 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)
290   data = Twilio::Values.of({
291       'FriendlyName' => friendly_name,
292       'ApnCredentialSid' => apn_credential_sid,
293       'GcmCredentialSid' => gcm_credential_sid,
294       'MessagingServiceSid' => messaging_service_sid,
295       'FacebookMessengerPageId' => facebook_messenger_page_id,
296       'DefaultApnNotificationProtocolVersion' => default_apn_notification_protocol_version,
297       'DefaultGcmNotificationProtocolVersion' => default_gcm_notification_protocol_version,
298       'FcmCredentialSid' => fcm_credential_sid,
299       'DefaultFcmNotificationProtocolVersion' => default_fcm_notification_protocol_version,
300       'LogEnabled' => log_enabled,
301       'AlexaSkillId' => alexa_skill_id,
302       'DefaultAlexaNotificationProtocolVersion' => default_alexa_notification_protocol_version,
303       'DeliveryCallbackUrl' => delivery_callback_url,
304       'DeliveryCallbackEnabled' => delivery_callback_enabled,
305   })
306 
307   payload = @version.update('POST', @uri, data: data)
308 
309   ServiceInstance.new(@version, payload, sid: @solution[:sid], )
310 end