Class: Twilio::REST::FrontlineApi::V1::UserInstance

Inherits:
InstanceResource show all
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

Constructor Details

#initialize(version, payload, sid: nil) ⇒ UserInstance

Initialize the UserInstance



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 132

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'],
      'url' => payload['url'],
  }

  # Context
  @instance_context = nil
  @params = {'sid' => sid || @properties['sid'], }
end

Instance Method Details

#avatarString



181
182
183
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 181

def avatar
  @properties['avatar']
end

#contextUserContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context



154
155
156
157
158
159
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 154

def context
  unless @instance_context
    @instance_context = UserContext.new(@version, @params['sid'], )
  end
  @instance_context
end

#fetchUserInstance

Fetch the UserInstance



200
201
202
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 200

def fetch
  context.fetch
end

#friendly_nameString



175
176
177
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 175

def friendly_name
  @properties['friendly_name']
end

#identityString



169
170
171
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 169

def identity
  @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



225
226
227
228
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 225

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.FrontlineApi.V1.UserInstance #{values}>"
end

#sidString



163
164
165
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 163

def sid
  @properties['sid']
end

#stateuser.StateType



187
188
189
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 187

def state
  @properties['state']
end

#to_sObject

Provide a user friendly representation



218
219
220
221
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 218

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) ⇒ UserInstance

Update the UserInstance



212
213
214
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 212

def update(friendly_name: :unset, avatar: :unset, state: :unset)
  context.update(friendly_name: friendly_name, avatar: avatar, state: state, )
end

#urlString



193
194
195
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 193

def url
  @properties['url']
end