banana_docs 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +99 -2
- data/banana_docs.gemspec +5 -2
- data/lib/banana_docs/helpers.rb +4 -0
- data/lib/banana_docs/version.rb +1 -1
- metadata +4 -3
data/README.md
CHANGED
@@ -16,8 +16,105 @@ Or install it yourself as:
|
|
16
16
|
|
17
17
|
$ gem install banana_docs
|
18
18
|
|
19
|
-
## Usage
|
19
|
+
## Usage()
|
20
20
|
|
21
21
|
After install the gem in your project, by terminal execute:
|
22
22
|
|
23
|
-
$ banana
|
23
|
+
$ banana doc/main.slim public/documentation
|
24
|
+
|
25
|
+
Open the file: doc/index.html and write your documentation, using gem helpers, and then run the command:
|
26
|
+
|
27
|
+
$ banana doc/main.slim
|
28
|
+
|
29
|
+
This will generate documentation.
|
30
|
+
|
31
|
+
|
32
|
+
## Helpers
|
33
|
+
|
34
|
+
To create a new section in documentation:
|
35
|
+
|
36
|
+
> section(name)
|
37
|
+
```ruby
|
38
|
+
= section 'Publishing new books'
|
39
|
+
```
|
40
|
+
|
41
|
+
To inform what this action do, your URL and METHOD:
|
42
|
+
|
43
|
+
> action(title, options)
|
44
|
+
```ruby
|
45
|
+
= action 'Publish new book', method: 'GET', url: '/some/url/path'
|
46
|
+
```
|
47
|
+
|
48
|
+
To add a table with params to send to API:
|
49
|
+
|
50
|
+
> params(&block)
|
51
|
+
```ruby
|
52
|
+
= params
|
53
|
+
= [...]
|
54
|
+
```
|
55
|
+
|
56
|
+
Inside the ``params`` method, you need to add some ``param`` helpers to build the table:
|
57
|
+
|
58
|
+
> param(name, description, type, format, options = {})
|
59
|
+
```ruby
|
60
|
+
= params
|
61
|
+
= param :name, 'Name of Book', :string, 'Just String', { required: false/true, obs: 'Here goes the description' }
|
62
|
+
```
|
63
|
+
|
64
|
+
Showing response:
|
65
|
+
|
66
|
+
> response(&block)
|
67
|
+
```ruby
|
68
|
+
= response
|
69
|
+
= [...]
|
70
|
+
```
|
71
|
+
|
72
|
+
To use a blockquote to inform some observation about an action:
|
73
|
+
|
74
|
+
> note(text)
|
75
|
+
```ruby
|
76
|
+
= response
|
77
|
+
= note 'Here some observarion about an action :P'
|
78
|
+
```
|
79
|
+
|
80
|
+
To informe the status code for response:
|
81
|
+
|
82
|
+
> status_code(status) (200, 400 or 404)
|
83
|
+
```ruby
|
84
|
+
= response
|
85
|
+
= status_code '200'
|
86
|
+
```
|
87
|
+
|
88
|
+
To show up how the code will be returned:
|
89
|
+
> code(&block)
|
90
|
+
```ruby
|
91
|
+
= response
|
92
|
+
= code
|
93
|
+
= [...]
|
94
|
+
```
|
95
|
+
|
96
|
+
To Build and Hash for response:
|
97
|
+
> key_with_block(name, &block)
|
98
|
+
```ruby
|
99
|
+
= response
|
100
|
+
= code
|
101
|
+
= key_with_block 'errors'
|
102
|
+
```
|
103
|
+
|
104
|
+
To add keys and values to hash returned for response:
|
105
|
+
> key_value(key, value, show_keys = true)
|
106
|
+
```ruby
|
107
|
+
= response
|
108
|
+
= code
|
109
|
+
= key_with_block 'errors'
|
110
|
+
= key_value 'attribute', '["error_type"]', false/true
|
111
|
+
|
112
|
+
When some empty Array is returned from response:
|
113
|
+
> empty
|
114
|
+
```ruby
|
115
|
+
= response
|
116
|
+
= status_code '200'
|
117
|
+
= code
|
118
|
+
= key_with_block 'addresses'
|
119
|
+
= empty
|
120
|
+
```
|
data/banana_docs.gemspec
CHANGED
@@ -9,8 +9,11 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Luiz Cezer", "Carlos Fonseca"]
|
10
10
|
spec.email = ["lccezinha@gmail.com", "carlos.fonseca@a2c.com.br"]
|
11
11
|
spec.description = %q{Simple gem to build documentation for CDA-API}
|
12
|
-
spec.summary = %q{
|
13
|
-
|
12
|
+
spec.summary = %q{
|
13
|
+
Gem used to provide a simple and nice way to write documentations for API applications.
|
14
|
+
This gem is not a generic gem, for while, it's specific for CDA-API project :(.
|
15
|
+
}
|
16
|
+
spec.homepage = "https://github.com/lccezinha/banana_docs"
|
14
17
|
spec.license = "MIT"
|
15
18
|
|
16
19
|
spec.files = `git ls-files`.split($/)
|
data/lib/banana_docs/helpers.rb
CHANGED
data/lib/banana_docs/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: banana_docs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -139,7 +139,7 @@ files:
|
|
139
139
|
- lib/banana_docs/version.rb
|
140
140
|
- spec/helpers_spec.rb
|
141
141
|
- views/assets.slim
|
142
|
-
homepage:
|
142
|
+
homepage: https://github.com/lccezinha/banana_docs
|
143
143
|
licenses:
|
144
144
|
- MIT
|
145
145
|
post_install_message:
|
@@ -164,6 +164,7 @@ rubygems_version: 1.8.25
|
|
164
164
|
signing_key:
|
165
165
|
specification_version: 3
|
166
166
|
summary: Gem used to provide a simple and nice way to write documentations for API
|
167
|
-
applications
|
167
|
+
applications. This gem is not a generic gem, for while, it's specific for CDA-API
|
168
|
+
project :(.
|
168
169
|
test_files:
|
169
170
|
- spec/helpers_spec.rb
|