rubyjedi-actionwebservice 2.3.5.20100615120735

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