class Twilio::REST::Chat::V1::ServiceInstance

Public Class Methods

new(version, payload, sid: nil) click to toggle source

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

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/chat/v1/service.rb
477 def initialize(version, payload, sid: nil)
478   super(version)
479 
480   # Marshaled Properties
481   @properties = {
482       'sid' => payload['sid'],
483       'account_sid' => payload['account_sid'],
484       'friendly_name' => payload['friendly_name'],
485       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
486       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
487       'default_service_role_sid' => payload['default_service_role_sid'],
488       'default_channel_role_sid' => payload['default_channel_role_sid'],
489       'default_channel_creator_role_sid' => payload['default_channel_creator_role_sid'],
490       'read_status_enabled' => payload['read_status_enabled'],
491       'reachability_enabled' => payload['reachability_enabled'],
492       'typing_indicator_timeout' => payload['typing_indicator_timeout'].to_i,
493       'consumption_report_interval' => payload['consumption_report_interval'].to_i,
494       'limits' => payload['limits'],
495       'webhooks' => payload['webhooks'],
496       'pre_webhook_url' => payload['pre_webhook_url'],
497       'post_webhook_url' => payload['post_webhook_url'],
498       'webhook_method' => payload['webhook_method'],
499       'webhook_filters' => payload['webhook_filters'],
500       'notifications' => payload['notifications'],
501       'url' => payload['url'],
502       'links' => payload['links'],
503   }
504 
505   # Context
506   @instance_context = nil
507   @params = {'sid' => sid || @properties['sid'], }
508 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The SID of the Account that created the resource

    # File lib/twilio-ruby/rest/chat/v1/service.rb
529 def account_sid
530   @properties['account_sid']
531 end
channels() click to toggle source

Access the channels @return [channels] channels

    # File lib/twilio-ruby/rest/chat/v1/service.rb
869 def channels
870   context.channels
871 end
consumption_report_interval() click to toggle source

@return [String] DEPRECATED

    # File lib/twilio-ruby/rest/chat/v1/service.rb
589 def consumption_report_interval
590   @properties['consumption_report_interval']
591 end
context() click to toggle source

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/chat/v1/service.rb
514 def context
515   unless @instance_context
516     @instance_context = ServiceContext.new(@version, @params['sid'], )
517   end
518   @instance_context
519 end
date_created() click to toggle source

@return [Time] The RFC 2822 date and time in GMT when the resource was created

    # File lib/twilio-ruby/rest/chat/v1/service.rb
541 def date_created
542   @properties['date_created']
543 end
date_updated() click to toggle source

@return [Time] The RFC 2822 date and time in GMT when the resource was last updated

    # File lib/twilio-ruby/rest/chat/v1/service.rb
547 def date_updated
548   @properties['date_updated']
549 end
default_channel_creator_role_sid() click to toggle source

@return [String] The channel role assigned to a channel creator when they join a new channel

    # File lib/twilio-ruby/rest/chat/v1/service.rb
565 def default_channel_creator_role_sid
566   @properties['default_channel_creator_role_sid']
567 end
default_channel_role_sid() click to toggle source

@return [String] The channel role assigned to users when they are added to a channel

    # File lib/twilio-ruby/rest/chat/v1/service.rb
559 def default_channel_role_sid
560   @properties['default_channel_role_sid']
561 end
default_service_role_sid() click to toggle source

@return [String] The service role assigned to users when they are added to the service

    # File lib/twilio-ruby/rest/chat/v1/service.rb
553 def default_service_role_sid
554   @properties['default_service_role_sid']
555 end
delete() click to toggle source

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

    # File lib/twilio-ruby/rest/chat/v1/service.rb
657 def delete
658   context.delete
659 end
fetch() click to toggle source

Fetch the ServiceInstance @return [ServiceInstance] Fetched ServiceInstance

    # File lib/twilio-ruby/rest/chat/v1/service.rb
650 def fetch
651   context.fetch
652 end
friendly_name() click to toggle source

@return [String] The string that you assigned to describe the resource

    # File lib/twilio-ruby/rest/chat/v1/service.rb
535 def friendly_name
536   @properties['friendly_name']
537 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/chat/v1/service.rb
896 def inspect
897   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
898   "<Twilio.Chat.V1.ServiceInstance #{values}>"
899 end
limits() click to toggle source

@return [Hash] An object that describes the limits of the service instance

    # File lib/twilio-ruby/rest/chat/v1/service.rb
595 def limits
596   @properties['limits']
597 end
notifications() click to toggle source

@return [Hash] The notification configuration for the Service instance

    # File lib/twilio-ruby/rest/chat/v1/service.rb
631 def notifications
632   @properties['notifications']
633 end
post_webhook_url() click to toggle source

@return [String] The URL for post-event webhooks

    # File lib/twilio-ruby/rest/chat/v1/service.rb
613 def post_webhook_url
614   @properties['post_webhook_url']
615 end
pre_webhook_url() click to toggle source

@return [String] The webhook URL for pre-event webhooks

    # File lib/twilio-ruby/rest/chat/v1/service.rb
607 def pre_webhook_url
608   @properties['pre_webhook_url']
609 end
reachability_enabled() click to toggle source

@return [Boolean] Whether the Reachability Indicator feature is enabled for this Service instance

    # File lib/twilio-ruby/rest/chat/v1/service.rb
577 def reachability_enabled
578   @properties['reachability_enabled']
579 end
read_status_enabled() click to toggle source

@return [Boolean] Whether the Message Consumption Horizon feature is enabled

    # File lib/twilio-ruby/rest/chat/v1/service.rb
571 def read_status_enabled
572   @properties['read_status_enabled']
573 end
roles() click to toggle source

Access the roles @return [roles] roles

    # File lib/twilio-ruby/rest/chat/v1/service.rb
876 def roles
877   context.roles
878 end
sid() click to toggle source

@return [String] The unique string that identifies the resource

    # File lib/twilio-ruby/rest/chat/v1/service.rb
523 def sid
524   @properties['sid']
525 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/chat/v1/service.rb
889 def to_s
890   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
891   "<Twilio.Chat.V1.ServiceInstance #{values}>"
892 end
typing_indicator_timeout() click to toggle source

@return [String] How long in seconds to wait before assuming the user is no longer typing

    # File lib/twilio-ruby/rest/chat/v1/service.rb
583 def typing_indicator_timeout
584   @properties['typing_indicator_timeout']
585 end
update(friendly_name: :unset, default_service_role_sid: :unset, default_channel_role_sid: :unset, default_channel_creator_role_sid: :unset, read_status_enabled: :unset, reachability_enabled: :unset, typing_indicator_timeout: :unset, consumption_report_interval: :unset, notifications_new_message_enabled: :unset, notifications_new_message_template: :unset, notifications_added_to_channel_enabled: :unset, notifications_added_to_channel_template: :unset, notifications_removed_from_channel_enabled: :unset, notifications_removed_from_channel_template: :unset, notifications_invited_to_channel_enabled: :unset, notifications_invited_to_channel_template: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, webhook_method: :unset, webhook_filters: :unset, webhooks_on_message_send_url: :unset, webhooks_on_message_send_method: :unset, webhooks_on_message_update_url: :unset, webhooks_on_message_update_method: :unset, webhooks_on_message_remove_url: :unset, webhooks_on_message_remove_method: :unset, webhooks_on_channel_add_url: :unset, webhooks_on_channel_add_method: :unset, webhooks_on_channel_destroy_url: :unset, webhooks_on_channel_destroy_method: :unset, webhooks_on_channel_update_url: :unset, webhooks_on_channel_update_method: :unset, webhooks_on_member_add_url: :unset, webhooks_on_member_add_method: :unset, webhooks_on_member_remove_url: :unset, webhooks_on_member_remove_method: :unset, webhooks_on_message_sent_url: :unset, webhooks_on_message_sent_method: :unset, webhooks_on_message_updated_url: :unset, webhooks_on_message_updated_method: :unset, webhooks_on_message_removed_url: :unset, webhooks_on_message_removed_method: :unset, webhooks_on_channel_added_url: :unset, webhooks_on_channel_added_method: :unset, webhooks_on_channel_destroyed_url: :unset, webhooks_on_channel_destroyed_method: :unset, webhooks_on_channel_updated_url: :unset, webhooks_on_channel_updated_method: :unset, webhooks_on_member_added_url: :unset, webhooks_on_member_added_method: :unset, webhooks_on_member_removed_url: :unset, webhooks_on_member_removed_method: :unset, limits_channel_members: :unset, limits_user_channels: :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] default_service_role_sid The service role assigned to users when

they are added to the service. See the {Roles
endpoint}[https://www.twilio.com/docs/chat/api/roles] for more details.

@param [String] default_channel_role_sid The channel role assigned to users when

they are added to a channel. See the {Roles
endpoint}[https://www.twilio.com/docs/chat/api/roles] for more details.

@param [String] default_channel_creator_role_sid The channel role assigned to a

channel creator when they join a new channel. See the {Roles
endpoint}[https://www.twilio.com/docs/chat/api/roles] for more details.

@param [Boolean] read_status_enabled Whether to enable the {Message Consumption

Horizon}[https://www.twilio.com/docs/chat/consumption-horizon] feature. The
default is `true`.

@param [Boolean] reachability_enabled Whether to enable the {Reachability

Indicator}[https://www.twilio.com/docs/chat/reachability-indicator] for this
Service instance. The default is `false`.

@param [String] typing_indicator_timeout How long in seconds after a `started

typing` event until clients should assume that user is no longer typing, even if
no `ended typing` message was received.  The default is 5 seconds.

@param [String] consumption_report_interval DEPRECATED. The interval in seconds

between consumption reports submission batches from client endpoints.

@param [Boolean] notifications_new_message_enabled Whether to send a

notification when a new message is added to a channel. Can be: `true` or `false`
and the default is `false`.

@param [String] notifications_new_message_template The template to use to create

the notification text displayed when a new message is added to a channel and
`notifications.new_message.enabled` is `true`.

@param [Boolean] notifications_added_to_channel_enabled Whether to send a

notification when a member is added to a channel. Can be: `true` or `false` and
the default is `false`.

@param [String] notifications_added_to_channel_template The template to use to

create the notification text displayed when a member is added to a channel and
`notifications.added_to_channel.enabled` is `true`.

@param [Boolean] notifications_removed_from_channel_enabled Whether to send a

notification to a user when they are removed from a channel. Can be: `true` or
`false` and the default is `false`.

@param [String] notifications_removed_from_channel_template The template to use

to create the notification text displayed to a user when they are removed from a
channel and `notifications.removed_from_channel.enabled` is `true`.

@param [Boolean] notifications_invited_to_channel_enabled Whether to send a

notification when a user is invited to a channel. Can be: `true` or `false` and
the default is `false`.

@param [String] notifications_invited_to_channel_template The template to use to

create the notification text displayed when a user is invited to a channel and
`notifications.invited_to_channel.enabled` is `true`.

@param [String] pre_webhook_url The URL for pre-event webhooks, which are called

by using the `webhook_method`. See {Webhook
Events}[https://www.twilio.com/docs/api/chat/webhooks] for more details.

@param [String] post_webhook_url The URL for post-event webhooks, which are

called by using the `webhook_method`. See {Webhook
Events}[https://www.twilio.com/docs/api/chat/webhooks] for more details.

@param [String] webhook_method The HTTP method to use for calls to the

`pre_webhook_url` and `post_webhook_url` webhooks.  Can be: `POST` or `GET` and
the default is `POST`. See {Webhook
Events}[https://www.twilio.com/docs/chat/webhook-events] for more details.

@param [Array] webhook_filters The list of WebHook events that are

enabled for this Service instance. See {Webhook
Events}[https://www.twilio.com/docs/chat/webhook-events] for more details.

@param [String] webhooks_on_message_send_url The URL of the webhook to call in

response to the `on_message_send` event using the
`webhooks.on_message_send.method` HTTP method.

@param [String] webhooks_on_message_send_method The HTTP method to use when

calling the `webhooks.on_message_send.url`.

@param [String] webhooks_on_message_update_url The URL of the webhook to call in

response to the `on_message_update` event using the
`webhooks.on_message_update.method` HTTP method.

@param [String] webhooks_on_message_update_method The HTTP method to use when

calling the `webhooks.on_message_update.url`.

@param [String] webhooks_on_message_remove_url The URL of the webhook to call in

response to the `on_message_remove` event using the
`webhooks.on_message_remove.method` HTTP method.

@param [String] webhooks_on_message_remove_method The HTTP method to use when

calling the `webhooks.on_message_remove.url`.

@param [String] webhooks_on_channel_add_url The URL of the webhook to call in

response to the `on_channel_add` event using the
`webhooks.on_channel_add.method` HTTP method.

@param [String] webhooks_on_channel_add_method The HTTP method to use when

calling the `webhooks.on_channel_add.url`.

@param [String] webhooks_on_channel_destroy_url The URL of the webhook to call

in response to the `on_channel_destroy` event using the
`webhooks.on_channel_destroy.method` HTTP method.

@param [String] webhooks_on_channel_destroy_method The HTTP method to use when

calling the `webhooks.on_channel_destroy.url`.

@param [String] webhooks_on_channel_update_url The URL of the webhook to call in

response to the `on_channel_update` event using the
`webhooks.on_channel_update.method` HTTP method.

@param [String] webhooks_on_channel_update_method The HTTP method to use when

calling the `webhooks.on_channel_update.url`.

@param [String] webhooks_on_member_add_url The URL of the webhook to call in

response to the `on_member_add` event using the `webhooks.on_member_add.method`
HTTP method.

@param [String] webhooks_on_member_add_method The HTTP method to use when

calling the `webhooks.on_member_add.url`.

@param [String] webhooks_on_member_remove_url The URL of the webhook to call in

response to the `on_member_remove` event using the
`webhooks.on_member_remove.method` HTTP method.

@param [String] webhooks_on_member_remove_method The HTTP method to use when

calling the `webhooks.on_member_remove.url`.

@param [String] webhooks_on_message_sent_url The URL of the webhook to call in

response to the `on_message_sent` event using the
`webhooks.on_message_sent.method` HTTP method.

@param [String] webhooks_on_message_sent_method The URL of the webhook to call

in response to the `on_message_sent` event`.

@param [String] webhooks_on_message_updated_url The URL of the webhook to call

in response to the `on_message_updated` event using the
`webhooks.on_message_updated.method` HTTP method.

@param [String] webhooks_on_message_updated_method The HTTP method to use when

calling the `webhooks.on_message_updated.url`.

@param [String] webhooks_on_message_removed_url The URL of the webhook to call

in response to the `on_message_removed` event using the
`webhooks.on_message_removed.method` HTTP method.

@param [String] webhooks_on_message_removed_method The HTTP method to use when

calling the `webhooks.on_message_removed.url`.

@param [String] webhooks_on_channel_added_url The URL of the webhook to call in

response to the `on_channel_added` event using the
`webhooks.on_channel_added.method` HTTP method.

@param [String] webhooks_on_channel_added_method The URL of the webhook to call

in response to the `on_channel_added` event`.

@param [String] webhooks_on_channel_destroyed_url The URL of the webhook to call

in response to the `on_channel_added` event using the
`webhooks.on_channel_destroyed.method` HTTP method.

@param [String] webhooks_on_channel_destroyed_method The HTTP method to use when

calling the `webhooks.on_channel_destroyed.url`.

@param [String] webhooks_on_channel_updated_url The URL of the webhook to call

in response to the `on_channel_updated` event using the
`webhooks.on_channel_updated.method` HTTP method.

@param [String] webhooks_on_channel_updated_method The HTTP method to use when

calling the `webhooks.on_channel_updated.url`.

@param [String] webhooks_on_member_added_url The URL of the webhook to call in

response to the `on_channel_updated` event using the
`webhooks.on_channel_updated.method` HTTP method.

@param [String] webhooks_on_member_added_method The HTTP method to use when

calling the `webhooks.on_channel_updated.url`.

@param [String] webhooks_on_member_removed_url The URL of the webhook to call in

response to the `on_member_removed` event using the
`webhooks.on_member_removed.method` HTTP method.

@param [String] webhooks_on_member_removed_method The HTTP method to use when

calling the `webhooks.on_member_removed.url`.

@param [String] limits_channel_members The maximum number of Members that can be

added to Channels within this Service. Can be up to 1,000.

@param [String] limits_user_channels The maximum number of Channels Users can be

a Member of within this Service. Can be up to 1,000.

@return [ServiceInstance] Updated ServiceInstance

    # File lib/twilio-ruby/rest/chat/v1/service.rb
807 def update(friendly_name: :unset, default_service_role_sid: :unset, default_channel_role_sid: :unset, default_channel_creator_role_sid: :unset, read_status_enabled: :unset, reachability_enabled: :unset, typing_indicator_timeout: :unset, consumption_report_interval: :unset, notifications_new_message_enabled: :unset, notifications_new_message_template: :unset, notifications_added_to_channel_enabled: :unset, notifications_added_to_channel_template: :unset, notifications_removed_from_channel_enabled: :unset, notifications_removed_from_channel_template: :unset, notifications_invited_to_channel_enabled: :unset, notifications_invited_to_channel_template: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, webhook_method: :unset, webhook_filters: :unset, webhooks_on_message_send_url: :unset, webhooks_on_message_send_method: :unset, webhooks_on_message_update_url: :unset, webhooks_on_message_update_method: :unset, webhooks_on_message_remove_url: :unset, webhooks_on_message_remove_method: :unset, webhooks_on_channel_add_url: :unset, webhooks_on_channel_add_method: :unset, webhooks_on_channel_destroy_url: :unset, webhooks_on_channel_destroy_method: :unset, webhooks_on_channel_update_url: :unset, webhooks_on_channel_update_method: :unset, webhooks_on_member_add_url: :unset, webhooks_on_member_add_method: :unset, webhooks_on_member_remove_url: :unset, webhooks_on_member_remove_method: :unset, webhooks_on_message_sent_url: :unset, webhooks_on_message_sent_method: :unset, webhooks_on_message_updated_url: :unset, webhooks_on_message_updated_method: :unset, webhooks_on_message_removed_url: :unset, webhooks_on_message_removed_method: :unset, webhooks_on_channel_added_url: :unset, webhooks_on_channel_added_method: :unset, webhooks_on_channel_destroyed_url: :unset, webhooks_on_channel_destroyed_method: :unset, webhooks_on_channel_updated_url: :unset, webhooks_on_channel_updated_method: :unset, webhooks_on_member_added_url: :unset, webhooks_on_member_added_method: :unset, webhooks_on_member_removed_url: :unset, webhooks_on_member_removed_method: :unset, limits_channel_members: :unset, limits_user_channels: :unset)
808   context.update(
809       friendly_name: friendly_name,
810       default_service_role_sid: default_service_role_sid,
811       default_channel_role_sid: default_channel_role_sid,
812       default_channel_creator_role_sid: default_channel_creator_role_sid,
813       read_status_enabled: read_status_enabled,
814       reachability_enabled: reachability_enabled,
815       typing_indicator_timeout: typing_indicator_timeout,
816       consumption_report_interval: consumption_report_interval,
817       notifications_new_message_enabled: notifications_new_message_enabled,
818       notifications_new_message_template: notifications_new_message_template,
819       notifications_added_to_channel_enabled: notifications_added_to_channel_enabled,
820       notifications_added_to_channel_template: notifications_added_to_channel_template,
821       notifications_removed_from_channel_enabled: notifications_removed_from_channel_enabled,
822       notifications_removed_from_channel_template: notifications_removed_from_channel_template,
823       notifications_invited_to_channel_enabled: notifications_invited_to_channel_enabled,
824       notifications_invited_to_channel_template: notifications_invited_to_channel_template,
825       pre_webhook_url: pre_webhook_url,
826       post_webhook_url: post_webhook_url,
827       webhook_method: webhook_method,
828       webhook_filters: webhook_filters,
829       webhooks_on_message_send_url: webhooks_on_message_send_url,
830       webhooks_on_message_send_method: webhooks_on_message_send_method,
831       webhooks_on_message_update_url: webhooks_on_message_update_url,
832       webhooks_on_message_update_method: webhooks_on_message_update_method,
833       webhooks_on_message_remove_url: webhooks_on_message_remove_url,
834       webhooks_on_message_remove_method: webhooks_on_message_remove_method,
835       webhooks_on_channel_add_url: webhooks_on_channel_add_url,
836       webhooks_on_channel_add_method: webhooks_on_channel_add_method,
837       webhooks_on_channel_destroy_url: webhooks_on_channel_destroy_url,
838       webhooks_on_channel_destroy_method: webhooks_on_channel_destroy_method,
839       webhooks_on_channel_update_url: webhooks_on_channel_update_url,
840       webhooks_on_channel_update_method: webhooks_on_channel_update_method,
841       webhooks_on_member_add_url: webhooks_on_member_add_url,
842       webhooks_on_member_add_method: webhooks_on_member_add_method,
843       webhooks_on_member_remove_url: webhooks_on_member_remove_url,
844       webhooks_on_member_remove_method: webhooks_on_member_remove_method,
845       webhooks_on_message_sent_url: webhooks_on_message_sent_url,
846       webhooks_on_message_sent_method: webhooks_on_message_sent_method,
847       webhooks_on_message_updated_url: webhooks_on_message_updated_url,
848       webhooks_on_message_updated_method: webhooks_on_message_updated_method,
849       webhooks_on_message_removed_url: webhooks_on_message_removed_url,
850       webhooks_on_message_removed_method: webhooks_on_message_removed_method,
851       webhooks_on_channel_added_url: webhooks_on_channel_added_url,
852       webhooks_on_channel_added_method: webhooks_on_channel_added_method,
853       webhooks_on_channel_destroyed_url: webhooks_on_channel_destroyed_url,
854       webhooks_on_channel_destroyed_method: webhooks_on_channel_destroyed_method,
855       webhooks_on_channel_updated_url: webhooks_on_channel_updated_url,
856       webhooks_on_channel_updated_method: webhooks_on_channel_updated_method,
857       webhooks_on_member_added_url: webhooks_on_member_added_url,
858       webhooks_on_member_added_method: webhooks_on_member_added_method,
859       webhooks_on_member_removed_url: webhooks_on_member_removed_url,
860       webhooks_on_member_removed_method: webhooks_on_member_removed_method,
861       limits_channel_members: limits_channel_members,
862       limits_user_channels: limits_user_channels,
863   )
864 end
url() click to toggle source

@return [String] The absolute URL of the Service resource

    # File lib/twilio-ruby/rest/chat/v1/service.rb
637 def url
638   @properties['url']
639 end
users() click to toggle source

Access the users @return [users] users

    # File lib/twilio-ruby/rest/chat/v1/service.rb
883 def users
884   context.users
885 end
webhook_filters() click to toggle source

@return [Array] The list of WebHook events that are enabled for this Service instance

    # File lib/twilio-ruby/rest/chat/v1/service.rb
625 def webhook_filters
626   @properties['webhook_filters']
627 end
webhook_method() click to toggle source

@return [String] The HTTP method to use for both PRE and POST webhooks

    # File lib/twilio-ruby/rest/chat/v1/service.rb
619 def webhook_method
620   @properties['webhook_method']
621 end
webhooks() click to toggle source

@return [Hash] An object that contains information about the webhooks configured for this service

    # File lib/twilio-ruby/rest/chat/v1/service.rb
601 def webhooks
602   @properties['webhooks']
603 end