Sha256: 666916d80ff2ea67ace19bef70c8f27eeb57a1a67f8bfc50337d5f75f9131a78

Contents?: true

Size: 501 Bytes

Versions: 14

Compression:

Stored size: 501 Bytes

Contents

class Api::V1::PingsController < Api::ApiController

  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: "ok" } }, status: (ping_params[:status] || "201").to_i
        end
      end
    end
  end

private

  def ping_params
    params.permit(:error, :status)
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
stitches-3.7.2 lib/stitches/generator_files/app/controllers/api/v1/pings_controller.rb
stitches-3.7.0 lib/stitches/generator_files/app/controllers/api/v1/pings_controller.rb
stitches-3.6.1 lib/stitches/generator_files/app/controllers/api/v1/pings_controller.rb
stitches-3.6.0 lib/stitches/generator_files/app/controllers/api/v1/pings_controller.rb
stitches-3.6.0.RC1 lib/stitches/generator_files/app/controllers/api/v1/pings_controller.rb
stitches-3.5.0 lib/stitches/generator_files/app/controllers/api/v1/pings_controller.rb
stitches-3.4.0 lib/stitches/generator_files/app/controllers/api/v1/pings_controller.rb
stitches-3.3.0 lib/stitches/generator_files/app/controllers/api/v1/pings_controller.rb
stitches-3.2.3 lib/stitches/generator_files/app/controllers/api/v1/pings_controller.rb
stitches-3.2.2 lib/stitches/generator_files/app/controllers/api/v1/pings_controller.rb
stitches-3.2.1 lib/stitches/generator_files/app/controllers/api/v1/pings_controller.rb
stitches-3.2.0 lib/stitches/generator_files/app/controllers/api/v1/pings_controller.rb
stitches-3.1.0 lib/stitches/generator_files/app/controllers/api/v1/pings_controller.rb
stitches-3.0.0 lib/stitches/generator_files/app/controllers/api/v1/pings_controller.rb