Module: RestMyCase::Status
- Included in:
- HttpStatus
- Defined in:
- lib/rest_my_case/status.rb
Defined Under Namespace
Modules: ClassMethods
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
14 15 16 |
# File 'lib/rest_my_case/status.rb', line 14 def self.included(parent_class) parent_class.extend ClassMethods end |
Instance Method Details
#failure(status, error_message = nil) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rest_my_case/status.rb', line 22 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
34 35 36 |
# File 'lib/rest_my_case/status.rb', line 34 def failure!(status, error = nil) failure(status, error) && fail(Errors::Abort) end |
#status ⇒ Object
18 19 20 |
# File 'lib/rest_my_case/status.rb', line 18 def status context.status end |