Module: Teambition2::API::Project

Included in:
Client
Defined in:
lib/teambition2/api/project.rb

Instance Method Summary collapse

Instance Method Details

#project(project_id) ⇒ Object



8
9
10
# File 'lib/teambition2/api/project.rb', line 8

def project(project_id)
  get("/api/projects/#{project_id}")
end

#project_search(name, key: 'name', limit: 1) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/teambition2/api/project.rb', line 20

def project_search(name, key: 'name', limit: 1)
  result = projects.select { |p| p[key].include?(name) }
  return nil if result.empty?

  case limit
  when 0
    result
  when 1
    result[0]
  else
    result.size >= limit ? result[0..limit] : result
  end
end

#project_tags(project_id) ⇒ Object



16
17
18
# File 'lib/teambition2/api/project.rb', line 16

def project_tags(project_id)
  get("/api/projects/#{project_id}/tags")
end

#project_task_groups(project_id) ⇒ Object



12
13
14
# File 'lib/teambition2/api/project.rb', line 12

def project_task_groups(project_id)
  get("/api/projects/#{project_id}/tasklists")
end

#projectsObject



4
5
6
# File 'lib/teambition2/api/project.rb', line 4

def projects
  get('/api/projects')
end