lib/togostanza/application.rb in togostanza-1.2.2 vs lib/togostanza/application.rb in togostanza-1.3.0
- old
+ new
@@ -23,10 +23,21 @@
get '/' do
haml :index
end
+ get '/metadata.json' do
+ metadata = {
+ "@context" => {
+ stanza: "http://togostanza.org/resource/stanza#"
+ },
+ "stanza:stanzas" => Stanza.all.map {|stanza| stanza.new.metadata }.compact
+ }
+
+ json metadata
+ end
+
get '/:id.json' do |id|
json Stanza.find(id).new(params).context
end
get '/:id' do |id|
@@ -57,8 +68,14 @@
json enabled: true, count: identifiers.size, urls: identifiers
rescue NoSearchDeclarationError
json enabled: false, count: 0, urls: []
end
+ end
+
+ get '/:id/metadata.json' do |id|
+ @stanza = Stanza.find(id).new
+
+ json @stanza.metadata
end
end
end