Class: RubstApi::JSONResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/rubst_api/responses.rb

Instance Attribute Summary

Attributes inherited from Response

#body, #headers, #media_type, #status_code

Instance Method Summary collapse

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, **options)
  super(content, media_type: "application/json", **options)
end

Instance Method Details

#render(content) ⇒ Object



32
# File 'lib/rubst_api/responses.rb', line 32

def render(content) = JSON.generate(Serializer.dump(content))