Class: JCF::CF::User

Inherits:
Base
  • Object
show all
Defined in:
lib/jcf/cf/user.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#name, #relationships

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

all, find, find_by, first, format, keys, #keys, #populate!, resource_url, #to_s, #values

Constructor Details

#initialize(username: nil, guid: nil, presentation_name: nil) ⇒ User

Returns a new instance of User.



16
17
18
19
20
21
# File 'lib/jcf/cf/user.rb', line 16

def initialize(username: nil, guid: nil, presentation_name: nil)
  super()
  @username = username
  @guid = guid
  @presentation_name = presentation_name
end

Instance Attribute Details

#guidObject

Returns the value of attribute guid.



8
9
10
# File 'lib/jcf/cf/user.rb', line 8

def guid
  @guid
end

#presentation_nameObject

Returns the value of attribute presentation_name.



8
9
10
# File 'lib/jcf/cf/user.rb', line 8

def presentation_name
  @presentation_name
end

#rawObject

Returns the value of attribute raw.



8
9
10
# File 'lib/jcf/cf/user.rb', line 8

def raw
  @raw
end

#usernameObject

Returns the value of attribute username.



8
9
10
# File 'lib/jcf/cf/user.rb', line 8

def username
  @username
end

Class Method Details

.populate_objects(hash) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/jcf/cf/user.rb', line 23

def self.populate_objects(hash)
  hash[:resources].map! do |object|
    o = new(
      guid: object[:guid],
      username: object[:username],
      presentation_name: object[:presentation_name]
    )
    o
  end
rescue NoMethodError
  puts "object is #{hash[:resources]}"
end

Instance Method Details

#attributesObject



12
13
14
# File 'lib/jcf/cf/user.rb', line 12

def attributes
  { username: username, guid: guid, presentation_name: presentation_name }
end