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



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

def emails
  @emails
end

#nameObject

optional metadata from UAA



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

def name
  @name
end

Instance Method Details

#change_password!(new, old) ⇒ Object



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

def change_password!(new, old)
  @client.base.uaa.change_password(@guid, new, old)
end

#emailObject



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

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

#family_nameObject



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

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

#full_nameObject



50
51
52
53
54
55
56
# File 'lib/cfoundry/v2/user.rb', line 50

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

#given_nameObject



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

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