documentation-zero 0.0.4 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.documentation_api/sections/posts.md +26 -20
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/documentation_zero/version.rb +1 -1
- data/lib/generators/documentation/scaffold/templates/resource.md.tt +24 -21
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96f1e943d71e91ceb6caa7cba651a86e3f93e70c5ac1d2e27bd0498fd9d2a853
|
4
|
+
data.tar.gz: fff3f3e4acf8c71edff06491824431a1c71ccb660355aea8b79eb39c3a824f58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96e451239ab9a7ae56c792d0901a1c22128983273dc1a827a2f26b236b573a10e38565ebec7a7510161b1b1e108f7e99b8c9cedf22bb59995422a88febd721bd
|
7
|
+
data.tar.gz: 4778a6f4796e2d59f244a2af8982b3512136276c7d4b829990fc13d74e5b89f08631a2f35f97247324a4c0d7c0297cb954943f259d6910611956db83068c4939
|
@@ -8,6 +8,10 @@ Endpoints:
|
|
8
8
|
- [Update post](#update-post)
|
9
9
|
- [Delete post](#delete-post)
|
10
10
|
|
11
|
+
Models:
|
12
|
+
|
13
|
+
- [Post model](#post-model)
|
14
|
+
|
11
15
|
## Get posts
|
12
16
|
|
13
17
|
- `GET /posts.json` will return a [paginated list](../README.md#pagination) of posts.
|
@@ -15,49 +19,47 @@ Endpoints:
|
|
15
19
|
<!--
|
16
20
|
_Optional query parameters_:
|
17
21
|
|
18
|
-
* `attribute1` - when set to true, will only return resources that
|
19
|
-
* `attribute2` - when set to true, will only return resources that
|
22
|
+
* `attribute1` - when set to true, will only return resources that...
|
23
|
+
* `attribute2` - when set to true, will only return resources that...
|
20
24
|
-->
|
21
25
|
|
22
|
-
See the [
|
26
|
+
See the [Post model](#post-model) for more info on the response payload.
|
23
27
|
|
24
28
|
## Get post
|
25
29
|
|
26
30
|
- `GET /posts/1.json` will return the post with an ID of `1`.
|
27
31
|
|
28
|
-
See the [
|
32
|
+
See the [Post model](#post-model) for more info on the response payload.
|
29
33
|
|
30
34
|
## Create post
|
31
35
|
|
32
36
|
- `POST /posts.json` creates post.
|
33
37
|
|
34
38
|
<!--
|
35
|
-
**Required parameters**:
|
39
|
+
**Required parameters**:
|
40
|
+
|
41
|
+
* `title` - title of the post.
|
42
|
+
* `content` - content of the post.
|
43
|
+
* `published` - published of the post.
|
44
|
+
* `user_id` - user of the post.
|
36
45
|
-->
|
37
46
|
|
38
47
|
_Optional parameters_:
|
39
48
|
|
40
|
-
* `title` -
|
41
|
-
* `content` -
|
42
|
-
* `published` -
|
49
|
+
* `title` - title of the post.
|
50
|
+
* `content` - content of the post.
|
51
|
+
* `published` - published of the post.
|
52
|
+
* `user_id` - user of the post.
|
43
53
|
|
44
|
-
This endpoint will return `201 Created` with the current JSON representation of the post if the creation was a success. See the [
|
54
|
+
This endpoint will return `201 Created` with the current JSON representation of the post if the creation was a success. See the [Post model](#post-model) for more info on the payload.
|
45
55
|
|
46
56
|
## Update post
|
47
57
|
|
48
58
|
- `PUT /posts/1.json` allows changing the post with an ID of `1`.
|
49
59
|
|
50
|
-
|
51
|
-
|
52
|
-
<!--
|
53
|
-
**Required parameters**: `attribute1` and `attribute2`.
|
54
|
-
-->
|
55
|
-
|
56
|
-
_Optional parameters_:
|
60
|
+
You may change any of the required or optional parameters as listed in the [create post](#create-post) endpoint.
|
57
61
|
|
58
|
-
|
59
|
-
* `content` - attribute from post.
|
60
|
-
* `published` - attribute from post.
|
62
|
+
This endpoint will return `200 OK` with the current JSON representation of the post if the update was a success. See the [Post model](#post-model) for more info on the payload.
|
61
63
|
|
62
64
|
## Delete post
|
63
65
|
|
@@ -67,11 +69,15 @@ This endpoint will return `204 No Content` if successful. No parameters are requ
|
|
67
69
|
|
68
70
|
---
|
69
71
|
|
70
|
-
##
|
72
|
+
## Models
|
73
|
+
|
74
|
+
###### Post model
|
75
|
+
|
71
76
|
```json
|
72
77
|
{
|
73
78
|
"title": "string",
|
74
79
|
"content": "string",
|
75
80
|
"published": "boolean",
|
81
|
+
"user": "users.md#user-model",
|
76
82
|
}
|
77
83
|
```
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@ The purpose of documentation zero is to generate a scaffold for rails api docume
|
|
4
4
|
|
5
5
|
## Example
|
6
6
|
|
7
|
-
You can see an example of the generated documentation [here](.documentation_api/README.md)
|
7
|
+
You can see an example of the generated documentation [here](.documentation_api/README.md).
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -21,7 +21,7 @@ rails generate documentation:readme
|
|
21
21
|
```
|
22
22
|
|
23
23
|
```
|
24
|
-
rails generate documentation:scaffold posts title:string body:text published:boolean
|
24
|
+
rails generate documentation:scaffold posts title:string body:text published:boolean user:references
|
25
25
|
```
|
26
26
|
|
27
27
|
Add ```- [Posts](sections/posts.md)``` to API endpoints section.
|
@@ -8,6 +8,10 @@ Endpoints:
|
|
8
8
|
- [Update <%= human_name.downcase %>](#update-<%= singular_name.dasherize %>)
|
9
9
|
- [Delete <%= human_name.downcase %>](#delete-<%= singular_name.dasherize %>)
|
10
10
|
|
11
|
+
Models:
|
12
|
+
|
13
|
+
- [<%= class_name %> model](#<%= singular_name.dasherize %>-model)
|
14
|
+
|
11
15
|
## Get <%= human_name.pluralize.downcase %>
|
12
16
|
|
13
17
|
- `GET /<%= plural_name %>.json` will return a [paginated list](../README.md#pagination) of <%= human_name.pluralize.downcase %>.
|
@@ -15,49 +19,45 @@ Endpoints:
|
|
15
19
|
<!--
|
16
20
|
_Optional query parameters_:
|
17
21
|
|
18
|
-
* `attribute1` - when set to true, will only return resources that
|
19
|
-
* `attribute2` - when set to true, will only return resources that
|
22
|
+
* `attribute1` - when set to true, will only return resources that...
|
23
|
+
* `attribute2` - when set to true, will only return resources that...
|
20
24
|
-->
|
21
25
|
|
22
|
-
See the [<%=
|
26
|
+
See the [<%= class_name %> model](#<%= class_name.downcase %>-model) for more info on the response payload.
|
23
27
|
|
24
28
|
## Get <%= human_name.downcase %>
|
25
29
|
|
26
30
|
- `GET /<%= plural_name %>/1.json` will return the <%= human_name.downcase %> with an ID of `1`.
|
27
31
|
|
28
|
-
See the [<%=
|
32
|
+
See the [<%= class_name %> model](#<%= class_name.downcase %>-model) for more info on the response payload.
|
29
33
|
|
30
34
|
## Create <%= human_name.downcase %>
|
31
35
|
|
32
36
|
- `POST /<%= plural_name %>.json` creates <%= human_name.downcase %>.
|
33
37
|
|
34
38
|
<!--
|
35
|
-
**Required parameters**:
|
39
|
+
**Required parameters**:
|
40
|
+
|
41
|
+
<% attributes.each do |attribute| -%>
|
42
|
+
* `<%= attribute.column_name %>` - <%= attribute.name.humanize(capitalize: false) %> of the <%= human_name.downcase %>.
|
43
|
+
<% end -%>
|
36
44
|
-->
|
37
45
|
|
38
46
|
_Optional parameters_:
|
39
47
|
|
40
48
|
<% attributes.each do |attribute| -%>
|
41
|
-
* `<%= attribute.column_name %>` - attribute
|
49
|
+
* `<%= attribute.column_name %>` - <%= attribute.name.humanize(capitalize: false) %> of the <%= human_name.downcase %>.
|
42
50
|
<% end -%>
|
43
51
|
|
44
|
-
This endpoint will return `201 Created` with the current JSON representation of the <%= human_name.downcase %> if the creation was a success. See the [<%=
|
52
|
+
This endpoint will return `201 Created` with the current JSON representation of the <%= human_name.downcase %> if the creation was a success. See the [<%= class_name %> model](#<%= class_name.downcase %>-model) for more info on the payload.
|
45
53
|
|
46
54
|
## Update <%= human_name.downcase %>
|
47
55
|
|
48
56
|
- `PUT /<%= plural_name %>/1.json` allows changing the <%= human_name.downcase %> with an ID of `1`.
|
49
57
|
|
50
|
-
|
58
|
+
You may change any of the required or optional parameters as listed in the [create <%= human_name.downcase %>](#create-<%= singular_name.dasherize %>) endpoint.
|
51
59
|
|
52
|
-
|
53
|
-
**Required parameters**: `attribute1` and `attribute2`.
|
54
|
-
-->
|
55
|
-
|
56
|
-
_Optional parameters_:
|
57
|
-
|
58
|
-
<% attributes_names.each do |attribute| -%>
|
59
|
-
* `<%= attribute %>` - attribute from <%= human_name.downcase %>.
|
60
|
-
<% end -%>
|
60
|
+
This endpoint will return `200 OK` with the current JSON representation of the <%= human_name.downcase %> if the update was a success. See the [<%= class_name %> model](#<%= class_name.downcase %>-model) for more info on the payload.
|
61
61
|
|
62
62
|
## Delete <%= human_name.downcase %>
|
63
63
|
|
@@ -67,18 +67,21 @@ This endpoint will return `204 No Content` if successful. No parameters are requ
|
|
67
67
|
|
68
68
|
---
|
69
69
|
|
70
|
-
##
|
70
|
+
## Models
|
71
|
+
|
72
|
+
###### <%= class_name %> model
|
73
|
+
|
71
74
|
```json
|
72
75
|
{
|
73
76
|
<% attributes.each do |attribute| -%>
|
74
77
|
<% if attribute.password_digest? -%>
|
75
78
|
"password_digest": "string",
|
76
79
|
<% elsif attribute.token? -%>
|
77
|
-
"<%= attribute.
|
80
|
+
"<%= attribute.name %>": "string",
|
78
81
|
<% elsif attribute.reference? -%>
|
79
|
-
"<%= attribute.
|
82
|
+
"<%= attribute.name %>": "<%= attribute.name.pluralize %>.md#<%= attribute.name.dasherize %>-model",
|
80
83
|
<% elsif !attribute.virtual? -%>
|
81
|
-
"<%= attribute.
|
84
|
+
"<%= attribute.name %>": "<%= attribute.type %>",
|
82
85
|
<% end -%>
|
83
86
|
<% end -%>
|
84
87
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: documentation-zero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nixon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|