actionwebservice 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +5 -0
- data/Rakefile +125 -4
- data/lib/action_web_service.rb +3 -3
- data/lib/action_web_service/container/action_controller_container.rb +6 -3
- data/lib/action_web_service/dispatcher/abstract.rb +6 -1
- data/test/abstract_dispatcher.rb +8 -0
- data/test/dispatcher_action_controller_soap_test.rb +13 -1
- metadata +5 -5
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
*0.6.2* (27th March, 2005)
|
2
|
+
|
3
|
+
* Allow method declarations for direct dispatching to declare parameters as well. We treat an arity of < 0 or > 0 as an indication that we should send through parameters. Closes #939.
|
4
|
+
|
5
|
+
|
1
6
|
*0.6.1* (22th March, 2005)
|
2
7
|
|
3
8
|
* Fix that method response QNames mismatched with that declared in the WSDL, makes SOAP::WSDLDriverFactory work against AWS again
|
data/Rakefile
CHANGED
@@ -9,10 +9,15 @@ require 'fileutils'
|
|
9
9
|
|
10
10
|
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
|
11
11
|
PKG_NAME = 'actionwebservice'
|
12
|
-
PKG_VERSION = '0.6.
|
12
|
+
PKG_VERSION = '0.6.2' + PKG_BUILD
|
13
13
|
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
14
14
|
PKG_DESTINATION = ENV["RAILS_PKG_DESTINATION"] || "../#{PKG_NAME}"
|
15
15
|
|
16
|
+
RELEASE_NAME = "REL #{PKG_VERSION}"
|
17
|
+
|
18
|
+
RUBY_FORGE_PROJECT = "aws"
|
19
|
+
RUBY_FORGE_USER = "webster132"
|
20
|
+
|
16
21
|
desc "Default Task"
|
17
22
|
task :default => [ :test ]
|
18
23
|
|
@@ -30,6 +35,7 @@ Rake::RDocTask.new { |rdoc|
|
|
30
35
|
rdoc.rdoc_dir = 'doc'
|
31
36
|
rdoc.title = "Action Web Service -- Web services for Action Pack"
|
32
37
|
rdoc.options << '--line-numbers --inline-source --main README --accessor class_inheritable_option=RW'
|
38
|
+
rdoc.template = "#{ENV['template']}.rb" if ENV['template']
|
33
39
|
rdoc.rdoc_files.include('README')
|
34
40
|
rdoc.rdoc_files.include('CHANGELOG')
|
35
41
|
rdoc.rdoc_files.include('lib/action_web_service.rb')
|
@@ -56,9 +62,9 @@ spec = Gem::Specification.new do |s|
|
|
56
62
|
s.rubyforge_project = "aws"
|
57
63
|
s.homepage = "http://www.rubyonrails.org"
|
58
64
|
|
59
|
-
s.add_dependency('actionpack', '= 1.
|
60
|
-
s.add_dependency('activerecord', '= 1.9.
|
61
|
-
s.add_dependency('activesupport', '= 1.0.
|
65
|
+
s.add_dependency('actionpack', '= 1.7.0' + PKG_BUILD)
|
66
|
+
s.add_dependency('activerecord', '= 1.9.1' + PKG_BUILD)
|
67
|
+
s.add_dependency('activesupport', '= 1.0.3' + PKG_BUILD)
|
62
68
|
|
63
69
|
s.has_rdoc = true
|
64
70
|
s.requirements << 'none'
|
@@ -144,3 +150,118 @@ task :lines do
|
|
144
150
|
puts "Total:"
|
145
151
|
puts " Lines #{total_lines}, LOC #{total_loc}"
|
146
152
|
end
|
153
|
+
|
154
|
+
desc "Publish the release files to RubyForge."
|
155
|
+
task :release => [:package] do
|
156
|
+
files = ["gem", "tgz", "zip"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" }
|
157
|
+
|
158
|
+
if RUBY_FORGE_PROJECT then
|
159
|
+
require 'net/http'
|
160
|
+
require 'open-uri'
|
161
|
+
|
162
|
+
project_uri = "http://rubyforge.org/projects/#{RUBY_FORGE_PROJECT}/"
|
163
|
+
project_data = open(project_uri) { |data| data.read }
|
164
|
+
group_id = project_data[/[?&]group_id=(\d+)/, 1]
|
165
|
+
raise "Couldn't get group id" unless group_id
|
166
|
+
|
167
|
+
# This echos password to shell which is a bit sucky
|
168
|
+
if ENV["RUBY_FORGE_PASSWORD"]
|
169
|
+
password = ENV["RUBY_FORGE_PASSWORD"]
|
170
|
+
else
|
171
|
+
print "#{RUBY_FORGE_USER}@rubyforge.org's password: "
|
172
|
+
password = STDIN.gets.chomp
|
173
|
+
end
|
174
|
+
|
175
|
+
login_response = Net::HTTP.start("rubyforge.org", 80) do |http|
|
176
|
+
data = [
|
177
|
+
"login=1",
|
178
|
+
"form_loginname=#{RUBY_FORGE_USER}",
|
179
|
+
"form_pw=#{password}"
|
180
|
+
].join("&")
|
181
|
+
http.post("/account/login.php", data)
|
182
|
+
end
|
183
|
+
|
184
|
+
cookie = login_response["set-cookie"]
|
185
|
+
raise "Login failed" unless cookie
|
186
|
+
headers = { "Cookie" => cookie }
|
187
|
+
|
188
|
+
release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}"
|
189
|
+
release_data = open(release_uri, headers) { |data| data.read }
|
190
|
+
package_id = release_data[/[?&]package_id=(\d+)/, 1]
|
191
|
+
raise "Couldn't get package id" unless package_id
|
192
|
+
|
193
|
+
first_file = true
|
194
|
+
release_id = ""
|
195
|
+
|
196
|
+
files.each do |filename|
|
197
|
+
basename = File.basename(filename)
|
198
|
+
file_ext = File.extname(filename)
|
199
|
+
file_data = File.open(filename, "rb") { |file| file.read }
|
200
|
+
|
201
|
+
puts "Releasing #{basename}..."
|
202
|
+
|
203
|
+
release_response = Net::HTTP.start("rubyforge.org", 80) do |http|
|
204
|
+
release_date = Time.now.strftime("%Y-%m-%d %H:%M")
|
205
|
+
type_map = {
|
206
|
+
".zip" => "3000",
|
207
|
+
".tgz" => "3110",
|
208
|
+
".gz" => "3110",
|
209
|
+
".gem" => "1400"
|
210
|
+
}; type_map.default = "9999"
|
211
|
+
type = type_map[file_ext]
|
212
|
+
boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor"
|
213
|
+
|
214
|
+
query_hash = if first_file then
|
215
|
+
{
|
216
|
+
"group_id" => group_id,
|
217
|
+
"package_id" => package_id,
|
218
|
+
"release_name" => RELEASE_NAME,
|
219
|
+
"release_date" => release_date,
|
220
|
+
"type_id" => type,
|
221
|
+
"processor_id" => "8000", # Any
|
222
|
+
"release_notes" => "",
|
223
|
+
"release_changes" => "",
|
224
|
+
"preformatted" => "1",
|
225
|
+
"submit" => "1"
|
226
|
+
}
|
227
|
+
else
|
228
|
+
{
|
229
|
+
"group_id" => group_id,
|
230
|
+
"release_id" => release_id,
|
231
|
+
"package_id" => package_id,
|
232
|
+
"step2" => "1",
|
233
|
+
"type_id" => type,
|
234
|
+
"processor_id" => "8000", # Any
|
235
|
+
"submit" => "Add This File"
|
236
|
+
}
|
237
|
+
end
|
238
|
+
|
239
|
+
query = "?" + query_hash.map do |(name, value)|
|
240
|
+
[name, URI.encode(value)].join("=")
|
241
|
+
end.join("&")
|
242
|
+
|
243
|
+
data = [
|
244
|
+
"--" + boundary,
|
245
|
+
"Content-Disposition: form-data; name=\"userfile\"; filename=\"#{basename}\"",
|
246
|
+
"Content-Type: application/octet-stream",
|
247
|
+
"Content-Transfer-Encoding: binary",
|
248
|
+
"", file_data, ""
|
249
|
+
].join("\x0D\x0A")
|
250
|
+
|
251
|
+
release_headers = headers.merge(
|
252
|
+
"Content-Type" => "multipart/form-data; boundary=#{boundary}"
|
253
|
+
)
|
254
|
+
|
255
|
+
target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php"
|
256
|
+
http.post(target + query, data, release_headers)
|
257
|
+
end
|
258
|
+
|
259
|
+
if first_file then
|
260
|
+
release_id = release_response.body[/release_id=(\d+)/, 1]
|
261
|
+
raise("Couldn't get release id") unless release_id
|
262
|
+
end
|
263
|
+
|
264
|
+
first_file = false
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
data/lib/action_web_service.rb
CHANGED
@@ -27,9 +27,9 @@ begin
|
|
27
27
|
require 'active_record'
|
28
28
|
rescue LoadError
|
29
29
|
require 'rubygems'
|
30
|
-
require_gem 'activesupport', '>= 0.
|
31
|
-
require_gem 'actionpack', '>= 1.
|
32
|
-
require_gem 'activerecord', '>= 1.
|
30
|
+
require_gem 'activesupport', '>= 1.0.2'
|
31
|
+
require_gem 'actionpack', '>= 1.6.0'
|
32
|
+
require_gem 'activerecord', '>= 1.9.0'
|
33
33
|
end
|
34
34
|
|
35
35
|
$:.unshift(File.dirname(__FILE__) + "/action_web_service/vendor/")
|
@@ -64,7 +64,8 @@ module ActionWebService # :nodoc:
|
|
64
64
|
require_dependency(file_name)
|
65
65
|
rescue LoadError => load_error
|
66
66
|
requiree = / -- (.*?)(\.rb)?$/.match(load_error).to_a[1]
|
67
|
-
|
67
|
+
msg = requiree == file_name ? "Missing API definition file in apis/#{file_name}.rb" : "Can't load file: #{requiree}"
|
68
|
+
raise LoadError.new(msg).copy_blame!(load_error)
|
68
69
|
end
|
69
70
|
klass = nil
|
70
71
|
class_names.each do |name|
|
@@ -83,8 +84,10 @@ module ActionWebService # :nodoc:
|
|
83
84
|
private
|
84
85
|
def inherited(child)
|
85
86
|
inherited_without_api(child)
|
86
|
-
child.web_service_api(child.controller_path)
|
87
|
-
|
87
|
+
begin child.web_service_api(child.controller_path)
|
88
|
+
rescue MissingSourceFile => e
|
89
|
+
raise unless e.is_missing?("apis/#{child.controller_path}_api")
|
90
|
+
end
|
88
91
|
end
|
89
92
|
end
|
90
93
|
end
|
@@ -34,7 +34,12 @@ module ActionWebService # :nodoc:
|
|
34
34
|
|
35
35
|
def web_service_direct_invoke(invocation)
|
36
36
|
@method_params = invocation.method_ordered_params
|
37
|
-
|
37
|
+
arity = method(invocation.api_method_name).arity rescue 0
|
38
|
+
if arity < 0 || arity > 0
|
39
|
+
return_value = self.__send__(invocation.api_method_name, *@method_params)
|
40
|
+
else
|
41
|
+
return_value = self.__send__(invocation.api_method_name)
|
42
|
+
end
|
38
43
|
if invocation.api.has_api_method?(invocation.api_method_name)
|
39
44
|
returns = invocation.returns ? invocation.returns[0] : nil
|
40
45
|
else
|
data/test/abstract_dispatcher.rb
CHANGED
@@ -40,6 +40,7 @@ module DispatcherTest
|
|
40
40
|
|
41
41
|
class DirectAPI < ActionWebService::API::Base
|
42
42
|
api_method :add, :expects => [{:a=>:int}, {:b=>:int}], :returns => [:int]
|
43
|
+
api_method :add2, :expects => [{:a=>:int}, {:b=>:int}], :returns => [:int]
|
43
44
|
api_method :before_filtered
|
44
45
|
api_method :after_filtered, :returns => [[:int]]
|
45
46
|
api_method :struct_return, :returns => [[Node]]
|
@@ -141,6 +142,7 @@ module DispatcherTest
|
|
141
142
|
after_filter :alwaysok, :only => [:after_filtered]
|
142
143
|
|
143
144
|
attr :added
|
145
|
+
attr :added2
|
144
146
|
attr :before_filter_called
|
145
147
|
attr :before_filter_target_called
|
146
148
|
attr :after_filter_called
|
@@ -159,6 +161,10 @@ module DispatcherTest
|
|
159
161
|
@added = @params['a'] + @params['b']
|
160
162
|
end
|
161
163
|
|
164
|
+
def add2(a, b)
|
165
|
+
@added2 = a + b
|
166
|
+
end
|
167
|
+
|
162
168
|
def before_filtered
|
163
169
|
@before_filter_target_called = true
|
164
170
|
end
|
@@ -212,6 +218,8 @@ module DispatcherCommonTests
|
|
212
218
|
def test_direct_dispatching
|
213
219
|
assert_equal(70, do_method_call(@direct_controller, 'Add', 20, 50))
|
214
220
|
assert_equal(70, @direct_controller.added)
|
221
|
+
assert_equal(50, do_method_call(@direct_controller, 'Add2', 25, 25))
|
222
|
+
assert_equal(50, @direct_controller.added2)
|
215
223
|
assert(@direct_controller.void_called == false)
|
216
224
|
case @encoder
|
217
225
|
when WS::Encoding::SoapRpcEncoding
|
@@ -2,6 +2,18 @@ $:.unshift(File.dirname(__FILE__) + '/apis')
|
|
2
2
|
require File.dirname(__FILE__) + '/abstract_dispatcher'
|
3
3
|
require 'wsdl/parser'
|
4
4
|
|
5
|
+
class ActionController::Base
|
6
|
+
class << self
|
7
|
+
alias :inherited_without_name_error :inherited
|
8
|
+
def inherited(child)
|
9
|
+
begin
|
10
|
+
inherited_without_name_error(child)
|
11
|
+
rescue NameError => e
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
5
17
|
class AutoLoadController < ActionController::Base; end
|
6
18
|
class FailingAutoLoadController < ActionController::Base; end
|
7
19
|
class BrokenAutoLoadController < ActionController::Base; end
|
@@ -39,7 +51,7 @@ class TC_DispatcherActionControllerSoap < Test::Unit::TestCase
|
|
39
51
|
assert(!AutoLoadController.web_service_api.nil?)
|
40
52
|
assert(AutoLoadController.web_service_api.has_public_api_method?('Void'))
|
41
53
|
assert(FailingAutoLoadController.web_service_api.nil?)
|
42
|
-
assert_raises(
|
54
|
+
assert_raises(MissingSourceFile) do
|
43
55
|
FailingAutoLoadController.require_web_service_api :blah
|
44
56
|
end
|
45
57
|
assert_raises(ArgumentError) do
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.8
|
|
3
3
|
specification_version: 1
|
4
4
|
name: actionwebservice
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.6.
|
7
|
-
date: 2005-03-
|
6
|
+
version: 0.6.2
|
7
|
+
date: 2005-03-27
|
8
8
|
summary: Web service support for Action Pack.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -142,7 +142,7 @@ dependencies:
|
|
142
142
|
-
|
143
143
|
- "="
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 1.
|
145
|
+
version: 1.7.0
|
146
146
|
version:
|
147
147
|
- !ruby/object:Gem::Dependency
|
148
148
|
name: activerecord
|
@@ -152,7 +152,7 @@ dependencies:
|
|
152
152
|
-
|
153
153
|
- "="
|
154
154
|
- !ruby/object:Gem::Version
|
155
|
-
version: 1.9.
|
155
|
+
version: 1.9.1
|
156
156
|
version:
|
157
157
|
- !ruby/object:Gem::Dependency
|
158
158
|
name: activesupport
|
@@ -162,5 +162,5 @@ dependencies:
|
|
162
162
|
-
|
163
163
|
- "="
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version: 1.0.
|
165
|
+
version: 1.0.3
|
166
166
|
version:
|