diff options
Diffstat (limited to 'actionwebservice/test/abstract_client.rb')
-rw-r--r-- | actionwebservice/test/abstract_client.rb | 59 |
1 files changed, 53 insertions, 6 deletions
diff --git a/actionwebservice/test/abstract_client.rb b/actionwebservice/test/abstract_client.rb index 0efa1d7ec1..c5484b6b62 100644 --- a/actionwebservice/test/abstract_client.rb +++ b/actionwebservice/test/abstract_client.rb @@ -12,17 +12,44 @@ module ClientTest firstnames == other.firstnames && lastname == other.lastname end end + + class Inner < ActionWebService::Struct + member :name, :string + end + + class Outer < ActionWebService::Struct + member :name, :string + member :inner, Inner + end + + class User < ActiveRecord::Base + end + + module Accounting + class User < ActiveRecord::Base + end + end + + class WithModel < ActionWebService::Struct + member :user, User + member :users, [User] + end class API < ActionWebService::API::Base api_method :void - api_method :normal, :expects => [:int, :int], :returns => [:int] - api_method :array_return, :returns => [[Person]] - api_method :struct_pass, :expects => [[Person]], :returns => [:bool] - api_method :client_container, :returns => [:int] - api_method :named_parameters, :expects => [{:key=>:string}, {:id=>:int}] + api_method :normal, :expects => [:int, :int], :returns => [:int] + api_method :array_return, :returns => [[Person]] + api_method :struct_pass, :expects => [[Person]], :returns => [:bool] + api_method :nil_struct_return, :returns => [Person] + api_method :inner_nil, :returns => [Outer] + api_method :client_container, :returns => [:int] + api_method :named_parameters, :expects => [{:key=>:string}, {:id=>:int}] api_method :thrower + api_method :user_return, :returns => [User] + api_method :with_model_return, :returns => [WithModel] + api_method :scoped_model_return, :returns => [Accounting::User] end - + class NullLogOut def <<(*args); end end @@ -65,6 +92,14 @@ module ClientTest @value_struct_pass = @method_params true end + + def nil_struct_return + nil + end + + def inner_nil + Outer.new :name => 'outer', :inner => nil + end def client_container 50 @@ -77,6 +112,18 @@ module ClientTest def thrower raise "Hi" end + + def user_return + User.find(1) + end + + def with_model_return + WithModel.new :user => User.find(1), :users => User.find(:all) + end + + def scoped_model_return + Accounting::User.find(1) + end end class AbstractClientLet < WEBrick::HTTPServlet::AbstractServlet |