sinatra_resource 0.3.0 → 0.3.1
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/VERSION +1 -1
- data/lib/builder/helpers.rb +7 -3
- data/sinatra_resource.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/lib/builder/helpers.rb
CHANGED
@@ -273,11 +273,13 @@ module SinatraResource
|
|
273
273
|
def params_check_action(action)
|
274
274
|
case action
|
275
275
|
when :list
|
276
|
-
# TODO: is anything needed here?
|
277
|
-
when :read
|
278
276
|
unless params.reject { |k, v| k == FILTER_KEY }.empty?
|
279
277
|
error 400, convert(body_for(:non_empty_params))
|
280
278
|
end
|
279
|
+
when :read
|
280
|
+
unless params.empty?
|
281
|
+
error 400, convert(body_for(:non_empty_params))
|
282
|
+
end
|
281
283
|
when :create
|
282
284
|
# No need to complain. If there are problems,
|
283
285
|
# params_check_action_and_role will catch them.
|
@@ -322,15 +324,17 @@ module SinatraResource
|
|
322
324
|
# Converts +action+ to :r or :w (i.e. read or write).
|
323
325
|
#
|
324
326
|
# @param [Symbol] action
|
325
|
-
# :read, :create, or :
|
327
|
+
# :list, :read, :create, :update, or :delete
|
326
328
|
#
|
327
329
|
# @return [Symbol]
|
328
330
|
# :r or :w
|
329
331
|
def to_r_or_w(action)
|
330
332
|
case action
|
333
|
+
when :list then :r
|
331
334
|
when :read then :r
|
332
335
|
when :create then :w
|
333
336
|
when :update then :w
|
337
|
+
when :delete then :w
|
334
338
|
else raise "Unexpected action : #{action.inspect}"
|
335
339
|
end
|
336
340
|
end
|
data/sinatra_resource.gemspec
CHANGED