Class: Twilio::REST::FrontlineApi::V1::UserInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::FrontlineApi::V1::UserInstance
- 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
-
#avatar ⇒ String
The avatar URL which will be shown in Frontline application.
-
#context ⇒ UserContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#fetch ⇒ UserInstance
Fetch the UserInstance.
-
#friendly_name ⇒ String
The string that you assigned to describe the User.
-
#identity ⇒ String
The string that identifies the resource’s User.
-
#initialize(version, payload, sid: nil) ⇒ UserInstance
constructor
Initialize the UserInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#is_available ⇒ Boolean
Whether the User is available for new conversations.
-
#sid ⇒ String
The unique string that identifies the resource.
-
#state ⇒ user.StateType
Current state of this user.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, avatar: :unset, state: :unset, is_available: :unset) ⇒ UserInstance
Update the UserInstance.
-
#url ⇒ String
An absolute URL for this user.
Constructor Details
#initialize(version, payload, sid: nil) ⇒ UserInstance
Initialize the UserInstance
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 141 def initialize(version, payload, sid: nil) super(version) # Marshaled Properties @properties = { 'sid' => payload['sid'], 'identity' => payload['identity'], 'friendly_name' => payload['friendly_name'], 'avatar' => payload['avatar'], 'state' => payload['state'], 'is_available' => payload['is_available'], 'url' => payload['url'], } # Context @instance_context = nil @params = {'sid' => sid || @properties['sid'], } end |
Instance Method Details
#avatar ⇒ String
Returns The avatar URL which will be shown in Frontline application.
191 192 193 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 191 def avatar @properties['avatar'] end |
#context ⇒ UserContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
164 165 166 167 168 169 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 164 def context unless @instance_context @instance_context = UserContext.new(@version, @params['sid'], ) end @instance_context end |
#fetch ⇒ UserInstance
Fetch the UserInstance
216 217 218 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 216 def fetch context.fetch end |
#friendly_name ⇒ String
Returns The string that you assigned to describe the User.
185 186 187 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 185 def friendly_name @properties['friendly_name'] end |
#identity ⇒ String
Returns The string that identifies the resource’s User.
179 180 181 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 179 def identity @properties['identity'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
250 251 252 253 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 250 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.FrontlineApi.V1.UserInstance #{values}>" end |
#is_available ⇒ Boolean
Returns Whether the User is available for new conversations.
203 204 205 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 203 def is_available @properties['is_available'] end |
#sid ⇒ String
Returns The unique string that identifies the resource.
173 174 175 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 173 def sid @properties['sid'] end |
#state ⇒ user.StateType
Returns Current state of this user.
197 198 199 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 197 def state @properties['state'] end |
#to_s ⇒ Object
Provide a user friendly representation
243 244 245 246 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 243 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.FrontlineApi.V1.UserInstance #{values}>" end |
#update(friendly_name: :unset, avatar: :unset, state: :unset, is_available: :unset) ⇒ UserInstance
Update the UserInstance
232 233 234 235 236 237 238 239 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 232 def update(friendly_name: :unset, avatar: :unset, state: :unset, is_available: :unset) context.update( friendly_name: friendly_name, avatar: avatar, state: state, is_available: is_available, ) end |
#url ⇒ String
Returns An absolute URL for this user.
209 210 211 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 209 def url @properties['url'] end |