Sha256: dbef7e999bc6f08d1e9df04e064e41aadc9c8ac336ac8bd1022fe44ed378a5e4

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 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         = options[:status]
    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

2 entries across 2 versions & 1 rubygems

Version Path
jsonapi-resources-0.5.7 lib/jsonapi/error.rb
jsonapi-resources-0.5.6 lib/jsonapi/error.rb