Class: PsuIdentity::SearchService::Person

Inherits:
Object
  • Object
show all
Defined in:
lib/psu_identity/search_service/person.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data = {}) ⇒ Person

Returns a new instance of Person.

Parameters:

  • data (Hash) (defaults to: {})

    parsed from the json reponse from the API



8
9
10
# File 'lib/psu_identity/search_service/person.rb', line 8

def initialize(data = {})
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/psu_identity/search_service/person.rb', line 5

def data
  @data
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/psu_identity/search_service/person.rb', line 57

def active?
  data['active'].is_a?(TrueClass) || data['active'] == 'true'
end

#affiliationObject



73
74
75
# File 'lib/psu_identity/search_service/person.rb', line 73

def affiliation
  data.fetch('affiliation', [])
end

#conf_hold?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/psu_identity/search_service/person.rb', line 61

def conf_hold?
  data['confHold'] == 'true'
end

#cpr_idObject



20
21
22
# File 'lib/psu_identity/search_service/person.rb', line 20

def cpr_id
  data['cprid']
end

#display_nameObject



77
78
79
# File 'lib/psu_identity/search_service/person.rb', line 77

def display_name
  data['displayName']
end

#family_nameObject Also known as: surname



32
33
34
# File 'lib/psu_identity/search_service/person.rb', line 32

def family_name
  data['familyName']
end

#given_nameObject



24
25
26
# File 'lib/psu_identity/search_service/person.rb', line 24

def given_name
  data['givenName']
end

#honorific_suffixObject



37
38
39
# File 'lib/psu_identity/search_service/person.rb', line 37

def honorific_suffix
  data['honorificSuffix']
end


81
82
83
# File 'lib/psu_identity/search_service/person.rb', line 81

def link
  AtomicLink.new(data['link'])
end

#middle_nameObject



28
29
30
# File 'lib/psu_identity/search_service/person.rb', line 28

def middle_name
  data['middleName']
end

#other_emailObject



69
70
71
# File 'lib/psu_identity/search_service/person.rb', line 69

def other_email
  data['otherEmail']
end

#preferred_family_nameObject



49
50
51
# File 'lib/psu_identity/search_service/person.rb', line 49

def preferred_family_name
  data.fetch('preferredFamilyName', family_name)
end

#preferred_given_nameObject



41
42
43
# File 'lib/psu_identity/search_service/person.rb', line 41

def preferred_given_name
  data.fetch('preferredGivenName', given_name)
end

#preferred_honorific_suffixObject



53
54
55
# File 'lib/psu_identity/search_service/person.rb', line 53

def preferred_honorific_suffix
  data.fetch('preferredHonorificSuffix', honorific_suffix)
end

#preferred_middle_nameObject



45
46
47
# File 'lib/psu_identity/search_service/person.rb', line 45

def preferred_middle_name
  data.fetch('preferredMiddleName', middle_name)
end

#psu_idObject



12
13
14
# File 'lib/psu_identity/search_service/person.rb', line 12

def psu_id
  data['psuid']
end

#university_emailObject



65
66
67
# File 'lib/psu_identity/search_service/person.rb', line 65

def university_email
  data['universityEmail']
end

#user_idObject



16
17
18
# File 'lib/psu_identity/search_service/person.rb', line 16

def user_id
  data['userid']
end