Rhino with DOM from Ruby (I hope not)

2 views
Skip to first unread message

Bill Burcham

unread,
Nov 5, 2009, 12:35:02 PM11/5/09
to Portland JavaScript Admirers
I'm using the Google AJAX Search API. In particular, the RESTful
version of the API. I'm using URLs like:

http://ajax.googleapis.com/ajax/services/search/local?v=1.0&Issaquah&rsz=large&q=coffee&sll=32,-96

I'm having lots of trouble getting zooming to work. No matter what
combination of radius, sspn or z parameters I use, I get the same
results. I am unable to affect the zoom level or the span of search.

I find that the documentation is really thin for the RESTful version
of the API. There's just a little blurb at the bottom of this page:

http://code.google.com/apis/ajaxsearch/documentation/

This leads me to believe that I'm barking up the wrong tree. I am
considering a couple alternatives here:

1. experimenting with providing an API Key in my requests in hopes
that maybe the sspn will magically start working
2. using Rhino on my server and moving to the well-documented (full-
fledged) AJAX search API

Assuming (1) is probably a dead end, there are many unknowns with (2).
First off, I think I'd have to have some DOM solution for Rhino. I see
this from John Resig:

http://ejohn.org/blog/bringing-the-browser-to-the-server/

Then there is the need to set up communication between my Ruby code
(on the server) and the JavaScript code (also on the server, running
in Rhino). For that I have not yet found a solution.

I'd really benefit from some group wisdom here.

Mike Leach

unread,
Nov 5, 2009, 12:59:37 PM11/5/09
to pd...@googlegroups.com
Without seeing the actual code, not sure what the issue may be.

Server-side JS makes sense when you're talking to your own DB, but not so much as a proxy to another service that already provides a RESTful API.
The JSON response from this API is just too juicy to pass up IMO. The intent is to run this on the client.

Several Google Code APIs are really pushing the AJAX loader. I haven't used it yet, but it seems like an avenue to exhaust before re-architecting server-side.

-Mike

Bill Burcham

unread,
Nov 6, 2009, 6:56:10 PM11/6/09
to pd...@googlegroups.com
Mkay so I found some better (Google) documentation on the the API for "Flash and other Non-Javascript Environments" a.k.a. REST in the API reference here:


Some more experimenting w/ GETs on URLs leads me to believe that sspn is actually working and that all I need to do is actually "cursor" through (all) the results to actually make things work. I was getting tripped up by the fact that I was always getting back the same number of results but as it turns out that was actually to be expected.

Also I had the impression that the full JavaScript API was richer than what was documented (for the REST one) but it looks like that may have been a mistaken impression. So I'm pretty optimistic now that I'll just be able to stick w/ REST and avoid Rhino on my server for now. Kind of a bummer because I've been kind of looking for an excuse. Oh well.
Reply all
Reply to author
Forward
0 new messages