Class: Twilio::REST::FrontlineApi::V1::UserContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::FrontlineApi::V1::UserContext
- Defined in:
- lib/twilio-ruby/rest/frontline_api/v1/user.rb
Overview
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Instance Method Summary collapse
-
#fetch ⇒ UserInstance
Fetch the UserInstance.
-
#initialize(version, sid) ⇒ UserContext
constructor
Initialize the UserContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, avatar: :unset, state: :unset, is_available: :unset) ⇒ UserInstance
Update the UserInstance.
Constructor Details
#initialize(version, sid) ⇒ UserContext
Initialize the UserContext
50 51 52 53 54 55 56 57 58 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 50 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Users/#{@solution[:sid]}" end |
Instance Method Details
#fetch ⇒ UserInstance
Fetch the UserInstance
62 63 64 65 66 67 68 69 70 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 62 def fetch payload = @version.fetch('GET', @uri) UserInstance.new( @version, payload, sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
111 112 113 114 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 111 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.FrontlineApi.V1.UserContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
104 105 106 107 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 104 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.FrontlineApi.V1.UserContext #{context}>" end |
#update(friendly_name: :unset, avatar: :unset, state: :unset, is_available: :unset) ⇒ UserInstance
Update the UserInstance
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 79 def update( friendly_name: :unset, avatar: :unset, state: :unset, is_available: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'Avatar' => avatar, 'State' => state, 'IsAvailable' => is_available, }) payload = @version.update('POST', @uri, data: data) UserInstance.new( @version, payload, sid: @solution[:sid], ) end |