Class: Rack::ApiFairy

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/api-fairy.rb

Instance Method Summary collapse

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