Ask Wikipedia is a ruby gem for querying wikipedia in any language from within your 
ruby or rails application, and also could be used from commandline directly.