Class: Twilio::REST::IpMessaging::V1::ServiceContext::UserContext
- Inherits:
-
Twilio::REST::InstanceContext
- Object
- Twilio::REST::InstanceContext
- Twilio::REST::IpMessaging::V1::ServiceContext::UserContext
- Defined in:
- lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb,
lib/twilio-ruby/rest/ip_messaging/v1/service/user/user_channel.rb
Defined Under Namespace
Classes: UserChannelInstance, UserChannelList, UserChannelListResponse, UserChannelPage, UserChannelPageMetadata
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the UserInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the UserInstanceMetadata.
-
#fetch ⇒ UserInstance
Fetch the UserInstance.
-
#fetch_with_metadata ⇒ UserInstance
Fetch the UserInstanceMetadata.
-
#initialize(version, service_sid, sid) ⇒ UserContext
constructor
Initialize the UserContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(role_sid: :unset, attributes: :unset, friendly_name: :unset) ⇒ UserInstance
Update the UserInstance.
-
#update_with_metadata(role_sid: :unset, attributes: :unset, friendly_name: :unset) ⇒ UserInstance
Update the UserInstanceMetadata.
-
#user_channels ⇒ UserChannelList, UserChannelContext
Access the user_channels.
Constructor Details
#initialize(version, service_sid, sid) ⇒ UserContext
Initialize the UserContext
246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb', line 246 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
Delete the UserInstance
260 261 262 263 264 265 266 267 268 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb', line 260 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 UserInstanceMetadata
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb', line 273 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) user_instance = UserInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) UserInstanceMetadata.new(@version, user_instance, response.headers, response.status_code) end |
#fetch ⇒ UserInstance
Fetch the UserInstance
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb', line 292 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) UserInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ UserInstance
Fetch the UserInstanceMetadata
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb', line 312 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) user_instance = UserInstance.new( @version, response.body, service_sid: @solution[:service_sid], sid: @solution[:sid], ) UserInstanceMetadata.new( @version, user_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
428 429 430 431 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb', line 428 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.IpMessaging.V1.UserContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
421 422 423 424 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb', line 421 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.IpMessaging.V1.UserContext #{context}>" end |
#update(role_sid: :unset, attributes: :unset, friendly_name: :unset) ⇒ UserInstance
Update the UserInstance
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb', line 341 def update( role_sid: :unset, attributes: :unset, friendly_name: :unset ) data = Twilio::Values.of({ 'RoleSid' => role_sid, 'Attributes' => attributes, 'FriendlyName' => friendly_name, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) UserInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |
#update_with_metadata(role_sid: :unset, attributes: :unset, friendly_name: :unset) ⇒ UserInstance
Update the UserInstanceMetadata
374 375 376 377 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 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb', line 374 def ( role_sid: :unset, attributes: :unset, friendly_name: :unset ) data = Twilio::Values.of({ 'RoleSid' => role_sid, 'Attributes' => attributes, 'FriendlyName' => friendly_name, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) user_instance = UserInstance.new( @version, response.body, service_sid: @solution[:service_sid], sid: @solution[:sid], ) UserInstanceMetadata.new( @version, user_instance, response.headers, response.status_code ) end |
#user_channels ⇒ UserChannelList, UserChannelContext
Access the user_channels
411 412 413 414 415 416 417 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb', line 411 def user_channels unless @user_channels @user_channels = UserChannelList.new( @version, service_sid: @solution[:service_sid], user_sid: @solution[:sid], ) end @user_channels end |