class Twilio::REST::Chat::V2::ServiceInstance
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 SID of the Service resource to fetch. @return [ServiceInstance] ServiceInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/chat/v2/service.rb 417 def initialize(version, payload, sid: nil) 418 super(version) 419 420 # Marshaled Properties 421 @properties = { 422 'sid' => payload['sid'], 423 'account_sid' => payload['account_sid'], 424 'friendly_name' => payload['friendly_name'], 425 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 426 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 427 'default_service_role_sid' => payload['default_service_role_sid'], 428 'default_channel_role_sid' => payload['default_channel_role_sid'], 429 'default_channel_creator_role_sid' => payload['default_channel_creator_role_sid'], 430 'read_status_enabled' => payload['read_status_enabled'], 431 'reachability_enabled' => payload['reachability_enabled'], 432 'typing_indicator_timeout' => payload['typing_indicator_timeout'].to_i, 433 'consumption_report_interval' => payload['consumption_report_interval'].to_i, 434 'limits' => payload['limits'], 435 'pre_webhook_url' => payload['pre_webhook_url'], 436 'post_webhook_url' => payload['post_webhook_url'], 437 'webhook_method' => payload['webhook_method'], 438 'webhook_filters' => payload['webhook_filters'], 439 'pre_webhook_retry_count' => payload['pre_webhook_retry_count'].to_i, 440 'post_webhook_retry_count' => payload['post_webhook_retry_count'].to_i, 441 'notifications' => payload['notifications'], 442 'media' => payload['media'], 443 'url' => payload['url'], 444 'links' => payload['links'], 445 } 446 447 # Context 448 @instance_context = nil 449 @params = {'sid' => sid || @properties['sid'], } 450 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/chat/v2/service.rb 471 def account_sid 472 @properties['account_sid'] 473 end
Access the bindings @return [bindings] bindings
# File lib/twilio-ruby/rest/chat/v2/service.rb 767 def bindings 768 context.bindings 769 end
Access the channels @return [channels] channels
# File lib/twilio-ruby/rest/chat/v2/service.rb 746 def channels 747 context.channels 748 end
@return [String] DEPRECATED
# File lib/twilio-ruby/rest/chat/v2/service.rb 531 def consumption_report_interval 532 @properties['consumption_report_interval'] 533 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/chat/v2/service.rb 456 def context 457 unless @instance_context 458 @instance_context = ServiceContext.new(@version, @params['sid'], ) 459 end 460 @instance_context 461 end
@return [Time] The RFC 2822 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/chat/v2/service.rb 483 def date_created 484 @properties['date_created'] 485 end
@return [Time] The RFC 2822 date and time in GMT when the resource was last updated
# File lib/twilio-ruby/rest/chat/v2/service.rb 489 def date_updated 490 @properties['date_updated'] 491 end
@return [String] The channel role assigned to a channel creator when they join a new channel
# File lib/twilio-ruby/rest/chat/v2/service.rb 507 def default_channel_creator_role_sid 508 @properties['default_channel_creator_role_sid'] 509 end
@return [String] The channel role assigned to users when they are added to a channel
# File lib/twilio-ruby/rest/chat/v2/service.rb 501 def default_channel_role_sid 502 @properties['default_channel_role_sid'] 503 end
@return [String] The service role assigned to users when they are added to the service
# File lib/twilio-ruby/rest/chat/v2/service.rb 495 def default_service_role_sid 496 @properties['default_service_role_sid'] 497 end
Delete the ServiceInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/chat/v2/service.rb 611 def delete 612 context.delete 613 end
Fetch the ServiceInstance
@return [ServiceInstance] Fetched ServiceInstance
# File lib/twilio-ruby/rest/chat/v2/service.rb 604 def fetch 605 context.fetch 606 end
@return [String] The string that you assigned to describe the resource
# File lib/twilio-ruby/rest/chat/v2/service.rb 477 def friendly_name 478 @properties['friendly_name'] 479 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/chat/v2/service.rb 780 def inspect 781 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 782 "<Twilio.Chat.V2.ServiceInstance #{values}>" 783 end
@return [Hash] An object that describes the limits of the service instance
# File lib/twilio-ruby/rest/chat/v2/service.rb 537 def limits 538 @properties['limits'] 539 end
@return [String] The absolute URLs of the Service's Channels, Roles, and Users
# File lib/twilio-ruby/rest/chat/v2/service.rb 597 def links 598 @properties['links'] 599 end
@return [Hash] The properties of the media that the service supports
# File lib/twilio-ruby/rest/chat/v2/service.rb 585 def media 586 @properties['media'] 587 end
@return [Hash] The notification configuration for the Service instance
# File lib/twilio-ruby/rest/chat/v2/service.rb 579 def notifications 580 @properties['notifications'] 581 end
@return [String] The number of times calls to the `post_webhook_url` will be retried
# File lib/twilio-ruby/rest/chat/v2/service.rb 573 def post_webhook_retry_count 574 @properties['post_webhook_retry_count'] 575 end
@return [String] The URL for post-event webhooks
# File lib/twilio-ruby/rest/chat/v2/service.rb 549 def post_webhook_url 550 @properties['post_webhook_url'] 551 end
@return [String] Count of times webhook will be retried in case of timeout or 429/503/504 HTTP
responses
# File lib/twilio-ruby/rest/chat/v2/service.rb 567 def pre_webhook_retry_count 568 @properties['pre_webhook_retry_count'] 569 end
@return [String] The webhook URL for pre-event webhooks
# File lib/twilio-ruby/rest/chat/v2/service.rb 543 def pre_webhook_url 544 @properties['pre_webhook_url'] 545 end
@return [Boolean] Whether the Reachability Indicator feature is enabled for this Service instance
# File lib/twilio-ruby/rest/chat/v2/service.rb 519 def reachability_enabled 520 @properties['reachability_enabled'] 521 end
@return [Boolean] Whether the Message Consumption Horizon feature is enabled
# File lib/twilio-ruby/rest/chat/v2/service.rb 513 def read_status_enabled 514 @properties['read_status_enabled'] 515 end
Access the roles @return [roles] roles
# File lib/twilio-ruby/rest/chat/v2/service.rb 753 def roles 754 context.roles 755 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/chat/v2/service.rb 465 def sid 466 @properties['sid'] 467 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/chat/v2/service.rb 773 def to_s 774 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 775 "<Twilio.Chat.V2.ServiceInstance #{values}>" 776 end
@return [String] How long in seconds to wait before assuming the user is no longer typing
# File lib/twilio-ruby/rest/chat/v2/service.rb 525 def typing_indicator_timeout 526 @properties['typing_indicator_timeout'] 527 end
Update the ServiceInstance
@param [String] friendly_name
A descriptive string that you create to describe
the resource.
@param [String] default_service_role_sid
The service role assigned to users when
they are added to the service. See the {Role resource}[https://www.twilio.com/docs/chat/rest/role-resource] for more info about roles.
@param [String] default_channel_role_sid
The channel role assigned to users when
they are added to a channel. See the {Role resource}[https://www.twilio.com/docs/chat/rest/role-resource] for more info about roles.
@param [String] default_channel_creator_role_sid
The channel role assigned to a
channel creator when they join a new channel. See the {Role resource}[https://www.twilio.com/docs/chat/rest/role-resource] for more info about roles.
@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. 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 [String] notifications_new_message_sound The name of the sound to play
when a new message is added to a channel and `notifications.new_message.enabled` is `true`.
@param [Boolean] notifications_new_message_badge_count_enabled Whether the new
message badge is enabled. The default is `false`.
@param [Boolean] notifications_added_to_channel_enabled Whether to send a
notification when a member is added to a channel. 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 [String] notifications_added_to_channel_sound The name of the sound to
play 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. 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 [String] notifications_removed_from_channel_sound The name of the sound
to play 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. 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] notifications_invited_to_channel_sound The name of the sound to
play 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/chat/webhook-events] 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/chat/webhook-events] 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] 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.
@param [String] media_compatibility_message The message to send when a media
message has no text. Can be used as placeholder message.
@param [String] pre_webhook_retry_count
The number of times to retry a call to
the `pre_webhook_url` if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. Default retry count is 0 times, which means the call won't be retried.
@param [String] post_webhook_retry_count
The number of times to retry a call to
the `post_webhook_url` if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. The default is 0, which means the call won't be retried.
@param [Boolean] notifications_log_enabled Whether to log notifications. The
default is `false`.
@return [ServiceInstance] Updated ServiceInstance
# File lib/twilio-ruby/rest/chat/v2/service.rb 707 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_new_message_sound: :unset, notifications_new_message_badge_count_enabled: :unset, notifications_added_to_channel_enabled: :unset, notifications_added_to_channel_template: :unset, notifications_added_to_channel_sound: :unset, notifications_removed_from_channel_enabled: :unset, notifications_removed_from_channel_template: :unset, notifications_removed_from_channel_sound: :unset, notifications_invited_to_channel_enabled: :unset, notifications_invited_to_channel_template: :unset, notifications_invited_to_channel_sound: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, webhook_method: :unset, webhook_filters: :unset, limits_channel_members: :unset, limits_user_channels: :unset, media_compatibility_message: :unset, pre_webhook_retry_count: :unset, post_webhook_retry_count: :unset, notifications_log_enabled: :unset) 708 context.update( 709 friendly_name: friendly_name, 710 default_service_role_sid: default_service_role_sid, 711 default_channel_role_sid: default_channel_role_sid, 712 default_channel_creator_role_sid: default_channel_creator_role_sid, 713 read_status_enabled: read_status_enabled, 714 reachability_enabled: reachability_enabled, 715 typing_indicator_timeout: typing_indicator_timeout, 716 consumption_report_interval: consumption_report_interval, 717 notifications_new_message_enabled: notifications_new_message_enabled, 718 notifications_new_message_template: notifications_new_message_template, 719 notifications_new_message_sound: notifications_new_message_sound, 720 notifications_new_message_badge_count_enabled: notifications_new_message_badge_count_enabled, 721 notifications_added_to_channel_enabled: notifications_added_to_channel_enabled, 722 notifications_added_to_channel_template: notifications_added_to_channel_template, 723 notifications_added_to_channel_sound: notifications_added_to_channel_sound, 724 notifications_removed_from_channel_enabled: notifications_removed_from_channel_enabled, 725 notifications_removed_from_channel_template: notifications_removed_from_channel_template, 726 notifications_removed_from_channel_sound: notifications_removed_from_channel_sound, 727 notifications_invited_to_channel_enabled: notifications_invited_to_channel_enabled, 728 notifications_invited_to_channel_template: notifications_invited_to_channel_template, 729 notifications_invited_to_channel_sound: notifications_invited_to_channel_sound, 730 pre_webhook_url: pre_webhook_url, 731 post_webhook_url: post_webhook_url, 732 webhook_method: webhook_method, 733 webhook_filters: webhook_filters, 734 limits_channel_members: limits_channel_members, 735 limits_user_channels: limits_user_channels, 736 media_compatibility_message: media_compatibility_message, 737 pre_webhook_retry_count: pre_webhook_retry_count, 738 post_webhook_retry_count: post_webhook_retry_count, 739 notifications_log_enabled: notifications_log_enabled, 740 ) 741 end
@return [String] The absolute URL of the Service resource
# File lib/twilio-ruby/rest/chat/v2/service.rb 591 def url 592 @properties['url'] 593 end
Access the users @return [users] users
# File lib/twilio-ruby/rest/chat/v2/service.rb 760 def users 761 context.users 762 end
@return [Array] The list of webhook events that are enabled for this Service instance
# File lib/twilio-ruby/rest/chat/v2/service.rb 561 def webhook_filters 562 @properties['webhook_filters'] 563 end
@return [String] The HTTP
method to use for both PRE and POST webhooks
# File lib/twilio-ruby/rest/chat/v2/service.rb 555 def webhook_method 556 @properties['webhook_method'] 557 end