sinatra-docdsl 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +8 -8
  2. data/lib/docdsl.rb +50 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  SHA1:
3
3
  metadata.gz: !binary |-
4
- NTIzOGU0NzU1MTYxYzdmM2IwODZlZjM0NWY1NDFjMjczY2U1N2ViMQ==
4
+ Yzc0MmUwOTQwMzQxMjY0MDkzN2Y2ZDE5OGMzYzc2NmFmMDA0OGE4NQ==
5
5
  data.tar.gz: !binary |-
6
- NzhmYTc3NDcyNTMxZjBjMjY4NTk1ZmNhOTkwZTgxMGY2YmQxZmY3NA==
6
+ NmUzOTBhMWJlYjIzZTA5MmI5MjVkYTg4YTM0OTk3MjczN2QyYWZmMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTlmOGQ5YzE3NDlmOTI1NThiMjI4MGUzYjdiZWIzNDJlNGFjZTcyMWY4MjVi
10
- ODM5NDNlNjBiZjdkZjg5MDM1ZjJkOGY4ZTZkZTc5ZWQ0Y2M1YTgzZjNlYWU3
11
- NzFlMzBjMTlhZmFkNDU0YWIzOWRiZDNjM2I2ZjUyODgyMjhhMDI=
9
+ ODhlNDMzNjYwYTk1NmZhYjI1OTRjZDY4MTU3M2UzZjg5MzhlYTQyNmFmNDAw
10
+ MTc2NzVkMTU4ZjVkN2M3ZGRlZmMwMTRkNDM4NmY0ZjY4OGEyYjA3MTNhN2Ji
11
+ YWZkYjk2MTM5OTJjZDEwMDYzOTE2MDMzNGNjYTc2ZWVmZWZhMTg=
12
12
  data.tar.gz: !binary |-
13
- MThlZDM1Y2VjNDgzMzIyOTdjYjU0YzM2NGE4NmUxNjUxODY1YzVhMWUxZGQw
14
- ZjMzMWQ5NWQ5OWEwYTI0MWM4ZWJlMmUzYWYwMjI2MWJiMzBjMWZlOGI1MGZj
15
- NTZjOTc1OTA0OTIzZDNiN2NhMzAzNjExMjdhNDZkY2Q2MTJkMzY=
13
+ NjE5Mzc5MDhkMGUzYmVlOThmMTgwMDZiMjY0MmFjMDkyNDEwNzZmOGY2YWU5
14
+ NjRmOGI0YjJiMjMxMWZmMWY2NDQ5ZTFjMmUwNzgxZmY0MTJiZjRkMmNmOWNm
15
+ Zjg1YjdlOTcyYTlhYTkzZTNiM2Q1MWMxNGZhNWEwNjNhMDAwZWY=
data/lib/docdsl.rb CHANGED
@@ -210,8 +210,56 @@ module Sinatra
210
210
  @query_params[name]=desc
211
211
  end
212
212
 
213
- def status(code,meaning)
214
- @status_codes[code]=meaning
213
+ def status(code,meaning=nil)
214
+ official_meaning=status_codes_map[code]
215
+ if meaning
216
+ @status_codes[code]="#{official_meaning} - #{meaning}"
217
+ else
218
+ @status_codes[code]=official_meaning
219
+ end
220
+ end
221
+
222
+ def status_codes_map
223
+ {
224
+ 100=> 'Continue',
225
+ 101=> 'Switching Protocols',
226
+ 102=> 'Processing',
227
+ 200=> 'OK',
228
+ 201=> 'Created',
229
+ 202=> 'Accepted',
230
+ 203=> 'Non Authoritative Information',
231
+ 204=> 'No Content',
232
+ 205=> 'Reset Content',
233
+ 206=> 'Partial Content',
234
+ 207=> 'Multi-Status',
235
+ 300=> 'Mutliple Choices',
236
+ 301=> 'Moved Permanently',
237
+ 302=> 'Moved Temporarily',
238
+ 303=> 'See Other',
239
+ 304=> 'Not Modified',
240
+ 305=> 'Use Proxy',
241
+ 307=> 'Temporary Redirect',
242
+ 400=> 'Bad Request',
243
+ 401=> 'Unauthorized',
244
+ 402=> 'Payment Required',
245
+ 403=> 'Forbidden',
246
+ 404=> 'Not Found',
247
+ 405=> 'Method Not Allowed',
248
+ 406=> 'Not Acceptable',
249
+ 407=> 'Proxy Authentication Required',
250
+ 408=> 'Request Timeout',
251
+ 409=> 'Conflict',
252
+ 410=> 'Gone',
253
+ 411=> 'Length Required',
254
+ 412=> 'Precondition Failed',
255
+ 413=> 'Request Entity Too Large',
256
+ 414=> 'Request-URI Too Long',
257
+ 415=> 'Unsupported Media Type',
258
+ 416=> 'Requested Range Not Satisfiable',
259
+ 417=> 'Expectation Failed',
260
+ 500=> 'Internal Server Error',
261
+ 503=> 'Temporarily Unavailable'
262
+ }
215
263
  end
216
264
 
217
265
  def json
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-docdsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jilles van Gurp