Class: Redminer::User

Inherits:
Object
  • Object
show all
Defined in:
lib/redminer/user.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server, id = nil) ⇒ User

Returns a new instance of User.



6
7
8
# File 'lib/redminer/user.rb', line 6

def initialize(server, id = nil)
  @id = id
end

Instance Attribute Details

#firstnameObject

Returns the value of attribute firstname.



4
5
6
# File 'lib/redminer/user.rb', line 4

def firstname
  @firstname
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/redminer/user.rb', line 3

def id
  @id
end

#lastnameObject

Returns the value of attribute lastname.



4
5
6
# File 'lib/redminer/user.rb', line 4

def lastname
  @lastname
end

#loginObject

Returns the value of attribute login.



4
5
6
# File 'lib/redminer/user.rb', line 4

def 
  @login
end

#mailObject

Returns the value of attribute mail.



4
5
6
# File 'lib/redminer/user.rb', line 4

def mail
  @mail
end

Class Method Details

.current(server) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/redminer/user.rb', line 10

def self.current(server)
  response = server.get('/users/current.json')
  origin = response["user"]
  c_user = self.new(server)
  c_user.all = origin
  c_user.instance_variable_get(:@id, origin["id"])
  c_user
end