Class: Twilio::REST::FlexApi::V1::WebChannelContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::FlexApi::V1::WebChannelContext
- Defined in:
- lib/twilio-ruby/rest/flex_api/v1/web_channel.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the WebChannelInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the WebChannelInstanceMetadata.
-
#fetch ⇒ WebChannelInstance
Fetch the WebChannelInstance.
-
#fetch_with_metadata ⇒ WebChannelInstance
Fetch the WebChannelInstanceMetadata.
-
#initialize(version, sid) ⇒ WebChannelContext
constructor
Initialize the WebChannelContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(chat_status: :unset, post_engagement_data: :unset) ⇒ WebChannelInstance
Update the WebChannelInstance.
-
#update_with_metadata(chat_status: :unset, post_engagement_data: :unset) ⇒ WebChannelInstance
Update the WebChannelInstanceMetadata.
Constructor Details
#initialize(version, sid) ⇒ WebChannelContext
Initialize the WebChannelContext
245 246 247 248 249 250 251 252 253 254 |
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 245 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/WebChannels/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the WebChannelInstance
258 259 260 261 262 263 264 265 266 |
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 258 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 WebChannelInstanceMetadata
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 271 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) webChannel_instance = WebChannelInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) WebChannelInstanceMetadata.new(@version, webChannel_instance, response.headers, response.status_code) end |
#fetch ⇒ WebChannelInstance
Fetch the WebChannelInstance
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 290 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) WebChannelInstance.new( @version, payload, sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ WebChannelInstance
Fetch the WebChannelInstanceMetadata
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 309 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) web_channel_instance = WebChannelInstance.new( @version, response.body, sid: @solution[:sid], ) WebChannelInstanceMetadata.new( @version, web_channel_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
405 406 407 408 |
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 405 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.FlexApi.V1.WebChannelContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
398 399 400 401 |
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 398 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.FlexApi.V1.WebChannelContext #{context}>" end |
#update(chat_status: :unset, post_engagement_data: :unset) ⇒ WebChannelInstance
Update the WebChannelInstance
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 |
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 336 def update( chat_status: :unset, post_engagement_data: :unset ) data = Twilio::Values.of({ 'ChatStatus' => chat_status, 'PostEngagementData' => post_engagement_data, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) WebChannelInstance.new( @version, payload, sid: @solution[:sid], ) end |
#update_with_metadata(chat_status: :unset, post_engagement_data: :unset) ⇒ WebChannelInstance
Update the WebChannelInstanceMetadata
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 365 def ( chat_status: :unset, post_engagement_data: :unset ) data = Twilio::Values.of({ 'ChatStatus' => chat_status, 'PostEngagementData' => post_engagement_data, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) web_channel_instance = WebChannelInstance.new( @version, response.body, sid: @solution[:sid], ) WebChannelInstanceMetadata.new( @version, web_channel_instance, response.headers, response.status_code ) end |