Class: Twilio::REST::Chat::V2::ServiceContext::UserContext::UserChannelInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, service_sid: nil, user_sid: nil) ⇒ UserChannelInstance

Initialize the UserChannelInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • service_sid (String) (defaults to: nil)

    The unique id of the [Service](www.twilio.com/docs/api/chat/rest/services) this channel belongs to.

  • user_sid (String) (defaults to: nil)

    A 34 character string that uniquely identifies this resource.



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb', line 167

def initialize(version, payload, service_sid: nil, user_sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'service_sid' => payload['service_sid'],
      'channel_sid' => payload['channel_sid'],
      'member_sid' => payload['member_sid'],
      'status' => payload['status'],
      'last_consumed_message_index' => payload['last_consumed_message_index'] == nil ? payload['last_consumed_message_index'] : payload['last_consumed_message_index'].to_i,
      'unread_messages_count' => payload['unread_messages_count'] == nil ? payload['unread_messages_count'] : payload['unread_messages_count'].to_i,
      'links' => payload['links'],
  }
end

Instance Method Details

#account_sidString

Returns The unique id of the Account responsible for this channel.

Returns:

  • (String)

    The unique id of the Account responsible for this channel.



185
186
187
# File 'lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb', line 185

def 
  @properties['account_sid']
end

#channel_sidString

Returns The unique id of a Channel.

Returns:

  • (String)

    The unique id of a Channel.



197
198
199
# File 'lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb', line 197

def channel_sid
  @properties['channel_sid']
end

#inspectObject

Provide a detailed, user friendly representation



239
240
241
# File 'lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb', line 239

def inspect
  "<Twilio.Chat.V2.UserChannelInstance>"
end

#last_consumed_message_indexString

Returns The index of the last read Message in this Channel for this User.

Returns:

  • (String)

    The index of the last read Message in this Channel for this User.



215
216
217
# File 'lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb', line 215

def last_consumed_message_index
  @properties['last_consumed_message_index']
end

Returns The links.

Returns:

  • (String)

    The links



227
228
229
# File 'lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb', line 227

def links
  @properties['links']
end

#member_sidString

Returns The unique id of this User as a Member in this Channel.

Returns:

  • (String)

    The unique id of this User as a Member in this Channel.



203
204
205
# File 'lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb', line 203

def member_sid
  @properties['member_sid']
end

#service_sidString

Returns The unique id of the Service this channel belongs to.

Returns:

  • (String)

    The unique id of the Service this channel belongs to.



191
192
193
# File 'lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb', line 191

def service_sid
  @properties['service_sid']
end

#statususer_channel.ChannelStatus

Returns The status of the User on this Channel.

Returns:

  • (user_channel.ChannelStatus)

    The status of the User on this Channel.



209
210
211
# File 'lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb', line 209

def status
  @properties['status']
end

#to_sObject

Provide a user friendly representation



233
234
235
# File 'lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb', line 233

def to_s
  "<Twilio.Chat.V2.UserChannelInstance>"
end

#unread_messages_countString

Returns The count of unread Messages in this Channel for this User.

Returns:

  • (String)

    The count of unread Messages in this Channel for this User.



221
222
223
# File 'lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb', line 221

def unread_messages_count
  @properties['unread_messages_count']
end