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

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

    The SID of the User resource to fetch. This value can be either the `sid` or the `identity` of the User resource to fetch.


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

Returns The avatar URL which will be shown in Frontline application.

Returns:

  • (String)

    The avatar URL which will be shown in Frontline application


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

Returns:


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

Returns:


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

def fetch
  context.fetch
end

#friendly_nameString

Returns The string that you assigned to describe the User.

Returns:

  • (String)

    The string that you assigned to describe the User


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

def friendly_name
  @properties['friendly_name']
end

#identityString

Returns The string that identifies the resource's User.

Returns:

  • (String)

    The string that identifies the resource's User


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

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource


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

def sid
  @properties['sid']
end

#stateuser.StateType

Returns Current state of this user.

Returns:

  • (user.StateType)

    Current state of this user


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

Parameters:

  • friendly_name (String) (defaults to: :unset)

    The string that you assigned to describe the User.

  • avatar (String) (defaults to: :unset)

    The avatar URL which will be shown in Frontline application.

  • state (user.StateType) (defaults to: :unset)

    Current state of this user. Can be either `active` or `deactivated` and defaults to `active`

Returns:


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

Returns An absolute URL for this user.

Returns:

  • (String)

    An absolute URL for this user.


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

def url
  @properties['url']
end