Class: Mailjet::Rack::Endpoint
- Inherits:
-
Object
- Object
- Mailjet::Rack::Endpoint
- Defined in:
- lib/mailjet/rack/endpoint.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, path, &block) ⇒ Endpoint
constructor
A new instance of Endpoint.
Constructor Details
#initialize(app, path, &block) ⇒ Endpoint
Returns a new instance of Endpoint.
7 8 9 10 11 |
# File 'lib/mailjet/rack/endpoint.rb', line 7 def initialize(app, path, &block) @app = app @path = path @block = block end |
Instance Method Details
#call(env) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/mailjet/rack/endpoint.rb', line 13 def call(env) if env['PATH_INFO'] == @path && (content = env['rack.input'].read) @block.call(Yajl::Parser.parse(content)) [200, { 'Content-Type' => 'text/html', 'Content-Length' => '0' }, []] else @app.call(env) end end |