Class: Twilio::REST::Conversations::V1::ServiceContext::ConfigurationContext::NotificationContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Conversations::V1::ServiceContext::ConfigurationContext::NotificationContext
- Defined in:
- lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb
Instance Method Summary collapse
-
#fetch ⇒ NotificationInstance
Fetch the NotificationInstance.
-
#fetch_with_metadata ⇒ NotificationInstance
Fetch the NotificationInstanceMetadata.
-
#initialize(version, chat_service_sid) ⇒ NotificationContext
constructor
Initialize the NotificationContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#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, new_message_with_media_enabled: :unset, new_message_with_media_template: :unset) ⇒ NotificationInstance
Update the NotificationInstance.
-
#update_with_metadata(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, new_message_with_media_enabled: :unset, new_message_with_media_template: :unset) ⇒ NotificationInstance
Update the NotificationInstanceMetadata.
Constructor Details
#initialize(version, chat_service_sid) ⇒ NotificationContext
Initialize the NotificationContext
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb', line 53 def initialize(version, chat_service_sid) super(version) # Path Solution @solution = { chat_service_sid: chat_service_sid, } @uri = "/Services/#{@solution[:chat_service_sid]}/Configuration/Notifications" end |
Instance Method Details
#fetch ⇒ NotificationInstance
Fetch the NotificationInstance
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb', line 66 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) NotificationInstance.new( @version, payload, chat_service_sid: @solution[:chat_service_sid], ) end |
#fetch_with_metadata ⇒ NotificationInstance
Fetch the NotificationInstanceMetadata
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb', line 85 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) notification_instance = NotificationInstance.new( @version, response.body, chat_service_sid: @solution[:chat_service_sid], ) NotificationInstanceMetadata.new( @version, notification_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
247 248 249 250 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb', line 247 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.NotificationContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
240 241 242 243 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb', line 240 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.NotificationContext #{context}>" end |
#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, new_message_with_media_enabled: :unset, new_message_with_media_template: :unset) ⇒ NotificationInstance
Update the NotificationInstance
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb', line 123 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, new_message_with_media_enabled: :unset, new_message_with_media_template: :unset ) data = Twilio::Values.of({ 'LogEnabled' => log_enabled, 'NewMessage.Enabled' => , 'NewMessage.Template' => , 'NewMessage.Sound' => , 'NewMessage.BadgeCountEnabled' => , 'AddedToConversation.Enabled' => added_to_conversation_enabled, 'AddedToConversation.Template' => added_to_conversation_template, 'AddedToConversation.Sound' => added_to_conversation_sound, 'RemovedFromConversation.Enabled' => removed_from_conversation_enabled, 'RemovedFromConversation.Template' => removed_from_conversation_template, 'RemovedFromConversation.Sound' => removed_from_conversation_sound, 'NewMessage.WithMedia.Enabled' => , 'NewMessage.WithMedia.Template' => , }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) NotificationInstance.new( @version, payload, chat_service_sid: @solution[:chat_service_sid], ) end |
#update_with_metadata(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, new_message_with_media_enabled: :unset, new_message_with_media_template: :unset) ⇒ NotificationInstance
Update the NotificationInstanceMetadata
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb', line 185 def ( 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, new_message_with_media_enabled: :unset, new_message_with_media_template: :unset ) data = Twilio::Values.of({ 'LogEnabled' => log_enabled, 'NewMessage.Enabled' => , 'NewMessage.Template' => , 'NewMessage.Sound' => , 'NewMessage.BadgeCountEnabled' => , 'AddedToConversation.Enabled' => added_to_conversation_enabled, 'AddedToConversation.Template' => added_to_conversation_template, 'AddedToConversation.Sound' => added_to_conversation_sound, 'RemovedFromConversation.Enabled' => removed_from_conversation_enabled, 'RemovedFromConversation.Template' => removed_from_conversation_template, 'RemovedFromConversation.Sound' => removed_from_conversation_sound, 'NewMessage.WithMedia.Enabled' => , 'NewMessage.WithMedia.Template' => , }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) notification_instance = NotificationInstance.new( @version, response.body, chat_service_sid: @solution[:chat_service_sid], ) NotificationInstanceMetadata.new( @version, notification_instance, response.headers, response.status_code ) end |