class Abt::Providers::Devops::Services::BoardPicker

Attributes

cli[R]
config[R]
path[R]

Public Class Methods

call(**args) click to toggle source
# File lib/abt/providers/devops/services/board_picker.rb, line 17
def self.call(**args)
  new(**args).call
end
new(cli:, config:) click to toggle source
# File lib/abt/providers/devops/services/board_picker.rb, line 23
def initialize(cli:, config:)
  @cli = cli
  @config = config
end

Public Instance Methods

call() click to toggle source
# File lib/abt/providers/devops/services/board_picker.rb, line 28
def call
  @path = ProjectPicker.call(cli: cli).path
  board = cli.prompt.choice("Select a project work board", boards)

  Result.new(board: board, path: path_with_board(team, board))
end

Private Instance Methods

api() click to toggle source
# File lib/abt/providers/devops/services/board_picker.rb, line 59
def api
  Api.new(organization_name: path.organization_name,
          username: config.username_for_organization(path.organization_name),
          access_token: config.access_token_for_organization(path.organization_name),
          cli: cli)
end
boards() click to toggle source
# File lib/abt/providers/devops/services/board_picker.rb, line 54
def boards
  team_name = Api.rfc_3986_encode_path_segment(team["name"])
  @boards ||= api.get_paged("#{path.project_name}/#{team_name}/_apis/work/boards")
end
path_with_board(team, board) click to toggle source
# File lib/abt/providers/devops/services/board_picker.rb, line 37
def path_with_board(team, board)
  Path.from_ids(
    organization_name: path.organization_name,
    project_name: path.project_name,
    team_name: Api.rfc_3986_encode_path_segment(team["name"]),
    board_name: Api.rfc_3986_encode_path_segment(board["name"])
  )
end
team() click to toggle source
# File lib/abt/providers/devops/services/board_picker.rb, line 46
def team
  @team ||= cli.prompt.choice("Select a team", teams)
end
teams() click to toggle source
# File lib/abt/providers/devops/services/board_picker.rb, line 50
def teams
  @teams ||= api.get_paged("/_apis/projects/#{path.project_name}/teams")
end