rails_api_documentation 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +30 -11
- data/lib/rails_api_doc/controller/parameter/repository/param.rb +1 -1
- data/lib/rails_api_doc/engine.rb +0 -1
- data/lib/rails_api_doc/version.rb +1 -1
- data/lib/rails_api_doc.rb +4 -0
- metadata +1 -2
- data/lib/rails_api_doc/types.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7536a83956fb84f99bafaaedd7b342bb31e55452
|
4
|
+
data.tar.gz: 4cfb6323f7122a800f0bc20672fddd4038819141
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99461d810397dea52c9f97712a0d616461bc299d45ebbc72fbfc09cbf260f9be69d12a021dff392adc6164eb9a0e70f4f2d12c5c3eb16a31047106cbf033c5af
|
7
|
+
data.tar.gz: cb592b3ef29c0c8c704e4795a02d481935c8f996062c4b4dbb2be51ddae9b043a54e7c9f3e4001a0dab9a06f101bc6bd9efeea1dcad470f0ea219c5f29caa4f1
|
data/README.md
CHANGED
@@ -1,8 +1,5 @@
|
|
1
|
-
# RailsApiDoc
|
2
|
-
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rails_api_doc`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
1
|
|
5
|
-
|
2
|
+
# RailsApiDoc
|
6
3
|
|
7
4
|
## Installation
|
8
5
|
|
@@ -22,20 +19,42 @@ Or install it yourself as:
|
|
22
19
|
|
23
20
|
## Usage
|
24
21
|
|
25
|
-
|
22
|
+
To display api documentation on route '/api_doc' you need to:
|
26
23
|
|
27
|
-
|
24
|
+
1. config/routes.rb ->
|
25
|
+
```ruby
|
26
|
+
mount RailsApiDoc::Engine => '/api_doc'
|
27
|
+
```
|
28
28
|
|
29
|
-
|
29
|
+
2. define request parameters. Example:
|
30
|
+
```ruby
|
31
|
+
class AuthorsController < ApplicationController
|
30
32
|
|
31
|
-
|
33
|
+
has_scope :article_id, :name
|
32
34
|
|
33
|
-
|
35
|
+
# Define parameters with type and nested options
|
36
|
+
parameter :age, type: Integer
|
37
|
+
parameter :name, type: String, required: true
|
38
|
+
parameter :articles, type: :model, model: Article do
|
39
|
+
parameter :title, type: String
|
40
|
+
parameter :body, type: String, required: true
|
41
|
+
parameter :rating, type: :enum, enum: [1, 2, 3]
|
42
|
+
parameter :data, type: :model, model: Datum do
|
43
|
+
parameter :creation_date, type: DateTime
|
44
|
+
parameter :comment, type: String
|
45
|
+
end
|
46
|
+
end
|
47
|
+
parameter :test, type: String, required: true
|
34
48
|
|
35
|
-
|
49
|
+
end
|
50
|
+
```
|
36
51
|
|
52
|
+
Parameter type may be one of these:
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
ACCEPTED_TYPES = [Bool, String, Integer, Object, Array, DateTime, :enum, :model].freeze
|
56
|
+
```
|
37
57
|
|
38
58
|
## License
|
39
59
|
|
40
60
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
-
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# author: Vadim Shaveiko <@vshaveyko>
|
3
3
|
class RailsApiDoc::Controller::Parameter::Repository::Param
|
4
4
|
|
5
|
-
ACCEPTED_TYPES = [String, Integer, Object, Array, DateTime, :enum, :model].freeze
|
5
|
+
ACCEPTED_TYPES = [Bool, String, Integer, Object, Array, DateTime, :enum, :model].freeze
|
6
6
|
|
7
7
|
# @type - type to check
|
8
8
|
def self.accepted_nested_type?(type)
|
data/lib/rails_api_doc/engine.rb
CHANGED
data/lib/rails_api_doc.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_api_documentation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vs
|
@@ -170,7 +170,6 @@ files:
|
|
170
170
|
- lib/rails_api_doc/controller/response_factory.rb
|
171
171
|
- lib/rails_api_doc/controller/strong_params.rb
|
172
172
|
- lib/rails_api_doc/engine.rb
|
173
|
-
- lib/rails_api_doc/types.rb
|
174
173
|
- lib/rails_api_doc/version.rb
|
175
174
|
homepage: https://github.com/vshaveyko/rails_api_doc
|
176
175
|
licenses:
|