Klout <img src=“http://travis-ci.org/terra-firma/klout.png” /> <img src=“https://gemnasium.com/terra-firma/klout.png” alt=“Dependency Status” />

Klout is a Ruby gem that provides a wrapper for interacting with the Klout API. Note: this gem only supports 2[http://klout.com/s/developers/v2] of the Klout API. Use the branch[https://github.com/terra-firma/klout/tree/v1] if you need legacy support.

Requirements

You will need a Klout API Key in order to get started.

Installation

(sudo) gem install klout

Usage

Please refer to the Klout API Documentation for more information about the API, or follow the examples below:

require 'klout'
k = Klout::API.new('api_key')

If you set the ENV environment variable you don’t need to pass anything:

k = Klout::API.new('api_key')

Obtain the klout_id for someone using their Twitter screen name or numerical Twitter ID:

k.identity('screen_name')
k.identity(12345678)
k.identity('screen_name', :ks)  # Query a different network.

Once you have a klout_id for someone, you can access their Klout score, influence and topics:

k.users klout_id
k.users klout_id, :score
k.users klout_id, :influence
k.users klout_id, :topics

And that’s it!

Caching

The Klout API Documentation has great information about what data can be cached safely, and for how long, in order to improve the performance of your app.

Errors

When an error is received an instance of Klout::API::Error will be returned so that you can rescue accordingly:

rescue Klout::API::Error > error
  ...

Contributing to Klout

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2011 Terra Firma Design & Consulting. See LICENSE.txt for further details.