Sha256: fde36422a04bffd363d626b110955a643977a95690e8ca7f495b775e1335f08d

Contents?: true

Size: 511 Bytes

Versions: 1

Compression:

Stored size: 511 Bytes

Contents

class Spree::Api::V1::DevicesController < Spree::Api::BaseController
  skip_before_action :check_device, only: :create
  before_action :set_user

  def create
    @resource = device_service.find_or_create_user_device(@user, params[:name], params[:uid])

    if @resource.errors.any?
      render 'spree/api/errors/invalid_resource', status: 422
    else
      head :ok
    end
  end

  private

  def set_user
    @user = current_api_user
  end

  def device_service
    Spree::DeviceService.instance
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_devices-1.2.0 app/controllers/spree/api/v1/devices_controller.rb