Sha256: 0c0794c6f77788894e92a9f3c7b766e2c68dec52b8940f2de93a21018426431b

Contents?: true

Size: 367 Bytes

Versions: 5

Compression:

Stored size: 367 Bytes

Contents

module DDC
  module ResponseBuilder
    def not_found
      {status: :not_found}
    end

    def ok(obj)
      {status: :ok, object: obj}
    end

    def created(obj)
      {status: :created, object: obj}
    end

    def not_valid(obj)
      {status: :not_valid, errors: obj.errors.to_hash}
    end

    def deleted(obj)
      {status: :deleted}
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ddc-0.1.7 lib/ddc/response_builder.rb
ddc-0.1.5 lib/ddc/response_builder.rb
ddc-0.1.4 lib/ddc/response_builder.rb
ddc-0.1.3 lib/ddc/response_builder.rb
ddc-0.1.2 lib/ddc/response_builder.rb