Module: RestMyCase::Status

Defined in:
lib/rest_my_case/status.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(parent_class) ⇒ Object



5
6
7
# File 'lib/rest_my_case/status.rb', line 5

def self.included(parent_class)
  parent_class.trial_court.context_class = Context::Status
end

Instance Method Details

#failure(status, error = nil) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/rest_my_case/status.rb', line 13

def failure(status, error = nil)
  error = { message: error } unless error.is_a?(Hash)

  error[:status] = status

  error(error)
end

#failure!(status, error = nil) ⇒ Object



21
22
23
# File 'lib/rest_my_case/status.rb', line 21

def failure!(status, error = nil)
  failure(status, error) && fail(Errors::Abort)
end

#statusObject



9
10
11
# File 'lib/rest_my_case/status.rb', line 9

def status
  context.status
end