Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/public/js/example.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
function mirror(textarea, contentType, options) {
if(contentType === undefined) { contentType = ''; }
$textarea = $(textarea);
if ($textarea.val() != '') {
if(contentType.indexOf('json') >= 0) {
Expand Down
14 changes: 13 additions & 1 deletion lib/raddocs/models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def initialize(file)
@attrs = JSON.parse(File.read(file))
@resource_explanation = @attrs.fetch("resource_explanation", nil)
@resource = @attrs.fetch("resource")

@description = @attrs.fetch("description")
@explanation = @attrs.fetch("explanation", nil)
@parameters = Parameters.new(@attrs.fetch("parameters"))
Expand Down Expand Up @@ -282,6 +282,12 @@ def request_body?
!@request_body.nil?
end

def request_body
return "" if @request_body.blank?
return @request_body if @request_body.is_a?(String)
@request_body.to_json
end

# @return [Boolean] true if request headers are present
def request_headers?
request_headers.length > 0
Expand Down Expand Up @@ -315,6 +321,12 @@ def response_body?
!@response_body.nil?
end

def response_body
return "" if @response_body.blank?
return @response_body if @response_body.is_a?(String)
@response_body.to_json
end

# @return [Boolean] true if response headers are present
def response_headers?
response_headers.length > 0
Expand Down