3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/responders/landable/api_responder.rb', line 3
def to_format
controller.response.['X-Landable-Media-Type'] = api_media_type
if serializer = resource_serializer
options[collection_resource? ? :each_serializer : :serializer] = serializer
controller.response.['X-Landable-Serializer'] = serializer.name if leaky?
end
if leaky? && format == :json && schema = json_schema
key = collection_resource? ? resource_name.pluralize : resource_name
link = "<#{schema}>; rel=\"describedby\"; anchor=\"#/#{key}\""
link = "#{link}; collection=\"collection\"" if collection_resource?
controller.response.['Link'] = link
end
if patch? || put? || delete?
display resource
else
super
end
end
|