Prev | Current Page 175 | Next

David Berube

"Practical Reporting with Ruby and Rails"


CHAPTER 6 n TRACKING AUCTIONS WITH EBAY 124
The second line actually calls the API, using the Net::HTTP.get method. This is a convenience
method that skips several steps for you. Normally, you would need to open a
connection to the server, request the document represented by url_path, and then close
the connection. Fortunately, the Net:HTTP.get method does all that and returns a string,
which represents the body of eBay??™s response to your request.
Next, you need to create an Hpricot object to parse the response. After that, you can
use Hpricot to loop through the XML:
hpricot_doc = Hpricot.XML(response.body)
Incidentally, the XML you??™re parsing looks something like this:

2007-08-12T20:31:11.148Z
Success
525
e525_core_Bundled_5124914_R1



120148832189

2007-08-05T13:39:30.


Pages:
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
sennik Maria McKee Little Eva mieszkania do wynajecia tychy zmywarki