class Skore::PeerIndex
Attributes
data[RW]
Public Class Methods
new(api_key)
click to toggle source
Initialize and load data from kred api
# File lib/skore/peerindex.rb, line 15 def initialize(api_key) raise ArgumentError, 'api_key is required' if api_key == nil || api_key.empty? @api_key = api_key end
Public Instance Methods
score(username)
click to toggle source
Get core from peerindex api
# File lib/skore/peerindex.rb, line 21 def score(username) begin @data = self.class.get("?twitter_screen_name=#{username}&api_key=#{@api_key}", verify: false) result = @data ? JSON.parse(@data.body) : nil result['peerindex'] if result rescue Timeout::Error nil end end