Class: RubstApi::JSONResponse
- Defined in:
- lib/rubst_api/responses.rb
Instance Attribute Summary
Attributes inherited from Response
#body, #headers, #media_type, #status_code
Instance Method Summary collapse
-
#initialize(content = nil, **options) ⇒ JSONResponse
constructor
A new instance of JSONResponse.
- #render(content) ⇒ Object
Methods inherited from Response
#delete_cookie, #finish, #set_cookie
Constructor Details
#initialize(content = nil, **options) ⇒ JSONResponse
Returns a new instance of JSONResponse.
29 30 31 |
# File 'lib/rubst_api/responses.rb', line 29 def initialize(content = nil, **) super(content, media_type: "application/json", **) end |
Instance Method Details
#render(content) ⇒ Object
32 |
# File 'lib/rubst_api/responses.rb', line 32 def render(content) = JSON.generate(Serializer.dump(content)) |