removing log dir from .gitignore
[monkeycharger.git] / vendor / rails / actionwebservice / examples / googlesearch / autoloading / google_search_controller.rb
blobc62e869df521a0a007960129822ceec67b47e65c
1 class GoogleSearchController < ApplicationController
2   wsdl_service_name 'GoogleSearch'
4   def doGetCachedPage
5     "<html><body>i am a cached page. my key was %s, url was %s</body></html>" % [@params['key'], @params['url']]
6   end
8   def doSpellingSuggestion
9     "%s: Did you mean '%s'?" % [@params['key'], @params['phrase']]
10   end
12   def doGoogleSearch
13     resultElement = ResultElement.new
14     resultElement.summary = "ONlamp.com: Rolling with Ruby on Rails"
15     resultElement.URL = "http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html"
16     resultElement.snippet = "Curt Hibbs shows off Ruby on Rails by building a simple application that requires " +
17                             "almost no Ruby experience. ... Rolling with Ruby on Rails. ..."
18     resultElement.title = "Teh Railz0r"
19     resultElement.cachedSize = "Almost no lines of code!"
20     resultElement.relatedInformationPresent = true
21     resultElement.hostName = "rubyonrails.com"
22     resultElement.directoryCategory = category("Web Development", "UTF-8")
24     result = GoogleSearchResult.new
25     result.documentFiltering = @params['filter']
26     result.searchComments = ""
27     result.estimatedTotalResultsCount = 322000
28     result.estimateIsExact = false
29     result.resultElements = [resultElement]
30     result.searchQuery = "http://www.google.com/search?q=ruby+on+rails"
31     result.startIndex = @params['start']
32     result.endIndex = @params['start'] + @params['maxResults']
33     result.searchTips = "\"on\" is a very common word and was not included in your search [details]"
34     result.searchTime = 0.000001
36     # For Mono, we have to clone objects if they're referenced by more than one place, otherwise
37     # the Ruby SOAP collapses them into one instance and uses references all over the
38     # place, confusing Mono. 
39     #
40     # This has recently been fixed:
41     #   http://bugzilla.ximian.com/show_bug.cgi?id=72265
42     result.directoryCategories = [
43       category("Web Development", "UTF-8"),
44       category("Programming", "US-ASCII"),
45     ]
47     result
48   end
50   private
51     def category(name, encoding)
52       cat = DirectoryCategory.new
53       cat.fullViewableName = name.dup
54       cat.specialEncoding = encoding.dup
55       cat
56     end
57 end