Class: MasonClient::App
- Inherits:
-
Object
- Object
- MasonClient::App
- Defined in:
- lib/mason_client/app.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(handler) ⇒ App
constructor
A new instance of App.
Constructor Details
#initialize(handler) ⇒ App
Returns a new instance of App.
3 4 5 |
# File 'lib/mason_client/app.rb', line 3 def initialize(handler) @handler = handler end |
Instance Method Details
#call(env) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/mason_client/app.rb', line 7 def call(env) request = Rack::Request.new(env) payload = JSON.parse(request.params["payload"]) result = Result.from(payload) if @handler.call(result) Rack::Response.new("OK", 200, {"Content-Type" => "text/plain"}).finish else raise Error, "failed to handle build result for #{result.callback}" end end |