lib/statsmix.rb in statsmix-0.1.4 vs lib/statsmix.rb in statsmix-0.1.5
- old
+ new
@@ -1,10 +1,9 @@
require 'net/http'
require 'net/https'
require 'rubygems'
require 'json'
-
class StatsMix
BASE_URI = 'https://statsmix.com/api/v2/'
GEM_VERSION = File.exist?('../VERSION') ? File.read('../VERSION') : ""
@@ -67,10 +66,11 @@
# Returns: Net::HTTP object
def self.create_stat(metric_id, value = nil, params = {})
connect('stats')
@request_uri = @url.path + '.' + @format
@request = Net::HTTP::Post.new(@request_uri)
+ @params[:metric_id] = metric_id
@params.merge!(params)
@params[:value] = value if value
return do_request
end
@@ -133,11 +133,11 @@
# Create metric
#
# Required: name
# Optional: params[:profile_id, :sharing, :include_in_email]
# Returns: Net::HTTP object
- def self.create_metric(name,params={})
+ def self.create_metric(name, params = {})
connect('metrics')
@params.merge!(params)
@params[:name] = name
@request_uri = @url.path + '.' + @format
@request = Net::HTTP::Post.new(@request_uri)
@@ -167,13 +167,9 @@
def self.delete_metric(metric_id)
connect('metrics')
@request_uri = @url.path + '/' + metric_id.to_s + '.' + @format
@request = Net::HTTP::Delete.new(@request_uri)
return do_request
- end
-
- def initialize(api_key = nil)
- self.setup(api_key)
end
# Returns: Net::HTTP object
def self.response
@response
\ No newline at end of file