Module: Teambition2::API::TaskGroup
- Included in:
- Client
- Defined in:
- lib/teambition2/api/task_group.rb
Instance Method Summary collapse
- #create_task_group(project_id, title, template_id: nil, description: nil) ⇒ Object
- #task_group(group_id) ⇒ Object
- #task_group_search(project_id, name, key: 'title', limit: 1) ⇒ Object
Instance Method Details
#create_task_group(project_id, title, template_id: nil, description: nil) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/teambition2/api/task_group.rb', line 8 def create_task_group(project_id, title, template_id: nil, description: nil) post('/api/tasklists', { 'title' => title, '_projectId' => project_id, '_templateId' => template_id }) end |
#task_group(group_id) ⇒ Object
4 5 6 |
# File 'lib/teambition2/api/task_group.rb', line 4 def task_group(group_id) get("/api/tasklists/#{project_id}") end |
#task_group_search(project_id, name, key: 'title', limit: 1) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/teambition2/api/task_group.rb', line 16 def task_group_search(project_id, name, key: 'title', limit: 1) result = get("/api/projects/#{project_id}/tasklists").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 |