Class: Twilio::REST::Chat::V1::ServiceContext::UserContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Chat::V1::ServiceContext::UserContext
- Defined in:
- lib/twilio-ruby/rest/chat/v1/service/user.rb,
lib/twilio-ruby/rest/chat/v1/service/user/user_channel.rb
Defined Under Namespace
Classes: UserChannelInstance, UserChannelList, UserChannelPage
Instance Method Summary collapse
-
#delete ⇒ Boolean
Deletes the UserInstance.
-
#fetch ⇒ UserInstance
Fetch a UserInstance.
-
#initialize(version, service_sid, sid) ⇒ UserContext
constructor
Initialize the UserContext.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(role_sid: :unset, attributes: :unset, friendly_name: :unset) ⇒ UserInstance
Update the UserInstance.
-
#user_channels ⇒ UserChannelList, UserChannelContext
Access the user_channels.
Constructor Details
#initialize(version, service_sid, sid) ⇒ UserContext
Initialize the UserContext
193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/twilio-ruby/rest/chat/v1/service/user.rb', line 193 def initialize(version, service_sid, sid) super(version) # Path Solution @solution = { service_sid: service_sid, sid: sid, } @uri = "/Services/#{@solution[:service_sid]}/Users/#{@solution[:sid]}" # Dependents @user_channels = nil end |
Instance Method Details
#delete ⇒ Boolean
Deletes the UserInstance
230 231 232 |
# File 'lib/twilio-ruby/rest/chat/v1/service/user.rb', line 230 def delete @version.delete('delete', @uri) end |
#fetch ⇒ UserInstance
Fetch a UserInstance
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
# File 'lib/twilio-ruby/rest/chat/v1/service/user.rb', line 210 def fetch params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) UserInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |
#to_s ⇒ Object
Provide a user friendly representation
279 280 281 282 |
# File 'lib/twilio-ruby/rest/chat/v1/service/user.rb', line 279 def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Chat.V1.UserContext #{context}>" end |
#update(role_sid: :unset, attributes: :unset, friendly_name: :unset) ⇒ UserInstance
Update the UserInstance
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/twilio-ruby/rest/chat/v1/service/user.rb', line 240 def update(role_sid: :unset, attributes: :unset, friendly_name: :unset) data = Twilio::Values.of({ 'RoleSid' => role_sid, 'Attributes' => attributes, 'FriendlyName' => friendly_name, }) payload = @version.update( 'POST', @uri, data: data, ) UserInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |
#user_channels ⇒ UserChannelList, UserChannelContext
Access the user_channels
265 266 267 268 269 270 271 272 273 274 275 |
# File 'lib/twilio-ruby/rest/chat/v1/service/user.rb', line 265 def user_channels unless @user_channels @user_channels = UserChannelList.new( @version, service_sid: @solution[:service_sid], user_sid: @solution[:sid], ) end @user_channels end |