Noob: http script to google finance

Hello everybody, I’m learning Ruby, coming from Java and Python.

I thought a good first project would be to duplicate a script I’ve
previously done in Python, which takes a list of stock symbols and
does an http GET from google finance to pull the current stock price.

I started out by looking at the net.http library. However the
documentation isn’t super descriptive as far as usage:

This was a bit surprising to me coming from Python where the docs are
pretty good. Bascially, I am expecting to do a get and ruby returns a
string of the page html.

Is there another place documentation wise I should be looking? Or do I
just grab the interpreter and start experimenting? That’s fine also,
but if there is a better documentation source I thought I’d ask.



You should generally look for the documentation of the top level classes
(in this case Net::HTTP or Net). That’s were you’ll find explanations,
usage examples etc.

As a simple example:

require ‘net/http’

include the Net module so you don’t always have to prepend “Net”

include Net

response = HTTP.get ‘’, ‘/’
print response

I just created a new gem to provide a command line interface for
searches on

gem install gemqs

gemqs term1 term2
…search results


Hope it’s useful.

David H.
remo[email protected]

On Sat, Mar 17, 2012 at 7:02 PM, David H. [email protected]

Hope it’s useful.
It seems to work like a charm. The one nitpick I have so far is that
my terminal is set to 160 columns but it truncates the output lines to
170 characters; so there are 7 characters plus ‘…’ sitting all alone
on a line sometimes.

For some reason I don’t see your announcement on

On Sun, Mar 18, 2012 at 12:55 PM, Ryan D. [email protected]

Don’t thread hijack. It’s rude.

On Mar 17, 2012, at 17:02, David H. [email protected] wrote:

I just created a new gem to provide a command line interface for searches on

Ahh yes… that’s why I didn’t see it on the forum.

Sorry about that, my mistake.

Dave Heitzman

Don’t thread hijack. It’s rude.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs