sinatra_resource 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -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 :update
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
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sinatra_resource}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
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"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David James