Sha256: 41c27a6a884b824fc6fa1bcbcacef1ec84e5664b38d0f8e7e6b8b0a4f60a02e1

Contents?: true

Size: 309 Bytes

Versions: 11

Compression:

Stored size: 309 Bytes

Contents

module Napa
  class JsonError
    def initialize(code, message)
      @code = code
      @message = message
    end

    def to_json(options = {})
      to_h.to_json(options)
    end

    def to_h
      {
        error: {
          code: @code,
          message: @message
        }
      }
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
napa-0.4.0 lib/napa/json_error.rb
napa-0.3.0 lib/napa/json_error.rb
napa-0.2.1 lib/napa/json_error.rb
napa-0.2.0 lib/napa/json_error.rb
napa-0.1.29 lib/napa/json_error.rb
napa-0.1.28 lib/napa/json_error.rb
napa-0.1.26 lib/napa/json_error.rb
napa-0.1.25 lib/napa/json_error.rb
napa-0.1.24 lib/napa/json_error.rb
napa-0.1.23 lib/napa/json_error.rb
napa-0.1.22 lib/napa/json_error.rb