Module: API::Helpers::IssuesHelpers
- Extended by:
- Grape::API::Helpers
- Defined in:
- lib/api/helpers/issues_helpers.rb
Class Method Summary collapse
Instance Method Summary collapse
- #find_issues(args = {}) ⇒ Object
- #issue_finder(args = {}) ⇒ Object
- #issues_statistics(args = {}) ⇒ Object
Class Method Details
.sort_options ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/api/helpers/issues_helpers.rb', line 36 def self. %w[ created_at due_date label_priority milestone_due popularity priority relative_position title updated_at ] end |
.update_params_at_least_one_of ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/api/helpers/issues_helpers.rb', line 17 def self.update_params_at_least_one_of [ :assignee_id, :assignee_ids, :confidential, :created_at, :description, :discussion_locked, :due_date, :labels, :add_labels, :remove_labels, :milestone_id, :state_event, :title, :issue_type ] end |
Instance Method Details
#find_issues(args = {}) ⇒ Object
68 69 70 71 |
# File 'lib/api/helpers/issues_helpers.rb', line 68 def find_issues(args = {}) finder = issue_finder(args) finder.execute.with_api_entity_associations end |
#issue_finder(args = {}) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/api/helpers/issues_helpers.rb', line 50 def issue_finder(args = {}) args = declared_params.merge(args) args.delete(:id) args[:not] ||= {} args[:milestone_title] ||= args.delete(:milestone) args[:milestone_wildcard_id] ||= args.delete(:milestone_id) args[:not][:milestone_title] ||= args[:not].delete(:milestone) args[:not][:milestone_wildcard_id] ||= args[:not].delete(:milestone_id) args[:label_name] ||= args.delete(:labels) args[:not][:label_name] ||= args[:not].delete(:labels) args[:scope] = args[:scope].underscore if args[:scope] args[:sort] = "#{args[:order_by]}_#{args[:sort]}" args[:issue_types] ||= args.delete(:issue_type) || WorkItems::Type.allowed_types_for_issues IssuesFinder.new(current_user, args) end |
#issues_statistics(args = {}) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/api/helpers/issues_helpers.rb', line 73 def issues_statistics(args = {}) finder = issue_finder(args) counter = Gitlab::IssuablesCountForState.new(finder) { statistics: { counts: { all: counter[:all], closed: counter[:closed], opened: counter[:opened] } } } end |