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