yard-restful 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.markdown +41 -116
  2. data/Rakefile +1 -1
  3. data/VERSION +1 -1
  4. metadata +2 -2
data/README.markdown CHANGED
@@ -1,16 +1,12 @@
1
1
  # Yardoc RESTful Web Service Plugin
2
2
 
3
- originally by [vWorkApp](http://www.vworkapp.com)
4
- rewritten for 0.3.0 by [rknLA](http://github.com/rknLA) with substantial help from [lsegal](http://gnuu.org/)
5
- customized by [spape](http://github.com/spape) for the [MAdeK](http://github.com/zhdk/madek)
6
- further customization by [DerNalia](http://github.com/DerNalia) for [TinderBox](http://gettinderbox.com)
7
- [API-Documentation](http://medienarchiv.zhdk.ch/api)
3
+ Previous authors: [vWorkApp](http://www.vworkapp.com), [rknLA](http://github.com/rknLA), [lsegal](http://gnuu.org/), [spape](http://github.com/spape), [DerNalia](http://github.com/DerNalia)
8
4
 
9
5
  A plugin for [Yardoc](http://yardoc.org/) that generates documentation for RESTful web services.
10
6
 
11
7
  ## Install
12
8
  Bundler will reduce your headaches, so, please you that
13
- gem 'yard-rest' # in your gemfile
9
+ gem 'yard-restful' # in your gemfile
14
10
 
15
11
  You may need to include the following dependencies as well:
16
12
  gem 'redcarpet'
@@ -27,61 +23,73 @@ So you'll have to re-genenarte your API on every machine. This should encourage
27
23
 
28
24
  ## Execution
29
25
  It is recommended that you use a .yardopts file
26
+
30
27
  --title "My API Documentation"
31
28
  --plugin rest
32
29
  --readme API_README
33
30
  --output-dir ./public/api
34
- app/models/*.rb
35
- app/controllers/*.rb
31
+ app/models/**/*.rb
32
+ app/controllers/**/*.rb
36
33
 
37
34
  So that way, whenever you want to generate your API docs, you simply need to run only
35
+
38
36
  bundle exec yardoc
39
37
 
40
38
 
41
39
  ## See an API-Example
42
40
 
43
- [Yard-Rest-Plugin](http://DerNalia.github.com/yard-rest-plugin) and get a look to the "Example" resource.
44
-
45
- ## Demo (see the plugin in action)
46
-
47
- Visit [TinderBox API Documentation](http://mytinder.com/api/) for a demonstration.
41
+ [Sample application](http://kraft001.github.com/yard-restful-sample)
48
42
 
49
43
  ## Writing Comments
50
44
 
51
45
  The following tags are provided:
52
46
 
53
- - @resource resource. Specifies the resource (controller action/method) that the service is accessed from. This tag is compulsory, only **classes** and **methods** that include this in their comments are included in the API documentation.
47
+ - **@restful_api** version
48
+ Specifies the resource (controller) or object (model). This tag is compulsory, only **classes** and **methods** that include this in their comments are included in the API documentation.
54
49
 
55
- - @url url. Specifies the URL which someone should use to access that resource.
50
+ - **@url** url
51
+ Specifies the URL which someone should use to access that resource.
56
52
 
57
- - @action action. Specifies the http action (GET, POST, PUT etc.).
53
+ - **@action** action
54
+ Specifies the http action (GET, POST, PUT etc.).
58
55
 
59
- - @status\_codes Any possible returned states codes that the API user may need to handle.
56
+ - **@required** [type] name description
57
+ Specifies an argument that must be passed to the service. You can specify as many of these as you need.
60
58
 
61
- - @required [type] name description. Specifies an argument that must be passed to the service. You can specify as many of these as you need.
59
+ - **@optional** [type] name description
60
+ Specifies an optional argument that may be passed to the service. You can specify as many of these as you need.
62
61
 
63
- - @optional [type] name description. Specifies an optional argument that may be passed to the service. You can specify as many of these as you need.
62
+ - **@response** [type] description
63
+ Specifies type of the response. Usually just a link to an object.
64
64
 
65
- - @response_field [type] name description. Further specifies the fields that are returned within the response.
65
+ - **@response_field** [type] name description
66
+ Further specifies the fields that are returned within the response.
66
67
 
67
- - @resource\_object ModelName. A modal that users of the API should know about.
68
+ - **@property** [type] name description
69
+ A property (attribute) of an object.
68
70
 
69
- - @resource\_object\_properties Description of the modal and attributes that the API user should know about.
70
-
71
- - @resource\_object\_footnotes Anything else that needs to be said about the model
72
71
  ### Examples
73
72
 
74
- Examples should always be together in the following order: example_request, example_request_description, example_response, example_response_description (as soon as you write a example_request you need a following example_response and the other way around).
73
+ Examples should always be together in the following order: example_request, example_request_description, example_response, example_response_description (as soon as you write an example_request you need a following example_response and the other way around).
75
74
 
76
75
  Markdown rendering for the text is activated if a tags text contains a newline (see example).
77
76
 
78
- - @example_request example. An example of the request that is send to the service.
77
+ - **@example_request**
78
+ An example of the request that is send to the service.
79
+
80
+ - **@example_request_description**
81
+ The description text for the example request.
82
+
83
+ - **@example_response**
84
+ An example of the response that is returned from the service.
79
85
 
80
- - @example_request_description description. The description text for the example request.
86
+ - **@example_response_description**
87
+ The description text for the example response.
81
88
 
82
- - @example_response example. An example of the response that is returned from the service.
89
+ - **@example**
90
+ Example of an object.
83
91
 
84
- - @example_response example.
92
+ @example_response example.
85
93
  ```json
86
94
  {
87
95
  "examples": [{
@@ -92,100 +100,17 @@ Markdown rendering for the text is activated if a tags text contains a newline (
92
100
  }]
93
101
  }
94
102
  ```
95
-
96
- - @example_response_description example. The description text for the example response.
97
-
98
103
  ## Ignored Documentation
99
104
 
100
- This plugin only documents **classes** and **methods** with **@resource** or **@resource\_object** tags. It does not support module documentation.
105
+ This plugin only documents **classes** and **methods** with **@restful_api** tag. It does not support module documentation.
101
106
 
102
107
  ## Example:
103
- For controllers:
104
-
105
- ##
106
- # A thing characteristic of its kind or illustrating a general rule:
107
- # it's a good example of how European action can produce results | some of these carpets are among the finest examples of the period.
108
- class ExamplesController
109
- ##
110
- # Get a collection of examples:
111
- #
112
- # @resource index
113
- # @url /examples[ .format ]
114
- #
115
- # @action GET
116
- #
117
- # @optional [Boolean] highlight Show only highlighted examples.
118
- #
119
- # @response_field [Array] examples The collection of examples.
120
- #
121
- # @status_codes possible API status codes
122
- # 404 - Not Found
123
- # 401 - Unauthorized
124
- # 422 - Unprocessable Entity
125
- # 200 - OK
126
- #
127
- #
128
- # @example_request {}
129
- # @example_request_description Just requests an index of samples.
130
- # @example_response {"examples": [{"id":1, "title":"Animals", "text":"Dogs and cats are some.", "highlight":true}, {"id":2, "title":"Computers", "text":"Windows PC or Apple's Macintosh.", "highlight":false}]}
131
- # @example_response_description Responds with the index of examples.
132
- #
133
- # @example_request {"highlight": true}
134
- # @example_request_description Request only highlighted examples.
135
- # @example_response
136
- # ```json
137
- # {
138
- # "examples": [{
139
- # "id":1,
140
- # "title":"Animals",
141
- # "text":"Dogs and cats are some.",
142
- # "highlight":true
143
- # }]
144
- # }
145
- # ```
146
- # @example_response_description Responds only with highlighted examples.
147
- #
148
- def index
149
- #...
150
- end
151
- end
152
-
153
- And for models:
154
-
155
- ##
156
- # @resource_object ExamplesModel
157
- # @resource_object_properties
158
- # ExamplesModel{
159
- # id: Integer
160
- # name: String
161
- # }
162
- #
163
- # @resource_object_footnotes
164
- # (1) For visibility, see {Shared}
165
- class ExamplesModel
166
-
167
- # @resource
168
- CONSTANT_VARIABLE = 3
169
-
170
- # internal documentation
171
- # not picked up by yard-rest-plugin
172
- # @return something_else
173
- def something
174
- #...
175
- end
176
-
177
- end
108
+
109
+ [Sample controller](http://kraft001.github.com/yard-restful-sample/app/controllers/books_controller.rb) and [sample model](http://kraft001.github.com/yard-restful-sample/app/models/book.rb)
178
110
 
179
111
  ## Development
180
112
 
181
113
  As always, you can see what tasks are available by running:
182
-
183
- rake -T
184
-
185
- You can run the template locally over the included sample code by using the following rake tasks:
186
-
187
- rake ex:clean
188
- rake ex:generate
189
-
190
114
 
115
+ rake -T
191
116
 
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ begin
8
8
  gem.summary = %Q{Yardoc plugin for Restful web services}
9
9
  gem.description = %Q{A customized plugin for Yardoc that produces API documentation for Restful web services}
10
10
  gem.email = ''
11
- gem.homepage = "https://github.com/kraft/yard-restful"
11
+ gem.homepage = "https://github.com/kraft001/yard-restful"
12
12
  gem.authors = ['Konstantin Rafalsky']
13
13
  gem.add_dependency("yard", '~>0.8.3')
14
14
  gem.files = Dir.glob("{lib,templates}/**/*").concat(["Rakefile"])
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.2.1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard-restful
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -60,7 +60,7 @@ files:
60
60
  - templates/default/layout/html/setup.rb
61
61
  - README.markdown
62
62
  - VERSION
63
- homepage: https://github.com/kraft/yard-restful
63
+ homepage: https://github.com/kraft001/yard-restful
64
64
  licenses: []
65
65
  post_install_message:
66
66
  rdoc_options: []