Class: RailsSpotlight::Middlewares::Handlers::BaseActionHandler
- Inherits:
-
Object
- Object
- RailsSpotlight::Middlewares::Handlers::BaseActionHandler
- Defined in:
- lib/rails_spotlight/middlewares/handlers/base_action_handler.rb
Direct Known Subclasses
CodeAnalysisActionHandler, ConsoleActionHandler, DirectoryIndexActionHandler, FileActionHandler, MetaActionHandler, NotFoundActionHandler, SqlActionHandler, VerifyActionHandler
Constant Summary collapse
- IncorrectResponseContentType =
Class.new(StandardError)
- NotFound =
Class.new(StandardError)
- UnprocessableEntity =
Class.new(StandardError)
- Forbidden =
Class.new(StandardError)
Instance Attribute Summary collapse
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(request_id, request, content_type) ⇒ BaseActionHandler
constructor
A new instance of BaseActionHandler.
Constructor Details
#initialize(request_id, request, content_type) ⇒ BaseActionHandler
Returns a new instance of BaseActionHandler.
12 13 14 15 16 |
# File 'lib/rails_spotlight/middlewares/handlers/base_action_handler.rb', line 12 def initialize(request_id, request, content_type) @request_id = request_id @request = request @content_type = content_type end |
Instance Attribute Details
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
18 19 20 |
# File 'lib/rails_spotlight/middlewares/handlers/base_action_handler.rb', line 18 def content_type @content_type end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
18 19 20 |
# File 'lib/rails_spotlight/middlewares/handlers/base_action_handler.rb', line 18 def request @request end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
18 19 20 |
# File 'lib/rails_spotlight/middlewares/handlers/base_action_handler.rb', line 18 def request_id @request_id end |
Instance Method Details
#call ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rails_spotlight/middlewares/handlers/base_action_handler.rb', line 20 def call validate_project! unless skip_project_validation? execute response rescue NotFound => e not_found_response(e.) rescue UnprocessableEntity => e unprocessed_response(e.) rescue Forbidden => e forbidden_response(e.) rescue => e # rubocop:disable Style/RescueStandardError internal_server_error_response(e.) end |