Class: Twilio::REST::IpMessaging::V2::ServiceContext::UserContext::UserChannelContext
- Inherits:
-
Twilio::REST::InstanceContext
- Object
- Twilio::REST::InstanceContext
- Twilio::REST::IpMessaging::V2::ServiceContext::UserContext::UserChannelContext
- Defined in:
- lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the UserChannelInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the UserChannelInstanceMetadata.
-
#fetch ⇒ UserChannelInstance
Fetch the UserChannelInstance.
-
#fetch_with_metadata ⇒ UserChannelInstance
Fetch the UserChannelInstanceMetadata.
-
#initialize(version, service_sid, user_sid, channel_sid) ⇒ UserChannelContext
constructor
Initialize the UserChannelContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(notification_level: :unset, last_consumed_message_index: :unset, last_consumption_timestamp: :unset) ⇒ UserChannelInstance
Update the UserChannelInstance.
-
#update_with_metadata(notification_level: :unset, last_consumed_message_index: :unset, last_consumption_timestamp: :unset) ⇒ UserChannelInstance
Update the UserChannelInstanceMetadata.
Constructor Details
#initialize(version, service_sid, user_sid, channel_sid) ⇒ UserChannelContext
Initialize the UserChannelContext
172 173 174 175 176 177 178 179 180 181 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 172 def initialize(version, service_sid, user_sid, channel_sid) super(version) # Path Solution @solution = { service_sid: service_sid, user_sid: user_sid, channel_sid: channel_sid, } @uri = "/Services/#{@solution[:service_sid]}/Users/#{@solution[:user_sid]}/Channels/#{@solution[:channel_sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the UserChannelInstance
185 186 187 188 189 190 191 192 193 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 185 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#delete_with_metadata ⇒ Boolean
Delete the UserChannelInstanceMetadata
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 198 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) userChannel_instance = UserChannelInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) UserChannelInstanceMetadata.new(@version, userChannel_instance, response.headers, response.status_code) end |
#fetch ⇒ UserChannelInstance
Fetch the UserChannelInstance
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 217 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) UserChannelInstance.new( @version, payload, service_sid: @solution[:service_sid], user_sid: @solution[:user_sid], channel_sid: @solution[:channel_sid], ) end |
#fetch_with_metadata ⇒ UserChannelInstance
Fetch the UserChannelInstanceMetadata
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 238 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) user_channel_instance = UserChannelInstance.new( @version, response.body, service_sid: @solution[:service_sid], user_sid: @solution[:user_sid], channel_sid: @solution[:channel_sid], ) UserChannelInstanceMetadata.new( @version, user_channel_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
346 347 348 349 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 346 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.IpMessaging.V2.UserChannelContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
339 340 341 342 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 339 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.IpMessaging.V2.UserChannelContext #{context}>" end |
#update(notification_level: :unset, last_consumed_message_index: :unset, last_consumption_timestamp: :unset) ⇒ UserChannelInstance
Update the UserChannelInstance
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 268 def update( notification_level: :unset, last_consumed_message_index: :unset, last_consumption_timestamp: :unset ) data = Twilio::Values.of({ 'NotificationLevel' => notification_level, 'LastConsumedMessageIndex' => , 'LastConsumptionTimestamp' => Twilio.serialize_iso8601_datetime(), }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) UserChannelInstance.new( @version, payload, service_sid: @solution[:service_sid], user_sid: @solution[:user_sid], channel_sid: @solution[:channel_sid], ) end |
#update_with_metadata(notification_level: :unset, last_consumed_message_index: :unset, last_consumption_timestamp: :unset) ⇒ UserChannelInstance
Update the UserChannelInstanceMetadata
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 302 def ( notification_level: :unset, last_consumed_message_index: :unset, last_consumption_timestamp: :unset ) data = Twilio::Values.of({ 'NotificationLevel' => notification_level, 'LastConsumedMessageIndex' => , 'LastConsumptionTimestamp' => Twilio.serialize_iso8601_datetime(), }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) user_channel_instance = UserChannelInstance.new( @version, response.body, service_sid: @solution[:service_sid], user_sid: @solution[:user_sid], channel_sid: @solution[:channel_sid], ) UserChannelInstanceMetadata.new( @version, user_channel_instance, response.headers, response.status_code ) end |