lib/rbbt/rest/entity.rb in rbbt-rest-1.1.5 vs lib/rbbt/rest/entity.rb in rbbt-rest-1.2.0
- old
+ new
@@ -20,10 +20,11 @@
require 'rbbt/rest/entity/entity_list_card'
require 'rbbt/rest/entity/entity_map_card'
require 'rbbt/rest/entity/action_card'
require 'rbbt/rest/entity/list_container'
require 'rbbt/rest/entity/action_controller'
+require 'rbbt/rest/knowledge_base'
require 'rbbt/statistics/rank_product'
module Sinatra
@@ -152,13 +153,14 @@
global_file = Entity::List.list_file(entity_type.split(":").first, list_id, nil)
send_file global_file if File.exists? global_file
raise "List file not found: #{ list_id }"
when :json
- list_info = {:entities => list, :info => list.info}
- halt 200, list_info.to_json
+ content_type "application/json"
+ halt 200, list_json(list)
when :info
+ content_type "application/json"
halt 200, list.info.to_json
when :list
content_type "text/plain"
halt 200, list * "\n"
when :name
@@ -473,20 +475,20 @@
get '/favourite_entities' do
content_type "application/json"
favs = {}
-
favourite_entities.each{|type, list|
type_favs = {}
list.each do |entity|
info = entity.info
info.delete :annotation_types
type_favs[entity] = {:info => info, :link => entity.link}
end
favs[type] = type_favs
}
+ cache_control :public, :max_age => 360000 if production?
favs.to_json
end
#{{{ Favourite entity lists