7
7
module StatHat
8
8
class API
9
9
class << self
10
- def ez_post_value ( stat_name , ezkey , value , &block )
11
- Reporter . instance . ez_post_value ( stat_name , ezkey , value , block )
10
+ def ez_post_value ( stat_name , ezkey , value , timestamp = nil , &block )
11
+ Reporter . instance . ez_post_value ( stat_name , ezkey , value , timestamp , block )
12
12
end
13
13
14
- def ez_post_count ( stat_name , ezkey , count , &block )
15
- Reporter . instance . ez_post_count ( stat_name , ezkey , count , block )
14
+ def ez_post_count ( stat_name , ezkey , count , timestamp = nil , &block )
15
+ Reporter . instance . ez_post_count ( stat_name , ezkey , count , timestamp , block )
16
16
end
17
17
18
- def post_count ( stat_key , user_key , count , &block )
19
- Reporter . instance . post_count ( stat_key , user_key , count , block )
18
+ def post_count ( stat_key , user_key , count , timestamp = nil , &block )
19
+ Reporter . instance . post_count ( stat_key , user_key , count , timestamp , block )
20
20
end
21
21
22
- def post_value ( stat_key , user_key , value , &block )
23
- Reporter . instance . post_value ( stat_key , user_key , value , block )
22
+ def post_value ( stat_key , user_key , value , timestamp = nil , &block )
23
+ Reporter . instance . post_value ( stat_key , user_key , value , timestamp , block )
24
24
end
25
25
end
26
26
end
@@ -32,7 +32,6 @@ class Reporter
32
32
CLASSIC_COUNT_URL = "http://api.stathat.com/c"
33
33
EZ_URL = "http://api.stathat.com/ez"
34
34
35
-
36
35
def initialize
37
36
@que = Queue . new
38
37
@runlock = Mutex . new
@@ -44,32 +43,36 @@ def finish()
44
43
# XXX serialize queue?
45
44
end
46
45
47
- def post_value ( stat_key , user_key , value , cb )
46
+ def post_value ( stat_key , user_key , value , timestamp , cb )
48
47
args = { :key => stat_key ,
49
48
:ukey => user_key ,
50
49
:value => value }
50
+ args [ :t ] = timestamp unless timestamp . nil?
51
51
enqueue ( CLASSIC_VALUE_URL , args , cb )
52
52
end
53
53
54
- def post_count ( stat_key , user_key , count , cb )
54
+ def post_count ( stat_key , user_key , count , timestamp , cb )
55
55
args = { :key => stat_key ,
56
56
:ukey => user_key ,
57
57
:count => count }
58
+ args [ :t ] = timestamp unless timestamp . nil?
58
59
enqueue ( CLASSIC_COUNT_URL , args , cb )
59
60
end
60
61
61
- def ez_post_value ( stat_name , ezkey , value , cb )
62
+ def ez_post_value ( stat_name , ezkey , value , timestamp , cb )
62
63
puts "ezval cb: #{ cb } "
63
64
args = { :stat => stat_name ,
64
65
:ezkey => ezkey ,
65
66
:value => value }
67
+ args [ :t ] = timestamp unless timestamp . nil?
66
68
enqueue ( EZ_URL , args , cb )
67
69
end
68
70
69
- def ez_post_count ( stat_name , ezkey , count , cb )
71
+ def ez_post_count ( stat_name , ezkey , count , timestamp , cb )
70
72
args = { :stat => stat_name ,
71
73
:ezkey => ezkey ,
72
74
:count => count }
75
+ args [ :t ] = timestamp unless timestamp . nil?
73
76
enqueue ( EZ_URL , args , cb )
74
77
end
75
78
0 commit comments