Class: Eipiai::HealthResource
Overview
HealthResource
Provides basic health checking of the API. This resource can be configured to validate a working service, and return the correct availability to the client.
Instance Method Summary
collapse
Methods included from Resource
#base_uri, #content_types_accepted, #create_uri, included, #malformed_request?, #new_object, #params, #post_is_create?, #query_keys, #resource_relation, #to_h, #to_hal_json, #to_json, #unprocessable_entity?
Instance Method Details
#allowed_methods ⇒ Object
48
49
50
|
# File 'lib/eipiai/resources/health.rb', line 48
def allowed_methods
%w(GET)
end
|
#content_types_provided ⇒ Object
52
53
54
|
# File 'lib/eipiai/resources/health.rb', line 52
def content_types_provided
[['application/json', :to_json]]
end
|
#finish_request ⇒ Object
66
67
68
|
# File 'lib/eipiai/resources/health.rb', line 66
def finish_request
response.['Cache-Control'] = 'no-cache, no-store, must-revalidate, private'
end
|
#object ⇒ Object
70
71
72
|
# File 'lib/eipiai/resources/health.rb', line 70
def object
HealthCheck.new
end
|
#service_available? ⇒ Boolean
56
57
58
59
60
61
62
63
64
|
# File 'lib/eipiai/resources/health.rb', line 56
def service_available?
return true if healthy?
response.['Content-Type'] = 'application/json'
response.['Retry-After'] = '60'
response.body = to_json
false
end
|
#top_level_relation? ⇒ Boolean
44
45
46
|
# File 'lib/eipiai/resources/health.rb', line 44
def top_level_relation?
true
end
|