rails_api_documentation 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bdf183cc6b6c0fda395a7562bc1d114b87bb1478
4
- data.tar.gz: 6dd2a3f83b5cac67029bc216d87ab76d14db884b
3
+ metadata.gz: 7536a83956fb84f99bafaaedd7b342bb31e55452
4
+ data.tar.gz: 4cfb6323f7122a800f0bc20672fddd4038819141
5
5
  SHA512:
6
- metadata.gz: 1394d326673eab65074575a2de2ea16801c8c8f406302f06e7197e325131a5271b38636ca5ba3afc0816a7a56f1980d0ae52287593cef52218a44207310a11fd
7
- data.tar.gz: 2a8b66d882789e7d4fd81aa40b8bed53dda409c67a375d00dc0bc6cd86401cd4df5c339bb7aa505b789b64fdf7a4b01b86b6f859d7eb517d50ac8090e3dbf01c
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
- TODO: Delete this and the text above, and describe your gem
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
- TODO: Write usage instructions here
22
+ To display api documentation on route '/api_doc' you need to:
26
23
 
27
- ## Development
24
+ 1. config/routes.rb ->
25
+ ```ruby
26
+ mount RailsApiDoc::Engine => '/api_doc'
27
+ ```
28
28
 
29
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
29
+ 2. define request parameters. Example:
30
+ ```ruby
31
+ class AuthorsController < ApplicationController
30
32
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
33
+ has_scope :article_id, :name
32
34
 
33
- ## Contributing
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
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rails_api_doc. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
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)
@@ -5,7 +5,6 @@ require 'action_view'
5
5
  require 'jquery-rails'
6
6
  require 'slim'
7
7
 
8
- require_relative 'types'
9
8
  require_relative 'controller'
10
9
  require_relative 'controller/strong_params'
11
10
  require_relative 'controller/attribute_parser'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  # author: Vadim Shaveiko <@vshaveyko>
3
3
  module RailsApiDoc
4
- VERSION = '0.1.6'
4
+ VERSION = '0.1.7'
5
5
  end
data/lib/rails_api_doc.rb CHANGED
@@ -26,3 +26,7 @@ end
26
26
 
27
27
  require 'rails_api_doc/version'
28
28
  require 'rails_api_doc/engine'
29
+
30
+ # constant for defining in controllers
31
+ class Bool
32
+ end
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.6
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:
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
- # author: Vadim Shaveiko <@vshaveyko>
3
- class RailsApiDoc::Types
4
-
5
- ACCEPTED_TYPES = [String, Integer, Object, Array, :enum].freeze
6
-
7
- end