api_yard_parser 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NWMwNDkzNDQ5ZWI2MDEwOTIxYjYxZTQyZWQ1ZGNjMGI5ZTAzZDJjNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZWNhZTA3ZTM4ZGFiZWQ4NTdhZTQzMTM2OWQ0ZjhhMjA0ZDFlYjhkYQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjA2OTM4MjZiYzE1ZmYwZDU0YTQwODI2YzljNjQ2MTMwMzZlYmQ2YjczNjcx
|
10
|
+
NjI3MDhkZjIwOTc0Yjc3NWY1ZDI1ZDAzNmQzZWE0OTEyZmQ3ODI3ODA2NDU5
|
11
|
+
NGI4M2ZhNDY5NGIzZTY1YTU2NDc0ZjFhY2ZlODY5YmQ3MWFjOTk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDgzZGViZmNlOTBmZDNlYThhNWIxMTllNDZmN2ViZmM4Yzg1OWE4N2FkMjIz
|
14
|
+
NWMzMTczZTc4ZjY4OTMzYzNiMDI0YmI4ODBkMWEwM2MyMzFiMmExZDliNzAw
|
15
|
+
YmZkZWE4MzVjYjhhNDgxZjYyNzNmYjc4Zjc4ZjI3MTQzYTNiZWY=
|
data/README.rdoc
CHANGED
@@ -2,13 +2,78 @@
|
|
2
2
|
|
3
3
|
This project rocks and uses MIT-LICENSE.
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
Developed in Locaweb by Thiago Coutinho.
|
6
|
+
www.locaweb.com.br
|
7
|
+
|
8
|
+
=== 1. REQUIREMENTS
|
9
|
+
|
7
10
|
|
8
11
|
Ruby/ApiYardParser requires Ruby version 1.9.1 or newer and Rails ~> 3.2.16.
|
9
12
|
|
10
|
-
2. INSTALLATION
|
11
|
-
|
13
|
+
=== 2. INSTALLATION
|
14
|
+
|
15
|
+
Add to Gemfile:
|
16
|
+
|
17
|
+
gem 'api_yard_parser'
|
18
|
+
|
19
|
+
After... in prompt...
|
20
|
+
|
21
|
+
bundle install
|
22
|
+
|
23
|
+
Try....
|
24
|
+
|
25
|
+
http://localhost:XXXX/docs
|
26
|
+
|
27
|
+
=== 3. Examples
|
28
|
+
|
29
|
+
For your controller add the yard doc:
|
30
|
+
|
31
|
+
|
32
|
+
class ApiController < ApplicationController
|
33
|
+
|
34
|
+
# Infos of domain
|
35
|
+
# @note
|
36
|
+
# [ Receive parameters from GET]
|
37
|
+
# https://{APP_URL}/api/:domain
|
38
|
+
#
|
39
|
+
# @param [String] :domain => Domain name
|
40
|
+
# @return [JSON] Response HTTP 412 - Precondition Failed -> Parameters not valid
|
41
|
+
# @return [JSON] Response HTTP 500 - Internal error
|
42
|
+
# @return [JSON] Response HTTP 200 - Show -> Info of domain
|
43
|
+
#
|
44
|
+
# {
|
45
|
+
# "domain": "something.com",
|
46
|
+
# }
|
47
|
+
def infos
|
48
|
+
...
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
or......
|
55
|
+
|
56
|
+
|
57
|
+
class ApiController < ApplicationController
|
12
58
|
|
13
|
-
|
59
|
+
# Toggle status of alias from domain
|
60
|
+
# @type PUT
|
61
|
+
# @url https://:APP_URL/domains/:domain/toggle
|
62
|
+
#
|
63
|
+
# @param [String] domain -> Name of domain. Parameter in url
|
64
|
+
#
|
65
|
+
# @return [JSON] Response HTTP 201 - Ok -> Updated
|
66
|
+
#
|
67
|
+
# {
|
68
|
+
# "domain": "msf.com",
|
69
|
+
# "status": "enabled"
|
70
|
+
# }
|
71
|
+
#
|
72
|
+
# @return [JSON] Response HTTP 404 - Not Found -> Domain doesn't exists
|
73
|
+
# @return [JSON] Response HTTP 404 - Not Found -> Alias doesn't exists
|
74
|
+
# @return [JSON] Response HTTP 500 - Internal server error
|
75
|
+
def toggle_status
|
76
|
+
...
|
77
|
+
end
|
14
78
|
|
79
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module ApiYardParser
|
2
|
-
class ApiDocsController < ::
|
2
|
+
class ApiDocsController < ::ActionController::Base
|
3
3
|
|
4
4
|
def index
|
5
|
-
if Rails.env == "production" && ApiYardParser.
|
6
|
-
render :text => "
|
5
|
+
if Rails.env == "production" && ApiYardParser.no_docs_in_production
|
6
|
+
render :text => "no docs in production"
|
7
7
|
return true
|
8
8
|
end
|
9
9
|
@list_apis = ApiDocs.get_all
|
data/lib/api_yard_parser.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
require "active_support/dependencies"
|
3
3
|
|
4
4
|
module ApiYardParser
|
5
|
+
|
6
|
+
attr_accessor :no_docs_in_production
|
5
7
|
# %w(api_comment api_controllers ap_docs).each do |entity|
|
6
8
|
# require_relative "api_yard_parser/#{entity}"
|
7
9
|
# end
|
@@ -9,8 +11,8 @@ module ApiYardParser
|
|
9
11
|
require_relative "api_yard_parser/api_controllers"
|
10
12
|
require_relative "api_yard_parser/api_docs"
|
11
13
|
|
12
|
-
def
|
13
|
-
|
14
|
+
def no_docs_in_production
|
15
|
+
@no_docs_in_production || true
|
14
16
|
end
|
15
17
|
|
16
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_yard_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thiago Coutinho
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|