Last active
October 8, 2015 02:51
-
-
Save henriqueutsch/0360e50d051c6e21030f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'koala' | |
require 'net/http' | |
require 'json' | |
def gender(name) | |
begin | |
uri = URI("https://api.genderize.io/?name=#{name}") | |
response = JSON.parse(Net::HTTP.get(uri)) # => String | |
# puts response | |
return response["gender"] | |
rescue | |
return "Genero não identificado" | |
end | |
end | |
@graph = Koala::Facebook::API.new("key") | |
members = @graph.get_connections("181050402022479", "members") | |
members.each {|member| | |
p name = member["name"].split.first | |
p gender(name) | |
} | |
puts members.count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment