sinatra-rest-helpers 0.1.0 → 0.2.0
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/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/sinatra/rest_helpers.rb +2 -2
- data/sinatra-rest-helpers.gemspec +50 -0
- data/spec/sinatra-rest-helpers_spec.rb +14 -0
- metadata +3 -2
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@ begin
|
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
7
|
gem.name = "sinatra-rest-helpers"
|
8
8
|
gem.summary = %Q{Adds useful helpers for REST applications developed with Sinatra.}
|
9
|
-
gem.description = %Q{
|
9
|
+
gem.description = %Q{A set of helpers for sinatra apps that expose REST resources.}
|
10
10
|
gem.email = "cyril.rohr@gmail.com"
|
11
11
|
gem.homepage = "http://github.com/cryx/sinatra-rest-helpers"
|
12
12
|
gem.authors = ["Cyril Rohr"]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/sinatra/rest_helpers.rb
CHANGED
@@ -23,8 +23,8 @@ module Sinatra
|
|
23
23
|
end
|
24
24
|
selected_format = supported_formats.detect{ |supported_format|
|
25
25
|
!accepted_formats.detect{ |accepted_format|
|
26
|
-
accepted_format["type"]
|
27
|
-
|
26
|
+
Regexp.new(Regexp.escape(accepted_format["type"]).gsub("\\*", ".*?")) =~ supported_format["type"] &&
|
27
|
+
(accepted_format["level"] || INFINITY).to_f >= (supported_format["level"] || 0).to_f
|
28
28
|
}.nil?
|
29
29
|
}
|
30
30
|
if selected_format.nil?
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{sinatra-rest-helpers}
|
8
|
+
s.version = "0.2.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Cyril Rohr"]
|
12
|
+
s.date = %q{2009-10-19}
|
13
|
+
s.description = %q{A set of helpers for sinatra apps that expose REST resources.}
|
14
|
+
s.email = %q{cyril.rohr@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"lib/sinatra/rest_helpers.rb",
|
27
|
+
"sinatra-rest-helpers.gemspec",
|
28
|
+
"spec/sinatra-rest-helpers_spec.rb",
|
29
|
+
"spec/spec_helper.rb"
|
30
|
+
]
|
31
|
+
s.homepage = %q{http://github.com/cryx/sinatra-rest-helpers}
|
32
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
33
|
+
s.require_paths = ["lib"]
|
34
|
+
s.rubygems_version = %q{1.3.5}
|
35
|
+
s.summary = %q{Adds useful helpers for REST applications developed with Sinatra.}
|
36
|
+
s.test_files = [
|
37
|
+
"spec/sinatra-rest-helpers_spec.rb",
|
38
|
+
"spec/spec_helper.rb"
|
39
|
+
]
|
40
|
+
|
41
|
+
if s.respond_to? :specification_version then
|
42
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
43
|
+
s.specification_version = 3
|
44
|
+
|
45
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
46
|
+
else
|
47
|
+
end
|
48
|
+
else
|
49
|
+
end
|
50
|
+
end
|
@@ -65,4 +65,18 @@ describe "SinatraRestHelpers" do
|
|
65
65
|
app.test_provides!("application/json")
|
66
66
|
app.response.headers['Content-Type'].should == "application/json"
|
67
67
|
end
|
68
|
+
it "should correctly deal with widlcard characters [client-side, I]" do
|
69
|
+
request = mock("request", :accept => "application/vnd.fr.grid5000.api.*+json")
|
70
|
+
app = App.new(request)
|
71
|
+
app.should_not_receive(:halt)
|
72
|
+
app.test_provides!("application/vnd.fr.grid5000.api.Cluster+json;level=1")
|
73
|
+
app.response.headers['Content-Type'].should == "application/vnd.fr.grid5000.api.Cluster+json;level=1"
|
74
|
+
end
|
75
|
+
it "should correctly deal with widlcard characters [client-side, II]" do
|
76
|
+
request = mock("request", :accept => "application/*")
|
77
|
+
app = App.new(request)
|
78
|
+
app.should_not_receive(:halt)
|
79
|
+
app.test_provides!("application/vnd.fr.grid5000.api.Cluster+json;level=1")
|
80
|
+
app.response.headers['Content-Type'].should == "application/vnd.fr.grid5000.api.Cluster+json;level=1"
|
81
|
+
end
|
68
82
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-rest-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Rohr
|
@@ -30,10 +30,11 @@ files:
|
|
30
30
|
- Rakefile
|
31
31
|
- VERSION
|
32
32
|
- lib/sinatra/rest_helpers.rb
|
33
|
+
- sinatra-rest-helpers.gemspec
|
33
34
|
- spec/sinatra-rest-helpers_spec.rb
|
34
35
|
- spec/spec_helper.rb
|
35
36
|
has_rdoc: true
|
36
|
-
homepage: http://github.com/
|
37
|
+
homepage: http://github.com/cryx/sinatra-rest-helpers
|
37
38
|
licenses: []
|
38
39
|
|
39
40
|
post_install_message:
|