Web Services on Rails

Anyone use this pdf ?
Already ran into an error and checked O’Reilly site and there is no
errata
submitted to date.

I’m getting an error in the first example (Yahoo search using REST)

NoMethodError in Code#yahootest
Showing app/views/code/yahootest.rhtml where line #2 raised:
undefined method `text’ for #REXML::Text:0x388fb50

Controller -
class CodeController < ApplicationController

def yahootest
query = CGI.escape(“SEARCH TEXT”) #URL encoded search value
yahookey = “19571957”
url = “http://api.search.yahoo.com/” +
“WebSearchService/VI/webSearch?” +
“appid=#{yahookey}&query=#{query}” +
“&results=3&start=1”
result = Net::HTTP.get(URI(url))
@doc = REXML::Document.new result
end

end

View-
<% @doc.root.each_element do |res| %>
Title: <%= res[0].text.to_s %>

Summary: <%= res[1].text.to_s %>

Link: <%= res[2].text.to_s
%>




<% end %>

??? Anyone know what’s wrong
Stuart


After changing some of the code for the Yahoo test and then trying the
Google test, I’m getting 404 errors:

Not Found `/code/googletest’ not found.

WEBrick/1.3.1 (Ruby/1.8.4/2005-12-24) at localhost:3000

On 11/8/06, Dark A. [email protected] wrote:

result = Net::HTTP.get(URI(url))

%>



<% end %>

??? Anyone know what’s wrong
Stuart


http://en.wikipedia.org/wiki/Dark_ambient


Pretty weird after all was getting uninitialized constant in Application
Controller bug .
This is in 1.1.6
Updated to edge to finish off these two “quick” examples.

Stuart

On 11/8/06, Dark A. [email protected] wrote:

Anyone use this pdf ?
class CodeController < ApplicationController
end
<% end %>

http://en.wikipedia.org/wiki/Dark_ambient


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