documentation-zero 0.0.8 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.documentation_api/README.md +7 -0
- data/.documentation_api/sections/posts.md +3 -1
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/documentation_zero/version.rb +1 -1
- data/lib/generators/documentation/readme/templates/README.md.tt +7 -0
- data/lib/generators/documentation/scaffold/scaffold_generator.rb +3 -0
- data/lib/generators/documentation/scaffold/templates/resource.md.tt +8 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97fbe4b0c16b2f7245a7b77979114e7256aca1a38dae972ce1b05a5988bcaec5
|
4
|
+
data.tar.gz: e950699801c5933f0ed88c7e06dd48a4a350a71cac814c47e4a0f17277d8dc72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5641ab04a82885b693163a82e1442565cf374114b86e152e5e7b2b5839d358392d02ecaf2944390ad60d53bd3710cf171e67bce5b34b1a2361eb5b612dbb430f
|
7
|
+
data.tar.gz: f8405a25a46cbcab6f798a6fb4ccde933d7fda7cba89acce00a2846d5aa778a03e9ca4b0d5b7658fae51542e81ee1884e7a1a78f47586627149aed59666fa7e4
|
@@ -12,6 +12,10 @@ To make a request for all the resources on your account, append the `resources`
|
|
12
12
|
curl -H "Authorization: Bearer $ACCESS_TOKEN" -H 'User-Agent: MyApp (yourname@example.com)' https://example.com/api/resources.json
|
13
13
|
```
|
14
14
|
|
15
|
+
## Authentication
|
16
|
+
|
17
|
+
Describe your authentication here.
|
18
|
+
|
15
19
|
## Identifying your application
|
16
20
|
|
17
21
|
You must include a `User-Agent` header with **both**:
|
@@ -64,6 +68,9 @@ If Rails tabler is having trouble, you will get a response with a 5xx status cod
|
|
64
68
|
|
65
69
|
API requests may 404 due to deleted content, an inactive account, missing user permissions, etc. Detect these conditions to give your users a clear explanation about why they can't connect to Rails tabler. Do not automatically retry these requests.
|
66
70
|
|
71
|
+
* Inactive account. 404 Not Found response with a `Reason: Account Inactive` header. Due to an expired trial or account suspension. All API requests to an inactive account will fail, so we recommend detecting and disabling the account in your integration as well.
|
72
|
+
* Inaccessible items. 404 Not Found response. Due to a deleted item or insufficient permissions.
|
73
|
+
|
67
74
|
## API endpoints
|
68
75
|
|
69
76
|
<!-- START API ENDPOINTS -->
|
@@ -78,6 +78,8 @@ This endpoint will return `204 No Content` if successful. No parameters are requ
|
|
78
78
|
"title": "string",
|
79
79
|
"content": "string",
|
80
80
|
"published": "boolean",
|
81
|
-
"
|
81
|
+
"user_id": "integer",
|
82
|
+
"created_at": "datetime",
|
83
|
+
"updated_at": "datetime"
|
82
84
|
}
|
83
85
|
```
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -24,7 +24,7 @@ rails generate documentation:readme
|
|
24
24
|
rails generate documentation:scaffold posts title:string body:text published:boolean user:references
|
25
25
|
```
|
26
26
|
|
27
|
-
Add
|
27
|
+
Add `- [Posts](sections/posts.md)` to API endpoints section.
|
28
28
|
|
29
29
|
## Development
|
30
30
|
|
@@ -12,6 +12,10 @@ To make a request for all the resources on your account, append the `resources`
|
|
12
12
|
curl -H "Authorization: Bearer $ACCESS_TOKEN" -H 'User-Agent: MyApp (yourname@example.com)' https://example.com/api/resources.json
|
13
13
|
```
|
14
14
|
|
15
|
+
## Authentication
|
16
|
+
|
17
|
+
Describe your authentication here.
|
18
|
+
|
15
19
|
## Identifying your application
|
16
20
|
|
17
21
|
You must include a `User-Agent` header with **both**:
|
@@ -64,6 +68,9 @@ If <%= application_name.humanize %> is having trouble, you will get a response w
|
|
64
68
|
|
65
69
|
API requests may 404 due to deleted content, an inactive account, missing user permissions, etc. Detect these conditions to give your users a clear explanation about why they can't connect to <%= application_name.humanize %>. Do not automatically retry these requests.
|
66
70
|
|
71
|
+
* Inactive account. 404 Not Found response with a `Reason: Account Inactive` header. Due to an expired trial or account suspension. All API requests to an inactive account will fail, so we recommend detecting and disabling the account in your integration as well.
|
72
|
+
* Inaccessible items. 404 Not Found response. Due to a deleted item or insufficient permissions.
|
73
|
+
|
67
74
|
## API endpoints
|
68
75
|
|
69
76
|
<!-- START API ENDPOINTS -->
|
@@ -2,6 +2,9 @@ module Documentation
|
|
2
2
|
module Generators
|
3
3
|
class ScaffoldGenerator < Rails::Generators::NamedBase
|
4
4
|
argument :attributes, type: :array, default: [], banner: "field:type field:type"
|
5
|
+
|
6
|
+
class_option :timestamps, type: :boolean, default: true
|
7
|
+
|
5
8
|
source_root File.expand_path("templates", __dir__)
|
6
9
|
|
7
10
|
def copy_files
|
@@ -77,10 +77,16 @@ This endpoint will return `204 No Content` if successful. No parameters are requ
|
|
77
77
|
<% if attribute.password_digest? -%>
|
78
78
|
"password_digest": "string",
|
79
79
|
<% elsif attribute.token? -%>
|
80
|
-
"<%= attribute.
|
80
|
+
"<%= attribute.column_name %>": "string",
|
81
|
+
<% elsif attribute.reference? -%>
|
82
|
+
"<%= attribute.column_name %>": "integer",
|
81
83
|
<% elsif !attribute.virtual? -%>
|
82
|
-
"<%= attribute.
|
84
|
+
"<%= attribute.column_name %>": "<%= attribute.type %>",
|
83
85
|
<% end -%>
|
84
86
|
<% end -%>
|
87
|
+
<% if options.timestamps? -%>
|
88
|
+
"created_at": "datetime",
|
89
|
+
"updated_at": "datetime"
|
90
|
+
<% end -%>
|
85
91
|
}
|
86
92
|
```
|