Sha256: 246dfc18e71589e4ace2f02592756bb7e74b147f438ae8c31dbaa44c661a3abb

Contents?: true

Size: 509 Bytes

Versions: 3

Compression:

Stored size: 509 Bytes

Contents

module SteelWheel
  class Response
    attr_accessor :status
    attr_writer :errors
    include ActiveModel::Validations

    def self.generic_validation_keys(*keys)
      include SteelWheel::SkipActiveModelErrorsKeys[*keys]
    end

    generic_validation_keys(:not_found, :forbidden, :unprocessable_entity)

    def self.name
      'SteelWheel::Response'
    end

    def initialize
      @status = :ok
    end

    def success?
      errors.empty?
    end

    def valid?
      success?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
steel_wheel-0.5.2 lib/steel_wheel/response.rb
steel_wheel-0.5.1 lib/steel_wheel/response.rb
steel_wheel-0.5.0 lib/steel_wheel/response.rb