documentation-zero 0.0.5 → 0.0.8
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 +31 -26
- 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 +26 -26
- 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: ff0cfd8d7c31a648ac6ffb886529c5dbc3b52ec4b23cb5edff680332d6196823
|
4
|
+
data.tar.gz: 3e2452da26d4e5cdc39a86e94a0ce654becfc4e1e518512c16401caf57c737d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dda90a920a2e861c89419c0a8805eded8016f7f2944d7d5e276b6e60dcb3bd52f041aa7a7b5002a3adbb0e62a2711ad60abfd02d8cc9f4c1290800675b523fc
|
7
|
+
data.tar.gz: 3e3c0f3b5a7608f19d4606ef1d52b51518b82871891bb616716f4f68409c03c2f35c73fcf9246f0e27b402fd73c4ad7accfa6a31b095795f28f938d2a1780010
|
@@ -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,12 +69,15 @@ This endpoint will return `204 No Content` if successful. No parameters are requ
|
|
67
69
|
|
68
70
|
---
|
69
71
|
|
70
|
-
##
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
72
|
+
## Models
|
73
|
+
|
74
|
+
###### Post model
|
75
|
+
|
76
|
+
```json
|
77
|
+
{
|
78
|
+
"title": "string",
|
79
|
+
"content": "string",
|
80
|
+
"published": "boolean",
|
81
|
+
"user": "references",
|
77
82
|
}
|
78
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,19 +67,19 @@ This endpoint will return `204 No Content` if successful. No parameters are requ
|
|
67
67
|
|
68
68
|
---
|
69
69
|
|
70
|
-
##
|
71
|
-
|
72
|
-
|
73
|
-
|
70
|
+
## Models
|
71
|
+
|
72
|
+
###### <%= class_name %> model
|
73
|
+
|
74
|
+
```json
|
75
|
+
{
|
74
76
|
<% attributes.each do |attribute| -%>
|
75
77
|
<% if attribute.password_digest? -%>
|
76
|
-
string
|
78
|
+
"password_digest": "string",
|
77
79
|
<% elsif attribute.token? -%>
|
78
|
-
|
79
|
-
<% elsif attribute.reference? -%>
|
80
|
-
integer <%= attribute.column_name %>
|
80
|
+
"<%= attribute.name %>": "string",
|
81
81
|
<% elsif !attribute.virtual? -%>
|
82
|
-
<%= attribute.
|
82
|
+
"<%= attribute.name %>": "<%= attribute.type %>",
|
83
83
|
<% end -%>
|
84
84
|
<% end -%>
|
85
85
|
}
|
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.8
|
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:
|