Module: RestMyCase::Status
- Included in:
- HttpStatus
- Defined in:
- lib/rest_my_case/status.rb
Class Method Summary collapse
Instance Method Summary collapse
- #failure(status, error_message = nil) ⇒ Object
- #failure!(status, error = nil) ⇒ Object
- #status ⇒ Object
Class Method Details
.included(parent_class) ⇒ Object
7 8 9 10 11 |
# File 'lib/rest_my_case/status.rb', line 7 def self.included(parent_class) return unless parent_class.respond_to? :trial_court parent_class.trial_court.context_class = Context::Status end |
Instance Method Details
#failure(status, error_message = nil) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rest_my_case/status.rb', line 17 def failure(status, = nil) if .is_a?(Hash) error_data = else error_data = { message: } end error_data[:status] = status error(error_data) end |
#failure!(status, error = nil) ⇒ Object
29 30 31 |
# File 'lib/rest_my_case/status.rb', line 29 def failure!(status, error = nil) failure(status, error) && fail(Errors::Abort) end |
#status ⇒ Object
13 14 15 |
# File 'lib/rest_my_case/status.rb', line 13 def status context.status end |