lib/skore/kred.rb in skore-0.0.1.pre.1 vs lib/skore/kred.rb in skore-0.0.1
- old
+ new
@@ -6,20 +6,19 @@
class Kred
##
# Include httparty module from http querys
include HTTParty
- base_uri "http://api.kred.com/kredscore"
default_timeout 1
attr_accessor :data
##
# Initialize and load data from kred api
def initialize(app_id, app_key, username)
begin
- @data = self.class.get("?term=#{username}&source=twitter&app_id=#{app_id}&app_key=#{app_key}")
+ @data = self.class.get("http://api.kred.com/kredscore?term=#{username}&source=twitter&app_id=#{app_id}&app_key=#{app_key}")
rescue Timeout::Error
@data = false
end
end
@@ -28,10 +27,10 @@
def score
if @data
result = JSON.parse(@data.body)
result["data"][0]["influence"]
else
- -1
+ 0
end
end
end
end
\ No newline at end of file