Class: CFoundry::V2::User

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

Instance Attribute Summary collapse

Attributes inherited from Model

#cache, #changes, #diff

Attributes included from ModelMagic

#scoped_organization, #scoped_space

Instance Method Summary collapse

Methods inherited from Model

#attribute_for_error, #changed?, #create, #create!, #delete, #delete!, #eql?, #exists?, #hash, inherited, #initialize, #inspect, #invalidate!, #manifest, #object_name, objects, #partial?, #persisted?, #plural_object_name, #query_target, #to_key, #to_param, #update!

Methods included from ModelMagic

#attributes, #defaults, #inherited, #object_name, params_from, #plural_object_name, #scoped_to_organization, #scoped_to_space, #to_many_relations, #to_one_relations

Methods included from ModelMagic::QueryableBy

#queryable_by

Methods included from ModelMagic::ToMany

#to_many

Methods included from ModelMagic::ToOne

#to_one

Methods included from ModelMagic::Attribute

#attribute

Methods included from ModelMagic::HasSummary

#has_summary

Methods included from ModelMagic::ClientExtensions

#add_client_methods

Constructor Details

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

Instance Attribute Details

#emailsObject

optional metadata from UAA



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

def emails
  @emails
end

#nameObject

optional metadata from UAA



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

def name
  @name
end

Instance Method Details

#change_password!(new, old) ⇒ Object



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

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

#emailObject



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

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

#family_nameObject



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

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

#full_nameObject



56
57
58
59
60
61
62
# File 'lib/cfoundry/v2/user.rb', line 56

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

#given_nameObject



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

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

#guidObject



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

def guid
  @guid
end

#guid=(x) ⇒ Object



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

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

#set_guid_attributeObject



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

alias set_guid_attribute guid=