Sha256: 34a1faf618fe6c037a19d5b3f2fcd425eb7168663ca753ffd8fd29a18bf71d92

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

require 'klout'
require 'json'

module Klout
  # Represents an identity
  class Identity
    class << self
      def find_by_twitter_id(twitter_id)
        response = Klout.get "/identity.json/tw/#{twitter_id}", :query => {key: Klout.api_key}
        Hashie::Mash.new(response)
      end
      
      def find_by_screen_name(screen_name)
        response = Klout.get "/identity.json/twitter", :query => {key: Klout.api_key, screenName: screen_name}
        Hashie::Mash.new(response)
      end
      
      def find_by_klout_id(klout_id)
        response = Klout.get "/identity.json/klout/#{klout_id}/tw", :query => {key: Klout.api_key}
        Hashie::Mash.new(response)
      end
      
      def find_by_facebook_id(third_party_id)
        response = Klout.get "/identity.json/fb/#{third_party_id}", :query => {key: Klout.api_key}
        Hashie::Mash.new(response)
      end
      
      def find_by_google_plus_id(google_plus_id)
        response = Klout.get "/identity.json/gp/#{google_plus_id}", :query => {key: Klout.api_key}
        Hashie::Mash.new(response)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
klout-3.0.3 lib/klout/identity.rb
klout-3.0.2 lib/klout/identity.rb