Sha256: 187cfdf06b703522bc59d57de9ec7aea5354e7a19b5a095eb3d55910eee8937c

Contents?: true

Size: 464 Bytes

Versions: 2

Compression:

Stored size: 464 Bytes

Contents

# encoding: utf-8

require 'rubygems'
require 'net/http'
require 'json'

require 'twhois/user'
require 'twhois/version'

module Twhois
  
  LOOKUP_HOST = "api.twitter.com"
  LOOKUP_PATH = "/1/users/show.json?screen_name="
  
  # Lookup a Twitter user by their username.
  def self.lookup(username)
    res = Net::HTTP.start(LOOKUP_HOST) { |http| http.get(LOOKUP_PATH + username) }
    if res.code == '200'
      User.new(JSON.parse(res.body))
    end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
twhois-0.0.2 lib/twhois.rb
twhois-0.0.1 lib/twhois.rb