lib/statsmix.rb in statsmix-0.1.5 vs lib/statsmix.rb in statsmix-0.1.6
- old
+ new
@@ -34,18 +34,19 @@
# Stats
# List stats (index)
#
# Required: metric_id
- # Optional: limit
+ # Optional: limit, {:startdate => nil, :end_date => nil}
+ # Use start_date and end_date as has keys in the third param to scope the date range of stats based on the generated_at timestamp of a stat
# Returns: Net::HTTP object
- def self.list_stats(metric_id, limit = nil)
+ 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[:limit] = limit if limit != nil
+ @params.merge!(options)
return do_request
end
# Get stat
#
@@ -287,19 +288,9 @@
else
@error = JSON.parse(@response.body)['errors']['error']
end
end
@response.body
- end
-end
-
-#added to suppress ssl warnings per advice at http://www.5dollarwhitebox.org/drupal/node/64
-class Net::HTTP
- alias_method :old_initialize, :initialize
- def initialize(*args)
- old_initialize(*args)
- @ssl_context = OpenSSL::SSL::SSLContext.new
- @ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
end
end
StatsMix.api_from_env
\ No newline at end of file