Class: CFoundry::V2::User

Inherits:
Model
  • Object
show all
Defined in:
lib/cfoundry/v2/user.rb

Instance Attribute Summary collapse

Attributes inherited from Model

#id

Instance Method Summary collapse

Methods inherited from Model

#==, attribute, #create!, defaults, #delete!, #exists?, #initialize, #inspect, #manifest, #object_name, to_many, to_one, #update!

Constructor Details

This class inherits a constructor from CFoundry::V2::Model

Instance Attribute Details

#emailsObject

optional metadata from UAA



25
26
27
# File 'lib/cfoundry/v2/user.rb', line 25

def emails
  @emails
end

#nameObject

optional metadata from UAA



25
26
27
# File 'lib/cfoundry/v2/user.rb', line 25

def name
  @name
end

Instance Method Details

#emailObject



27
28
29
30
# File 'lib/cfoundry/v2/user.rb', line 27

def email
  return unless @emails && @emails.first
  @emails.first[:value]
end

#family_nameObject



37
38
39
40
# File 'lib/cfoundry/v2/user.rb', line 37

def family_name
  return unless @name && @name[:familyName] != email
  @name[:familyName]
end

#full_nameObject



42
43
44
45
46
47
48
# File 'lib/cfoundry/v2/user.rb', line 42

def full_name
  if @name && @name[:fullName]
    @name[:fullName]
  elsif given_name && family_name
    "#{given_name} #{family_name}"
  end
end

#given_nameObject



32
33
34
35
# File 'lib/cfoundry/v2/user.rb', line 32

def given_name
  return unless @name && @name[:givenName] != email
  @name[:givenName]
end