autodoc 0.4.5 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +15 -1
- data/autodoc.gemspec +1 -1
- data/lib/autodoc/configuration.rb +3 -0
- data/lib/autodoc/document.rb +10 -3
- data/lib/autodoc/version.rb +1 -1
- data/spec/autodoc/documents_spec.rb +15 -0
- data/spec/dummy/config/application.rb +0 -7
- data/spec/dummy/config/environments/development.rb +2 -3
- data/spec/dummy/config/environments/production.rb +2 -0
- data/spec/dummy/config/environments/test.rb +2 -0
- data/spec/dummy/doc/admin/entries.md +3 -0
- data/spec/dummy/doc/entries.md +3 -0
- data/spec/dummy/doc/recipes.md +16 -12
- data/spec/dummy/doc/spec/requests/admin/entries.md +26 -0
- data/spec/dummy/doc/spec/requests/entries.md +26 -0
- data/spec/dummy/doc/spec/requests/recipes.md +84 -0
- data/spec/dummy/doc/toc.html +369 -0
- data/spec/dummy/doc/toc.md +7 -0
- metadata +14 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2a5528a44cbd03fbfae762dbaa8c4f274e1a537
|
4
|
+
data.tar.gz: 911b9292db126659555cab615394c675f4442343
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b05f3d3f81415016e9a18d509d4c3b290866e063d4906360236b95f5161323bdff8e6b40794765bb12ae4afec824dfb065025262c4d2ca7ecfb5ef7b3946cab
|
7
|
+
data.tar.gz: 9e22c29f5e0e8d90a6b07adba30b3c0f25b9afb4236a2c758d0c5e905176d282f4132c69075caa74e41b1e5f36305039861d0467d784f43f9688af9cc484baef
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -83,12 +83,26 @@ You can configure `Autodoc.configuration` to change its behavior:
|
|
83
83
|
* toc - [Boolean] whether to generate toc.md (default: false)
|
84
84
|
* toc_html_template - [String] ERB template for html ToC (default: [toc.html.erb](https://github.com/r7kamura/autodoc/blob/master/lib/autodoc/templates/toc.html.erb))
|
85
85
|
* toc_html - [Boolean] whether to generate toc.html - a single page documentation with a toc (default: false)
|
86
|
+
* document_path_from_example - [Proc] specify a Proc to change the naming rule of document file paths
|
86
87
|
|
87
88
|
```ruby
|
88
|
-
# example
|
89
89
|
Autodoc.configuration.path = "doc/api"
|
90
90
|
Autodoc.configuration.toc = true
|
91
91
|
Autodoc.configuration.toc_html = true
|
92
92
|
Autodoc.configuration.template = File.read(File.expand_path("../autodoc/templates/document.md.erb", __FILE__))
|
93
|
+
Audocot.configuration.document_path_from_example = -> (example) do
|
94
|
+
example.file_path.gsub(%r<\./spec/requests/api/(.+)_spec\.rb>, '\1.md')
|
95
|
+
end
|
96
|
+
```
|
93
97
|
|
98
|
+
## WeakParameters integration
|
99
|
+
If your app uses [WeakParameters](https://github.com/r7kamura/weak_parameters) to define parameters schema
|
100
|
+
in your controller, autodoc scans them and provides `### Parameters` section to generated docs.
|
101
|
+
|
102
|
+
```rb
|
103
|
+
class RecipesController < ApplicationController
|
104
|
+
validates :create do
|
105
|
+
string :name, required: true, except: ["charlie", "dave"]
|
106
|
+
integer :type, only: 1..3
|
107
|
+
end
|
94
108
|
```
|
data/autodoc.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_dependency "actionpack"
|
22
22
|
spec.add_dependency "rspec"
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
-
spec.add_development_dependency "rails", "
|
24
|
+
spec.add_development_dependency "rails", "4.2.0"
|
25
25
|
spec.add_development_dependency "rake"
|
26
26
|
spec.add_development_dependency "sqlite3"
|
27
27
|
end
|
data/lib/autodoc/document.rb
CHANGED
@@ -7,6 +7,10 @@ require "pathname"
|
|
7
7
|
|
8
8
|
module Autodoc
|
9
9
|
class Document
|
10
|
+
DEFAULT_DOCUMENT_PATH_FROM_EXAMPLE = -> (example) do
|
11
|
+
example.file_path.gsub(%r<\./spec/[^/]+/(.+)_spec\.rb>, '\1.md')
|
12
|
+
end
|
13
|
+
|
10
14
|
def self.render(*args)
|
11
15
|
new(*args).render
|
12
16
|
end
|
@@ -17,9 +21,8 @@ module Autodoc
|
|
17
21
|
end
|
18
22
|
|
19
23
|
def pathname
|
20
|
-
@
|
21
|
-
|
22
|
-
Autodoc.configuration.pathname + payload
|
24
|
+
@pathname ||= begin
|
25
|
+
Autodoc.configuration.pathname + document_path_from_example.call(example)
|
23
26
|
end
|
24
27
|
end
|
25
28
|
|
@@ -37,6 +40,10 @@ module Autodoc
|
|
37
40
|
|
38
41
|
private
|
39
42
|
|
43
|
+
def document_path_from_example
|
44
|
+
Autodoc.configuration.document_path_from_example || DEFAULT_DOCUMENT_PATH_FROM_EXAMPLE
|
45
|
+
end
|
46
|
+
|
40
47
|
def example
|
41
48
|
if ::RSpec::Core::Version::STRING.match /\A(?:3\.|2.99\.)/
|
42
49
|
@example
|
data/lib/autodoc/version.rb
CHANGED
@@ -82,6 +82,21 @@ describe Autodoc::Documents do
|
|
82
82
|
expect(toc).to include("[admin/recipes.md](admin/recipes.md)")
|
83
83
|
expect(toc).to include("[GET /admin/recipes](admin/recipes.md#get-adminrecipes)")
|
84
84
|
end
|
85
|
+
|
86
|
+
context "with document_path_from_example configuration" do
|
87
|
+
around do |example|
|
88
|
+
origin = Autodoc.configuration.document_path_from_example
|
89
|
+
Autodoc.configuration.document_path_from_example = -> (example) { "test.md" }
|
90
|
+
example.run
|
91
|
+
Autodoc.configuration.document_path_from_example = origin
|
92
|
+
end
|
93
|
+
|
94
|
+
it "change the naming rule of document file paths" do
|
95
|
+
toc = documents.send(:render_toc)
|
96
|
+
expect(toc).to include("[test.md](test.md)")
|
97
|
+
expect(toc).to include("[GET /admin/recipes](test.md#get-adminrecipes)")
|
98
|
+
end
|
99
|
+
end
|
85
100
|
end
|
86
101
|
end
|
87
102
|
end
|
@@ -44,14 +44,7 @@ module Dummy
|
|
44
44
|
# like if you have constraints or database-specific column types
|
45
45
|
# config.active_record.schema_format = :sql
|
46
46
|
|
47
|
-
# Enforce whitelist mode for mass assignment.
|
48
|
-
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
49
|
-
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
50
|
-
# parameters by using an attr_accessible or attr_protected declaration.
|
51
|
-
config.active_record.whitelist_attributes = true
|
52
|
-
|
53
47
|
# Version of your assets, change this if you want to expire all your assets
|
54
48
|
config.assets.version = '1.0'
|
55
49
|
end
|
56
50
|
end
|
57
|
-
|
@@ -1,6 +1,8 @@
|
|
1
1
|
Dummy::Application.configure do
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb
|
3
3
|
|
4
|
+
config.eager_load = false
|
5
|
+
|
4
6
|
# In the development environment your application's code is reloaded on
|
5
7
|
# every request. This slows down response time but is perfect for development
|
6
8
|
# since you don't have to restart the web server when you make code changes.
|
@@ -10,9 +12,6 @@ Dummy::Application.configure do
|
|
10
12
|
config.consider_all_requests_local = true
|
11
13
|
config.action_controller.perform_caching = false
|
12
14
|
|
13
|
-
# Don't care if the mailer can't send
|
14
|
-
config.action_mailer.raise_delivery_errors = false
|
15
|
-
|
16
15
|
# Print deprecation notices to the Rails logger
|
17
16
|
config.active_support.deprecation = :log
|
18
17
|
|
@@ -1,6 +1,8 @@
|
|
1
1
|
Dummy::Application.configure do
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb
|
3
3
|
|
4
|
+
config.eager_load = false
|
5
|
+
|
4
6
|
# The test environment is used exclusively to run your application's
|
5
7
|
# test suite. You never need to work with it otherwise. Remember that
|
6
8
|
# your test database is "scratch space" for the test suite and is wiped
|
data/spec/dummy/doc/entries.md
CHANGED
data/spec/dummy/doc/recipes.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
Returns the recipe.
|
3
3
|
|
4
4
|
### Example
|
5
|
+
|
6
|
+
#### Request
|
5
7
|
```
|
6
8
|
GET /recipes/1 HTTP/1.1
|
7
9
|
Content-Length: 0
|
@@ -9,25 +11,25 @@ Content-Type: application/json
|
|
9
11
|
Host: example.org
|
10
12
|
```
|
11
13
|
|
14
|
+
#### Response
|
12
15
|
```
|
13
16
|
HTTP/1.1 200
|
14
17
|
Cache-Control: max-age=0, private, must-revalidate
|
15
18
|
Content-Length: 111
|
16
19
|
Content-Type: application/json; charset=utf-8
|
17
|
-
ETag: "
|
20
|
+
ETag: W/"569e12b49f55be4160858ca7de2935c3"
|
18
21
|
X-Content-Type-Options: nosniff
|
19
22
|
X-Frame-Options: SAMEORIGIN
|
20
|
-
X-Request-Id:
|
21
|
-
X-Runtime: 0.
|
22
|
-
X-UA-Compatible: chrome=1
|
23
|
+
X-Request-Id: cbf1563c-2e0f-421f-b734-5234a7388f70
|
24
|
+
X-Runtime: 0.001643
|
23
25
|
X-XSS-Protection: 1; mode=block
|
24
26
|
|
25
27
|
{
|
26
28
|
"id": 1,
|
27
29
|
"name": "test",
|
28
30
|
"type": 2,
|
29
|
-
"created_at": "
|
30
|
-
"updated_at": "
|
31
|
+
"created_at": "2015-04-21T14:55:09.351Z",
|
32
|
+
"updated_at": "2015-04-21T14:55:09.351Z"
|
31
33
|
}
|
32
34
|
```
|
33
35
|
|
@@ -43,6 +45,8 @@ recipe!
|
|
43
45
|
* `type` integer (only: `1..3`)
|
44
46
|
|
45
47
|
### Example
|
48
|
+
|
49
|
+
#### Request
|
46
50
|
```
|
47
51
|
POST /recipes HTTP/1.1
|
48
52
|
Accept: application/json
|
@@ -56,25 +60,25 @@ Host: www.example.com
|
|
56
60
|
}
|
57
61
|
```
|
58
62
|
|
63
|
+
#### Response
|
59
64
|
```
|
60
65
|
HTTP/1.1 201
|
61
66
|
Cache-Control: max-age=0, private, must-revalidate
|
62
67
|
Content-Length: 111
|
63
68
|
Content-Type: application/json; charset=utf-8
|
64
|
-
ETag: "
|
69
|
+
ETag: W/"499417290ebf67a5283002fb2b214c12"
|
65
70
|
Location: http://www.example.com/recipes/1
|
66
71
|
X-Content-Type-Options: nosniff
|
67
72
|
X-Frame-Options: SAMEORIGIN
|
68
|
-
X-Request-Id:
|
69
|
-
X-Runtime: 0.
|
70
|
-
X-UA-Compatible: chrome=1
|
73
|
+
X-Request-Id: fac5ae8a-1eec-41c5-a533-c1cd0991ea92
|
74
|
+
X-Runtime: 0.003226
|
71
75
|
X-XSS-Protection: 1; mode=block
|
72
76
|
|
73
77
|
{
|
74
78
|
"id": 1,
|
75
79
|
"name": "name",
|
76
80
|
"type": 1,
|
77
|
-
"created_at": "
|
78
|
-
"updated_at": "
|
81
|
+
"created_at": "2015-04-21T14:55:09.377Z",
|
82
|
+
"updated_at": "2015-04-21T14:55:09.377Z"
|
79
83
|
}
|
80
84
|
```
|
@@ -0,0 +1,26 @@
|
|
1
|
+
## GET /admin/entries
|
2
|
+
Returns entries.
|
3
|
+
|
4
|
+
### Example
|
5
|
+
|
6
|
+
#### Request
|
7
|
+
```
|
8
|
+
GET /admin/entries HTTP/1.1
|
9
|
+
Accept: application/json
|
10
|
+
Content-Length: 0
|
11
|
+
Host: example.org
|
12
|
+
```
|
13
|
+
|
14
|
+
#### Response
|
15
|
+
```
|
16
|
+
HTTP/1.1 200
|
17
|
+
Content-Length: 45
|
18
|
+
Content-Type: application/json
|
19
|
+
|
20
|
+
[
|
21
|
+
{
|
22
|
+
"title": "Test Title",
|
23
|
+
"body": "Lorem Ipsum"
|
24
|
+
}
|
25
|
+
]
|
26
|
+
```
|
@@ -0,0 +1,26 @@
|
|
1
|
+
## GET /entries
|
2
|
+
Returns entries.
|
3
|
+
|
4
|
+
### Example
|
5
|
+
|
6
|
+
#### Request
|
7
|
+
```
|
8
|
+
GET /entries HTTP/1.1
|
9
|
+
Accept: application/json
|
10
|
+
Content-Length: 0
|
11
|
+
Host: example.org
|
12
|
+
```
|
13
|
+
|
14
|
+
#### Response
|
15
|
+
```
|
16
|
+
HTTP/1.1 200
|
17
|
+
Content-Length: 45
|
18
|
+
Content-Type: application/json
|
19
|
+
|
20
|
+
[
|
21
|
+
{
|
22
|
+
"title": "Test Title",
|
23
|
+
"body": "Lorem Ipsum"
|
24
|
+
}
|
25
|
+
]
|
26
|
+
```
|
@@ -0,0 +1,84 @@
|
|
1
|
+
## GET /recipes/:id
|
2
|
+
Returns the recipe.
|
3
|
+
|
4
|
+
### Example
|
5
|
+
|
6
|
+
#### Request
|
7
|
+
```
|
8
|
+
GET /recipes/1 HTTP/1.1
|
9
|
+
Content-Length: 0
|
10
|
+
Content-Type: application/json
|
11
|
+
Host: example.org
|
12
|
+
```
|
13
|
+
|
14
|
+
#### Response
|
15
|
+
```
|
16
|
+
HTTP/1.1 200
|
17
|
+
Cache-Control: max-age=0, private, must-revalidate
|
18
|
+
Content-Length: 111
|
19
|
+
Content-Type: application/json; charset=utf-8
|
20
|
+
ETag: W/"c95e174a05580bffa98c6cb95a2e9ae2"
|
21
|
+
X-Content-Type-Options: nosniff
|
22
|
+
X-Frame-Options: SAMEORIGIN
|
23
|
+
X-Request-Id: 0bb04a6a-b8f3-4640-a487-6f97023efef0
|
24
|
+
X-Runtime: 0.013095
|
25
|
+
X-XSS-Protection: 1; mode=block
|
26
|
+
|
27
|
+
{
|
28
|
+
"id": 1,
|
29
|
+
"name": "test",
|
30
|
+
"type": 2,
|
31
|
+
"created_at": "2015-04-21T14:55:09.299Z",
|
32
|
+
"updated_at": "2015-04-21T14:55:09.299Z"
|
33
|
+
}
|
34
|
+
```
|
35
|
+
|
36
|
+
## POST /recipes
|
37
|
+
Creates
|
38
|
+
a
|
39
|
+
new
|
40
|
+
recipe!
|
41
|
+
|
42
|
+
|
43
|
+
### Parameters
|
44
|
+
* `name` string (required, except: `["alice", "bob"]`)
|
45
|
+
* `type` integer (only: `1..3`)
|
46
|
+
|
47
|
+
### Example
|
48
|
+
|
49
|
+
#### Request
|
50
|
+
```
|
51
|
+
POST /recipes HTTP/1.1
|
52
|
+
Accept: application/json
|
53
|
+
Content-Length: 24
|
54
|
+
Content-Type: application/json
|
55
|
+
Host: www.example.com
|
56
|
+
|
57
|
+
{
|
58
|
+
"name": "name",
|
59
|
+
"type": 1
|
60
|
+
}
|
61
|
+
```
|
62
|
+
|
63
|
+
#### Response
|
64
|
+
```
|
65
|
+
HTTP/1.1 201
|
66
|
+
Cache-Control: max-age=0, private, must-revalidate
|
67
|
+
Content-Length: 111
|
68
|
+
Content-Type: application/json; charset=utf-8
|
69
|
+
ETag: W/"145ecc23e52083cbc00658e547234672"
|
70
|
+
Location: http://www.example.com/recipes/1
|
71
|
+
X-Content-Type-Options: nosniff
|
72
|
+
X-Frame-Options: SAMEORIGIN
|
73
|
+
X-Request-Id: 50bd40e2-d110-40e8-b6cb-7589262fd00a
|
74
|
+
X-Runtime: 0.003226
|
75
|
+
X-XSS-Protection: 1; mode=block
|
76
|
+
|
77
|
+
{
|
78
|
+
"id": 1,
|
79
|
+
"name": "name",
|
80
|
+
"type": 1,
|
81
|
+
"created_at": "2015-04-21T14:55:09.346Z",
|
82
|
+
"updated_at": "2015-04-21T14:55:09.346Z"
|
83
|
+
}
|
84
|
+
```
|
@@ -0,0 +1,369 @@
|
|
1
|
+
<head>
|
2
|
+
<style>
|
3
|
+
.api-docs {
|
4
|
+
left: 210px;
|
5
|
+
}
|
6
|
+
|
7
|
+
.api-docs, .api-docs-toc {
|
8
|
+
width: 66%;
|
9
|
+
}
|
10
|
+
|
11
|
+
.api-action {
|
12
|
+
padding: 10px;
|
13
|
+
}
|
14
|
+
|
15
|
+
.tocify-wrapper {
|
16
|
+
overflow-y: auto;
|
17
|
+
overflow-x: hidden;
|
18
|
+
position: fixed;
|
19
|
+
width: 210px;
|
20
|
+
float: left;
|
21
|
+
font-size: 16px;
|
22
|
+
background-color: #AAAADD;
|
23
|
+
top: 1px;
|
24
|
+
bottom: -1px;
|
25
|
+
padding: 10px;
|
26
|
+
}
|
27
|
+
|
28
|
+
.generated-at {
|
29
|
+
position: fixed;
|
30
|
+
bottom: 10px;
|
31
|
+
}
|
32
|
+
|
33
|
+
.api-resource {
|
34
|
+
border-bottom: black 1px solid;
|
35
|
+
}
|
36
|
+
|
37
|
+
pre {
|
38
|
+
padding: 10px;
|
39
|
+
background-color: #CCCCEE;
|
40
|
+
}
|
41
|
+
|
42
|
+
.page-wrapper {
|
43
|
+
margin-left: 240px;
|
44
|
+
min-width: 700px;
|
45
|
+
position: relative;
|
46
|
+
z-index: 10;
|
47
|
+
}
|
48
|
+
</style>
|
49
|
+
</head>
|
50
|
+
|
51
|
+
|
52
|
+
<html>
|
53
|
+
<div class='tocify-wrapper'>
|
54
|
+
<h1> Table of Contents </h1>
|
55
|
+
<li>
|
56
|
+
<a href="#spec/dummy/doc/admin/entries.md">admin/entries.md</a>
|
57
|
+
</li>
|
58
|
+
|
59
|
+
<li>
|
60
|
+
<a href="#spec/dummy/doc/entries.md">entries.md</a>
|
61
|
+
</li>
|
62
|
+
|
63
|
+
<li>
|
64
|
+
<a href="#spec/dummy/doc/recipes.md">recipes.md</a>
|
65
|
+
</li>
|
66
|
+
|
67
|
+
<li>
|
68
|
+
<a href="#spec/dummy/doc/spec/requests/admin/entries.md">spec/requests/admin/entries.md</a>
|
69
|
+
</li>
|
70
|
+
|
71
|
+
<li>
|
72
|
+
<a href="#spec/dummy/doc/spec/requests/entries.md">spec/requests/entries.md</a>
|
73
|
+
</li>
|
74
|
+
|
75
|
+
<li>
|
76
|
+
<a href="#spec/dummy/doc/spec/requests/recipes.md">spec/requests/recipes.md</a>
|
77
|
+
</li>
|
78
|
+
|
79
|
+
<div class='generated-at'>
|
80
|
+
Generated at:
|
81
|
+
<br>
|
82
|
+
2015-04-21 23:55:09 +0900</div>
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div class='page-wrapper'>
|
86
|
+
<div id="spec/dummy/doc/admin/entries.md" class="api-resource"><div class="api-action"><h2>GET /admin/entries</h2>
|
87
|
+
|
88
|
+
<p>Returns entries.</p>
|
89
|
+
|
90
|
+
<h3>Example</h3>
|
91
|
+
|
92
|
+
<h4>Request</h4>
|
93
|
+
|
94
|
+
<pre><code>GET /admin/entries HTTP/1.1
|
95
|
+
Accept: application/json
|
96
|
+
Content-Length: 0
|
97
|
+
Host: example.org
|
98
|
+
</code></pre>
|
99
|
+
|
100
|
+
<h4>Response</h4>
|
101
|
+
|
102
|
+
<pre><code>HTTP/1.1 200
|
103
|
+
Content-Length: 45
|
104
|
+
Content-Type: application/json
|
105
|
+
|
106
|
+
[
|
107
|
+
{
|
108
|
+
"title": "Test Title",
|
109
|
+
"body": "Lorem Ipsum"
|
110
|
+
}
|
111
|
+
]
|
112
|
+
</code></pre>
|
113
|
+
</div></div><div id="spec/dummy/doc/entries.md" class="api-resource"><div class="api-action"><h2>GET /entries</h2>
|
114
|
+
|
115
|
+
<p>Returns entries.</p>
|
116
|
+
|
117
|
+
<h3>Example</h3>
|
118
|
+
|
119
|
+
<h4>Request</h4>
|
120
|
+
|
121
|
+
<pre><code>GET /entries HTTP/1.1
|
122
|
+
Accept: application/json
|
123
|
+
Content-Length: 0
|
124
|
+
Host: example.org
|
125
|
+
</code></pre>
|
126
|
+
|
127
|
+
<h4>Response</h4>
|
128
|
+
|
129
|
+
<pre><code>HTTP/1.1 200
|
130
|
+
Content-Length: 45
|
131
|
+
Content-Type: application/json
|
132
|
+
|
133
|
+
[
|
134
|
+
{
|
135
|
+
"title": "Test Title",
|
136
|
+
"body": "Lorem Ipsum"
|
137
|
+
}
|
138
|
+
]
|
139
|
+
</code></pre>
|
140
|
+
</div></div><div id="spec/dummy/doc/recipes.md" class="api-resource"><div class="api-action"><h2>GET /recipes/:id</h2>
|
141
|
+
|
142
|
+
<p>Returns the recipe.</p>
|
143
|
+
|
144
|
+
<h3>Example</h3>
|
145
|
+
|
146
|
+
<h4>Request</h4>
|
147
|
+
|
148
|
+
<pre><code>GET /recipes/1 HTTP/1.1
|
149
|
+
Content-Length: 0
|
150
|
+
Content-Type: application/json
|
151
|
+
Host: example.org
|
152
|
+
</code></pre>
|
153
|
+
|
154
|
+
<h4>Response</h4>
|
155
|
+
|
156
|
+
<pre><code>HTTP/1.1 200
|
157
|
+
Cache-Control: max-age=0, private, must-revalidate
|
158
|
+
Content-Length: 111
|
159
|
+
Content-Type: application/json; charset=utf-8
|
160
|
+
ETag: W/"569e12b49f55be4160858ca7de2935c3"
|
161
|
+
X-Content-Type-Options: nosniff
|
162
|
+
X-Frame-Options: SAMEORIGIN
|
163
|
+
X-Request-Id: cbf1563c-2e0f-421f-b734-5234a7388f70
|
164
|
+
X-Runtime: 0.001643
|
165
|
+
X-XSS-Protection: 1; mode=block
|
166
|
+
|
167
|
+
{
|
168
|
+
"id": 1,
|
169
|
+
"name": "test",
|
170
|
+
"type": 2,
|
171
|
+
"created_at": "2015-04-21T14:55:09.351Z",
|
172
|
+
"updated_at": "2015-04-21T14:55:09.351Z"
|
173
|
+
}
|
174
|
+
</code></pre>
|
175
|
+
</div><div class="api-action"><h2>POST /recipes</h2>
|
176
|
+
|
177
|
+
<p>Creates
|
178
|
+
a
|
179
|
+
new
|
180
|
+
recipe!</p>
|
181
|
+
|
182
|
+
<h3>Parameters</h3>
|
183
|
+
|
184
|
+
<ul>
|
185
|
+
<li><code>name</code> string (required, except: <code>["alice", "bob"]</code>)</li>
|
186
|
+
<li><code>type</code> integer (only: <code>1..3</code>)</li>
|
187
|
+
</ul>
|
188
|
+
|
189
|
+
<h3>Example</h3>
|
190
|
+
|
191
|
+
<h4>Request</h4>
|
192
|
+
|
193
|
+
<pre><code>POST /recipes HTTP/1.1
|
194
|
+
Accept: application/json
|
195
|
+
Content-Length: 24
|
196
|
+
Content-Type: application/json
|
197
|
+
Host: www.example.com
|
198
|
+
|
199
|
+
{
|
200
|
+
"name": "name",
|
201
|
+
"type": 1
|
202
|
+
}
|
203
|
+
</code></pre>
|
204
|
+
|
205
|
+
<h4>Response</h4>
|
206
|
+
|
207
|
+
<pre><code>HTTP/1.1 201
|
208
|
+
Cache-Control: max-age=0, private, must-revalidate
|
209
|
+
Content-Length: 111
|
210
|
+
Content-Type: application/json; charset=utf-8
|
211
|
+
ETag: W/"499417290ebf67a5283002fb2b214c12"
|
212
|
+
Location: http://www.example.com/recipes/1
|
213
|
+
X-Content-Type-Options: nosniff
|
214
|
+
X-Frame-Options: SAMEORIGIN
|
215
|
+
X-Request-Id: fac5ae8a-1eec-41c5-a533-c1cd0991ea92
|
216
|
+
X-Runtime: 0.003226
|
217
|
+
X-XSS-Protection: 1; mode=block
|
218
|
+
|
219
|
+
{
|
220
|
+
"id": 1,
|
221
|
+
"name": "name",
|
222
|
+
"type": 1,
|
223
|
+
"created_at": "2015-04-21T14:55:09.377Z",
|
224
|
+
"updated_at": "2015-04-21T14:55:09.377Z"
|
225
|
+
}
|
226
|
+
</code></pre>
|
227
|
+
</div></div><div id="spec/dummy/doc/spec/requests/admin/entries.md" class="api-resource"><div class="api-action"><h2>GET /admin/entries</h2>
|
228
|
+
|
229
|
+
<p>Returns entries.</p>
|
230
|
+
|
231
|
+
<h3>Example</h3>
|
232
|
+
|
233
|
+
<h4>Request</h4>
|
234
|
+
|
235
|
+
<pre><code>GET /admin/entries HTTP/1.1
|
236
|
+
Accept: application/json
|
237
|
+
Content-Length: 0
|
238
|
+
Host: example.org
|
239
|
+
</code></pre>
|
240
|
+
|
241
|
+
<h4>Response</h4>
|
242
|
+
|
243
|
+
<pre><code>HTTP/1.1 200
|
244
|
+
Content-Length: 45
|
245
|
+
Content-Type: application/json
|
246
|
+
|
247
|
+
[
|
248
|
+
{
|
249
|
+
"title": "Test Title",
|
250
|
+
"body": "Lorem Ipsum"
|
251
|
+
}
|
252
|
+
]
|
253
|
+
</code></pre>
|
254
|
+
</div></div><div id="spec/dummy/doc/spec/requests/entries.md" class="api-resource"><div class="api-action"><h2>GET /entries</h2>
|
255
|
+
|
256
|
+
<p>Returns entries.</p>
|
257
|
+
|
258
|
+
<h3>Example</h3>
|
259
|
+
|
260
|
+
<h4>Request</h4>
|
261
|
+
|
262
|
+
<pre><code>GET /entries HTTP/1.1
|
263
|
+
Accept: application/json
|
264
|
+
Content-Length: 0
|
265
|
+
Host: example.org
|
266
|
+
</code></pre>
|
267
|
+
|
268
|
+
<h4>Response</h4>
|
269
|
+
|
270
|
+
<pre><code>HTTP/1.1 200
|
271
|
+
Content-Length: 45
|
272
|
+
Content-Type: application/json
|
273
|
+
|
274
|
+
[
|
275
|
+
{
|
276
|
+
"title": "Test Title",
|
277
|
+
"body": "Lorem Ipsum"
|
278
|
+
}
|
279
|
+
]
|
280
|
+
</code></pre>
|
281
|
+
</div></div><div id="spec/dummy/doc/spec/requests/recipes.md" class="api-resource"><div class="api-action"><h2>GET /recipes/:id</h2>
|
282
|
+
|
283
|
+
<p>Returns the recipe.</p>
|
284
|
+
|
285
|
+
<h3>Example</h3>
|
286
|
+
|
287
|
+
<h4>Request</h4>
|
288
|
+
|
289
|
+
<pre><code>GET /recipes/1 HTTP/1.1
|
290
|
+
Content-Length: 0
|
291
|
+
Content-Type: application/json
|
292
|
+
Host: example.org
|
293
|
+
</code></pre>
|
294
|
+
|
295
|
+
<h4>Response</h4>
|
296
|
+
|
297
|
+
<pre><code>HTTP/1.1 200
|
298
|
+
Cache-Control: max-age=0, private, must-revalidate
|
299
|
+
Content-Length: 111
|
300
|
+
Content-Type: application/json; charset=utf-8
|
301
|
+
ETag: W/"c95e174a05580bffa98c6cb95a2e9ae2"
|
302
|
+
X-Content-Type-Options: nosniff
|
303
|
+
X-Frame-Options: SAMEORIGIN
|
304
|
+
X-Request-Id: 0bb04a6a-b8f3-4640-a487-6f97023efef0
|
305
|
+
X-Runtime: 0.013095
|
306
|
+
X-XSS-Protection: 1; mode=block
|
307
|
+
|
308
|
+
{
|
309
|
+
"id": 1,
|
310
|
+
"name": "test",
|
311
|
+
"type": 2,
|
312
|
+
"created_at": "2015-04-21T14:55:09.299Z",
|
313
|
+
"updated_at": "2015-04-21T14:55:09.299Z"
|
314
|
+
}
|
315
|
+
</code></pre>
|
316
|
+
</div><div class="api-action"><h2>POST /recipes</h2>
|
317
|
+
|
318
|
+
<p>Creates
|
319
|
+
a
|
320
|
+
new
|
321
|
+
recipe!</p>
|
322
|
+
|
323
|
+
<h3>Parameters</h3>
|
324
|
+
|
325
|
+
<ul>
|
326
|
+
<li><code>name</code> string (required, except: <code>["alice", "bob"]</code>)</li>
|
327
|
+
<li><code>type</code> integer (only: <code>1..3</code>)</li>
|
328
|
+
</ul>
|
329
|
+
|
330
|
+
<h3>Example</h3>
|
331
|
+
|
332
|
+
<h4>Request</h4>
|
333
|
+
|
334
|
+
<pre><code>POST /recipes HTTP/1.1
|
335
|
+
Accept: application/json
|
336
|
+
Content-Length: 24
|
337
|
+
Content-Type: application/json
|
338
|
+
Host: www.example.com
|
339
|
+
|
340
|
+
{
|
341
|
+
"name": "name",
|
342
|
+
"type": 1
|
343
|
+
}
|
344
|
+
</code></pre>
|
345
|
+
|
346
|
+
<h4>Response</h4>
|
347
|
+
|
348
|
+
<pre><code>HTTP/1.1 201
|
349
|
+
Cache-Control: max-age=0, private, must-revalidate
|
350
|
+
Content-Length: 111
|
351
|
+
Content-Type: application/json; charset=utf-8
|
352
|
+
ETag: W/"145ecc23e52083cbc00658e547234672"
|
353
|
+
Location: http://www.example.com/recipes/1
|
354
|
+
X-Content-Type-Options: nosniff
|
355
|
+
X-Frame-Options: SAMEORIGIN
|
356
|
+
X-Request-Id: 50bd40e2-d110-40e8-b6cb-7589262fd00a
|
357
|
+
X-Runtime: 0.003226
|
358
|
+
X-XSS-Protection: 1; mode=block
|
359
|
+
|
360
|
+
{
|
361
|
+
"id": 1,
|
362
|
+
"name": "name",
|
363
|
+
"type": 1,
|
364
|
+
"created_at": "2015-04-21T14:55:09.346Z",
|
365
|
+
"updated_at": "2015-04-21T14:55:09.346Z"
|
366
|
+
}
|
367
|
+
</code></pre>
|
368
|
+
</div></div></div>
|
369
|
+
</html>
|
data/spec/dummy/doc/toc.md
CHANGED
@@ -6,3 +6,10 @@
|
|
6
6
|
* [recipes.md](recipes.md)
|
7
7
|
* [GET /recipes/:id](recipes.md#get-recipesid)
|
8
8
|
* [POST /recipes](recipes.md#post-recipes)
|
9
|
+
* [spec/requests/admin/entries.md](spec/requests/admin/entries.md)
|
10
|
+
* [GET /admin/entries](spec/requests/admin/entries.md#get-adminentries)
|
11
|
+
* [spec/requests/entries.md](spec/requests/entries.md)
|
12
|
+
* [GET /entries](spec/requests/entries.md#get-entries)
|
13
|
+
* [spec/requests/recipes.md](spec/requests/recipes.md)
|
14
|
+
* [GET /recipes/:id](spec/requests/recipes.md#get-recipesid)
|
15
|
+
* [POST /recipes](spec/requests/recipes.md#post-recipes)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autodoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: rails
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 4.2.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 4.2.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -163,6 +163,10 @@ files:
|
|
163
163
|
- spec/dummy/doc/admin/entries.md
|
164
164
|
- spec/dummy/doc/entries.md
|
165
165
|
- spec/dummy/doc/recipes.md
|
166
|
+
- spec/dummy/doc/spec/requests/admin/entries.md
|
167
|
+
- spec/dummy/doc/spec/requests/entries.md
|
168
|
+
- spec/dummy/doc/spec/requests/recipes.md
|
169
|
+
- spec/dummy/doc/toc.html
|
166
170
|
- spec/dummy/doc/toc.md
|
167
171
|
- spec/dummy/lib/assets/.gitkeep
|
168
172
|
- spec/dummy/log/.gitkeep
|
@@ -232,6 +236,10 @@ test_files:
|
|
232
236
|
- spec/dummy/doc/admin/entries.md
|
233
237
|
- spec/dummy/doc/entries.md
|
234
238
|
- spec/dummy/doc/recipes.md
|
239
|
+
- spec/dummy/doc/spec/requests/admin/entries.md
|
240
|
+
- spec/dummy/doc/spec/requests/entries.md
|
241
|
+
- spec/dummy/doc/spec/requests/recipes.md
|
242
|
+
- spec/dummy/doc/toc.html
|
235
243
|
- spec/dummy/doc/toc.md
|
236
244
|
- spec/dummy/lib/assets/.gitkeep
|
237
245
|
- spec/dummy/log/.gitkeep
|