Sha256: cd49113f042e581184832fbcb054d773356535fc769fa6323580d96cc663b3e1

Contents?: true

Size: 747 Bytes

Versions: 1

Compression:

Stored size: 747 Bytes

Contents

require 'klout'
# This module analize and extract score from social analizer http://klout.com
module Skore
  class KloutSkore

    # Include module and clases from Klout
    include Klout

    attr_accessor :user

    # Initialize Base and almacenate user information
    def initialize(api_key)
      raise ArgumentError, 'api_key is required' if api_key == nil || api_key.empty?
      Klout.api_key = api_key
    end

    # Get score for user
    def score(username, round=false)
      begin
        identity = Identity.find_by_screen_name(username)
        @user = User.new(identity.id)
        if round
          @user.score.score.round
        else
          @user.score.score
        end
      rescue
        nil
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
skore-1.0.0 lib/skore/klout.rb