medea 0.6.8 → 0.6.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -62,6 +62,14 @@ module Medea
62
62
  def top n
63
63
  limit n
64
64
  end
65
+
66
+ def since t
67
+ self.filters[:SINCE] = t
68
+ end
69
+
70
+ def since= t
71
+ since t
72
+ end
65
73
  #end query interface
66
74
 
67
75
  def add_data_filter property, value
@@ -82,7 +82,7 @@ module Medea
82
82
  end
83
83
 
84
84
  def remove! member, cascade=false
85
- raise RuntimeError, "You can only remove an item if you are accessing this list from an object." unless @parent.is_a? JasonObject
85
+ raise RuntimeError, "You can only remove an item if you are accessing this list from an object (ie, not another list)." unless @parent.is_a? JasonObject
86
86
  raise ArgumentError, "You can only remove #{@type.name} items from this collection!" unless member.is_a? @type
87
87
  raise ArgumentError, "This item (#{member.jason_key}) doesn't exist in the list you're trying to remove it from!" unless self.include? member
88
88
 
@@ -24,8 +24,9 @@ module Medea
24
24
  #create a JasonDeferredQuery for all records of this class & with some optional conditions
25
25
  def JasonObject.all(opts=nil)
26
26
  q = JasonDeferredQuery.new :class => self, :filters => {:VERSION0 => nil, :FILTER => {:HTTP_X_CLASS => self, :HTTP_X_ACTION => :POST}}
27
- if opts && opts[:limit]
28
- q.limit = opts[:limit]
27
+ if opts
28
+ q.limit = opts[:limit] if opts[:limit]
29
+ q.since = opts[:since] if opts[:since]
29
30
  end
30
31
 
31
32
  q
data/lib/medea/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Medea
2
- VERSION = "0.6.8"
2
+ VERSION = "0.6.9"
3
3
 
4
4
  #When the templates are changed, this version should be incremented
5
5
  #This version is used when uploading/updating the templates
@@ -26,13 +26,18 @@ describe "Deferred Query" do
26
26
  it "should be able to be limited to a certain number of results" do
27
27
  u = User.all
28
28
  u.limit = 5
29
- u.count.should be <= 5
29
+ u.count.should be == 5
30
30
 
31
31
  u = User.all :limit => 4
32
- u.count.should be <= 4
32
+ u.count.should be == 4
33
33
  end
34
34
 
35
- it "should be able to fetch those since a particular time"
35
+ it "should be able to fetch those since a particular time" do
36
+ u = User.all[10]
37
+ User.all(:since => u.jason_timestamp).each do |i|
38
+ i.jason_timestamp.should be >= u.jason_timestamp
39
+ end
40
+ end
36
41
 
37
42
  it "should return the last element" do
38
43
  u = User.all
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: medea
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.6.8
5
+ version: 0.6.9
6
6
  platform: ruby
7
7
  authors:
8
8
  - Michael Jensen
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-08 00:00:00 +11:00
13
+ date: 2011-02-24 00:00:00 +11:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency