Sha256: f9647ee4550a7e88dd8b0864fb7cf050b2aeaf0b452a2449b765e0d62f61b5e7

Contents?: true

Size: 1.52 KB

Versions: 21

Compression:

Stored size: 1.52 KB

Contents

require 'active_model_serializers/model'

module FunWithJsonApi
  # id: a unique identifier for this particular occurrence of the problem.
  # links: a links object containing the following members:
  #   about: a link that leads to further details about this particular occurrence of the problem.
  # status: the HTTP status code applicable to this problem, expressed as a string value.
  # code: an application-specific error code, expressed as a string value.
  # title: a short, human-readable summary of the problem that SHOULD NOT change from occurrence to
  #   occurrence of the problem, except for purposes of localization.
  # detail: a human-readable explanation specific to this occurrence of the problem. Like title,
  #   this field's value can be localized.
  # source: an object containing references to the source of the error, optionally including any of
  #   the following members:
  # pointer: a JSON Pointer [RFC6901] to the associated entity in the request document
  #  [e.g. "/data" for a primary data object, or "/data/attributes/title" for a specific attribute].
  #  parameter: a string indicating which URI query parameter caused the error.
  #  meta: a meta object containing non-standard meta-information about the error.
  class ExceptionPayload < ActiveModelSerializers::Model
    [:id, :status, :code, :title, :detail, :pointer, :parameter].each do |param|
      define_method param do
        attributes[param]
      end
      define_method "#{param}=" do |value|
        attributes[param] = value
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
fun_with_json_api-0.0.11.1 lib/fun_with_json_api/exception_payload.rb
fun_with_json_api-0.0.11 lib/fun_with_json_api/exception_payload.rb
fun_with_json_api-0.0.10.4 lib/fun_with_json_api/exception_payload.rb
fun_with_json_api-0.0.10.3 lib/fun_with_json_api/exception_payload.rb
fun_with_json_api-0.0.10.2 lib/fun_with_json_api/exception_payload.rb
fun_with_json_api-0.0.10.1 lib/fun_with_json_api/exception_payload.rb
fun_with_json_api-0.0.10 lib/fun_with_json_api/exception_payload.rb
fun_with_json_api-0.0.9 lib/fun_with_json_api/exception_payload.rb
fun_with_json_api-0.0.8.2 lib/fun_with_json_api/exception_payload.rb
fun_with_json_api-0.0.8.1 lib/fun_with_json_api/exception_payload.rb
fun_with_json_api-0.0.8 lib/fun_with_json_api/exception_payload.rb
fun_with_json_api-0.0.7 lib/fun_with_json_api/exception_payload.rb
fun_with_json_api-0.0.6.pre.alpha.2 lib/fun_with_json_api/exception_payload.rb
fun_with_json_api-0.0.6.pre.alpha.1 lib/fun_with_json_api/exception_payload.rb
fun_with_json_api-0.0.6.1 lib/fun_with_json_api/exception_payload.rb
fun_with_json_api-0.0.6 lib/fun_with_json_api/exception_payload.rb
fun_with_json_api-0.0.5 lib/fun_with_json_api/exception_payload.rb
fun_with_json_api-0.0.4 lib/fun_with_json_api/exception_payload.rb
fun_with_json_api-0.0.3 lib/fun_with_json_api/exception_payload.rb
fun_with_json_api-0.0.2 lib/fun_with_json_api/exception_payload.rb