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


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

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


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

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