Class: Fakeit::App::Helpers::ResponseBuilder
- Inherits:
-
Object
- Object
- Fakeit::App::Helpers::ResponseBuilder
- Defined in:
- lib/fakeit/app/helpers/response_builder.rb
Class Method Summary collapse
- .error(code, err) ⇒ Object
- .method_not_allowed ⇒ Object
- .not_found ⇒ Object
- .ok(body) ⇒ Object
- .unsupported_media_type ⇒ Object
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. }.to_json]] end |
.method_not_allowed ⇒ Object
14 15 16 |
# File 'lib/fakeit/app/helpers/response_builder.rb', line 14 def method_not_allowed [405, {}, ['Method Not Allowed']] end |
.not_found ⇒ Object
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_type ⇒ Object
18 19 20 |
# File 'lib/fakeit/app/helpers/response_builder.rb', line 18 def unsupported_media_type [415, {}, ['Unsupported Media Type']] end |