Sha256: c92cd2bc5a74243a5f5d8799b4f519cb12b000c4f04452a4254648b5e0c70f58
Contents?: true
Size: 892 Bytes
Versions: 7
Compression:
Stored size: 892 Bytes
Contents
module SnowmanIO module API class Friendship < Grape::API before(&:authenticate!) namespace :users do desc "Follow user" post ":id/follow" do authenticate! if user = User.where(id: params[:id]).first current_user.follow!(user) current_user.touch user.touch { users: [current_user, user] } else status 400 { status: "failed" } end end desc "Unfollow user" post ":id/unfollow" do authenticate! if user = User.where(id: params[:id]).first current_user.unfollow!(user) current_user.touch user.touch { users: [current_user, user] } else status 400 { status: "failed" } end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems