Class: HelpScout::User

Inherits:
Object
  • Object
show all
Defined in:
lib/helpscout/models.rb

Overview

User developer.helpscout.net/objects/user/

Name        Type      Example                 Notes
id          Int       1234                    Unique identifier
firstName   String    Jack   
lastName    String    Sprout   
email       String    [email protected]  
role        String    owner                   Role of this user.
timezone    String    America/New_York   
photoUrl    String    http://.../avatar.jpg   The user's photo, if one 
                                              exists.
createdAt   DateTime  2011-04-01T03:18:33Z    UTC time when this user was 
                                              created.
modifiedAt  DateTime  2012-07-24T20:18:33Z    UTC time when this user was 
                                              modified.

Possible values for role include:

  • ROLE_OWNER

  • ROLE_ADMIN

  • ROLE_USER

Constant Summary collapse

ROLE_OWNER =
"owner"
ROLE_ADMIN =
"admin"
ROLE_USER =
"user"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ User

Creates a new User object from a Hash of attributes



468
469
470
471
472
473
474
475
476
477
478
479
# File 'lib/helpscout/models.rb', line 468

def initialize(object)
  @createdAt = DateTime.iso8601(object["createdAt"]) if object["createdAt"]
  @modifiedAt = DateTime.iso8601(object["modifiedAt"]) if object["modifiedAt"]

  @id = object["id"]
  @firstName = object["firstName"]
  @lastName = object["lastName"]
  @email = object["email"]
  @role = object["role"]
  @timezone = object["timezone"]
  @photoUrl = object["photoUrl"]
end

Instance Attribute Details

#createdAtObject (readonly)

Returns the value of attribute createdAt.



461
462
463
# File 'lib/helpscout/models.rb', line 461

def createdAt
  @createdAt
end

#emailObject (readonly)

Returns the value of attribute email.



461
462
463
# File 'lib/helpscout/models.rb', line 461

def email
  @email
end

#firstNameObject (readonly)

Returns the value of attribute firstName.



461
462
463
# File 'lib/helpscout/models.rb', line 461

def firstName
  @firstName
end

#idObject (readonly)

Returns the value of attribute id.



461
462
463
# File 'lib/helpscout/models.rb', line 461

def id
  @id
end

#lastNameObject (readonly)

Returns the value of attribute lastName.



461
462
463
# File 'lib/helpscout/models.rb', line 461

def lastName
  @lastName
end

#modifiedAtObject (readonly)

Returns the value of attribute modifiedAt.



461
462
463
# File 'lib/helpscout/models.rb', line 461

def modifiedAt
  @modifiedAt
end

#photoUrlObject (readonly)

Returns the value of attribute photoUrl.



461
462
463
# File 'lib/helpscout/models.rb', line 461

def photoUrl
  @photoUrl
end

#roleObject (readonly)

Returns the value of attribute role.



461
462
463
# File 'lib/helpscout/models.rb', line 461

def role
  @role
end

#timezoneObject (readonly)

Returns the value of attribute timezone.



461
462
463
# File 'lib/helpscout/models.rb', line 461

def timezone
  @timezone
end

Instance Method Details

#to_sObject

Returns a String suitable for display



482
483
484
# File 'lib/helpscout/models.rb', line 482

def to_s
  "#{@firstName} #{@lastName}"
end