class Twilio::REST::Conversations::V1::ServiceContext::ConfigurationContext::NotificationInstance
Public Class Methods
Initialize the NotificationInstance
@param [Version] version Version
that contains the resource @param [Hash] payload payload that contains response from Twilio
@param [String] chat_service_sid
The unique string that we created to identify
the Service configuration resource.
@return [NotificationInstance] NotificationInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb 163 def initialize(version, payload, chat_service_sid: nil) 164 super(version) 165 166 # Marshaled Properties 167 @properties = { 168 'account_sid' => payload['account_sid'], 169 'chat_service_sid' => payload['chat_service_sid'], 170 'new_message' => payload['new_message'], 171 'added_to_conversation' => payload['added_to_conversation'], 172 'removed_from_conversation' => payload['removed_from_conversation'], 173 'log_enabled' => payload['log_enabled'], 174 'url' => payload['url'], 175 } 176 177 # Context 178 @instance_context = nil 179 @params = {'chat_service_sid' => chat_service_sid, } 180 end
Public Instance Methods
@return [String] The unique ID of the Account responsible for this configuration.
# File lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb 195 def account_sid 196 @properties['account_sid'] 197 end
@return [Hash] The Push Notification configuration for being added to a Conversation.
# File lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb 213 def added_to_conversation 214 @properties['added_to_conversation'] 215 end
@return [String] The SID of the Conversation Service that the Configuration applies to.
# File lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb 201 def chat_service_sid 202 @properties['chat_service_sid'] 203 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 [NotificationContext] NotificationContext
for this NotificationInstance
# File lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb 186 def context 187 unless @instance_context 188 @instance_context = NotificationContext.new(@version, @params['chat_service_sid'], ) 189 end 190 @instance_context 191 end
Fetch the NotificationInstance
@return [NotificationInstance] Fetched NotificationInstance
# File lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb 284 def fetch 285 context.fetch 286 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb 297 def inspect 298 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 299 "<Twilio.Conversations.V1.NotificationInstance #{values}>" 300 end
@return [Boolean] Weather the notification logging is enabled.
# File lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb 225 def log_enabled 226 @properties['log_enabled'] 227 end
@return [Hash] The Push Notification configuration for New Messages.
# File lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb 207 def new_message 208 @properties['new_message'] 209 end
@return [Hash] The Push Notification configuration for being removed from a Conversation.
# File lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb 219 def removed_from_conversation 220 @properties['removed_from_conversation'] 221 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb 290 def to_s 291 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 292 "<Twilio.Conversations.V1.NotificationInstance #{values}>" 293 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 265 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) 266 context.update( 267 log_enabled: log_enabled, 268 new_message_enabled: new_message_enabled, 269 new_message_template: new_message_template, 270 new_message_sound: new_message_sound, 271 new_message_badge_count_enabled: new_message_badge_count_enabled, 272 added_to_conversation_enabled: added_to_conversation_enabled, 273 added_to_conversation_template: added_to_conversation_template, 274 added_to_conversation_sound: added_to_conversation_sound, 275 removed_from_conversation_enabled: removed_from_conversation_enabled, 276 removed_from_conversation_template: removed_from_conversation_template, 277 removed_from_conversation_sound: removed_from_conversation_sound, 278 ) 279 end
@return [String] An absolute URL for this configuration.
# File lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb 231 def url 232 @properties['url'] 233 end