Class: Kanbanize::User

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ User

Returns a new instance of User.


6
7
8
9
10
11
12
13
14
15
16
# File 'lib/kanbanize/user.rb', line 6

def initialize(*args)
  case args.size
  when 1
    @api_key = args[0]
  when 2
    set_attributes(API.new.(args[0], args[1]))
  else
    raise ArgumentError
  end
  @api = API.new(@api_key)
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key


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

def api_key
  @api_key
end

#companyObject (readonly)

Returns the value of attribute company


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

def company
  @company
end

#emailObject (readonly)

Returns the value of attribute email


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

def email
  @email
end

#realnameObject (readonly)

Returns the value of attribute realname


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

def realname
  @realname
end

#timezoneObject (readonly)

Returns the value of attribute timezone


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

def timezone
  @timezone
end

#usernameObject (readonly)

Returns the value of attribute username


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

def username
  @username
end

Instance Method Details

#projectsObject


18
19
20
21
22
23
24
# File 'lib/kanbanize/user.rb', line 18

def projects
  projects = []
  @api.get_projects_and_boards['projects'].each do |project|
    projects << Project.new(@api, project)
  end
  return projects
end