News for hackers. Stuff that matters.
Re:The Ruby Stdlib is not a Ghetto by aaronbrethorst on Wednesday November 24, 2010 @08:45PM (#1939082)
With all due respect, Net::HTTP is clunky. I'm typing the following from memory, too:

    require 'open-uri'
    response = open("http://blog.segment7.net/").read
Re:The Ruby Stdlib is not a Ghetto by catch23 on Thursday November 25, 2010 @12:10AM (#1939422)
that's great if all you're trying to do is HTTP GET. standard libs are supposed to make all use cases fairly easy. making an http post isn't too bad:

  Net::HTTP.new(host, port).start do |http|
    post = Net::HTTP::Post.new(url)
    post.set_form_data('blah' => '123')
    http.request(post)
  end
Re:The Ruby Stdlib is not a Ghetto by petercooper on Thursday November 25, 2010 @03:33AM (#1939730)
That's "not too bad" if you're coming from Java. Thankfully most other Ruby libraries have significantly less verbose APIs than this.
Re:The Ruby Stdlib is not a Ghetto by carbon8 on Thursday November 25, 2010 @06:30PM (#1941245)
There's a much simpler way to do POSTs with Net::HTTP:

  response = Net::HTTP.post_form(URI.parse("http://example.com"), {:param => "val"})
Re:The Ruby Stdlib is not a Ghetto by aaronbrethorst on Thursday November 25, 2010 @04:20AM (#1939802)
Personally, I'm a big fan of open-uri for super-simple requests and HTTParty for anything more complex.
Re:The Ruby Stdlib is not a Ghetto by derefr on Wednesday November 24, 2010 @11:30PM (#1939372)
If you're doing more than one of those in a single document, having a persistent connection object and sending it request messages wins. (Though open-uri could actually do this, if it cached the connection objects by host:port.)