class Api
Public Instance Methods
current_resource()
click to toggle source
# File lib/magis/collections.rb, line 61 def current_resource @collection.source end
current_user()
click to toggle source
# File lib/magis/collections.rb, line 73 def current_user Magis.db["users"].find(_id: session[:user_id]).to_a.first end
faye_client()
click to toggle source
# File lib/magis/collections.rb, line 77 def faye_client Faye::Client.new(request.base_url+'/faye') end
fix_id(local_object)
click to toggle source
# File lib/magis/collections.rb, line 65 def fix_id(local_object) local_object["_id"] = local_object["_id"].to_s local_object end
friends()
click to toggle source
# File lib/magis/web.rb, line 130 def friends Array.new if current_user["provider"].to_s == "facebook" @friends ||= FBTether.friends(current_user) end end
pass()
click to toggle source
# File lib/magis/collections.rb, line 53 def pass halt [ 401, {error: "Not Found"}.to_json ] end
process_json(local_object)
click to toggle source
# File lib/magis/collections.rb, line 69 def process_json(local_object) fix_id(local_object).to_json end
resource_name()
click to toggle source
# File lib/magis/collections.rb, line 57 def resource_name params[:resource] end