lib/statsmix.rb in statsmix-0.1.9 vs lib/statsmix.rb in statsmix-0.1.10
- old
+ new
@@ -3,10 +3,11 @@
require 'rubygems'
require 'json'
class StatsMix
BASE_URI = 'https://statsmix.com/api/v2/'
+
GEM_VERSION = File.exist?('../VERSION') ? File.read('../VERSION') : ""
# Track an event
#
# Required: name of metric
@@ -40,11 +41,18 @@
# Returns: Net::HTTP object
def self.list_stats(metric_id, limit = nil, options = {})
self.connect('stats')
@request_uri = @url.path + '.' + @format
@request = Net::HTTP::Get.new(@request_uri)
+
@params[:metric_id] = metric_id
@params.merge!(options)
+ if @params[:start_date] && @params[:start_date].is_a?(ActiveSupport::TimeWithZone)
+ @params[:start_date] = @params[:start_date].utc.strftime('%Y-%m-%d %H:%M:%S')
+ end
+ if @params[:end_date] && @params[:end_date].is_a?(ActiveSupport::TimeWithZone)
+ @params[:end_date] = @params[:end_date].utc.strftime('%Y-%m-%d %H:%M:%S')
+ end
return do_request
end
# Get stat
#
\ No newline at end of file