Skip to content

Instantly share code, notes, and snippets.

@elebertus
Created June 22, 2013 01:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elebertus/5835498 to your computer and use it in GitHub Desktop.
Save elebertus/5835498 to your computer and use it in GitHub Desktop.
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