aboutsummaryrefslogtreecommitdiffstats
path: root/actionwebservice/examples/googlesearch/autoloading/google_search_api.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionwebservice/examples/googlesearch/autoloading/google_search_api.rb')
-rw-r--r--actionwebservice/examples/googlesearch/autoloading/google_search_api.rb50
1 files changed, 50 insertions, 0 deletions
diff --git a/actionwebservice/examples/googlesearch/autoloading/google_search_api.rb b/actionwebservice/examples/googlesearch/autoloading/google_search_api.rb
new file mode 100644
index 0000000000..e7e33a1105
--- /dev/null
+++ b/actionwebservice/examples/googlesearch/autoloading/google_search_api.rb
@@ -0,0 +1,50 @@
+class DirectoryCategory < ActionService::Struct
+ member :fullViewableName, :string
+ member :specialEncoding, :string
+end
+
+class ResultElement < ActionService::Struct
+ member :summary, :string
+ member :URL, :string
+ member :snippet, :string
+ member :title, :string
+ member :cachedSize, :string
+ member :relatedInformationPresent, :bool
+ member :hostName, :string
+ member :directoryCategory, DirectoryCategory
+ member :directoryTitle, :string
+end
+
+class GoogleSearchResult < ActionService::Struct
+ member :documentFiltering, :bool
+ member :searchComments, :string
+ member :estimatedTotalResultsCount, :int
+ member :estimateIsExact, :bool
+ member :resultElements, [ResultElement]
+ member :searchQuery, :string
+ member :startIndex, :int
+ member :endIndex, :int
+ member :searchTips, :string
+ member :directoryCategories, [DirectoryCategory]
+ member :searchTime, :float
+end
+
+class GoogleSearchAPI < ActionService::API::Base
+ inflect_names false
+
+ api_method :doGetCachedPage, :returns => [:string], :expects => [{:key=>:string}, {:url=>:string}]
+ api_method :doGetSpellingSuggestion, :returns => [:string], :expects => [{:key=>:string}, {:phrase=>:string}]
+
+ api_method :doGoogleSearch, :returns => [GoogleSearchResult], :expects => [
+ {:key=>:string},
+ {:q=>:string},
+ {:start=>:int},
+ {:maxResults=>:int},
+ {:filter=>:bool},
+ {:restrict=>:string},
+ {:safeSearch=>:bool},
+ {:lr=>:string},
+ {:ie=>:string},
+ {:oe=>:string}
+ ]
+end