Module: API::Helpers::MergeRequestsHelpers
- Extended by:
- ActiveSupport::Concern, Grape::API::Helpers
- Defined in:
- lib/api/helpers/merge_requests_helpers.rb
Constant Summary collapse
- UNPROCESSABLE_ERROR_KEYS =
[:project_access, :branch_conflict, :validate_fork, :base].freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.sort_options ⇒ Object
139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/api/helpers/merge_requests_helpers.rb', line 139 def self. %w[ created_at label_priority milestone_due popularity priority title updated_at merged_at ] end |
.sort_options_help ⇒ Object
152 153 154 |
# File 'lib/api/helpers/merge_requests_helpers.rb', line 152 def self. .map { |y| "`#{y}`" }.to_sentence(last_word_connector: ' or ') end |
Instance Method Details
#handle_merge_request_errors!(merge_request) ⇒ Object
125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/api/helpers/merge_requests_helpers.rb', line 125 def handle_merge_request_errors!(merge_request) return if merge_request.valid? errors = merge_request.errors UNPROCESSABLE_ERROR_KEYS.each do |error| unprocessable_entity!(errors[error]) if errors.has_key?(error) end conflict!(errors[:validate_branches]) if errors.has_key?(:validate_branches) render_validation_error!(merge_request) end |