Class: JIRA::Resource::Agile

Inherits:
Base
  • Object
show all
Defined in:
lib/jira/resource/agile.rb

Constant Summary

Constants inherited from Base

Base::QUERY_PARAMS_FOR_SEARCH, Base::QUERY_PARAMS_FOR_SINGLE_FETCH

Instance Attribute Summary

Attributes inherited from Base

#attrs, #client, #deleted, #expanded

Class Method Summary collapse

Methods inherited from Base

belongs_to, belongs_to_relationships, build, collection_attributes_are_nested, collection_path, #collection_path, #delete, endpoint_name, #fetch, find, #has_errors?, has_many, has_one, #id, #initialize, key_attribute, #key_value, #method_missing, nested_collections, #new_record?, parse_json, #patched_url, #path_component, #respond_to?, #save, #save!, #set_attrs, #set_attrs_from_response, singular_path, #to_json, #to_s, #to_sym, #url

Constructor Details

This class inherits a constructor from JIRA::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class JIRA::Base

Class Method Details

.all(client, options = {}) ⇒ Hash

Parameters:

  • client (JIRA::Client)
  • options (Hash<Symbol, Object>) (defaults to: {})

Returns:

  • (Hash)

12
13
14
15
16
# 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 = {}) ⇒ Object


18
19
20
21
22
# 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 = {}) ⇒ Object


24
25
26
27
28
29
30
31
32
33
# 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 = {}) ⇒ Object


52
53
54
55
56
57
58
59
# 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 = {}) ⇒ Object


47
48
49
50
# 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 = {}) ⇒ Object


41
42
43
44
45
# 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 = {}) ⇒ Object


35
36
37
38
39
# 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