Sha256: 775fdde4295c9cb6c39a32a450822c6c3014e29724c5be1a12b792165ccbe44f
Contents?: true
Size: 1.09 KB
Versions: 7
Compression:
Stored size: 1.09 KB
Contents
module SnowmanIO module API class Profile < Grape::API before(&:authenticate!) namespace :users do params do requires :name, type: String end post "profile/update_name" do authenticate! current_user.update_attributes!(name: permitted_params[:name]) { user: current_user } end params do requires :email, type: String end post "profile/update_email" do authenticate! new_email = permitted_params[:email] if User.ne(id: current_user.id).where(email: new_email).empty? current_user.update_attributes!(email: new_email) { user: current_user } else status 400 { message: "Duplicate email" } end end params do requires :password, type: String end post "profile/update_password" do authenticate! current_user.update_attributes!(password: permitted_params[:password]) { user: current_user } end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems