Class: Igniter::Store::HTTPAdapter::HealthHandler

Inherits:
Object
  • Object
show all
Includes:
ResponseHelper
Defined in:
lib/igniter/store/http_adapter.rb

Instance Method Summary collapse

Constructor Details

#initialize(health_provider: nil) ⇒ HealthHandler

Returns a new instance of HealthHandler.



57
58
59
# File 'lib/igniter/store/http_adapter.rb', line 57

def initialize(health_provider: nil)
  @health_provider = health_provider
end

Instance Method Details

#call(env) ⇒ Object



61
62
63
64
65
66
# File 'lib/igniter/store/http_adapter.rb', line 61

def call(env)
  return method_not_allowed unless env["REQUEST_METHOD"] == "GET"

  health = @health_provider ? @health_provider.call : { protocol: :igniter_store, schema_version: 1, status: :ready }
  json_response(200, health)
end