Class: Terjira::Client::Board

Inherits:
Base
  • Object
show all
Defined in:
lib/terjira/client/board.rb

Constant Summary

Constants inherited from Base

Terjira::Client::Base::AGILE_API_PATH, Terjira::Client::Base::DEFAULT_API_PATH, Terjira::Client::Base::DEFAULT_CACHE_SEC

Constants included from JQLBuilder

JQLBuilder::SEARCH_KEYS, JQLBuilder::STRICT_KEYS

Constants included from AuthOptionBuilder

AuthOptionBuilder::AUTH_CACHE_KEY

Class Method Summary collapse

Methods inherited from Base

cache, class_name, client, parse_body, resource, site_url, username

Methods included from JQLBuilder

#build_jql

Methods included from AuthOptionBuilder

#auth_file_cache, #build_auth_options, #build_auth_options_by_cached, #build_auth_options_by_tty, #expire_auth_options

Class Method Details

.all(options = {}) ⇒ Object



9
10
11
12
13
# File 'lib/terjira/client/board.rb', line 9

def all(options = {})
  boards_resp = agile_api_get('board')['values']
  boards_resp = boards_resp.select { |board| board["type"] == options[:type] } if options[:type].present?
  boards_resp.map { |board| build(board) }
end

.backlog(board_id, options = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/terjira/client/board.rb', line 20

def backlog(board_id, options = {})
  jql = build_jql(options)
  resp = if jql.present?
          agile_api_get("board/#{board_id}/backlog", jql: jql)
         else
           agile_api_get("board/#{board_id}/backlog")
         end
  resp["issues"].map { |issue| Issue.build(issue) }
end

.find(board_id) ⇒ Object



15
16
17
18
# File 'lib/terjira/client/board.rb', line 15

def find(board_id)
  resp = agile_api_get("board/#{board_id}")
  build(resp)
end