Class: Twilio::REST::FlexApi::V2::FlexUserInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/flex_api/v2/flex_user.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, instance_sid: nil, flex_user_sid: nil) ⇒ FlexUserInstance

Initialize the FlexUserInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this FlexUser resource.

  • sid (String)

    The SID of the Call resource to fetch.



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 175

def initialize(version, payload , instance_sid: nil, flex_user_sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'instance_sid' => payload['instance_sid'],
        'user_sid' => payload['user_sid'],
        'flex_user_sid' => payload['flex_user_sid'],
        'worker_sid' => payload['worker_sid'],
        'workspace_sid' => payload['workspace_sid'],
        'flex_team_sid' => payload['flex_team_sid'],
        'first_name' => payload['first_name'],
        'last_name' => payload['last_name'],
        'username' => payload['username'],
        'email' => payload['email'],
        'friendly_name' => payload['friendly_name'],
        'locale' => payload['locale'],
        'roles' => payload['roles'],
        'created_date' => Twilio.deserialize_iso8601_datetime(payload['created_date']),
        'updated_date' => Twilio.deserialize_iso8601_datetime(payload['updated_date']),
        'version' => payload['version'] == nil ? payload['version'] : payload['version'].to_i,
        'url' => payload['url'],
    }

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

Instance Method Details

#account_sidString

Returns The unique SID of the account that created the resource.

Returns:

  • (String)

    The unique SID of the account that created the resource.



218
219
220
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 218

def 
    @properties['account_sid']
end

#contextFlexUserContext

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

Returns:



209
210
211
212
213
214
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 209

def context
    unless @instance_context
        @instance_context = FlexUserContext.new(@version , @params['instance_sid'], @params['flex_user_sid'])
    end
    @instance_context
end

#created_dateTime

Returns The date that this user was created, given in ISO 8601 format.

Returns:

  • (Time)

    The date that this user was created, given in ISO 8601 format.



302
303
304
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 302

def created_date
    @properties['created_date']
end

#emailString

Returns Email of the User.

Returns:

  • (String)

    Email of the User.



278
279
280
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 278

def email
    @properties['email']
end

#fetchFlexUserInstance

Fetch the FlexUserInstance

Returns:



327
328
329
330
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 327

def fetch

    context.fetch
end

#first_nameString

Returns First name of the User.

Returns:

  • (String)

    First name of the User.



260
261
262
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 260

def first_name
    @properties['first_name']
end

#flex_team_sidString

Returns The unique SID identifier of the Flex Team.

Returns:

  • (String)

    The unique SID identifier of the Flex Team.



254
255
256
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 254

def flex_team_sid
    @properties['flex_team_sid']
end

#flex_user_sidString

Returns The unique SID identifier of the Flex User.

Returns:

  • (String)

    The unique SID identifier of the Flex User.



236
237
238
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 236

def flex_user_sid
    @properties['flex_user_sid']
end

#friendly_nameString

Returns Friendly name of the User.

Returns:

  • (String)

    Friendly name of the User.



284
285
286
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 284

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



369
370
371
372
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 369

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

#instance_sidString

Returns The unique ID created by Twilio to identify a Flex instance.

Returns:

  • (String)

    The unique ID created by Twilio to identify a Flex instance.



224
225
226
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 224

def instance_sid
    @properties['instance_sid']
end

#last_nameString

Returns Last name of the User.

Returns:

  • (String)

    Last name of the User.



266
267
268
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 266

def last_name
    @properties['last_name']
end

#localeString

Returns The locale preference of the user.

Returns:

  • (String)

    The locale preference of the user.



290
291
292
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 290

def locale
    @properties['locale']
end

#rolesArray<String>

Returns The roles of the user.

Returns:

  • (Array<String>)

    The roles of the user.



296
297
298
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 296

def roles
    @properties['roles']
end

#to_sObject

Provide a user friendly representation



362
363
364
365
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 362

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.FlexApi.V2.FlexUserInstance #{values}>"
end

#update(first_name: :unset, last_name: :unset, email: :unset, friendly_name: :unset, user_sid: :unset, locale: :unset) ⇒ FlexUserInstance

Update the FlexUserInstance

Parameters:

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

    First name of the User.

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

    Last name of the User.

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

    Email of the User.

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

    Friendly name of the User.

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

    The unique SID identifier of the Twilio Unified User.

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

    The locale preference of the user.

Returns:



341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 341

def update(
    first_name: :unset, 
    last_name: :unset, 
    email: :unset, 
    friendly_name: :unset, 
    user_sid: :unset, 
    locale: :unset
)

    context.update(
        first_name: first_name, 
        last_name: last_name, 
        email: email, 
        friendly_name: friendly_name, 
        user_sid: user_sid, 
        locale: locale, 
    )
end

#updated_dateTime

Returns The date that this user was updated, given in ISO 8601 format.

Returns:

  • (Time)

    The date that this user was updated, given in ISO 8601 format.



308
309
310
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 308

def updated_date
    @properties['updated_date']
end

#urlString

Returns:

  • (String)


320
321
322
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 320

def url
    @properties['url']
end

#user_sidString

Returns The unique SID identifier of the Twilio Unified User.

Returns:

  • (String)

    The unique SID identifier of the Twilio Unified User.



230
231
232
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 230

def user_sid
    @properties['user_sid']
end

#usernameString

Returns Username of the User.

Returns:

  • (String)

    Username of the User.



272
273
274
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 272

def username
    @properties['username']
end

#versionString

Returns The current version of the user.

Returns:

  • (String)

    The current version of the user.



314
315
316
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 314

def version
    @properties['version']
end

#worker_sidString

Returns The unique SID identifier of the worker.

Returns:

  • (String)

    The unique SID identifier of the worker.



242
243
244
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 242

def worker_sid
    @properties['worker_sid']
end

#workspace_sidString

Returns The unique SID identifier of the workspace.

Returns:

  • (String)

    The unique SID identifier of the workspace.



248
249
250
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 248

def workspace_sid
    @properties['workspace_sid']
end