Class: ExvoNotifications::NotificationsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/exvo_notifications/notifications_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
# File 'app/controllers/exvo_notifications/notifications_controller.rb', line 8

def create
  user = User.find_or_create_by_uid(params[:user_uid])
  user.plan = params[:edition_title]
  if user.save
    render :json => { :message => "Successfully created" }, :status => 201
  else
    render :json => { :errors => user.errors }, :status => :unprocessable_entity
  end
end

#destroyObject



18
19
20
21
22
23
24
25
26
# File 'app/controllers/exvo_notifications/notifications_controller.rb', line 18

def destroy
  user = User.find_or_create_by_uid(params[:user_uid])
  user.plan = nil
  if user.save
    render :json => { :message => "Successfully created" }, :status => 200     
  else
    render :json => { :errors => user.errors }, :status => :unprocessable_entity
  end
end