Class: JIRA::Resource::Board
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
Instance Method Summary collapse
- #add_issue_to_backlog(issue) ⇒ Object
- #configuration(params = {}) ⇒ Object
- #issues(params = {}) ⇒ Object
- #project ⇒ Object
-
#sprints(options = {}) ⇒ Object
options - state ~ future, active, closed, you can define multiple states separated by commas, e.g.
Methods inherited from Base
belongs_to, belongs_to_relationships, build, collection_attributes_are_nested, collection_path, #collection_path, #delete, endpoint_name, #fetch, #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) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/jira/resource/board.rb', line 11 def self.all(client) path = "#{path_base(client)}/board" response = client.get(path) json = parse_json(response.body) results = json['values'] until json['isLast'] params = { 'startAt' => (json['startAt'] + json['maxResults']).to_s } response = client.get(url_with_query_params(path, params)) json = parse_json(response.body) results += json['values'] end results.map do |board| client.Board.build(board) end end |
.find(client, key, _options = {}) ⇒ Object
29 30 31 32 33 |
# File 'lib/jira/resource/board.rb', line 29 def self.find(client, key, = {}) response = client.get(path_base(client) + "/board/#{key}") json = parse_json(response.body) client.Board.build(json) end |
Instance Method Details
#add_issue_to_backlog(issue) ⇒ Object
78 79 80 |
# File 'lib/jira/resource/board.rb', line 78 def add_issue_to_backlog(issue) client.post("#{path_base(client)}/backlog/issue", { issues: [issue.id] }.to_json) end |
#configuration(params = {}) ⇒ Object
51 52 53 54 55 56 |
# File 'lib/jira/resource/board.rb', line 51 def configuration(params = {}) path = path_base(client) + "/board/#{id}/configuration" response = client.get(url_with_query_params(path, params)) json = self.class.parse_json(response.body) client.BoardConfiguration.build(json) end |
#issues(params = {}) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/jira/resource/board.rb', line 35 def issues(params = {}) path = path_base(client) + "/board/#{id}/issue" response = client.get(url_with_query_params(path, params)) json = self.class.parse_json(response.body) results = json['issues'] while (json['startAt'] + json['maxResults']) < json['total'] params['startAt'] = (json['startAt'] + json['maxResults']) response = client.get(url_with_query_params(path, params)) json = self.class.parse_json(response.body) results += json['issues'] end results.map { |issue| client.Issue.build(issue) } end |
#project ⇒ Object
72 73 74 75 76 |
# File 'lib/jira/resource/board.rb', line 72 def project response = client.get(path_base(client) + "/board/#{id}/project") json = self.class.parse_json(response.body) json['values'][0] end |
#sprints(options = {}) ⇒ Object
options
- state ~ future, active, closed, you can define multiple states separated by commas, e.g. state=active,closed
- maxResults ~ default: 50 (JIRA API), 1000 (this library)
- startAt ~ base index, starts at 0
62 63 64 65 66 67 68 69 70 |
# File 'lib/jira/resource/board.rb', line 62 def sprints( = {}) # options.reverse_merge!(DEFAULT_OPTIONS) response = client.get(path_base(client) + "/board/#{id}/sprint?#{options.to_query}") json = self.class.parse_json(response.body) json['values'].map do |sprint| sprint['rapidview_id'] = id client.Sprint.build(sprint) end end |