class Twilio::REST::IpMessaging::V2::ServiceContext::UserInstance

Public Class Methods

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

Initialize the UserInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] service_sid The service_sid @param [String] sid The sid @return [UserInstance] UserInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
290 def initialize(version, payload, service_sid: nil, sid: nil)
291   super(version)
292 
293   # Marshaled Properties
294   @properties = {
295       'sid' => payload['sid'],
296       'account_sid' => payload['account_sid'],
297       'service_sid' => payload['service_sid'],
298       'attributes' => payload['attributes'],
299       'friendly_name' => payload['friendly_name'],
300       'role_sid' => payload['role_sid'],
301       'identity' => payload['identity'],
302       'is_online' => payload['is_online'],
303       'is_notifiable' => payload['is_notifiable'],
304       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
305       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
306       'joined_channels_count' => payload['joined_channels_count'].to_i,
307       'links' => payload['links'],
308       'url' => payload['url'],
309   }
310 
311   # Context
312   @instance_context = nil
313   @params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'], }
314 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The account_sid

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
335 def account_sid
336   @properties['account_sid']
337 end
attributes() click to toggle source

@return [String] The attributes

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
347 def attributes
348   @properties['attributes']
349 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 [UserContext] UserContext for this UserInstance

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
320 def context
321   unless @instance_context
322     @instance_context = UserContext.new(@version, @params['service_sid'], @params['sid'], )
323   end
324   @instance_context
325 end
date_created() click to toggle source

@return [Time] The date_created

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
383 def date_created
384   @properties['date_created']
385 end
date_updated() click to toggle source

@return [Time] The date_updated

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
389 def date_updated
390   @properties['date_updated']
391 end
delete() click to toggle source

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

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
421 def delete
422   context.delete
423 end
fetch() click to toggle source

Fetch the UserInstance @return [UserInstance] Fetched UserInstance

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
414 def fetch
415   context.fetch
416 end
friendly_name() click to toggle source

@return [String] The friendly_name

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
353 def friendly_name
354   @properties['friendly_name']
355 end
identity() click to toggle source

@return [String] The identity

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
365 def identity
366   @properties['identity']
367 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
465 def inspect
466   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
467   "<Twilio.IpMessaging.V2.UserInstance #{values}>"
468 end
is_notifiable() click to toggle source

@return [Boolean] The is_notifiable

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
377 def is_notifiable
378   @properties['is_notifiable']
379 end
is_online() click to toggle source

@return [Boolean] The is_online

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
371 def is_online
372   @properties['is_online']
373 end
joined_channels_count() click to toggle source

@return [String] The joined_channels_count

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
395 def joined_channels_count
396   @properties['joined_channels_count']
397 end
role_sid() click to toggle source

@return [String] The role_sid

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
359 def role_sid
360   @properties['role_sid']
361 end
service_sid() click to toggle source

@return [String] The service_sid

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
341 def service_sid
342   @properties['service_sid']
343 end
sid() click to toggle source

@return [String] The sid

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
329 def sid
330   @properties['sid']
331 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
458 def to_s
459   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
460   "<Twilio.IpMessaging.V2.UserInstance #{values}>"
461 end
update(role_sid: :unset, attributes: :unset, friendly_name: :unset, x_twilio_webhook_enabled: :unset) click to toggle source

Update the UserInstance @param [String] role_sid The role_sid @param [String] attributes The attributes @param [String] friendly_name The friendly_name @param [user.WebhookEnabledType] x_twilio_webhook_enabled The

X-Twilio-Webhook-Enabled HTTP request header

@return [UserInstance] Updated UserInstance

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
433 def update(role_sid: :unset, attributes: :unset, friendly_name: :unset, x_twilio_webhook_enabled: :unset)
434   context.update(
435       role_sid: role_sid,
436       attributes: attributes,
437       friendly_name: friendly_name,
438       x_twilio_webhook_enabled: x_twilio_webhook_enabled,
439   )
440 end
url() click to toggle source

@return [String] The url

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
407 def url
408   @properties['url']
409 end
user_bindings() click to toggle source

Access the user_bindings @return [user_bindings] user_bindings

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
452 def user_bindings
453   context.user_bindings
454 end
user_channels() click to toggle source

Access the user_channels @return [user_channels] user_channels

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
445 def user_channels
446   context.user_channels
447 end