Class: Twilio::REST::IpMessaging::V1::ServiceContext::ChannelContext
- Inherits:
-
Twilio::REST::InstanceContext
- Object
- Twilio::REST::InstanceContext
- Twilio::REST::IpMessaging::V1::ServiceContext::ChannelContext
- Defined in:
- lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb,
lib/twilio-ruby/rest/ip_messaging/v1/service/channel/invite.rb,
lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb,
lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb
Defined Under Namespace
Classes: InviteContext, InviteInstance, InviteInstanceMetadata, InviteList, InviteListResponse, InvitePage, InvitePageMetadata, MemberContext, MemberInstance, MemberInstanceMetadata, MemberList, MemberListResponse, MemberPage, MemberPageMetadata, MessageContext, MessageInstance, MessageInstanceMetadata, MessageList, MessageListResponse, MessagePage, MessagePageMetadata
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the ChannelInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the ChannelInstanceMetadata.
-
#fetch ⇒ ChannelInstance
Fetch the ChannelInstance.
-
#fetch_with_metadata ⇒ ChannelInstance
Fetch the ChannelInstanceMetadata.
-
#initialize(version, service_sid, sid) ⇒ ChannelContext
constructor
Initialize the ChannelContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#invites(sid = :unset) ⇒ InviteList, InviteContext
Access the invites.
-
#members(sid = :unset) ⇒ MemberList, MemberContext
Access the members.
-
#messages(sid = :unset) ⇒ MessageList, MessageContext
Access the messages.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, unique_name: :unset, attributes: :unset) ⇒ ChannelInstance
Update the ChannelInstance.
-
#update_with_metadata(friendly_name: :unset, unique_name: :unset, attributes: :unset) ⇒ ChannelInstance
Update the ChannelInstanceMetadata.
Constructor Details
#initialize(version, service_sid, sid) ⇒ ChannelContext
Initialize the ChannelContext
248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb', line 248 def initialize(version, service_sid, sid) super(version) # Path Solution @solution = { service_sid: service_sid, sid: sid, } @uri = "/Services/#{@solution[:service_sid]}/Channels/#{@solution[:sid]}" # Dependents @members = nil = nil @invites = nil end |
Instance Method Details
#delete ⇒ Boolean
Delete the ChannelInstance
264 265 266 267 268 269 270 271 272 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb', line 264 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 ChannelInstanceMetadata
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb', line 277 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) channel_instance = ChannelInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) ChannelInstanceMetadata.new(@version, channel_instance, response.headers, response.status_code) end |
#fetch ⇒ ChannelInstance
Fetch the ChannelInstance
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb', line 296 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) ChannelInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ ChannelInstance
Fetch the ChannelInstanceMetadata
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb', line 316 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) channel_instance = ChannelInstance.new( @version, response.body, service_sid: @solution[:service_sid], sid: @solution[:sid], ) ChannelInstanceMetadata.new( @version, channel_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
478 479 480 481 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb', line 478 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.IpMessaging.V1.ChannelContext #{context}>" end |
#invites(sid = :unset) ⇒ InviteList, InviteContext
Access the invites
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb', line 453 def invites(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return InviteContext.new(@version, @solution[:service_sid], @solution[:sid],sid ) end unless @invites @invites = InviteList.new( @version, service_sid: @solution[:service_sid], channel_sid: @solution[:sid], ) end @invites end |
#members(sid = :unset) ⇒ MemberList, MemberContext
Access the members
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb', line 415 def members(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return MemberContext.new(@version, @solution[:service_sid], @solution[:sid],sid ) end unless @members @members = MemberList.new( @version, service_sid: @solution[:service_sid], channel_sid: @solution[:sid], ) end @members end |
#messages(sid = :unset) ⇒ MessageList, MessageContext
Access the messages
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb', line 434 def (sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return MessageContext.new(@version, @solution[:service_sid], @solution[:sid],sid ) end unless = MessageList.new( @version, service_sid: @solution[:service_sid], channel_sid: @solution[:sid], ) end end |
#to_s ⇒ Object
Provide a user friendly representation
471 472 473 474 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb', line 471 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.IpMessaging.V1.ChannelContext #{context}>" end |
#update(friendly_name: :unset, unique_name: :unset, attributes: :unset) ⇒ ChannelInstance
Update the ChannelInstance
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb', line 345 def update( friendly_name: :unset, unique_name: :unset, attributes: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'UniqueName' => unique_name, 'Attributes' => attributes, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) ChannelInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |
#update_with_metadata(friendly_name: :unset, unique_name: :unset, attributes: :unset) ⇒ ChannelInstance
Update the ChannelInstanceMetadata
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb', line 378 def ( friendly_name: :unset, unique_name: :unset, attributes: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'UniqueName' => unique_name, 'Attributes' => attributes, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) channel_instance = ChannelInstance.new( @version, response.body, service_sid: @solution[:service_sid], sid: @solution[:sid], ) ChannelInstanceMetadata.new( @version, channel_instance, response.headers, response.status_code ) end |