actionwebservice 1.1.6 → 1.2.0

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 CHANGED
@@ -1,3 +1,18 @@
1
+ *1.2.0* (January 16th, 2007)
2
+
3
+ * Removed invocation of deprecated before_action and around_action filter methods. Corresponding before_invocation and after_invocation methods should be used instead. #6275 [Kent Sibilev]
4
+
5
+ * Provide access to the underlying SOAP driver. #6212 [bmilekic, Kent Sibilev]
6
+
7
+ * ActionWebService WSDL generation ignores HTTP_X_FORWARDED_HOST [Paul Butcher <paul@paulbutcher.com>]
8
+
9
+ * Tighten rescue clauses. #5985 [james@grayproductions.net]
10
+
11
+ * Fixed XMLRPC multicall when one of the called methods returns a struct object. [Kent Sibilev]
12
+
13
+ * Fix invoke_layered since api_method didn't declare :expects. Closes #4720. [Kevin Ballard <kevin@sb.org>, Kent Sibilev]
14
+
15
+
1
16
  *1.1.6* (August 10th, 2006)
2
17
 
3
18
  * Rely on Action Pack 1.12.5
@@ -18,17 +33,17 @@
18
33
  * Rely on Action Pack 1.12.2 and Active Record 1.14.3
19
34
 
20
35
 
21
- *1.1.2* (April 9th, 2005)
36
+ *1.1.2* (April 9th, 2006)
22
37
 
23
38
  * Rely on Active Record 1.14.2
24
39
 
25
40
 
26
- *1.1.1* (April 6th, 2005)
41
+ *1.1.1* (April 6th, 2006)
27
42
 
28
43
  * Do not convert driver options to strings (#4499)
29
44
 
30
45
 
31
- *1.1.0* (March 27th, 2005)
46
+ *1.1.0* (March 27th, 2006)
32
47
 
33
48
  * Make ActiveWebService::Struct type reloadable
34
49
 
data/Rakefile CHANGED
@@ -34,8 +34,8 @@ SCHEMA_PATH = File.join(File.dirname(__FILE__), *%w(test fixtures db_definitions
34
34
 
35
35
  desc 'Build the MySQL test database'
36
36
  task :build_database do
37
- %x( mysqladmin create activewebservice_unittest )
38
- %x( mysql activewebservice_unittest < #{File.join(SCHEMA_PATH, 'mysql.sql')} )
37
+ %x( mysqladmin create actionwebservice_unittest )
38
+ %x( mysql actionwebservice_unittest < #{File.join(SCHEMA_PATH, 'mysql.sql')} )
39
39
  end
40
40
 
41
41
 
@@ -71,8 +71,8 @@ spec = Gem::Specification.new do |s|
71
71
  s.rubyforge_project = "aws"
72
72
  s.homepage = "http://www.rubyonrails.org"
73
73
 
74
- s.add_dependency('actionpack', '= 1.12.5' + PKG_BUILD)
75
- s.add_dependency('activerecord', '= 1.14.4' + PKG_BUILD)
74
+ s.add_dependency('actionpack', '= 1.13.0' + PKG_BUILD)
75
+ s.add_dependency('activerecord', '= 1.15.0' + PKG_BUILD)
76
76
 
77
77
  s.has_rdoc = true
78
78
  s.requirements << 'none'
@@ -168,4 +168,4 @@ task :release => [ :package ] do
168
168
  puts release_command
169
169
  system(release_command)
170
170
  end
171
- end
171
+ end
@@ -16,7 +16,7 @@ module ActionWebService # :nodoc:
16
16
  class Base
17
17
  # Action WebService API subclasses should be reloaded by the dispatcher in Rails
18
18
  # when Dependencies.mechanism = :load.
19
- include Reloadable::Subclasses
19
+ include Reloadable::Deprecated
20
20
 
21
21
  # Whether to transform the public API method names into camel-cased names
22
22
  class_inheritable_option :inflect_names, true
@@ -12,7 +12,7 @@ module ActionWebService # :nodoc:
12
12
  # web_service_api PersonAPI
13
13
  #
14
14
  # def find_person(criteria)
15
- # Person.find_all [...]
15
+ # Person.find(:all) [...]
16
16
  # end
17
17
  #
18
18
  # def delete_person(id)
@@ -33,7 +33,7 @@ module ActionWebService # :nodoc:
33
33
  class Base
34
34
  # Action WebService subclasses should be reloaded by the dispatcher in Rails
35
35
  # when Dependencies.mechanism = :load.
36
- include Reloadable::Subclasses
36
+ include Reloadable::Deprecated
37
37
 
38
38
  # Whether to report exceptions back to the caller in the protocol's exception
39
39
  # format
@@ -96,14 +96,14 @@ module ActionWebService # :nodoc:
96
96
  when :float
97
97
  Float(value)
98
98
  when :time
99
- value = "#{value['2']}/#{value['3']}/#{value['1']} #{value['4']}:#{value['5']}:#{value['6']}" if value.kind_of?(Hash)
100
- Time.parse(value.to_s)
99
+ value = "%s/%s/%s %s:%s:%s" % value.values_at(*%w[2 3 1 4 5 6]) if value.kind_of?(Hash)
100
+ value.kind_of?(Time) ? value : Time.parse(value.to_s)
101
101
  when :date
102
- value = "#{value['2']}/#{value['3']}/#{value['1']}" if value.kind_of?(Hash)
103
- Date.parse(value.to_s)
102
+ value = "%s/%s/%s" % value.values_at(*%w[2 3 1]) if value.kind_of?(Hash)
103
+ value.kind_of?(Date) ? value : Date.parse(value.to_s)
104
104
  when :datetime
105
- value = "#{value['2']}/#{value['3']}/#{value['1']} #{value['4']}:#{value['5']}:#{value['6']}" if value.kind_of?(Hash)
106
- DateTime.parse(value.to_s)
105
+ value = "%s/%s/%s %s:%s:%s" % value.values_at(*%w[2 3 1 4 5 6]) if value.kind_of?(Hash)
106
+ value.kind_of?(DateTime) ? value : DateTime.parse(value.to_s)
107
107
  end
108
108
  end
109
109
 
@@ -16,6 +16,8 @@ module ActionWebService # :nodoc:
16
16
  # persons = soap_client.find_all
17
17
  #
18
18
  class Soap < Base
19
+ # provides access to the underlying soap driver
20
+ attr_reader :driver
19
21
 
20
22
  # Creates a new web service client using the SOAP RPC protocol.
21
23
  #
@@ -1,13 +1,11 @@
1
1
  module ActionWebService # :nodoc:
2
2
  module Container # :nodoc:
3
3
  module ActionController # :nodoc:
4
- def self.append_features(base) # :nodoc:
4
+ def self.included(base) # :nodoc:
5
5
  class << base
6
6
  include ClassMethods
7
- alias_method :inherited_without_api, :inherited
8
- alias_method :inherited, :inherited_with_api
9
- alias_method :web_service_api_without_require, :web_service_api
10
- alias_method :web_service_api, :web_service_api_with_require
7
+ alias_method_chain :inherited, :api
8
+ alias_method_chain :web_service_api, :require
11
9
  end
12
10
  end
13
11
 
@@ -4,8 +4,7 @@ module ActionWebService # :nodoc:
4
4
  class ContainerError < ActionWebServiceError # :nodoc:
5
5
  end
6
6
 
7
- def self.append_features(base) # :nodoc:
8
- super
7
+ def self.included(base) # :nodoc:
9
8
  base.extend(ClassMethods)
10
9
  base.send(:include, ActionWebService::Container::Delegated::InstanceMethods)
11
10
  end
@@ -4,8 +4,7 @@ module ActionWebService # :nodoc:
4
4
  class ContainerError < ActionWebServiceError # :nodoc:
5
5
  end
6
6
 
7
- def self.append_features(base) # :nodoc:
8
- super
7
+ def self.included(base) # :nodoc:
9
8
  base.extend(ClassMethods)
10
9
  end
11
10
 
@@ -5,8 +5,7 @@ module ActionWebService # :nodoc:
5
5
  class DispatcherError < ActionWebService::ActionWebServiceError # :nodoc:
6
6
  end
7
7
 
8
- def self.append_features(base) # :nodoc:
9
- super
8
+ def self.included(base) # :nodoc:
10
9
  base.class_inheritable_option(:web_service_dispatching_mode, :direct)
11
10
  base.class_inheritable_option(:web_service_exception_reporting, true)
12
11
  base.send(:include, ActionWebService::Dispatcher::InstanceMethods)
@@ -63,7 +62,7 @@ module ActionWebService # :nodoc:
63
62
  responses = []
64
63
  invocations.each do |invocation|
65
64
  if invocation.is_a?(Hash)
66
- responses << invocation
65
+ responses << [invocation, nil]
67
66
  next
68
67
  end
69
68
  begin
@@ -75,15 +74,18 @@ module ActionWebService # :nodoc:
75
74
  end
76
75
  api_method = invocation.api_method
77
76
  if invocation.api.has_api_method?(api_method.name)
77
+ response_type = (api_method.returns ? api_method.returns[0] : nil)
78
78
  return_value = api_method.cast_returns(return_value)
79
+ else
80
+ response_type = ActionWebService::SignatureTypes.canonical_signature_entry(return_value.class, 0)
79
81
  end
80
- responses << [return_value]
82
+ responses << [return_value, response_type]
81
83
  rescue Exception => e
82
- responses << { 'faultCode' => 3, 'faultString' => e.message }
84
+ responses << [{ 'faultCode' => 3, 'faultString' => e.message }, nil]
83
85
  end
84
86
  end
85
87
  invocation = invocations[0]
86
- invocation.protocol.encode_response('system.multicall', responses, nil, invocation.protocol_options)
88
+ invocation.protocol.encode_multicall_response(responses, invocation.protocol_options)
87
89
  end
88
90
 
89
91
  def web_service_invocation(request, level = 0)
@@ -4,12 +4,10 @@ require 'builder/xmlmarkup'
4
4
  module ActionWebService # :nodoc:
5
5
  module Dispatcher # :nodoc:
6
6
  module ActionController # :nodoc:
7
- def self.append_features(base) # :nodoc:
8
- super
7
+ def self.included(base) # :nodoc:
9
8
  class << base
10
9
  include ClassMethods
11
- alias_method :inherited_without_action_controller, :inherited
12
- alias_method :inherited, :inherited_with_action_controller
10
+ alias_method_chain :inherited, :action_controller
13
11
  end
14
12
  base.class_eval do
15
13
  alias_method :web_service_direct_invoke_without_controller, :web_service_direct_invoke
@@ -39,6 +37,10 @@ module ActionWebService # :nodoc:
39
37
  module InstanceMethods # :nodoc:
40
38
  private
41
39
  def dispatch_web_service_request
40
+ if request.get?
41
+ render_text('GET not supported', '500 GET not supported')
42
+ return
43
+ end
42
44
  exception = nil
43
45
  begin
44
46
  ws_request = discover_web_service_request(request)
@@ -104,13 +106,7 @@ module ActionWebService # :nodoc:
104
106
  invocation.method_named_params.each do |name, value|
105
107
  params[name] = value
106
108
  end
107
- params['action'] = invocation.api_method.name.to_s
108
- if before_action == false
109
- raise(DispatcherError, "Method filtered")
110
- end
111
- return_value = web_service_direct_invoke_without_controller(invocation)
112
- after_action
113
- return_value
109
+ web_service_direct_invoke_without_controller(invocation)
114
110
  end
115
111
 
116
112
  def log_request(ws_request, body)
@@ -165,7 +161,7 @@ module ActionWebService # :nodoc:
165
161
 
166
162
  private
167
163
  def base_uri
168
- host = request.env['HTTP_HOST'] || request.env['SERVER_NAME'] || 'localhost'
164
+ host = request.host_with_port
169
165
  relative_url_root = request.relative_url_root
170
166
  scheme = request.ssl? ? 'https' : 'http'
171
167
  '%s://%s%s/%s/' % [scheme, host, relative_url_root, self.class.controller_path]
@@ -3,8 +3,7 @@ module ActionWebService # :nodoc:
3
3
  class InvocationError < ActionWebService::ActionWebServiceError # :nodoc:
4
4
  end
5
5
 
6
- def self.append_features(base) # :nodoc:
7
- super
6
+ def self.included(base) # :nodoc:
8
7
  base.extend(ClassMethods)
9
8
  base.send(:include, ActionWebService::Invocation::InstanceMethods)
10
9
  end
@@ -125,11 +124,9 @@ module ActionWebService # :nodoc:
125
124
  end
126
125
 
127
126
  module InstanceMethods # :nodoc:
128
- def self.append_features(base)
129
- super
127
+ def self.included(base)
130
128
  base.class_eval do
131
- alias_method :perform_invocation_without_interception, :perform_invocation
132
- alias_method :perform_invocation, :perform_invocation_with_interception
129
+ alias_method_chain :perform_invocation, :interception
133
130
  end
134
131
  end
135
132
 
@@ -58,6 +58,19 @@ module ActionWebService # :nodoc:
58
58
  Response.new(raw_response, 'text/xml', return_value)
59
59
  end
60
60
 
61
+ def encode_multicall_response(responses, protocol_options={})
62
+ result = responses.map do |return_value, return_type|
63
+ if return_value && return_type
64
+ return_value = value_to_xmlrpc_wire_format(return_value, return_type)
65
+ return_value = [return_value] unless return_value.nil?
66
+ end
67
+ return_value = false if return_value.nil?
68
+ return_value
69
+ end
70
+ raw_response = XMLRPC::Marshal.dump_response(result)
71
+ Response.new(raw_response, 'text/xml', result)
72
+ end
73
+
61
74
  def protocol_client(api, protocol_name, endpoint_uri, options={})
62
75
  return nil unless protocol_name == :xmlrpc
63
76
  ActionWebService::Client::XmlRpc.new(api, endpoint_uri, options)
@@ -6,8 +6,7 @@ module ActionWebService
6
6
  class ScaffoldingError < ActionWebServiceError # :nodoc:
7
7
  end
8
8
 
9
- def self.append_features(base)
10
- super
9
+ def self.included(base)
11
10
  base.extend(ClassMethods)
12
11
  end
13
12
 
@@ -40,7 +39,7 @@ module ActionWebService
40
39
  # can then be used as the entry point for invoking API methods from a web browser.
41
40
  def web_service_scaffold(action_name)
42
41
  add_template_helper(Helpers)
43
- module_eval <<-"end_eval", __FILE__, __LINE__
42
+ module_eval <<-"end_eval", __FILE__, __LINE__ + 1
44
43
  def #{action_name}
45
44
  if request.method == :get
46
45
  setup_invocation_assigns
@@ -77,12 +76,12 @@ module ActionWebService
77
76
  @method_request_xml = @protocol.encode_request(method_name, params, @scaffold_method.expects)
78
77
  new_request = @protocol.encode_action_pack_request(@scaffold_service.name, @scaffold_method.public_name, @method_request_xml)
79
78
  prepare_request(new_request, @scaffold_service.name, @scaffold_method.public_name)
80
- @request = new_request
79
+ self.request = new_request
81
80
  if @scaffold_container.dispatching_mode != :direct
82
81
  request.parameters['action'] = @scaffold_service.name
83
82
  end
84
83
  dispatch_web_service_request
85
- @method_response_xml = @response.body
84
+ @method_response_xml = response.body
86
85
  method_name, obj = @protocol.decode_response(@method_response_xml)
87
86
  return if handle_invocation_exception(obj)
88
87
  @method_return_value = @scaffold_method.cast_returns(obj)
@@ -128,7 +127,7 @@ module ActionWebService
128
127
 
129
128
  def reset_invocation_response
130
129
  erase_render_results
131
- @response.headers = ::ActionController::AbstractResponse::DEFAULT_HEADERS.merge("cookie" => [])
130
+ response.headers = ::ActionController::AbstractResponse::DEFAULT_HEADERS.merge("cookie" => [])
132
131
  end
133
132
 
134
133
  def public_method_name(service_name, method_name)
@@ -21,7 +21,7 @@ module ActionWebService
21
21
  class Struct
22
22
  # Action WebService Struct subclasses should be reloaded by the dispatcher in Rails
23
23
  # when Dependencies.mechanism = :load.
24
- include Reloadable::Subclasses
24
+ include Reloadable::Deprecated
25
25
 
26
26
  # If a Hash is given as argument to an ActionWebService::Struct constructor,
27
27
  # it can contain initial values for the structure member.
@@ -1,12 +1,12 @@
1
1
  <h4>Method Invocation Details for <em><%= @scaffold_service %>#<%= @scaffold_method.public_name %></em></h4>
2
2
 
3
- <%= form_tag :action => @scaffold_action_name + '_submit' %>
3
+ <% form_tag(:action => @scaffold_action_name + '_submit') do -%>
4
4
  <%= hidden_field_tag "service", @scaffold_service.name %>
5
5
  <%= hidden_field_tag "method", @scaffold_method.public_name %>
6
6
 
7
7
  <p>
8
8
  <label for="protocol">Protocol:</label><br />
9
- <%= select_tag 'protocol', options_for_select([['SOAP', 'soap'], ['XML-RPC', 'xmlrpc']], @params['protocol']) %>
9
+ <%= select_tag 'protocol', options_for_select([['SOAP', 'soap'], ['XML-RPC', 'xmlrpc']], params['protocol']) %>
10
10
  </p>
11
11
 
12
12
  <% if @scaffold_method.expects %>
@@ -22,7 +22,7 @@
22
22
  <% end %>
23
23
 
24
24
  <%= submit_tag "Invoke" %>
25
- <%= end_form_tag %>
25
+ <% end -%>
26
26
 
27
27
  <p>
28
28
  <%= link_to "Back", :action => @scaffold_action_name %>
@@ -52,7 +52,7 @@ module Test # :nodoc:
52
52
  end
53
53
  protocol.register_api(api)
54
54
  method = api.api_methods[api_method_name.to_sym]
55
- raise ArgumentError, "wrong number of arguments for rpc call (#{args.length} for #{method.expects.length})" unless args.length == method.expects.length
55
+ raise ArgumentError, "wrong number of arguments for rpc call (#{args.length} for #{method.expects.length})" if method && method.expects && args.length != method.expects.length
56
56
  protocol.encode_request(public_method_name(service_name, api_method_name), args.dup, method.expects)
57
57
  end
58
58
 
@@ -1,8 +1,8 @@
1
1
  module ActionWebService
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
- MINOR = 1
5
- TINY = 6
4
+ MINOR = 2
5
+ TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -69,7 +69,6 @@ module ClientTest
69
69
  attr_accessor :value_named_parameters
70
70
 
71
71
  def initialize
72
- @session = @assigns = {}
73
72
  @value_void = nil
74
73
  @value_normal = nil
75
74
  @value_array_return = nil
@@ -110,6 +110,7 @@ module DispatcherTest
110
110
  api_method :getCategories, :returns => [[:string]]
111
111
  api_method :bool, :returns => [:bool]
112
112
  api_method :alwaysFail
113
+ api_method :person, :returns => [Person]
113
114
  end
114
115
 
115
116
  class BloggerAPI < ActionWebService::API::Base
@@ -133,6 +134,10 @@ module DispatcherTest
133
134
  def alwaysFail
134
135
  raise "MT AlwaysFail"
135
136
  end
137
+
138
+ def person
139
+ Person.new('id' => 1, 'name' => 'person1')
140
+ end
136
141
  end
137
142
 
138
143
  class BloggerService < ActionWebService::Base
@@ -156,7 +161,7 @@ module DispatcherTest
156
161
 
157
162
  class AbstractController < ActionController::Base
158
163
  def generate_wsdl
159
- @request ||= ::ActionController::TestRequest.new
164
+ self.request ||= ::ActionController::TestRequest.new
160
165
  to_wsdl
161
166
  end
162
167
  end
@@ -203,7 +208,7 @@ module DispatcherTest
203
208
  end
204
209
 
205
210
  def add
206
- @added = @params['a'] + @params['b']
211
+ @added = params['a'] + params['b']
207
212
  end
208
213
 
209
214
  def add2(a, b)
@@ -9,24 +9,31 @@ require 'action_web_service'
9
9
  require 'action_controller'
10
10
  require 'action_controller/test_process'
11
11
 
12
- ActionController::Base.logger = nil
12
+ # Show backtraces for deprecated behavior for quicker cleanup.
13
+ ActiveSupport::Deprecation.debug = true
14
+
15
+
16
+ ActionController::Base.logger = Logger.new("debug.log")
13
17
  ActionController::Base.ignore_missing_templates = true
14
18
 
15
19
  begin
16
20
  PATH_TO_AR = File.dirname(__FILE__) + '/../../activerecord'
17
21
  require "#{PATH_TO_AR}/lib/active_record" unless Object.const_defined?(:ActiveRecord)
18
22
  require "#{PATH_TO_AR}/lib/active_record/fixtures" unless Object.const_defined?(:Fixtures)
19
- rescue Object => e
23
+ rescue LoadError => e
20
24
  fail "\nFailed to load activerecord: #{e}"
21
25
  end
22
26
 
23
- ActiveRecord::Base.establish_connection(
24
- :adapter => "mysql",
25
- :username => "rails",
26
- :encoding => "utf8",
27
- :database => "activewebservice_unittest"
28
- )
29
- ActiveRecord::Base.connection
27
+ ActiveRecord::Base.configurations = {
28
+ 'mysql' => {
29
+ :adapter => "mysql",
30
+ :username => "rails",
31
+ :encoding => "utf8",
32
+ :database => "actionwebservice_unittest"
33
+ }
34
+ }
35
+
36
+ ActiveRecord::Base.establish_connection 'mysql'
30
37
 
31
38
  Test::Unit::TestCase.fixture_path = "#{File.dirname(__FILE__)}/fixtures/"
32
39
 
@@ -35,4 +42,4 @@ class ActionController::TestRequest
35
42
  def raw_post
36
43
  super
37
44
  end
38
- end
45
+ end
@@ -121,17 +121,15 @@ class TC_DispatcherActionControllerSoap < Test::Unit::TestCase
121
121
  end
122
122
  location = definitions.services[0].ports[0].soap_address.location
123
123
  if controller.is_a?(DelegatedController)
124
- assert_match %r{http://localhost/dispatcher_test/delegated/test_service$}, location
124
+ assert_match %r{http://test.host/dispatcher_test/delegated/test_service$}, location
125
125
  elsif controller.is_a?(DirectController)
126
- assert_match %r{http://localhost/dispatcher_test/direct/api$}, location
126
+ assert_match %r{http://test.host/dispatcher_test/direct/api$}, location
127
127
  end
128
128
  definitions.collect_complextypes
129
129
  end
130
130
 
131
131
  def ensure_valid_wsdl_action(controller)
132
132
  test_request = ActionController::TestRequest.new({ 'action' => 'wsdl' })
133
- test_request.env['REQUEST_METHOD'] = 'GET'
134
- test_request.env['HTTP_HOST'] = 'localhost'
135
133
  test_response = ActionController::TestResponse.new
136
134
  wsdl = controller.process(test_request, test_response).body
137
135
  ensure_valid_wsdl(controller, wsdl, DispatcherTest::WsdlNamespace)
@@ -28,7 +28,8 @@ class TC_DispatcherActionControllerXmlRpc < Test::Unit::TestCase
28
28
  {'methodName' => 'mt.alwaysFail'},
29
29
  {'methodName' => 'blogger.alwaysFail'},
30
30
  {'methodName' => 'mt.blah'},
31
- {'methodName' => 'blah.blah'}
31
+ {'methodName' => 'blah.blah'},
32
+ {'methodName' => 'mt.person'}
32
33
  ])
33
34
  assert_equal [
34
35
  [["mtCat1", "mtCat2"]],
@@ -38,7 +39,8 @@ class TC_DispatcherActionControllerXmlRpc < Test::Unit::TestCase
38
39
  {"faultCode" => 3, "faultString" => "MT AlwaysFail"},
39
40
  {"faultCode" => 3, "faultString" => "Blogger AlwaysFail"},
40
41
  {"faultCode" => 4, "faultMessage" => "no such method 'blah' on API DispatcherTest::MTAPI"},
41
- {"faultCode" => 4, "faultMessage" => "no such web service 'blah'"}
42
+ {"faultCode" => 4, "faultMessage" => "no such web service 'blah'"},
43
+ [{"name"=>"person1", "id"=>1}]
42
44
  ], response
43
45
  end
44
46
 
@@ -73,29 +73,30 @@ class ScaffoldedControllerTest < Test::Unit::TestCase
73
73
 
74
74
  def test_scaffold_invoke
75
75
  get :scaffold_invoke
76
- assert_rendered_file 'methods.rhtml'
76
+ assert_template 'methods.rhtml'
77
77
  end
78
78
 
79
79
  def test_scaffold_invoke_method_params
80
80
  get :scaffold_invoke_method_params, :service => 'scaffolded', :method => 'Hello'
81
- assert_rendered_file 'parameters.rhtml'
81
+ assert_template 'parameters.rhtml'
82
82
  end
83
83
 
84
84
  def test_scaffold_invoke_method_params_with_struct
85
85
  get :scaffold_invoke_method_params, :service => 'scaffolded', :method => 'HelloStructParam'
86
- assert_rendered_file 'parameters.rhtml'
86
+ assert_template 'parameters.rhtml'
87
+ assert_tag :tag => 'form'
87
88
  assert_tag :tag => 'input', :attributes => {:name => "method_params[0][name]"}
88
89
  end
89
90
 
90
91
  def test_scaffold_invoke_submit_hello
91
92
  post :scaffold_invoke_submit, :service => 'scaffolded', :method => 'Hello', :method_params => {'0' => '5', '1' => 'hello world'}
92
- assert_rendered_file 'result.rhtml'
93
+ assert_template 'result.rhtml'
93
94
  assert_equal false, @controller.instance_eval{ @method_return_value }
94
95
  end
95
96
 
96
97
  def test_scaffold_invoke_submit_bye
97
98
  post :scaffold_invoke_submit, :service => 'scaffolded', :method => 'Bye'
98
- assert_rendered_file 'result.rhtml'
99
+ assert_template 'result.rhtml'
99
100
  persons = [ScaffoldPerson.new(:id => 1, :name => "leon"), ScaffoldPerson.new(:id => 2, :name => "paul")]
100
101
  assert_equal persons, @controller.instance_eval{ @method_return_value }
101
102
  end
@@ -2,6 +2,7 @@ require File.dirname(__FILE__) + '/abstract_unit'
2
2
  require 'action_web_service/test_invoke'
3
3
 
4
4
  class TestInvokeAPI < ActionWebService::API::Base
5
+ api_method :null
5
6
  api_method :add, :expects => [:int, :int], :returns => [:int]
6
7
  end
7
8
 
@@ -14,6 +15,9 @@ class TestInvokeService < ActionWebService::Base
14
15
  @invoked = true
15
16
  a + b
16
17
  end
18
+
19
+ def null
20
+ end
17
21
  end
18
22
 
19
23
  class TestController < ActionController::Base
@@ -29,6 +33,9 @@ class TestInvokeDirectController < TestController
29
33
  @invoked = true
30
34
  @method_params[0] + @method_params[1]
31
35
  end
36
+
37
+ def null
38
+ end
32
39
  end
33
40
 
34
41
  class TestInvokeDelegatedController < TestController
@@ -97,4 +104,9 @@ class TestInvokeTest < Test::Unit::TestCase
97
104
  assert_raise(ArgumentError) { invoke :add, 1 }
98
105
  end
99
106
 
107
+ def test_with_no_parameters_declared
108
+ @controller = TestInvokeDirectController.new
109
+ assert_nil invoke(:null)
110
+ end
111
+
100
112
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.11
2
+ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: actionwebservice
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.1.6
7
- date: 2006-08-10 00:00:00 -05:00
6
+ version: 1.2.0
7
+ date: 2007-01-17 00:00:00 -06:00
8
8
  summary: Web service support for Action Pack.
9
9
  require_paths:
10
10
  - lib
@@ -25,6 +25,7 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
25
25
  platform: ruby
26
26
  signing_key:
27
27
  cert_chain:
28
+ post_install_message:
28
29
  authors:
29
30
  - Leon Breedt
30
31
  files:
@@ -139,7 +140,7 @@ dependencies:
139
140
  requirements:
140
141
  - - "="
141
142
  - !ruby/object:Gem::Version
142
- version: 1.12.5
143
+ version: 1.13.0
143
144
  version:
144
145
  - !ruby/object:Gem::Dependency
145
146
  name: activerecord
@@ -148,5 +149,5 @@ dependencies:
148
149
  requirements:
149
150
  - - "="
150
151
  - !ruby/object:Gem::Version
151
- version: 1.14.4
152
+ version: 1.15.0
152
153
  version: