axtro-actionwebservice 2.3.5.1.20101118142125

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. data/CHANGELOG +335 -0
  2. data/MIT-LICENSE +21 -0
  3. data/README +381 -0
  4. data/Rakefile +184 -0
  5. data/TODO +32 -0
  6. data/examples/googlesearch/README +143 -0
  7. data/examples/googlesearch/autoloading/google_search_api.rb +51 -0
  8. data/examples/googlesearch/autoloading/google_search_controller.rb +58 -0
  9. data/examples/googlesearch/delegated/google_search_service.rb +109 -0
  10. data/examples/googlesearch/delegated/search_controller.rb +8 -0
  11. data/examples/googlesearch/direct/google_search_api.rb +51 -0
  12. data/examples/googlesearch/direct/search_controller.rb +59 -0
  13. data/examples/metaWeblog/README +17 -0
  14. data/examples/metaWeblog/apis/blogger_api.rb +61 -0
  15. data/examples/metaWeblog/apis/blogger_service.rb +35 -0
  16. data/examples/metaWeblog/apis/meta_weblog_api.rb +68 -0
  17. data/examples/metaWeblog/apis/meta_weblog_service.rb +49 -0
  18. data/examples/metaWeblog/controllers/xmlrpc_controller.rb +17 -0
  19. data/generators/web_service/USAGE +28 -0
  20. data/generators/web_service/templates/api_definition.rb +6 -0
  21. data/generators/web_service/templates/controller.rb +9 -0
  22. data/generators/web_service/templates/functional_test.rb +20 -0
  23. data/generators/web_service/web_service_generator.rb +30 -0
  24. data/lib/action_web_service.rb +61 -0
  25. data/lib/action_web_service/acts_as_web_service.rb +26 -0
  26. data/lib/action_web_service/api.rb +298 -0
  27. data/lib/action_web_service/base.rb +39 -0
  28. data/lib/action_web_service/casting.rb +160 -0
  29. data/lib/action_web_service/client.rb +4 -0
  30. data/lib/action_web_service/client/base.rb +29 -0
  31. data/lib/action_web_service/client/soap_client.rb +114 -0
  32. data/lib/action_web_service/client/xmlrpc_client.rb +59 -0
  33. data/lib/action_web_service/container.rb +4 -0
  34. data/lib/action_web_service/container/action_controller_container.rb +94 -0
  35. data/lib/action_web_service/container/delegated_container.rb +87 -0
  36. data/lib/action_web_service/container/direct_container.rb +70 -0
  37. data/lib/action_web_service/dispatcher.rb +3 -0
  38. data/lib/action_web_service/dispatcher/abstract.rb +209 -0
  39. data/lib/action_web_service/dispatcher/action_controller_dispatcher.rb +397 -0
  40. data/lib/action_web_service/invocation.rb +203 -0
  41. data/lib/action_web_service/protocol.rb +5 -0
  42. data/lib/action_web_service/protocol/abstract.rb +113 -0
  43. data/lib/action_web_service/protocol/discovery.rb +38 -0
  44. data/lib/action_web_service/protocol/soap_protocol.rb +177 -0
  45. data/lib/action_web_service/protocol/soap_protocol/marshaler.rb +243 -0
  46. data/lib/action_web_service/protocol/soap_protocol/marshaler.rb~ +243 -0
  47. data/lib/action_web_service/protocol/xmlrpc_protocol.rb +124 -0
  48. data/lib/action_web_service/scaffolding.rb +282 -0
  49. data/lib/action_web_service/simple.rb +54 -0
  50. data/lib/action_web_service/string_to_datetime_for_soap.rb +17 -0
  51. data/lib/action_web_service/struct.rb +69 -0
  52. data/lib/action_web_service/support/class_inheritable_options.rb +27 -0
  53. data/lib/action_web_service/support/signature_types.rb +262 -0
  54. data/lib/action_web_service/templates/scaffolds/layout.html.erb +65 -0
  55. data/lib/action_web_service/templates/scaffolds/methods.html.erb +6 -0
  56. data/lib/action_web_service/templates/scaffolds/parameters.html.erb +29 -0
  57. data/lib/action_web_service/templates/scaffolds/result.html.erb +30 -0
  58. data/lib/action_web_service/test_invoke.rb +111 -0
  59. data/lib/action_web_service/version.rb +11 -0
  60. data/lib/action_web_service/version.rb~ +10 -0
  61. data/lib/actionwebservice.rb +2 -0
  62. data/setup.rb +1380 -0
  63. data/test/abstract_client.rb +185 -0
  64. data/test/abstract_dispatcher.rb +550 -0
  65. data/test/abstract_unit.rb +44 -0
  66. data/test/api_test.rb +103 -0
  67. data/test/apis/auto_load_api.rb +4 -0
  68. data/test/apis/broken_auto_load_api.rb +3 -0
  69. data/test/base_test.rb +43 -0
  70. data/test/casting_test.rb +96 -0
  71. data/test/client_soap_test.rb +157 -0
  72. data/test/client_xmlrpc_test.rb +155 -0
  73. data/test/container_test.rb +76 -0
  74. data/test/dispatcher_action_controller_soap_test.rb +147 -0
  75. data/test/dispatcher_action_controller_xmlrpc_test.rb +60 -0
  76. data/test/fixtures/db_definitions/mysql.sql +8 -0
  77. data/test/fixtures/db_definitions/sqlite3.sql +8 -0
  78. data/test/fixtures/users.yml +12 -0
  79. data/test/gencov +3 -0
  80. data/test/invocation_test.rb +187 -0
  81. data/test/run +6 -0
  82. data/test/scaffolded_controller_test.rb +148 -0
  83. data/test/struct_test.rb +85 -0
  84. data/test/test_invoke_test.rb +114 -0
  85. metadata +167 -0
@@ -0,0 +1,114 @@
1
+ # encoding: UTF-8
2
+ require 'abstract_unit'
3
+ require 'action_web_service/test_invoke'
4
+
5
+ class TestInvokeAPI < ActionWebService::API::Base
6
+ api_method :null
7
+ api_method :add, :expects => [:int, :int], :returns => [:int]
8
+ end
9
+
10
+ class TestInvokeService < ActionWebService::Base
11
+ web_service_api TestInvokeAPI
12
+
13
+ attr :invoked
14
+
15
+ def add(a, b)
16
+ @invoked = true
17
+ a + b
18
+ end
19
+
20
+ def null
21
+ end
22
+ end
23
+
24
+ class TestController < ActionController::Base
25
+ acts_as_web_service
26
+ def rescue_action(e); raise e; end
27
+ end
28
+
29
+ class TestInvokeDirectController < TestController
30
+ web_service_api TestInvokeAPI
31
+
32
+ attr :invoked
33
+
34
+ def add
35
+ @invoked = true
36
+ @method_params[0] + @method_params[1]
37
+ end
38
+
39
+ def null
40
+ end
41
+ end
42
+
43
+ class TestInvokeDelegatedController < TestController
44
+ web_service_dispatching_mode :delegated
45
+ web_service :service, TestInvokeService.new
46
+ end
47
+
48
+ class TestInvokeLayeredController < TestController
49
+ web_service_dispatching_mode :layered
50
+ web_service(:one) { @service_one ||= TestInvokeService.new }
51
+ web_service(:two) { @service_two ||= TestInvokeService.new }
52
+ end
53
+
54
+ class TestInvokeTest < ActiveSupport::TestCase
55
+ def setup
56
+ @request = ActionController::TestRequest.new
57
+ @response = ActionController::TestResponse.new
58
+ end
59
+
60
+ def test_direct_add
61
+ @controller = TestInvokeDirectController.new
62
+ assert_equal nil, @controller.invoked
63
+ result = invoke :add, 25, 25
64
+ assert_equal 50, result
65
+ assert_equal true, @controller.invoked
66
+ end
67
+
68
+ def test_delegated_add
69
+ @controller = TestInvokeDelegatedController.new
70
+ assert_equal nil, @controller.web_service_object(:service).invoked
71
+ result = invoke_delegated :service, :add, 100, 50
72
+ assert_equal 150, result
73
+ assert_equal true, @controller.web_service_object(:service).invoked
74
+ end
75
+
76
+ def test_layered_add
77
+ [:soap, :xmlrpc].each do |protocol|
78
+ @protocol = protocol
79
+ [:one, :two].each do |service|
80
+ @controller = TestInvokeLayeredController.new
81
+ assert_equal nil, @controller.web_service_object(service).invoked
82
+ result = invoke_layered service, :add, 200, -50
83
+ assert_equal 150, result
84
+ assert_equal true, @controller.web_service_object(service).invoked
85
+ end
86
+ end
87
+ end
88
+
89
+ def test_layered_fail_with_wrong_number_of_arguments
90
+ [:soap, :xmlrpc].each do |protocol|
91
+ @protocol = protocol
92
+ [:one, :two].each do |service|
93
+ @controller = TestInvokeLayeredController.new
94
+ assert_raise(ArgumentError) { invoke_layered service, :add, 1 }
95
+ end
96
+ end
97
+ end
98
+
99
+ def test_delegated_fail_with_wrong_number_of_arguments
100
+ @controller = TestInvokeDelegatedController.new
101
+ assert_raise(ArgumentError) { invoke_delegated :service, :add, 1 }
102
+ end
103
+
104
+ def test_direct_fail_with_wrong_number_of_arguments
105
+ @controller = TestInvokeDirectController.new
106
+ assert_raise(ArgumentError) { invoke :add, 1 }
107
+ end
108
+
109
+ def test_with_no_parameters_declared
110
+ @controller = TestInvokeDirectController.new
111
+ assert_nil invoke(:null)
112
+ end
113
+
114
+ end
metadata ADDED
@@ -0,0 +1,167 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: axtro-actionwebservice
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.3.5.1.20101118142125
5
+ platform: ruby
6
+ authors:
7
+ - Laurence A. Lee, Leon Breedt, Kent Sibilev
8
+ autorequire: actionwebservice
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-11-18 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: activesupport
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 2.3.0
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: actionpack
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 2.3.0
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: activerecord
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 2.3.0
44
+ version:
45
+ description: Adds WSDL/SOAP and XML-RPC web service support to Action Pack
46
+ email: rubyjedi@gmail.com, bitserf@gmail.com, ksibilev@yahoo.com
47
+ executables: []
48
+
49
+ extensions: []
50
+
51
+ extra_rdoc_files: []
52
+
53
+ files:
54
+ - Rakefile
55
+ - setup.rb
56
+ - README
57
+ - TODO
58
+ - CHANGELOG
59
+ - MIT-LICENSE
60
+ - examples/metaWeblog/README
61
+ - examples/metaWeblog/apis/blogger_api.rb
62
+ - examples/metaWeblog/apis/blogger_service.rb
63
+ - examples/metaWeblog/apis/meta_weblog_service.rb
64
+ - examples/metaWeblog/apis/meta_weblog_api.rb
65
+ - examples/metaWeblog/controllers/xmlrpc_controller.rb
66
+ - examples/googlesearch/direct/search_controller.rb
67
+ - examples/googlesearch/direct/google_search_api.rb
68
+ - examples/googlesearch/README
69
+ - examples/googlesearch/delegated/google_search_service.rb
70
+ - examples/googlesearch/delegated/search_controller.rb
71
+ - examples/googlesearch/autoloading/google_search_api.rb
72
+ - examples/googlesearch/autoloading/google_search_controller.rb
73
+ - lib/actionwebservice.rb
74
+ - lib/action_web_service/version.rb~
75
+ - lib/action_web_service/dispatcher.rb
76
+ - lib/action_web_service/protocol.rb
77
+ - lib/action_web_service/api.rb
78
+ - lib/action_web_service/test_invoke.rb
79
+ - lib/action_web_service/casting.rb
80
+ - lib/action_web_service/support/class_inheritable_options.rb
81
+ - lib/action_web_service/support/signature_types.rb
82
+ - lib/action_web_service/version.rb
83
+ - lib/action_web_service/acts_as_web_service.rb
84
+ - lib/action_web_service/invocation.rb
85
+ - lib/action_web_service/container/delegated_container.rb
86
+ - lib/action_web_service/container/action_controller_container.rb
87
+ - lib/action_web_service/container/direct_container.rb
88
+ - lib/action_web_service/base.rb
89
+ - lib/action_web_service/templates/scaffolds/parameters.html.erb
90
+ - lib/action_web_service/templates/scaffolds/result.html.erb
91
+ - lib/action_web_service/templates/scaffolds/layout.html.erb
92
+ - lib/action_web_service/templates/scaffolds/methods.html.erb
93
+ - lib/action_web_service/scaffolding.rb
94
+ - lib/action_web_service/struct.rb
95
+ - lib/action_web_service/container.rb
96
+ - lib/action_web_service/simple.rb
97
+ - lib/action_web_service/string_to_datetime_for_soap.rb
98
+ - lib/action_web_service/dispatcher/action_controller_dispatcher.rb
99
+ - lib/action_web_service/dispatcher/abstract.rb
100
+ - lib/action_web_service/client.rb
101
+ - lib/action_web_service/protocol/xmlrpc_protocol.rb
102
+ - lib/action_web_service/protocol/discovery.rb
103
+ - lib/action_web_service/protocol/soap_protocol.rb
104
+ - lib/action_web_service/protocol/soap_protocol/marshaler.rb~
105
+ - lib/action_web_service/protocol/soap_protocol/marshaler.rb
106
+ - lib/action_web_service/protocol/abstract.rb
107
+ - lib/action_web_service/client/xmlrpc_client.rb
108
+ - lib/action_web_service/client/base.rb
109
+ - lib/action_web_service/client/soap_client.rb
110
+ - lib/action_web_service.rb
111
+ - test/test_invoke_test.rb
112
+ - test/run
113
+ - test/scaffolded_controller_test.rb
114
+ - test/invocation_test.rb
115
+ - test/client_soap_test.rb
116
+ - test/abstract_dispatcher.rb
117
+ - test/gencov
118
+ - test/fixtures/db_definitions/mysql.sql
119
+ - test/fixtures/db_definitions/sqlite3.sql
120
+ - test/fixtures/users.yml
121
+ - test/apis/broken_auto_load_api.rb
122
+ - test/apis/auto_load_api.rb
123
+ - test/casting_test.rb
124
+ - test/base_test.rb
125
+ - test/dispatcher_action_controller_soap_test.rb
126
+ - test/dispatcher_action_controller_xmlrpc_test.rb
127
+ - test/api_test.rb
128
+ - test/abstract_unit.rb
129
+ - test/container_test.rb
130
+ - test/struct_test.rb
131
+ - test/client_xmlrpc_test.rb
132
+ - test/abstract_client.rb
133
+ - generators/web_service/USAGE
134
+ - generators/web_service/web_service_generator.rb
135
+ - generators/web_service/templates/api_definition.rb
136
+ - generators/web_service/templates/functional_test.rb
137
+ - generators/web_service/templates/controller.rb
138
+ has_rdoc: true
139
+ homepage: http://wiki.github.com/rubyjedi/actionwebservice/
140
+ licenses: []
141
+
142
+ post_install_message:
143
+ rdoc_options: []
144
+
145
+ require_paths:
146
+ - lib
147
+ required_ruby_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: "0"
152
+ version:
153
+ required_rubygems_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: "0"
158
+ version:
159
+ requirements:
160
+ - none
161
+ rubyforge_project:
162
+ rubygems_version: 1.3.5
163
+ signing_key:
164
+ specification_version: 3
165
+ summary: Web service support for Action Pack.
166
+ test_files: []
167
+