class Twilio::REST::Chat::V1::ServiceContext::ChannelInstance

Public Class Methods

new(version, payload, service_sid: nil, sid: nil) click to toggle source

Initialize the ChannelInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] service_sid The SID of the

{Service}[https://www.twilio.com/docs/api/chat/rest/services] the resource is
associated with.

@param [String] sid The Twilio-provided string that uniquely identifies the

Channel resource to fetch.

@return [ChannelInstance] ChannelInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
333 def initialize(version, payload, service_sid: nil, sid: nil)
334   super(version)
335 
336   # Marshaled Properties
337   @properties = {
338       'sid' => payload['sid'],
339       'account_sid' => payload['account_sid'],
340       'service_sid' => payload['service_sid'],
341       'friendly_name' => payload['friendly_name'],
342       'unique_name' => payload['unique_name'],
343       'attributes' => payload['attributes'],
344       'type' => payload['type'],
345       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
346       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
347       'created_by' => payload['created_by'],
348       'members_count' => payload['members_count'].to_i,
349       'messages_count' => payload['messages_count'].to_i,
350       'url' => payload['url'],
351       'links' => payload['links'],
352   }
353 
354   # Context
355   @instance_context = nil
356   @params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'], }
357 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The SID of the Account that created the resource

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
378 def account_sid
379   @properties['account_sid']
380 end
attributes() click to toggle source

@return [String] The JSON string that stores application-specific data

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
402 def attributes
403   @properties['attributes']
404 end
context() click to toggle source

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [ChannelContext] ChannelContext for this ChannelInstance

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
363 def context
364   unless @instance_context
365     @instance_context = ChannelContext.new(@version, @params['service_sid'], @params['sid'], )
366   end
367   @instance_context
368 end
created_by() click to toggle source

@return [String] The identity of the User that created the channel

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
426 def created_by
427   @properties['created_by']
428 end
date_created() click to toggle source

@return [Time] The RFC 2822 date and time in GMT when the resource was created

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
414 def date_created
415   @properties['date_created']
416 end
date_updated() click to toggle source

@return [Time] The RFC 2822 date and time in GMT when the resource was last updated

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
420 def date_updated
421   @properties['date_updated']
422 end
delete() click to toggle source

Delete the ChannelInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
464 def delete
465   context.delete
466 end
fetch() click to toggle source

Fetch the ChannelInstance @return [ChannelInstance] Fetched ChannelInstance

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
457 def fetch
458   context.fetch
459 end
friendly_name() click to toggle source

@return [String] The string that you assigned to describe the resource

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
390 def friendly_name
391   @properties['friendly_name']
392 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
513 def inspect
514   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
515   "<Twilio.Chat.V1.ChannelInstance #{values}>"
516 end
invites() click to toggle source

Access the invites @return [invites] invites

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
500 def invites
501   context.invites
502 end
members() click to toggle source

Access the members @return [members] members

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
486 def members
487   context.members
488 end
members_count() click to toggle source

@return [String] The number of Members in the Channel

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
432 def members_count
433   @properties['members_count']
434 end
messages() click to toggle source

Access the messages @return [messages] messages

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
493 def messages
494   context.messages
495 end
messages_count() click to toggle source

@return [String] The number of Messages in the Channel

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
438 def messages_count
439   @properties['messages_count']
440 end
service_sid() click to toggle source

@return [String] The SID of the Service that the resource is associated with

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
384 def service_sid
385   @properties['service_sid']
386 end
sid() click to toggle source

@return [String] The unique string that identifies the resource

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
372 def sid
373   @properties['sid']
374 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
506 def to_s
507   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
508   "<Twilio.Chat.V1.ChannelInstance #{values}>"
509 end
type() click to toggle source

@return [channel.ChannelType] The visibility of the channel. Can be: `public` or `private`

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
408 def type
409   @properties['type']
410 end
unique_name() click to toggle source

@return [String] An application-defined string that uniquely identifies the resource

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
396 def unique_name
397   @properties['unique_name']
398 end
update(friendly_name: :unset, unique_name: :unset, attributes: :unset) click to toggle source

Update the ChannelInstance @param [String] friendly_name A descriptive string that you create to describe

the resource. It can be up to 64 characters long.

@param [String] unique_name An application-defined string that uniquely

identifies the resource. It can be used to address the resource in place of the
resource's `sid` in the URL. This value must be 64 characters or less in length
and be unique within the Service.

@param [String] attributes A valid JSON string that contains

application-specific data.

@return [ChannelInstance] Updated ChannelInstance

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
479 def update(friendly_name: :unset, unique_name: :unset, attributes: :unset)
480   context.update(friendly_name: friendly_name, unique_name: unique_name, attributes: attributes, )
481 end
url() click to toggle source

@return [String] The absolute URL of the Channel resource

    # File lib/twilio-ruby/rest/chat/v1/service/channel.rb
444 def url
445   @properties['url']
446 end