sinatra_resource 0.4.17 → 0.4.18
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/examples/datacatalog/app.rb +1 -1
- data/examples/datacatalog/config/config.rb +1 -1
- data/examples/datacatalog/test/resources/sources/sources_get_many_search_test.rb +45 -0
- data/lib/builder/mongo_helpers.rb +2 -1
- data/sinatra_resource.gemspec +5 -5
- data/spec/spec_helper.rb +1 -0
- metadata +3 -10
data/Rakefile
CHANGED
@@ -14,7 +14,7 @@ begin
|
|
14
14
|
gem.add_dependency 'mongo_mapper', '>= 0.7'
|
15
15
|
gem.add_dependency 'mongo', '>= 0.18.3'
|
16
16
|
gem.add_dependency 'mongo_ext', '>= 0.18.3'
|
17
|
-
gem.add_dependency 'sinatra', '>=
|
17
|
+
gem.add_dependency 'sinatra', '>= 1.0'
|
18
18
|
gem.add_dependency 'query_string_filter', '>= 0.1.4'
|
19
19
|
|
20
20
|
gem.add_development_dependency 'crack', '>= 0.1.4'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.18
|
data/examples/datacatalog/app.rb
CHANGED
@@ -121,4 +121,49 @@ class SourcesGetManySearchResourceTest < ResourceTestCase
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
+
context "search=flight delays" do
|
125
|
+
before do
|
126
|
+
@search_params = { :search => "flight delays" }
|
127
|
+
end
|
128
|
+
|
129
|
+
%w(basic).each do |role|
|
130
|
+
context "#{role} : get /" do
|
131
|
+
before do
|
132
|
+
get "/", @search_params.merge(:api_key => api_key_for(role))
|
133
|
+
@members = parsed_response_body['members']
|
134
|
+
end
|
135
|
+
|
136
|
+
use "return 200 Ok"
|
137
|
+
|
138
|
+
test "body should have correct sources" do
|
139
|
+
titles = @members.map { |x| x['title'] }
|
140
|
+
assert_equal 1, titles.length
|
141
|
+
assert_include %{Airline On-Time Performance and Causes of Flight Delays}, titles
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
context "search=" do
|
148
|
+
before do
|
149
|
+
@search_params = { :search => "" }
|
150
|
+
end
|
151
|
+
|
152
|
+
%w(basic).each do |role|
|
153
|
+
context "#{role} : get /" do
|
154
|
+
before do
|
155
|
+
get "/", @search_params.merge(:api_key => api_key_for(role))
|
156
|
+
@members = parsed_response_body['members']
|
157
|
+
end
|
158
|
+
|
159
|
+
use "return 200 Ok"
|
160
|
+
|
161
|
+
test "body should have no sources" do
|
162
|
+
titles = @members.map { |x| x['title'] }
|
163
|
+
assert_equal 0, titles.length
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
124
169
|
end
|
@@ -369,7 +369,8 @@ module SinatraResource
|
|
369
369
|
if search_string && filter_string
|
370
370
|
error 400, convert(body_for(:invalid_params, [FILTER_KEY]))
|
371
371
|
elsif search_string
|
372
|
-
|
372
|
+
words = search_string.downcase.split(" ")
|
373
|
+
{ :_keywords => { '$all' => words } }
|
373
374
|
elsif filter_string
|
374
375
|
begin
|
375
376
|
unsafe = QS_FILTER.parse(filter_string)
|
data/sinatra_resource.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sinatra_resource}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.18"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["David James"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-04-05}
|
13
13
|
s.description = %q{A DSL for creating RESTful actions with Sinatra and MongoMapper. It embraces the Resource Oriented Architecture as explained by Leonard Richardson and Sam Ruby.}
|
14
14
|
s.email = %q{djames@sunlightfoundation.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -208,7 +208,7 @@ Gem::Specification.new do |s|
|
|
208
208
|
s.add_runtime_dependency(%q<mongo_mapper>, [">= 0.7"])
|
209
209
|
s.add_runtime_dependency(%q<mongo>, [">= 0.18.3"])
|
210
210
|
s.add_runtime_dependency(%q<mongo_ext>, [">= 0.18.3"])
|
211
|
-
s.add_runtime_dependency(%q<sinatra>, [">=
|
211
|
+
s.add_runtime_dependency(%q<sinatra>, [">= 1.0"])
|
212
212
|
s.add_runtime_dependency(%q<query_string_filter>, [">= 0.1.4"])
|
213
213
|
s.add_development_dependency(%q<crack>, [">= 0.1.4"])
|
214
214
|
s.add_development_dependency(%q<djsun-context>, [">= 0.5.6"])
|
@@ -219,7 +219,7 @@ Gem::Specification.new do |s|
|
|
219
219
|
s.add_dependency(%q<mongo_mapper>, [">= 0.7"])
|
220
220
|
s.add_dependency(%q<mongo>, [">= 0.18.3"])
|
221
221
|
s.add_dependency(%q<mongo_ext>, [">= 0.18.3"])
|
222
|
-
s.add_dependency(%q<sinatra>, [">=
|
222
|
+
s.add_dependency(%q<sinatra>, [">= 1.0"])
|
223
223
|
s.add_dependency(%q<query_string_filter>, [">= 0.1.4"])
|
224
224
|
s.add_dependency(%q<crack>, [">= 0.1.4"])
|
225
225
|
s.add_dependency(%q<djsun-context>, [">= 0.5.6"])
|
@@ -231,7 +231,7 @@ Gem::Specification.new do |s|
|
|
231
231
|
s.add_dependency(%q<mongo_mapper>, [">= 0.7"])
|
232
232
|
s.add_dependency(%q<mongo>, [">= 0.18.3"])
|
233
233
|
s.add_dependency(%q<mongo_ext>, [">= 0.18.3"])
|
234
|
-
s.add_dependency(%q<sinatra>, [">=
|
234
|
+
s.add_dependency(%q<sinatra>, [">= 1.0"])
|
235
235
|
s.add_dependency(%q<query_string_filter>, [">= 0.1.4"])
|
236
236
|
s.add_dependency(%q<crack>, [">= 0.1.4"])
|
237
237
|
s.add_dependency(%q<djsun-context>, [">= 0.5.6"])
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 18
|
9
|
+
version: 0.4.18
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- David James
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-04-05 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -64,13 +64,6 @@ dependencies:
|
|
64
64
|
requirement: &id004 !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
segments:
|
69
|
-
- 0
|
70
|
-
- 9
|
71
|
-
- 4
|
72
|
-
version: 0.9.4
|
73
|
-
- - <
|
74
67
|
- !ruby/object:Gem::Version
|
75
68
|
segments:
|
76
69
|
- 1
|