Sha256: 8a79fc2c10711991f3ecc2b75de01bb8a8221418cabb83bd199184c2e53c27c3

Contents?: true

Size: 664 Bytes

Versions: 2

Compression:

Stored size: 664 Bytes

Contents

module Fakeit
  module App
    module Helpers
      class ResponseBuilder
        class << self
          def error(code, err)
            [code, { 'Content-Type' => 'application/json' }, [{ message: err.message }.to_json]]
          end

          def not_found
            [404, {}, ['Not Found']]
          end

          def method_not_allowed
            [405, {}, ['Method Not Allowed']]
          end

          def unsupported_media_type
            [415, {}, ['Unsupported Media Type']]
          end

          def ok(body)
            [200, { 'Content-Type' => 'application/json' }, [body.to_json]]
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fakeit-0.7.1 lib/fakeit/app/helpers/response_builder.rb
fakeit-0.7.0 lib/fakeit/app/helpers/response_builder.rb