File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,16 +42,24 @@ API docs should look like:
4242
4343 ### Response
4444
45- <pre class="highlight"><code class="language-javascript">
46- [
47- {
48- ...
49- }
50- }
51- </code></pre>
45+ <%= json :resource_name %>
5246
5347** Note** : We're using [ Kramdown Markdown extensions] ( http://kramdown.rubyforge.org/syntax.html ) , such as definition lists.
5448
49+ ### JSON Responses
50+
51+ We specify the JSON responses in ruby so that we don't have to write
52+ them by hand all over the docs. You can render the JSON for a resource
53+ like this:
54+
55+ <%= json :issue %>
56+
57+ This looks up ` GitHub::Resources::ISSUE ` in ` lib/resources.rb ` .
58+
59+ Some actions return arrays. You can modify the JSON by passing a block:
60+
61+ <%= json(:issue) { |hash| [hash] } %>
62+
5563### Terminal blocks
5664
5765You can specify terminal blocks with ` pre.terminal ` elements. It'd be
@@ -106,5 +114,6 @@ One thing: remember to add trailing slashes to all nanoc links!
106114
107115* Need some way to deploy? Look into GitHub pages to start, until we
108116 can integrate through a simple hurl.it app for live API calls.
109- * Flesh out the missing components of the requests.
110117* Maybe add a nice TOC at the top of each page.
118+ * Write a task for verifying JSON Resource examples against the actual
119+ API.
You can’t perform that action at this time.
0 commit comments