lib/skore/kred.rb in skore-0.0.1 vs lib/skore/kred.rb in skore-0.0.2
- old
+ new
@@ -6,19 +6,20 @@
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("http://api.kred.com/kredscore?term=#{username}&source=twitter&app_id=#{app_id}&app_key=#{app_key}")
+ @data = self.class.get("?term=#{username}&source=twitter&app_id=#{app_id}&app_key=#{app_key}", :verify => false)
rescue Timeout::Error
@data = false
end
end
@@ -27,10 +28,10 @@
def score
if @data
result = JSON.parse(@data.body)
result["data"][0]["influence"]
else
- 0
+ -1
end
end
end
end
\ No newline at end of file