class Twilio::REST::Conversations::V1::ServiceContext::ConfigurationContext::NotificationContext
Public Class Methods
Initialize the NotificationContext
@param [Version] version Version
that contains the resource @param [String] chat_service_sid The SID of the {Conversation
Service}[https://www.twilio.com/docs/conversations/api/service-resource] the Configuration applies to.
@return [NotificationContext] NotificationContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb 73 def initialize(version, chat_service_sid) 74 super(version) 75 76 # Path Solution 77 @solution = {chat_service_sid: chat_service_sid, } 78 @uri = "/Services/#{@solution[:chat_service_sid]}/Configuration/Notifications" 79 end
Public Instance Methods
Fetch the NotificationInstance
@return [NotificationInstance] Fetched NotificationInstance
# File lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb 134 def fetch 135 payload = @version.fetch('GET', @uri) 136 137 NotificationInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], ) 138 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb 149 def inspect 150 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 151 "#<Twilio.Conversations.V1.NotificationContext #{context}>" 152 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb 142 def to_s 143 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 144 "#<Twilio.Conversations.V1.NotificationContext #{context}>" 145 end
Update the NotificationInstance
@param [Boolean] log_enabled Weather the notification logging is enabled. @param [Boolean] new_message_enabled Whether to send a notification when a new
message is added to a conversation. The default is `false`.
@param [String] new_message_template The template to use to create the
notification text displayed when a new message is added to a conversation and `new_message.enabled` is `true`.
@param [String] new_message_sound The name of the sound to play when a new
message is added to a conversation and `new_message.enabled` is `true`.
@param [Boolean] new_message_badge_count_enabled Whether the new message badge
is enabled. The default is `false`.
@param [Boolean] added_to_conversation_enabled Whether to send a notification
when a participant is added to a conversation. The default is `false`.
@param [String] added_to_conversation_template The template to use to create the
notification text displayed when a participant is added to a conversation and `added_to_conversation.enabled` is `true`.
@param [String] added_to_conversation_sound The name of the sound to play when a
participant is added to a conversation and `added_to_conversation.enabled` is `true`.
@param [Boolean] removed_from_conversation_enabled Whether to send a
notification to a user when they are removed from a conversation. The default is `false`.
@param [String] removed_from_conversation_template The template to use to create
the notification text displayed to a user when they are removed from a conversation and `removed_from_conversation.enabled` is `true`.
@param [String] removed_from_conversation_sound The name of the sound to play to
a user when they are removed from a conversation and `removed_from_conversation.enabled` is `true`.
@return [NotificationInstance] Updated NotificationInstance
# File lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb 111 def update(log_enabled: :unset, new_message_enabled: :unset, new_message_template: :unset, new_message_sound: :unset, new_message_badge_count_enabled: :unset, added_to_conversation_enabled: :unset, added_to_conversation_template: :unset, added_to_conversation_sound: :unset, removed_from_conversation_enabled: :unset, removed_from_conversation_template: :unset, removed_from_conversation_sound: :unset) 112 data = Twilio::Values.of({ 113 'LogEnabled' => log_enabled, 114 'NewMessage.Enabled' => new_message_enabled, 115 'NewMessage.Template' => new_message_template, 116 'NewMessage.Sound' => new_message_sound, 117 'NewMessage.BadgeCountEnabled' => new_message_badge_count_enabled, 118 'AddedToConversation.Enabled' => added_to_conversation_enabled, 119 'AddedToConversation.Template' => added_to_conversation_template, 120 'AddedToConversation.Sound' => added_to_conversation_sound, 121 'RemovedFromConversation.Enabled' => removed_from_conversation_enabled, 122 'RemovedFromConversation.Template' => removed_from_conversation_template, 123 'RemovedFromConversation.Sound' => removed_from_conversation_sound, 124 }) 125 126 payload = @version.update('POST', @uri, data: data) 127 128 NotificationInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], ) 129 end