Class: Twinger
- Inherits:
-
Object
- Object
- Twinger
- Defined in:
- lib/twinger.rb
Instance Method Summary collapse
-
#initialize(user) ⇒ Twinger
constructor
A new instance of Twinger.
Constructor Details
#initialize(user) ⇒ Twinger
Returns a new instance of Twinger.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/twinger.rb', line 5 def initialize(user) output = JSON.parse(Net::HTTP.get 'api.twitter.com', "/1/users/show.json?screen_name=#{user}") if output.has_key?("errors") puts "The Twitter user doesn't exist or an error has occured." else finger = "[#{output['screen_name']}@twitter.com]\n" \ "User\tReal Name\tWhat\n" \ "#{output['screen_name']}\t#{output['name']}\t#{output['description']}\n" puts finger end end |