Class: Rack::ApiFairy
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ ApiFairy
constructor
A new instance of ApiFairy.
Constructor Details
#initialize(app) ⇒ ApiFairy
Returns a new instance of ApiFairy.
7 8 9 |
# File 'lib/api-fairy.rb', line 7 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/api-fairy.rb', line 11 def call(env) params = parse_nested_query(env['QUERY_STRING']) response = 'Magic' if params['name'] response += "al #{params['name']}" end [200, {'Content-Type' => 'text/plain'}, [response]] end |