Class: Skore::SkoreUtil

Inherits:
Object
  • Object
show all
Defined in:
lib/skore/skore_util.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ SkoreUtil

Returns a new instance of SkoreUtil.



4
5
6
7
8
9
# File 'lib/skore/skore_util.rb', line 4

def initialize(options = {})
  @klout_api_key = options[:klout_api_key]
  @peerindex_api_key = options[:peerindex_api_key]
  @kred_app_id = options[:kred_app_id]
  @kred_app_key = options[:kred_app_key]
end

Instance Method Details

#score(social_network, username) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/skore/skore_util.rb', line 11

def score(social_network, username)
  result = {}
  case social_network.to_sym
    when :twitter then
      result[:klout] = Skore::KloutSkore.new(@klout_api_key).score(username, true)
      result[:peerindex] = Skore::PeerIndex.new(@peerindex_api_key).score(username)
      result[:kred] = Skore::Kred.new(@kred_app_id, @kred_app_key).score(social_network.to_sym, username)
    else
      result[:klout] = Skore::KloutSkore.new(@klout_api_key).score(username, true)
  end
  result
end