Created
November 5, 2013 14:58
-
-
Save roolo/7320300 to your computer and use it in GitHub Desktop.
Sinatra basic documentation for API. This code as it is generates code for Markdown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| after do | |
| TEST_DOCUMENTATION_FILE << "\n## %s %s"%[request.request_method,request.path_info] | |
| TEST_DOCUMENTATION_FILE << "\n### Request" | |
| TEST_DOCUMENTATION_FILE << "\n "+JSON.pretty_generate( | |
| JSON.parse(request.POST.to_json) | |
| ).gsub(/\n/, "\n ") | |
| TEST_DOCUMENTATION_FILE << "\n### Response" | |
| response_formatted = JSON.pretty_generate( | |
| JSON.parse(response.body.first) | |
| ).gsub(/\n/, "\n ") | |
| TEST_DOCUMENTATION_FILE << "\n "+response_formatted | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment