aboutsummaryrefslogtreecommitdiffstats
path: root/actionwebservice/lib
diff options
context:
space:
mode:
authorKent Sibilev <ksibilev@gmail.com>2006-12-03 20:30:34 +0000
committerKent Sibilev <ksibilev@gmail.com>2006-12-03 20:30:34 +0000
commitabe8fa73a91b72e79717673393a4f5bc5cd341f7 (patch)
tree1c7f3233c0ea1ecceb5d4634b7ab9575a263ac89 /actionwebservice/lib
parentdb459370f8986f3de20c7c20fdcaf3ee811f292a (diff)
downloadrails-abe8fa73a91b72e79717673393a4f5bc5cd341f7.tar.gz
rails-abe8fa73a91b72e79717673393a4f5bc5cd341f7.tar.bz2
rails-abe8fa73a91b72e79717673393a4f5bc5cd341f7.zip
Added support for decimal types. Closes #6676.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5670 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionwebservice/lib')
-rw-r--r--actionwebservice/lib/action_web_service/casting.rb2
-rw-r--r--actionwebservice/lib/action_web_service/protocol/soap_protocol/marshaler.rb14
-rw-r--r--actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb10
-rw-r--r--actionwebservice/lib/action_web_service/support/signature_types.rb4
4 files changed, 20 insertions, 10 deletions
diff --git a/actionwebservice/lib/action_web_service/casting.rb b/actionwebservice/lib/action_web_service/casting.rb
index 71cdf4e055..71f422eaea 100644
--- a/actionwebservice/lib/action_web_service/casting.rb
+++ b/actionwebservice/lib/action_web_service/casting.rb
@@ -95,6 +95,8 @@ module ActionWebService # :nodoc:
end
when :float
Float(value)
+ when :decimal
+ BigDecimal(value.to_s)
when :time
value = "%s/%s/%s %s:%s:%s" % value.values_at(*%w[2 3 1 4 5 6]) if value.kind_of?(Hash)
value.kind_of?(Time) ? value : Time.parse(value.to_s)
diff --git a/actionwebservice/lib/action_web_service/protocol/soap_protocol/marshaler.rb b/actionwebservice/lib/action_web_service/protocol/soap_protocol/marshaler.rb
index 351c9da159..1873396277 100644
--- a/actionwebservice/lib/action_web_service/protocol/soap_protocol/marshaler.rb
+++ b/actionwebservice/lib/action_web_service/protocol/soap_protocol/marshaler.rb
@@ -118,18 +118,12 @@ module ActionWebService
end
def register_static_factories
- @registry.add(ActionWebService::Base64,
- SOAP::SOAPBase64,
- SoapBase64Factory.new,
- nil)
+ @registry.add(ActionWebService::Base64, SOAP::SOAPBase64, SoapBase64Factory.new, nil)
mapping = @registry.find_mapped_soap_class(ActionWebService::Base64)
@type2binding[ActionWebService::Base64] =
- SoapBinding.new(self, SOAP::SOAPBase64::Type,
- ActionWebService::Base64, mapping)
- @registry.add(Array,
- SOAP::SOAPArray,
- SoapTypedArrayFactory.new,
- nil)
+ SoapBinding.new(self, SOAP::SOAPBase64::Type, ActionWebService::Base64, mapping)
+ @registry.add(Array, SOAP::SOAPArray, SoapTypedArrayFactory.new, nil)
+ @registry.add(::BigDecimal, SOAP::SOAPDouble, SOAP::Mapping::Registry::BasetypeFactory, {:derived_class => true})
end
end
diff --git a/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb b/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb
index a3abc6a24d..8ec36a29f1 100644
--- a/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb
+++ b/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb
@@ -5,6 +5,16 @@ module XMLRPC # :nodoc:
class FaultException # :nodoc:
alias :message :faultString
end
+
+ class Create
+ def wrong_type(value)
+ if BigDecimal === value
+ [true, value.to_f]
+ else
+ false
+ end
+ end
+ end
end
module ActionWebService # :nodoc:
diff --git a/actionwebservice/lib/action_web_service/support/signature_types.rb b/actionwebservice/lib/action_web_service/support/signature_types.rb
index 36224c645e..66c86bf6da 100644
--- a/actionwebservice/lib/action_web_service/support/signature_types.rb
+++ b/actionwebservice/lib/action_web_service/support/signature_types.rb
@@ -61,6 +61,8 @@ module ActionWebService # :nodoc:
:bool
when :float, :double
:float
+ when :decimal
+ :decimal
when :time, :timestamp
:time
when :datetime
@@ -117,6 +119,8 @@ module ActionWebService # :nodoc:
TrueClass
when :float
Float
+ when :decimal
+ BigDecimal
when :time
Time
when :date