class JIRA::Resource::Agile

Public Class Methods

all(client, options = {}) click to toggle source

@param client [JIRA::Client] @param options [Hash<Symbol, Object>] @return [Hash]

# File lib/jira/resource/agile.rb, line 12
def self.all(client, options = {})
  opts = options.empty? ? '' : "?#{hash_to_query_string(options)}"
  response = client.get(path_base(client) + "/board#{opts}")
  parse_json(response.body)
end
get_backlog_issues(client, board_id, options = {}) click to toggle source
# File lib/jira/resource/agile.rb, line 18
def self.get_backlog_issues(client, board_id, options = {})
  options[:maxResults] ||= 100
  response = client.get(path_base(client) + "/board/#{board_id}/backlog?#{hash_to_query_string(options)}")
  parse_json(response.body)
end
get_board_issues(client, board_id, options = {}) click to toggle source
# File lib/jira/resource/agile.rb, line 24
def self.get_board_issues(client, board_id, options = {})
  response = client.get(path_base(client) + "/board/#{board_id}/issue?#{hash_to_query_string(options)}")
  json = parse_json(response.body)
  # To get Issue objects with the same structure as for Issue.all
  return {} if json['issues'].size.zero?
  issue_ids = json['issues'].map do |issue|
    issue['id']
  end
  client.Issue.jql("id IN(#{issue_ids.join(', ')})")
end
get_projects(client, board_id, options = {}) click to toggle source
# File lib/jira/resource/agile.rb, line 52
def self.get_projects(client, board_id, options = {})
  options[:maxResults] ||= 100
  create_meta_url = path_base(client) + "/board/#{board_id}/project"
  params = hash_to_query_string(options)

  response = client.get("#{create_meta_url}?#{params}")
  parse_json(response.body)
end
get_projects_full(client, board_id, _options = {}) click to toggle source
# File lib/jira/resource/agile.rb, line 47
def self.get_projects_full(client, board_id, _options = {})
  response = client.get(path_base(client) + "/board/#{board_id}/project/full")
  parse_json(response.body)
end
get_sprint_issues(client, sprint_id, options = {}) click to toggle source
# File lib/jira/resource/agile.rb, line 41
def self.get_sprint_issues(client, sprint_id, options = {})
  options[:maxResults] ||= 100
  response = client.get(path_base(client) + "/sprint/#{sprint_id}/issue?#{hash_to_query_string(options)}")
  parse_json(response.body)
end
get_sprints(client, board_id, options = {}) click to toggle source
# File lib/jira/resource/agile.rb, line 35
def self.get_sprints(client, board_id, options = {})
  options[:maxResults] ||= 100
  response = client.get(path_base(client) + "/board/#{board_id}/sprint?#{hash_to_query_string(options)}")
  parse_json(response.body)
end

Private Class Methods

path_base(client) click to toggle source

def self.find(client, key, options = {})

options[:maxResults] ||= 100
fields = options[:fields].join(',') unless options[:fields].nil?
response = client.get("/rest/api/latest/search?jql=sprint=#{key}&fields=#{fields}&maxResults=#{options[:maxResults]}")
parse_json(response.body)

end

# File lib/jira/resource/agile.rb, line 70
def self.path_base(client)
  client.options[:context_path] + '/rest/agile/1.0'
end

Private Instance Methods

path_base(client) click to toggle source
# File lib/jira/resource/agile.rb, line 74
def path_base(client)
  self.class.path_base(client)
end