Class: HelpScout::Person

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

Overview

Person developer.helpscout.net/objects/person/

The person object is a subset of the data representing a Customer or User. The ‘type’ property will specify if this person is represented by a ‘user’ or a ‘customer’.

Name        Type      Example                 Notes
id          Int       1234                    Unique identifier
firstName   String    Jack   
lastName    String    Sprout   
email       String    [email protected]  
phone       String    800-555-1212  
type        String    user

Possible values for type include:

  • TYPE_USER

  • TYPE_CUSTOMER

Constant Summary collapse

TYPE_USER =
"user"
TYPE_CUSTOMER =
"customer"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ Person

Creates a new Person object from a Hash of attributes



422
423
424
425
426
427
428
429
# File 'lib/helpscout/models.rb', line 422

def initialize(object)
  @id = object["id"]
  @firstName = object["firstName"]
  @lastName = object["lastName"]
  @email = object["email"]
  @phone = object["phone"]
  @type = object["type"]
end

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



416
417
418
# File 'lib/helpscout/models.rb', line 416

def email
  @email
end

#firstNameObject (readonly)

Returns the value of attribute firstName.



416
417
418
# File 'lib/helpscout/models.rb', line 416

def firstName
  @firstName
end

#idObject (readonly)

Returns the value of attribute id.



416
417
418
# File 'lib/helpscout/models.rb', line 416

def id
  @id
end

#lastNameObject (readonly)

Returns the value of attribute lastName.



416
417
418
# File 'lib/helpscout/models.rb', line 416

def lastName
  @lastName
end

#phoneObject (readonly)

Returns the value of attribute phone.



416
417
418
# File 'lib/helpscout/models.rb', line 416

def phone
  @phone
end

#typeObject (readonly)

Returns the value of attribute type.



416
417
418
# File 'lib/helpscout/models.rb', line 416

def type
  @type
end

Instance Method Details

#to_sObject

Returns a String suitable for display



432
433
434
# File 'lib/helpscout/models.rb', line 432

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