Class: Api::V2::PingsController

Inherits:
ApiController
  • Object
show all
Defined in:
lib/stitches/generator_files/app/controllers/api/v2/pings_controller.rb

Instance Method Summary collapse

Methods inherited from ApiController

#current_user

Methods included from Stitches::Deprecation

#deprecated, #gone!

Instance Method Details

#createObject



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/stitches/generator_files/app/controllers/api/v2/pings_controller.rb', line 3

def create
  respond_to do |format|
    format.json do
      if ping_params[:error]
        render json: { errors: Stitches::Errors.new([ Stitches::Error.new(code: "test", message: ping_params[:error]) ])} , status: 422
      else
        render json: { ping: { status_v2: "ok" } }, status: (ping_params[:status] || "201").to_i
      end
    end
  end
end