Sha256: 127908e69fb1e7e084c702bd2d21018813fa595989fdd6769a5fc66cc733c8a6

Contents?: true

Size: 652 Bytes

Versions: 2

Compression:

Stored size: 652 Bytes

Contents

module FwtPushNotificationServer
  
  class DeviceTokensController < FwtPushNotificationServer.api_controller_class

    skip_authorization_check

    def create
      @device_token = DeviceToken.find_or_create_by_token(params[:token])
      @device_token.update_attributes({
        :user_id => params[:user_id],
        :provider => params[:provider]
      })
      if @device_token.present?
        @device_token.save
        status = 0
      else
        status = -1
      end
      render :json => { :status => status }
    end

    private
      def device_token_params
        params.permit(:token, :user_id, :provider)
      end

  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fwt_push_notification_server-0.0.7 app/controllers/fwt_push_notification_server/device_tokens_controller.rb
fwt_push_notification_server-0.0.7.b4 app/controllers/fwt_push_notification_server/device_tokens_controller.rb