Class: JIRA::Resource::RapidView
- Defined in:
- lib/jira/resource/rapidview.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
Instance 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, #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
9 10 11 12 13 14 15 |
# File 'lib/jira/resource/rapidview.rb', line 9 def self.all(client) response = client.get(path_base(client) + '/rapidview') json = parse_json(response.body) json['views'].map do |view| client.RapidView.build(view) end end |
.find(client, key, _options = {}) ⇒ Object
17 18 19 20 21 |
# File 'lib/jira/resource/rapidview.rb', line 17 def self.find(client, key, = {}) response = client.get(path_base(client) + "/rapidview/#{key}") json = parse_json(response.body) client.RapidView.build(json) end |
Instance Method Details
#issues(options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/jira/resource/rapidview.rb', line 23 def issues( = {}) response = client.get(path_base(client) + "/xboard/plan/backlog/data?rapidViewId=#{id}") json = self.class.parse_json(response.body) # To get Issue objects with the same structure as for Issue.all issue_ids = json['issues'].map { |issue| issue['id'] } # First we have to get all IDs of parent and sub tasks jql = "id IN(#{issue_ids.join(', ')})" # Filtering options jql << ' AND sprint IS NOT EMPTY' unless [:include_backlog_items] parent_issues = client.Issue.jql(jql) subtask_ids = parent_issues.map { |t| t.subtasks.map { |sub| sub['id'] } }.flatten parent_and_sub_ids = parent_issues.map(&:id) + subtask_ids jql = "id IN(#{parent_and_sub_ids.join(', ')})" jql << " and updated >= '#{.delete(:updated)}'" if [:updated] client.Issue.jql(jql) end |
#sprints(options = {}) ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/jira/resource/rapidview.rb', line 45 def sprints( = {}) params = { includeHistoricSprints: .fetch(:include_historic, false), includeFutureSprints: .fetch(:include_future, false) } response = client.get(path_base(client) + "/sprintquery/#{id}?#{params.to_query}") json = self.class.parse_json(response.body) json['sprints'].map do |sprint| sprint['rapidview_id'] = id client.Sprint.build(sprint) end end |