Exception: Core::Service::MethodNotAllowed

Inherits:
Error
  • Object
show all
Defined in:
app/api/core/service.rb

Instance Method Summary collapse

Methods included from Error::Behaviour

included

Constructor Details

#initialize(allowed_http_verbs) ⇒ MethodNotAllowed

Returns a new instance of MethodNotAllowed.



37
38
39
40
# File 'app/api/core/service.rb', line 37

def initialize(allowed_http_verbs)
  super('HTTP verb was not allowed!')
  @allowed = Array(allowed_http_verbs).map(&:to_s).map(&:upcase).join(',')
end

Instance Method Details

#api_error(response) ⇒ Object



45
46
47
48
# File 'app/api/core/service.rb', line 45

def api_error(response)
  response.headers('Allow' => @allowed)
  super
end