yard-rest-plugin 0.2.1 → 0.2.2
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.
- data/README.markdown +79 -4
- data/Rakefile +3 -2
- data/VERSION +1 -1
- data/example/SampleController.rb +54 -5
- data/lib/yard-rest-plugin.rb +5 -1
- data/templates/rest/tags/setup.rb +6 -1
- metadata +18 -41
- data/example/README.markdown +0 -11
- data/pkg/yard-rest-plugin-0.1.5.gem +0 -0
- data/pkg/yard-rest-plugin-0.2.0.gem +0 -0
- data/pkg/yard-rest-plugin-0.2.1.gem +0 -0
- data/templates/rest/.DS_Store +0 -0
- data/templates/rest/class/html/header.erb +0 -24
- data/templates/rest/class/html/method_details_list.erb +0 -6
- data/templates/rest/disqus/html/disqus.erb +0 -24
- data/templates/rest/docstring/html/text.erb +0 -1
- data/templates/rest/fulldoc/.DS_Store +0 -0
- data/templates/rest/fulldoc/html/.DS_Store +0 -0
- data/templates/rest/fulldoc/html/css/common.css +0 -1
- data/templates/rest/fulldoc/html/css/full_list.css +0 -78
- data/templates/rest/fulldoc/html/css/style.css +0 -235
- data/templates/rest/fulldoc/html/full_list.erb +0 -29
- data/templates/rest/fulldoc/html/full_list_files.erb +0 -5
- data/templates/rest/fulldoc/html/full_list_resource.erb +0 -8
- data/templates/rest/fulldoc/html/full_list_topic.erb +0 -12
- data/templates/rest/fulldoc/html/js/app.js +0 -42
- data/templates/rest/fulldoc/html/js/full_list.js +0 -117
- data/templates/rest/fulldoc/html/js/jquery.js +0 -19
- data/templates/rest/layout/html/footer.erb +0 -3
- data/templates/rest/layout/html/headers.erb +0 -13
- data/templates/rest/layout/html/index.erb +0 -55
- data/templates/rest/layout/html/layout.erb +0 -22
- data/templates/rest/layout/html/search.erb +0 -5
- data/templates/rest/method_details/html/header.erb +0 -3
- data/templates/rest/method_details/html/method_signature.erb +0 -7
- data/templates/rest/tags/html/example_response.erb +0 -9
- data/templates/rest/tags/html/generic_tag.erb +0 -17
- data/templates/rest/tags/html/index.erb +0 -3
- data/yard-rest-plugin.gemspec +0 -85
data/README.markdown
CHANGED
@@ -26,6 +26,10 @@ In addition to starting your comment with the normal RDoc description. The follo
|
|
26
26
|
- @argument [type] name description. Specifies an argument that is passed to the service. You can specify as
|
27
27
|
many of these as required
|
28
28
|
|
29
|
+
- @example_request example. An example of the request that is send to the service
|
30
|
+
|
31
|
+
- @request_field name description. Further specifies the fields that are send within the request
|
32
|
+
|
29
33
|
- @example_response example. An example of the response that is returned from the service
|
30
34
|
|
31
35
|
- @response_field name description. Further specifies the fields that are returned within the response
|
@@ -41,15 +45,29 @@ The rationale here is that you are documenting external services (as represented
|
|
41
45
|
##
|
42
46
|
# Retuns all samples, as XML, for the current user that match the given parameters.
|
43
47
|
#
|
44
|
-
# @url
|
45
|
-
# [GET] /samples/index.[format]?[arguments]
|
48
|
+
# @url [GET] /samples.[format]?[arguments]
|
49
|
+
# @url [GET] /samples/index.[format]?[arguments]
|
46
50
|
#
|
47
51
|
# @argument [String] format Only "xml" is support at this time.
|
48
52
|
# @argument [String] name The name of the sample
|
49
53
|
# @argument [String] reource The resource that sample belongs to
|
50
|
-
# @argument ["@assigned"|"@complete"|"!@complete"] search Return
|
54
|
+
# @argument ["@assigned"|"@complete"|"!@complete"] search Return samples that are assigned, complete, or
|
51
55
|
# uncomplete.
|
52
|
-
#
|
56
|
+
#
|
57
|
+
# @example_request
|
58
|
+
# <samples type="array">
|
59
|
+
# <sample>
|
60
|
+
# <id>961</id>
|
61
|
+
# <name>My Sample</name>
|
62
|
+
# <state>complete</state>
|
63
|
+
# <last_unassigned_user_id type="integer"></last_unassigned_user_id>
|
64
|
+
# <resource_id type="integer">127</resource_id>
|
65
|
+
# <notes></notes>
|
66
|
+
# <updated_at type="datetime">2010-03-09T20:43:29Z</updated_at>
|
67
|
+
# <created_at type="datetime">2010-03-09T20:43:16Z</created_at>
|
68
|
+
# </interval>
|
69
|
+
# <intervals>
|
70
|
+
#
|
53
71
|
# @example_response
|
54
72
|
# <samples type="array">
|
55
73
|
# <sample>
|
@@ -73,6 +91,63 @@ The rationale here is that you are documenting external services (as represented
|
|
73
91
|
#
|
74
92
|
def index
|
75
93
|
end
|
94
|
+
|
95
|
+
##
|
96
|
+
# Retuns all samples, as XML, for the current user that match the given parameters.
|
97
|
+
#
|
98
|
+
# @url [POST] /samples.[format]?[arguments]
|
99
|
+
#
|
100
|
+
# @argument [String] format Only "xml" is support at this time.
|
101
|
+
#
|
102
|
+
# @example_request
|
103
|
+
# <sample>
|
104
|
+
# <id>961</id>
|
105
|
+
# <name>My Sample</name>
|
106
|
+
# <state>complete</state>
|
107
|
+
# <last_unassigned_user_id type="integer"></last_unassigned_user_id>
|
108
|
+
# <resource_id type="integer">127</resource_id>
|
109
|
+
# <note_attributes type="array">
|
110
|
+
# <note>
|
111
|
+
# <id>new_123</id>
|
112
|
+
# <text>Note One</note>
|
113
|
+
# </note>
|
114
|
+
# </note_attributes>
|
115
|
+
# <updated_at type="datetime">2010-03-09T20:43:29Z</updated_at>
|
116
|
+
# <created_at type="datetime">2010-03-09T20:43:16Z</created_at>
|
117
|
+
# </sample>
|
118
|
+
#
|
119
|
+
# @request_field id A unique ID identifying the Sample
|
120
|
+
# @request_field name The name of the sample
|
121
|
+
# @request_field state The current status of the Sample. Can be complete, uncomplete, etc.
|
122
|
+
# @request_field note_attributes Any notes given for the sample that will be created
|
123
|
+
# @request_field updated_at The Date/Time (in ISO8601) that the Sample was last updated
|
124
|
+
# @request_field created_at The Date/Time (in ISO8601) that the Sample was created
|
125
|
+
#
|
126
|
+
# @example_response
|
127
|
+
# <sample>
|
128
|
+
# <id>961</id>
|
129
|
+
# <name>My Sample</name>
|
130
|
+
# <state>complete</state>
|
131
|
+
# <last_unassigned_user_id type="integer"></last_unassigned_user_id>
|
132
|
+
# <resource_id type="integer">127</resource_id>
|
133
|
+
# <notes type="array">
|
134
|
+
# <note>
|
135
|
+
# <text>Note One</note>
|
136
|
+
# </note>
|
137
|
+
# </notes>
|
138
|
+
# <updated_at type="datetime">2010-03-09T20:43:29Z</updated_at>
|
139
|
+
# <created_at type="datetime">2010-03-09T20:43:16Z</created_at>
|
140
|
+
# </sample>
|
141
|
+
#
|
142
|
+
# @response_field id A unique ID identifying the Sample
|
143
|
+
# @response_field name The name of the sample
|
144
|
+
# @response_field state The current status of the Sample. Can be complete, uncomplete, etc.
|
145
|
+
# @response_field notes Any notes given for the sample
|
146
|
+
# @response_field updated_at The Date/Time (in ISO8601) that the Sample was last updated
|
147
|
+
# @response_field created_at The Date/Time (in ISO8601) that the Sample was created
|
148
|
+
#
|
149
|
+
def create
|
150
|
+
end
|
76
151
|
|
77
152
|
## Development
|
78
153
|
|
data/Rakefile
CHANGED
@@ -10,7 +10,9 @@ begin
|
|
10
10
|
gem.email = "aisha.fenton@visfleet.com"
|
11
11
|
gem.homepage = "http://github.com/visfleet/yard-rest-plugin"
|
12
12
|
gem.authors = ["Aisha Fenton"]
|
13
|
-
gem.add_dependency("yard", '
|
13
|
+
gem.add_dependency("yard", '~>0.6.1')
|
14
|
+
gem.files = Dir.glob("{lib,example,templates/rest}/**/*.rb").concat(["Rakefile"])
|
15
|
+
gem.extra_rdoc_files = ['VERSION', 'README.markdown']
|
14
16
|
end
|
15
17
|
Jeweler::GemcutterTasks.new
|
16
18
|
rescue LoadError
|
@@ -28,5 +30,4 @@ namespace :ex do
|
|
28
30
|
`rm -R doc`
|
29
31
|
`rm -R .yardoc`
|
30
32
|
end
|
31
|
-
|
32
33
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/example/SampleController.rb
CHANGED
@@ -8,8 +8,8 @@ class SampleController
|
|
8
8
|
##
|
9
9
|
# Retuns all samples, as XML, for the current user that match the given parameters.
|
10
10
|
#
|
11
|
-
# @url
|
12
|
-
# [GET] /samples
|
11
|
+
# @url [GET] /samples/index.[format]?[arguments]
|
12
|
+
# @url [GET] /samples.[format]?[arguments]
|
13
13
|
#
|
14
14
|
# @argument [String] format Only "xml" is support at this time.
|
15
15
|
# @argument [String] name The name of the sample
|
@@ -48,10 +48,59 @@ class SampleController
|
|
48
48
|
end
|
49
49
|
|
50
50
|
##
|
51
|
-
# Creates a new
|
52
|
-
# @url [POST] /new
|
53
|
-
# @url [POST] /really_new
|
51
|
+
# Creates a new sample
|
54
52
|
#
|
53
|
+
# @url [POST] /samples.[format]?[arguments]
|
54
|
+
#
|
55
|
+
# @argument [String] format Only "xml" is support at this time.
|
56
|
+
#
|
57
|
+
# @example_request
|
58
|
+
# <sample>
|
59
|
+
# <id>961</id>
|
60
|
+
# <name>My Sample</name>
|
61
|
+
# <state>complete</state>
|
62
|
+
# <last_unassigned_user_id type="integer"></last_unassigned_user_id>
|
63
|
+
# <resource_id type="integer">127</resource_id>
|
64
|
+
# <note_attributes type="array">
|
65
|
+
# <note>
|
66
|
+
# <id>new_123</id>
|
67
|
+
# <text>Note One</note>
|
68
|
+
# </note>
|
69
|
+
# </note_attributes>
|
70
|
+
# <updated_at type="datetime">2010-03-09T20:43:29Z</updated_at>
|
71
|
+
# <created_at type="datetime">2010-03-09T20:43:16Z</created_at>
|
72
|
+
# </sample>
|
73
|
+
#
|
74
|
+
# @request_field id A unique ID identifying the Sample
|
75
|
+
# @request_field name The name of the sample
|
76
|
+
# @request_field state The current status of the Sample. Can be complete, uncomplete, etc.
|
77
|
+
# @request_field note_attributes Any notes given for the sample that will be created
|
78
|
+
# @request_field updated_at The Date/Time (in ISO8601) that the Sample was last updated
|
79
|
+
# @request_field created_at The Date/Time (in ISO8601) that the Sample was created
|
80
|
+
#
|
81
|
+
# @example_response
|
82
|
+
# <sample>
|
83
|
+
# <id>961</id>
|
84
|
+
# <name>My Sample</name>
|
85
|
+
# <state>complete</state>
|
86
|
+
# <last_unassigned_user_id type="integer"></last_unassigned_user_id>
|
87
|
+
# <resource_id type="integer">127</resource_id>
|
88
|
+
# <notes type="array">
|
89
|
+
# <note>
|
90
|
+
# <text>Note One</note>
|
91
|
+
# </note>
|
92
|
+
# </notes>
|
93
|
+
# <updated_at type="datetime">2010-03-09T20:43:29Z</updated_at>
|
94
|
+
# <created_at type="datetime">2010-03-09T20:43:16Z</created_at>
|
95
|
+
# </sample>
|
96
|
+
#
|
97
|
+
# @response_field id A unique ID identifying the Sample
|
98
|
+
# @response_field name The name of the sample
|
99
|
+
# @response_field state The current status of the Sample. Can be complete, uncomplete, etc.
|
100
|
+
# @response_field notes Any notes given for the sample
|
101
|
+
# @response_field updated_at The Date/Time (in ISO8601) that the Sample was last updated
|
102
|
+
# @response_field created_at The Date/Time (in ISO8601) that the Sample was created
|
103
|
+
#
|
55
104
|
def create
|
56
105
|
end
|
57
106
|
|
data/lib/yard-rest-plugin.rb
CHANGED
@@ -5,11 +5,15 @@ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
|
|
5
5
|
require "yard-rest-plugin/base_helper"
|
6
6
|
|
7
7
|
YARD::Templates::Engine.register_template_path File.dirname(__FILE__) + '/../templates'
|
8
|
+
# TODO: Check ruby version and support ruby 1.9 in future
|
9
|
+
YARD::Parser::SourceParser.parser_type = :ruby18
|
8
10
|
|
9
11
|
# Define custom tags
|
10
12
|
YARD::Tags::Library.define_tag("URL for Service", :url)
|
11
13
|
YARD::Tags::Library.define_tag("Topic for Service", :topic)
|
12
14
|
YARD::Tags::Library.define_tag("Arguments", :argument, :with_types_and_name)
|
13
|
-
YARD::Tags::Library.define_tag("Example
|
15
|
+
YARD::Tags::Library.define_tag("Example Request", :example_request)
|
16
|
+
YARD::Tags::Library.define_tag("Request Fields", :request_field, :with_name)
|
17
|
+
YARD::Tags::Library.define_tag("Example Response", :example_response)
|
14
18
|
YARD::Tags::Library.define_tag("Response Fields", :response_field, :with_name)
|
15
19
|
|
@@ -1,5 +1,10 @@
|
|
1
1
|
def init
|
2
|
-
|
2
|
+
super
|
3
|
+
sections.place([:argument, :example_request, :request_field, :example_response, :response_field]).before(:index)
|
4
|
+
end
|
5
|
+
|
6
|
+
def request_field
|
7
|
+
generic_tag :request_field
|
3
8
|
end
|
4
9
|
|
5
10
|
def response_field
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-rest-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Aisha Fenton
|
@@ -14,20 +15,23 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-11-08 00:00:00 +13:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: yard
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
|
-
- -
|
27
|
+
- - ~>
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 5
|
27
30
|
segments:
|
28
31
|
- 0
|
29
|
-
-
|
30
|
-
|
32
|
+
- 6
|
33
|
+
- 1
|
34
|
+
version: 0.6.1
|
31
35
|
type: :runtime
|
32
36
|
version_requirements: *id001
|
33
37
|
description: A plugin for Yardoc that produces API documentation for Restful web services. See README.markdown for more details
|
@@ -38,53 +42,22 @@ extensions: []
|
|
38
42
|
|
39
43
|
extra_rdoc_files:
|
40
44
|
- README.markdown
|
45
|
+
- VERSION
|
41
46
|
files:
|
42
|
-
- README.markdown
|
43
47
|
- Rakefile
|
44
|
-
- VERSION
|
45
|
-
- example/README.markdown
|
46
48
|
- example/SampleController.rb
|
47
49
|
- lib/yard-rest-plugin.rb
|
48
50
|
- lib/yard-rest-plugin/base_helper.rb
|
49
|
-
- pkg/yard-rest-plugin-0.1.5.gem
|
50
|
-
- pkg/yard-rest-plugin-0.2.0.gem
|
51
|
-
- pkg/yard-rest-plugin-0.2.1.gem
|
52
|
-
- templates/rest/.DS_Store
|
53
|
-
- templates/rest/class/html/header.erb
|
54
|
-
- templates/rest/class/html/method_details_list.erb
|
55
51
|
- templates/rest/class/html/setup.rb
|
56
|
-
- templates/rest/disqus/html/disqus.erb
|
57
52
|
- templates/rest/disqus/setup.rb
|
58
53
|
- templates/rest/docstring/html/setup.rb
|
59
|
-
- templates/rest/docstring/html/text.erb
|
60
|
-
- templates/rest/fulldoc/.DS_Store
|
61
|
-
- templates/rest/fulldoc/html/.DS_Store
|
62
|
-
- templates/rest/fulldoc/html/css/common.css
|
63
|
-
- templates/rest/fulldoc/html/css/full_list.css
|
64
|
-
- templates/rest/fulldoc/html/css/style.css
|
65
|
-
- templates/rest/fulldoc/html/full_list.erb
|
66
|
-
- templates/rest/fulldoc/html/full_list_files.erb
|
67
|
-
- templates/rest/fulldoc/html/full_list_resource.erb
|
68
|
-
- templates/rest/fulldoc/html/full_list_topic.erb
|
69
|
-
- templates/rest/fulldoc/html/js/app.js
|
70
|
-
- templates/rest/fulldoc/html/js/full_list.js
|
71
|
-
- templates/rest/fulldoc/html/js/jquery.js
|
72
54
|
- templates/rest/fulldoc/html/setup.rb
|
73
|
-
- templates/rest/layout/html/footer.erb
|
74
|
-
- templates/rest/layout/html/headers.erb
|
75
|
-
- templates/rest/layout/html/index.erb
|
76
|
-
- templates/rest/layout/html/layout.erb
|
77
|
-
- templates/rest/layout/html/search.erb
|
78
55
|
- templates/rest/layout/html/setup.rb
|
79
|
-
- templates/rest/method_details/html/header.erb
|
80
|
-
- templates/rest/method_details/html/method_signature.erb
|
81
56
|
- templates/rest/method_details/html/setup.rb
|
82
57
|
- templates/rest/module/setup.rb
|
83
|
-
- templates/rest/tags/html/example_response.erb
|
84
|
-
- templates/rest/tags/html/generic_tag.erb
|
85
|
-
- templates/rest/tags/html/index.erb
|
86
58
|
- templates/rest/tags/setup.rb
|
87
|
-
-
|
59
|
+
- README.markdown
|
60
|
+
- VERSION
|
88
61
|
has_rdoc: true
|
89
62
|
homepage: http://github.com/visfleet/yard-rest-plugin
|
90
63
|
licenses: []
|
@@ -95,23 +68,27 @@ rdoc_options:
|
|
95
68
|
require_paths:
|
96
69
|
- lib
|
97
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
98
72
|
requirements:
|
99
73
|
- - ">="
|
100
74
|
- !ruby/object:Gem::Version
|
75
|
+
hash: 3
|
101
76
|
segments:
|
102
77
|
- 0
|
103
78
|
version: "0"
|
104
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
105
81
|
requirements:
|
106
82
|
- - ">="
|
107
83
|
- !ruby/object:Gem::Version
|
84
|
+
hash: 3
|
108
85
|
segments:
|
109
86
|
- 0
|
110
87
|
version: "0"
|
111
88
|
requirements: []
|
112
89
|
|
113
90
|
rubyforge_project:
|
114
|
-
rubygems_version: 1.3.
|
91
|
+
rubygems_version: 1.3.7
|
115
92
|
signing_key:
|
116
93
|
specification_version: 3
|
117
94
|
summary: A plugin for Yardoc that produces API documentation for Restful web services
|
data/example/README.markdown
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
Sample API
|
2
|
-
==========
|
3
|
-
This is a sample API. You should see:
|
4
|
-
|
5
|
-
- This file
|
6
|
-
- An index containing one service /sample.
|
7
|
-
- That service should contain only one action: Index
|
8
|
-
- Index should have a description, list of arguments, an example response, and a list of response fields.
|
9
|
-
- Nothing else should be included because it doesn't have a URL specified.
|
10
|
-
|
11
|
-
Click [here](./_index.html) to go to the Index
|
Binary file
|
Binary file
|
Binary file
|
data/templates/rest/.DS_Store
DELETED
Binary file
|
@@ -1,24 +0,0 @@
|
|
1
|
-
<div class="service">
|
2
|
-
<h1><span class="minor_heading">Resource: </span><%= object.tag("url").text %></h1>
|
3
|
-
<% unless object.tags("topic").empty? %>
|
4
|
-
<h3 class="topic">Topics:</h3>
|
5
|
-
<ul class="box">
|
6
|
-
<% object.tags("topic").each do |topic| %>
|
7
|
-
<li><%= topic.text %></li>
|
8
|
-
<% end %>
|
9
|
-
</ul>
|
10
|
-
<% end %>
|
11
|
-
<%= yieldall %>
|
12
|
-
</div>
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
@@ -1,24 +0,0 @@
|
|
1
|
-
<h2>Discuss this Resource</h2>
|
2
|
-
<div id="disqus_thread"></div>
|
3
|
-
<script type="text/javascript">
|
4
|
-
var disqus_shortname = 'vworkapi';
|
5
|
-
var disqus_identifier = "<%= @disqus_identifier %>";
|
6
|
-
// var disqus_developer = 1;
|
7
|
-
/**
|
8
|
-
* var disqus_identifier; [Optional but recommended: Define a unique identifier (e.g. post id or slug) for this thread]
|
9
|
-
*/
|
10
|
-
(function() {
|
11
|
-
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
12
|
-
dsq.src = 'http://vworkapi.disqus.com/embed.js';
|
13
|
-
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
14
|
-
})();
|
15
|
-
</script>
|
16
|
-
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript=vworkapi">comments powered by Disqus.</a></noscript>
|
17
|
-
<a href="http://disqus.com" class="dsq-brlink">API comments powered by <span class="logo-disqus">Disqus</span></a>
|
18
|
-
<script type="text/javascript">
|
19
|
-
(function () {
|
20
|
-
var s = document.createElement('script'); s.async = true;
|
21
|
-
s.src = 'http://disqus.com/forums/vworkapi/count.js';
|
22
|
-
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
|
23
|
-
}());
|
24
|
-
</script>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= htmlify(object.docstring.strip) %>
|