Class: CFoundry::V2::User

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Model

attribute, #create!, defaults, #delete!, #eql?, #exists?, #hash, #initialize, #inspect, #invalidate!, #manifest, #object_name, to_many, to_one, #update!, validate_type, value_matches?

Constructor Details

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

Instance Attribute Details

#emailsObject

optional metadata from UAA



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

def emails
  @emails
end

#nameObject

optional metadata from UAA



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

def name
  @name
end

Instance Method Details

#emailObject



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

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

#family_nameObject



41
42
43
44
# File 'lib/cfoundry/v2/user.rb', line 41

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

#full_nameObject



46
47
48
49
50
51
52
# File 'lib/cfoundry/v2/user.rb', line 46

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

#given_nameObject



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

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

#guidObject



17
18
19
# File 'lib/cfoundry/v2/user.rb', line 17

def guid
  @guid
end

#guid=(x) ⇒ Object



21
22
23
24
# File 'lib/cfoundry/v2/user.rb', line 21

def guid=(x)
  @guid = x
  super
end