Class: Socialinvestigator::Client::Twitter

Inherits:
Object
  • Object
show all
Defined in:
lib/socialinvestigator/client/twitter.rb

Instance Method Summary collapse

Instance Method Details

#lookup_url(url) ⇒ Object



21
22
23
24
25
# File 'lib/socialinvestigator/client/twitter.rb', line 21

def lookup_url( url )
  return nil if url.nil? || url == ""
  r = HTTParty.head url, { follow_redirects: false }
  r['location'] || url
end


6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/socialinvestigator/client/twitter.rb', line 6

def ( u )
  t = "%-20s: %s\n"
  printf t, "Screenname", u.user_name
  printf t, "Full Name", u.name
  printf t, "Bio", u.description
  printf t, "Website", lookup_url( u.website.to_s )
  printf t, "Joined", u.created_at.strftime( "%Y-%m-%d" )
  printf t, "Location", u.location
  printf t, "Verified", u.verified?
  printf t, "Tweets", u.tweets_count
  printf t, "Followers", u.followers_count
  printf t, "Following", u.friends_count
  printf t, "Favorites count", u.favorites_count
end