aboutsummaryrefslogtreecommitdiffstats
path: root/actionservice/examples/googlesearch
diff options
context:
space:
mode:
Diffstat (limited to 'actionservice/examples/googlesearch')
-rw-r--r--actionservice/examples/googlesearch/README28
-rw-r--r--actionservice/examples/googlesearch/delegated/google_search_service.rb4
-rw-r--r--actionservice/examples/googlesearch/delegated/search_controller.rb4
-rw-r--r--actionservice/examples/googlesearch/direct/google_search_api.rb50
-rw-r--r--actionservice/examples/googlesearch/direct/search_controller.rb53
5 files changed, 64 insertions, 75 deletions
diff --git a/actionservice/examples/googlesearch/README b/actionservice/examples/googlesearch/README
index 20ecbc3a76..25ccbd2382 100644
--- a/actionservice/examples/googlesearch/README
+++ b/actionservice/examples/googlesearch/README
@@ -1,6 +1,5 @@
= Google Service example
-
This example shows how one would implement an API like Google
Search that uses lots of structured types.
@@ -9,26 +8,19 @@ modes.
There is also an example for API definition file autoloading.
-= Running
-
- 1. Ensure you have the 'actionservice' Gem installed. You can generate it using
- this command:
-
- $ rake package
-
-
- 2. Edit config/environment.rb, and add the following line after the rest of the
- require_gem statements:
- require_gem 'actionservice'
+= Running the examples
+ 1. Add the files to an Action Web Service enabled Rails project.
- 3. "Direct" example:
+ "Direct" example:
* Copy direct/search_controller.rb to "app/controllers"
in a Rails project.
+ * Copy direct/google_search_api.rb to "app/apis"
+ in a Rails project
- "Delegated" example:
+ "Delegated" example:
* Copy delegated/search_controller.rb to "app/controllers"
in a Rails project.
@@ -44,7 +36,7 @@ There is also an example for API definition file autoloading.
in a Rails project.
- 4. Go to the WSDL url in a browser, and check that it looks correct.
+ 2. Go to the WSDL url in a browser, and check that it looks correct.
"Direct" and "Delegated" examples:
http://url_to_project/search/wsdl
@@ -60,7 +52,7 @@ There is also an example for API definition file autoloading.
explain extreme similarities :)
- 5. Test that it works with .NET (Mono in this example):
+ 3. Test that it works with .NET (Mono in this example):
$ wget WSDL_URL
$ mv wsdl GoogleSearch.wsdl
@@ -144,8 +136,8 @@ There is also an example for API definition file autoloading.
If you don't like this behaviour, you can do:
class MyController < ActionController::Base
- service_exception_reporting false
+ web_service_exception_reporting false
end
- 6. Crack open a beer. Publishing APIs for working with the same model as
+ 4. Crack open a beer. Publishing APIs for working with the same model as
your Rails web app should be easy from now on :)
diff --git a/actionservice/examples/googlesearch/delegated/google_search_service.rb b/actionservice/examples/googlesearch/delegated/google_search_service.rb
index 84faf220ae..da7f8f4529 100644
--- a/actionservice/examples/googlesearch/delegated/google_search_service.rb
+++ b/actionservice/examples/googlesearch/delegated/google_search_service.rb
@@ -1,5 +1,3 @@
-require 'action_service'
-
class DirectoryCategory < ActionService::Struct
member :fullViewableName, :string
member :specialEncoding, :string
@@ -52,7 +50,7 @@ class GoogleSearchAPI < ActionService::API::Base
end
class GoogleSearchService < ActionService::Base
- service_api GoogleSearchAPI
+ web_service_api GoogleSearchAPI
def doGetCachedPage(key, url)
"<html><body>i am a cached page</body></html>"
diff --git a/actionservice/examples/googlesearch/delegated/search_controller.rb b/actionservice/examples/googlesearch/delegated/search_controller.rb
index 58c8321ef2..6525921b5a 100644
--- a/actionservice/examples/googlesearch/delegated/search_controller.rb
+++ b/actionservice/examples/googlesearch/delegated/search_controller.rb
@@ -2,6 +2,6 @@ require 'google_search_service'
class SearchController < ApplicationController
wsdl_service_name 'GoogleSearch'
- service_dispatching_mode :delegated
- service :beta3, GoogleSearchService.new
+ web_service_dispatching_mode :delegated
+ web_service :beta3, GoogleSearchService.new
end
diff --git a/actionservice/examples/googlesearch/direct/google_search_api.rb b/actionservice/examples/googlesearch/direct/google_search_api.rb
new file mode 100644
index 0000000000..e7e33a1105
--- /dev/null
+++ b/actionservice/examples/googlesearch/direct/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
diff --git a/actionservice/examples/googlesearch/direct/search_controller.rb b/actionservice/examples/googlesearch/direct/search_controller.rb
index e4e1d7a0eb..7c69f0225e 100644
--- a/actionservice/examples/googlesearch/direct/search_controller.rb
+++ b/actionservice/examples/googlesearch/direct/search_controller.rb
@@ -1,56 +1,5 @@
-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
-
class SearchController < ApplicationController
- service_api GoogleSearchAPI
+ web_service_api :google_search
wsdl_service_name 'GoogleSearch'
def doGetCachedPage