Sha256: 4979ef71b85e27472ca63495f1ee43d327beba41525e120ccd82e47800c3f281

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

module JSONAPI
  class Error
    attr_accessor :title, :detail, :id, :href, :code, :source, :links, :status

    def initialize(options = {})
      @title          = options[:title]
      @detail         = options[:detail]
      @id             = options[:id]
      @href           = options[:href]
      @code           = if JSONAPI.configuration.use_text_errors
                          TEXT_ERRORS[options[:code]]
                        else
                          options[:code]
                        end
      @source         = options[:source]
      @links          = options[:links]

      @status         = Rack::Utils::SYMBOL_TO_STATUS_CODE[options[:status]].to_s
    end
  end

  class Warning
    attr_accessor :title, :detail, :code
    def initialize(options = {})
      @title          = options[:title]
      @detail         = options[:detail]
      @code           = if JSONAPI.configuration.use_text_errors
                          TEXT_ERRORS[options[:code]]
                        else
                          options[:code]
                        end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jsonapi-resources-0.6.2 lib/jsonapi/error.rb
jsonapi-resources-0.6.1 lib/jsonapi/error.rb
jsonapi-resources-0.6.0 lib/jsonapi/error.rb
jsonapi-resources-0.5.9 lib/jsonapi/error.rb
jsonapi-resources-0.5.8 lib/jsonapi/error.rb