flexible_api 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,7 +30,7 @@ module FlexibleApi
30
30
  @eaten_levels << @klass.find_level(name)
31
31
  end
32
32
 
33
- def scope(name, args)
33
+ def scope(name, args = nil)
34
34
  @scopes << [name, args]
35
35
  end
36
36
 
@@ -1,5 +1,5 @@
1
1
  module FlexibleApi
2
2
 
3
- VERSION = '0.0.5'
3
+ VERSION = '0.0.6'
4
4
 
5
5
  end
data/lib/flexible_api.rb CHANGED
@@ -44,7 +44,9 @@ module FlexibleApi
44
44
  level = find_level(options[:request_level])
45
45
 
46
46
  query = self
47
- level.scopes.each { |s, args| query = query.send(s, *args) }
47
+ level.scopes.each do |s, args|
48
+ query = args.nil? ? query.send(s) : query = query.send(s, *args)
49
+ end
48
50
 
49
51
  records = query.all(:select => level.select_field.join(', '), :include => level.include_field)
50
52
  records.map { |r| level.receive(r) }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flexible_api
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - John Crepezzi