Class: Dragonfly::RoutedEndpoint
- Inherits:
-
Object
- Object
- Dragonfly::RoutedEndpoint
- Defined in:
- lib/dragonfly/routed_endpoint.rb
Defined Under Namespace
Classes: NoRoutingParams
Instance Method Summary (collapse)
- - (Object) call(env)
-
- (RoutedEndpoint) initialize(app, &block)
constructor
A new instance of RoutedEndpoint.
- - (Object) inspect
Constructor Details
- (RoutedEndpoint) initialize(app, &block)
Returns a new instance of RoutedEndpoint
6 7 8 9 |
# File 'lib/dragonfly/routed_endpoint.rb', line 6 def initialize(app, &block) @app = app @block = block end |
Instance Method Details
- (Object) call(env)
11 12 13 14 15 16 17 18 19 |
# File 'lib/dragonfly/routed_endpoint.rb', line 11 def call(env) params = Utils.symbolize_keys Rack::Request.new(env).params job = @block.call(params.merge(routing_params(env)), @app) Response.new(job, env).to_response rescue Job::NoSHAGiven => e [400, {"Content-Type" => 'text/plain'}, ["You need to give a SHA parameter"]] rescue Job::IncorrectSHA => e [400, {"Content-Type" => 'text/plain'}, ["The SHA parameter you gave (#{e}) is incorrect"]] end |
- (Object) inspect
21 22 23 |
# File 'lib/dragonfly/routed_endpoint.rb', line 21 def inspect "<#{self.class.name} for app #{@app.name.inspect} >" end |