Module: TwitterFriends

Defined in:
lib/twitter-friends.rb,
lib/twitter-friends/version.rb

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.mutual(first_user, second_user) ⇒ Object



6
7
8
9
10
11
# File 'lib/twitter-friends.rb', line 6

def mutual first_user, second_user
  first_users_followers  = Twitter.follower_ids first_user
  second_users_followers = Twitter.follower_ids second_user

  first_users_followers.ids & second_users_followers.ids
end

.random_connection(first_user, second_user) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/twitter-friends.rb', line 13

def random_connection first_user, second_user
  connections_array = mutual first_user, second_user

  if connections_array.any?
	random_connection = connections_array.sample
	Twitter.user(random_connection)
  else
	nil
  end
end