Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def post(term)
uri = URI("http://api.urbandictionary.com/v0/define?")
params = {:term => term }
uri.query = URI.encode_www_form(params)
res = Net::HTTP.get_response(uri)
data = res.body
result = JSON.parse(data)
pp result['list'][1]['definition']
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment