rackful 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rackful/resource.rb +7 -5
- data/rackful.gemspec +1 -1
- metadata +44 -47
data/lib/rackful/resource.rb
CHANGED
@@ -101,7 +101,7 @@ Meta-programmer method.
|
|
101
101
|
|
102
102
|
|
103
103
|
=begin
|
104
|
-
@
|
104
|
+
@return [Hash(method => Array(media_types))]
|
105
105
|
=end
|
106
106
|
def media_types
|
107
107
|
@rackful_resource_media_types ||= {}
|
@@ -291,14 +291,16 @@ This works by inspecting all the {#do_METHOD} methods this object implements.
|
|
291
291
|
def http_methods
|
292
292
|
r = []
|
293
293
|
if self.empty?
|
294
|
-
self.class.all_media_types
|
294
|
+
if self.class.all_media_types[:PUT]
|
295
|
+
r << :PUT
|
296
|
+
end
|
295
297
|
else
|
296
298
|
r.push( :OPTIONS, :HEAD, :GET )
|
297
299
|
r << :DELETE if self.respond_to?( :destroy )
|
298
300
|
end
|
299
301
|
self.class.public_instance_methods.each do
|
300
302
|
|instance_method|
|
301
|
-
if /\Ado_([A-Z])
|
303
|
+
if /\Ado_([A-Z]+)\z/ === instance_method
|
302
304
|
r << $1.to_sym
|
303
305
|
end
|
304
306
|
end
|
@@ -377,7 +379,7 @@ Wrapper around {#do_METHOD #do_GET}
|
|
377
379
|
=end
|
378
380
|
def http_DELETE request, response
|
379
381
|
raise HTTP404NotFound, path if self.empty?
|
380
|
-
raise HTTP405MethodNotAllowed unless self.respond_to?( :destroy )
|
382
|
+
raise HTTP405MethodNotAllowed, self.http_methods unless self.respond_to?( :destroy )
|
381
383
|
response.status = status_code( :no_content )
|
382
384
|
if headers = self.destroy( request, response )
|
383
385
|
response.headers.merge! headers
|
@@ -391,7 +393,7 @@ Wrapper around {#do_METHOD #do_GET}
|
|
391
393
|
@raise [HTTP415UnsupportedMediaType, HTTP405MethodNotAllowed] if the resource doesn't implement the `PUT` method.
|
392
394
|
=end
|
393
395
|
def http_PUT request, response
|
394
|
-
raise HTTP405MethodNotAllowed unless self.respond_to? :do_PUT
|
396
|
+
raise HTTP405MethodNotAllowed, self.http_methods unless self.respond_to? :do_PUT
|
395
397
|
unless self.class.media_types[:PUT] &&
|
396
398
|
self.class.media_types[:PUT].include?( request.media_type )
|
397
399
|
raise HTTP415UnsupportedMediaType, self.class.media_types[:PUT]
|
data/rackful.gemspec
CHANGED
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
|
|
2
2
|
|
3
3
|
# Required properties:
|
4
4
|
s.name = 'rackful'
|
5
|
-
s.version = '0.1.
|
5
|
+
s.version = '0.1.4'
|
6
6
|
s.summary = "Library for building ReSTful web services with Rack"
|
7
7
|
s.description = <<EOS
|
8
8
|
Rackful provides a minimal interface for developing ReSTful web services with
|
metadata
CHANGED
@@ -1,54 +1,48 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rackful
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
version: 0.1.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.4
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Pieter van Beek
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
|
13
|
+
date: 2012-11-26 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
15
16
|
name: rack
|
16
|
-
version_requirements: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ! '>='
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '1.4'
|
21
|
-
none: false
|
22
|
-
requirement: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ! '>='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.4'
|
27
|
-
none: false
|
28
17
|
prerelease: false
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "1.4"
|
29
24
|
type: :runtime
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
Rack and Ruby. Instead of writing HTTP method handlers, you'
|
34
|
-
|
25
|
+
version_requirements: *id001
|
26
|
+
description: |
|
27
|
+
Rackful provides a minimal interface for developing ReSTful web services with
|
28
|
+
Rack and Ruby. Instead of writing HTTP method handlers, you'll implement
|
35
29
|
resource objects, which expose their state at URLs.
|
36
|
-
|
37
|
-
|
30
|
+
|
38
31
|
This version is not backward compatible with v0.0.x.
|
39
32
|
|
40
|
-
'
|
41
33
|
email: rackful@djinnit.com
|
42
34
|
executables: []
|
35
|
+
|
43
36
|
extensions: []
|
37
|
+
|
44
38
|
extra_rdoc_files: []
|
45
|
-
|
39
|
+
|
40
|
+
files:
|
46
41
|
- RACKFUL.md
|
47
42
|
- README.md
|
48
43
|
- LICENSE.md
|
49
44
|
- CHANGES.md
|
50
45
|
- example/config.ru
|
51
|
-
- lib/rackful.rb
|
52
46
|
- lib/rackful/resource.rb
|
53
47
|
- lib/rackful/path.rb
|
54
48
|
- lib/rackful/http_status.rb
|
@@ -59,32 +53,35 @@ files:
|
|
59
53
|
- lib/rackful/middleware/method_spoofing.rb
|
60
54
|
- lib/rackful/middleware/header_spoofing.rb
|
61
55
|
- lib/rackful/middleware/relative_location.rb
|
56
|
+
- lib/rackful.rb
|
62
57
|
- rackful.gemspec
|
63
58
|
- mkdoc.sh
|
64
59
|
homepage: http://pieterb.github.com/Rackful/
|
65
|
-
licenses:
|
60
|
+
licenses:
|
66
61
|
- Apache License 2.0
|
67
|
-
post_install_message:
|
62
|
+
post_install_message:
|
68
63
|
rdoc_options: []
|
69
|
-
|
64
|
+
|
65
|
+
require_paths:
|
70
66
|
- lib
|
71
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ! '>='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
68
|
none: false
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: "0"
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
74
|
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: "0"
|
83
79
|
requirements: []
|
84
|
-
|
80
|
+
|
81
|
+
rubyforge_project:
|
85
82
|
rubygems_version: 1.8.24
|
86
|
-
signing_key:
|
83
|
+
signing_key:
|
87
84
|
specification_version: 3
|
88
85
|
summary: Library for building ReSTful web services with Rack
|
89
86
|
test_files: []
|
90
|
-
|
87
|
+
|