class Twilio::REST::IpMessaging::V2::ServiceContext::UserContext::UserChannelContext
Public Class Methods
Initialize the UserChannelContext
@param [Version] version Version
that contains the resource @param [String] service_sid The service_sid @param [String] user_sid The user_sid @param [String] channel_sid The channel_sid @return [UserChannelContext] UserChannelContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb 159 def initialize(version, service_sid, user_sid, channel_sid) 160 super(version) 161 162 # Path Solution 163 @solution = {service_sid: service_sid, user_sid: user_sid, channel_sid: channel_sid, } 164 @uri = "/Services/#{@solution[:service_sid]}/Users/#{@solution[:user_sid]}/Channels/#{@solution[:channel_sid]}" 165 end
Public Instance Methods
Delete the UserChannelInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb 185 def delete 186 @version.delete('DELETE', @uri) 187 end
Fetch the UserChannelInstance
@return [UserChannelInstance] Fetched UserChannelInstance
# File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb 170 def fetch 171 payload = @version.fetch('GET', @uri) 172 173 UserChannelInstance.new( 174 @version, 175 payload, 176 service_sid: @solution[:service_sid], 177 user_sid: @solution[:user_sid], 178 channel_sid: @solution[:channel_sid], 179 ) 180 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb 223 def inspect 224 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 225 "#<Twilio.IpMessaging.V2.UserChannelContext #{context}>" 226 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb 216 def to_s 217 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 218 "#<Twilio.IpMessaging.V2.UserChannelContext #{context}>" 219 end
Update the UserChannelInstance
@param [user_channel.NotificationLevel] notification_level The
notification_level
@param [String] last_consumed_message_index The last_consumed_message_index @param [Time] last_consumption_timestamp The last_consumption_timestamp @return [UserChannelInstance] Updated UserChannelInstance
# File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb 196 def update(notification_level: :unset, last_consumed_message_index: :unset, last_consumption_timestamp: :unset) 197 data = Twilio::Values.of({ 198 'NotificationLevel' => notification_level, 199 'LastConsumedMessageIndex' => last_consumed_message_index, 200 'LastConsumptionTimestamp' => Twilio.serialize_iso8601_datetime(last_consumption_timestamp), 201 }) 202 203 payload = @version.update('POST', @uri, data: data) 204 205 UserChannelInstance.new( 206 @version, 207 payload, 208 service_sid: @solution[:service_sid], 209 user_sid: @solution[:user_sid], 210 channel_sid: @solution[:channel_sid], 211 ) 212 end