Sha256: 5d0ec8b145e78a642bbce4bebbfc9265774e21fff7a9271592c96488176d5dc0

Contents?: true

Size: 544 Bytes

Versions: 7

Compression:

Stored size: 544 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]]

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

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

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fakeit-0.11.0 lib/fakeit/app/helpers/response_builder.rb
fakeit-0.10.0 lib/fakeit/app/helpers/response_builder.rb
fakeit-0.9.2 lib/fakeit/app/helpers/response_builder.rb
fakeit-0.9.1 lib/fakeit/app/helpers/response_builder.rb
fakeit-0.9.0 lib/fakeit/app/helpers/response_builder.rb
fakeit-0.8.1 lib/fakeit/app/helpers/response_builder.rb
fakeit-0.8.0 lib/fakeit/app/helpers/response_builder.rb