Skip to content

Commit 1de7c8f

Browse files
author
Patrick Crosby
committed
merge with timestamp changes
2 parents 42d9bf0 + 8da433c commit 1de7c8f

File tree

3 files changed

+17
-62
lines changed

3 files changed

+17
-62
lines changed

Rakefile

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,13 @@
11
require 'rubygems'
2-
#require 'bundler'
3-
#begin
4-
# Bundler.setup(:default, :development)
5-
#rescue Bundler::BundlerError => e
6-
# $stderr.puts e.message
7-
# $stderr.puts "Run `bundle install` to install missing gems"
8-
# exit e.status_code
9-
#end
102
require 'rake'
113

12-
#require 'jeweler'
13-
#Jeweler::Tasks.new do |gem|
14-
# # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15-
# gem.name = "stathat"
16-
# gem.homepage = "http://github.com/patrickxb/stathat"
17-
# gem.license = "MIT"
18-
# gem.summary = %Q{gem to access StatHat api}
19-
# gem.description = %Q{Easily post stats to your StatHat account using this gem. Encapsulates full API.}
20-
# gem.email = "[email protected]"
21-
# gem.authors = ["Patrick Crosby"]
22-
# # Include your dependencies below. Runtime dependencies are required when using your gem,
23-
# # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24-
# # gem.add_runtime_dependency 'jabber4r', '> 0.1'
25-
# # gem.add_development_dependency 'rspec', '> 1.2.3'
26-
#end
27-
#Jeweler::RubygemsDotOrgTasks.new
28-
294
require 'rake/testtask'
305
Rake::TestTask.new(:test) do |test|
316
test.libs << 'lib' << 'test'
327
test.pattern = 'test/**/test_*.rb'
338
test.verbose = true
349
end
3510

36-
#require 'rcov/rcovtask'
37-
#Rcov::RcovTask.new do |test|
38-
# test.libs << 'test'
39-
# test.pattern = 'test/**/test_*.rb'
40-
# test.verbose = true
41-
#end
42-
4311
task :default => :test
4412

4513
require 'rdoc/task'
46-
#require 'rake/rdoctask'
47-
#Rake::RDocTask.new do |rdoc|
48-
# version = File.exist?('VERSION') ? File.read('VERSION') : ""
49-
#
50-
# rdoc.rdoc_dir = 'rdoc'
51-
# rdoc.title = "stathat #{version}"
52-
# rdoc.rdoc_files.include('README*')
53-
# rdoc.rdoc_files.include('lib/**/*.rb')
54-
#end
55-
56-
#namespace :doc do
57-
# desc "build literate documentation"
58-
# task :build do
59-
# sh "rocco -o doc lib/*.rb"
60-
# end
61-
#end

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.4
1+
0.1.3

lib/stathat.rb

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@
77
module StatHat
88
class API
99
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)
1212
end
1313

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)
1616
end
1717

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)
2020
end
2121

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)
2424
end
2525
end
2626
end
@@ -32,7 +32,6 @@ class Reporter
3232
CLASSIC_COUNT_URL = "http://api.stathat.com/c"
3333
EZ_URL = "http://api.stathat.com/ez"
3434

35-
3635
def initialize
3736
@que = Queue.new
3837
@runlock = Mutex.new
@@ -44,32 +43,36 @@ def finish()
4443
# XXX serialize queue?
4544
end
4645

47-
def post_value(stat_key, user_key, value, cb)
46+
def post_value(stat_key, user_key, value, timestamp, cb)
4847
args = { :key => stat_key,
4948
:ukey => user_key,
5049
:value => value }
50+
args[:t] = timestamp unless timestamp.nil?
5151
enqueue(CLASSIC_VALUE_URL, args, cb)
5252
end
5353

54-
def post_count(stat_key, user_key, count, cb)
54+
def post_count(stat_key, user_key, count, timestamp, cb)
5555
args = { :key => stat_key,
5656
:ukey => user_key,
5757
:count => count }
58+
args[:t] = timestamp unless timestamp.nil?
5859
enqueue(CLASSIC_COUNT_URL, args, cb)
5960
end
6061

61-
def ez_post_value(stat_name, ezkey, value, cb)
62+
def ez_post_value(stat_name, ezkey, value, timestamp, cb)
6263
puts "ezval cb: #{cb}"
6364
args = { :stat => stat_name,
6465
:ezkey => ezkey,
6566
:value => value }
67+
args[:t] = timestamp unless timestamp.nil?
6668
enqueue(EZ_URL, args, cb)
6769
end
6870

69-
def ez_post_count(stat_name, ezkey, count, cb)
71+
def ez_post_count(stat_name, ezkey, count, timestamp, cb)
7072
args = { :stat => stat_name,
7173
:ezkey => ezkey,
7274
:count => count }
75+
args[:t] = timestamp unless timestamp.nil?
7376
enqueue(EZ_URL, args, cb)
7477
end
7578

0 commit comments

Comments
 (0)