example/rails/app/controllers/application_controller.rb in rest-graph-1.4.0 vs example/rails/app/controllers/application_controller.rb in rest-graph-1.4.1

- old
+ new

@@ -14,10 +14,11 @@ before_filter :filter_canvas, :only => [:canvas] before_filter :filter_options, :only => [:options] before_filter :filter_no_auto, :only => [:no_auto] before_filter :filter_diff_app_id, :only => [:diff_app_id] before_filter :filter_diff_canvas, :only => [:diff_canvas] + before_filter :filter_cache, :only => [:cache] def index render :text => rest_graph.get('me').to_json end alias_method :canvas , :index @@ -32,13 +33,20 @@ def diff_app_id render :text => rest_graph.app_id end + def cache + url = rest_graph.url('cache') + rest_graph.get('cache') + rest_graph.get('cache') + render :text => Rails.cache.read(Digest::MD5.hexdigest(url)) + end + private def filter_common - rest_graph_setup(:auto_authorize => true) + rest_graph_setup(:auto_authorize => true, :canvas => '') end def filter_canvas rest_graph_setup(:canvas => RestGraph.default_canvas, :auto_authorize_scope => 'publish_stream') @@ -57,8 +65,13 @@ rest_graph_setup(:app_id => 'zzz', :auto_authorize => true) end def filter_options - rest_graph_setup(:auto_authorize_options => {:scope => 'bogus'}) + rest_graph_setup(:auto_authorize_options => {:scope => 'bogus'}, + :canvas => nil) + end + + def filter_cache + rest_graph_setup(:cache => Rails.cache) end end