Class: Fakeit::App::Helpers::ResponseBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/fakeit/app/helpers/response_builder.rb

Class Method Summary collapse

Class Method Details

.error(code, err) ⇒ Object



6
7
8
# File 'lib/fakeit/app/helpers/response_builder.rb', line 6

def error(code, err)
  [code, { 'Content-Type' => 'application/json' }, [{ message: err.message }.to_json]]
end

.method_not_allowedObject



14
15
16
# File 'lib/fakeit/app/helpers/response_builder.rb', line 14

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

.not_foundObject



10
11
12
# File 'lib/fakeit/app/helpers/response_builder.rb', line 10

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

.ok(body) ⇒ Object



22
23
24
# File 'lib/fakeit/app/helpers/response_builder.rb', line 22

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

.unsupported_media_typeObject



18
19
20
# File 'lib/fakeit/app/helpers/response_builder.rb', line 18

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