Class: Lepus::Web::API

Inherits:
Object
  • Object
show all
Defined in:
lib/lepus/web/api.rb

Instance Method Summary collapse

Constructor Details

#initialize(aggregator: nil, management_api: nil) ⇒ API

Returns a new instance of API.



6
7
8
9
# File 'lib/lepus/web/api.rb', line 6

def initialize(aggregator: nil, management_api: nil)
  @aggregator = aggregator
  @management_api = management_api
end

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/lepus/web/api.rb', line 11

def call(env)
  req = Rack::Request.new(env)
  case req.path_info
  when "/health"
    Web::RespondWith.json(template: :health)
  when "/processes"
    processes_data
  when "/queues"
    queues_data
  when "/connections"
    connections_data
  when "/exchanges"
    exchanges_data
  else
    Web::RespondWith.json(template: :not_found)
  end
end