Class: Eipiai::HealthResource
Overview
ApiResource
The base resource which can be included in regular Webmachine::Resource objects. It provides sensible defaults for a full-features REST API endpoint.
Instance Method Summary
collapse
Methods included from Resource
#content_types_accepted, included, #malformed_request?, #new_object, #params, #to_hash, #to_json, #unprocessable_entity?
Instance Method Details
#allowed_methods ⇒ Object
42
43
44
|
# File 'lib/eipiai/webmachine/resources/health.rb', line 42
def allowed_methods
%w(GET)
end
|
#content_types_provided ⇒ Object
46
47
48
|
# File 'lib/eipiai/webmachine/resources/health.rb', line 46
def content_types_provided
[['application/json', :to_json]]
end
|
#object ⇒ Object
60
61
62
|
# File 'lib/eipiai/webmachine/resources/health.rb', line 60
def object
HealthCheck.new
end
|
#represented ⇒ Object
64
65
66
|
# File 'lib/eipiai/webmachine/resources/health.rb', line 64
def represented
object
end
|
#service_available? ⇒ Boolean
50
51
52
53
54
55
56
57
58
|
# File 'lib/eipiai/webmachine/resources/health.rb', line 50
def service_available?
return true if healthy?
response.['Content-Type'] = 'application/json'
response.['Retry-After'] = '60'
response.body = to_json
false
end
|