troelskn-handsoap 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 5
2
+ :patch: 6
3
3
  :major: 0
4
4
  :minor: 2
@@ -32,9 +32,9 @@ class HandsoapGenerator < Rails::Generator::Base
32
32
  m.file_contents "app/models/#{file_name}_service.rb" do |file|
33
33
  file.write Handsoap::Compiler.compile_service(wsdl, protocol, :soap_actions)
34
34
  end
35
- m.directory "tests"
36
- m.directory "tests/integration"
37
- m.file_contents "tests/integration/#{file_name}_service_test.rb" do |file|
35
+ m.directory "test"
36
+ m.directory "test/integration"
37
+ m.file_contents "test/integration/#{file_name}_service_test.rb" do |file|
38
38
  file.write Handsoap::Compiler.compile_test(wsdl, protocol)
39
39
  end
40
40
  # TODO
@@ -85,7 +85,7 @@ module Handsoap
85
85
  private :ns
86
86
 
87
87
  def protocol_from_ns(node)
88
- href = node.namespace.respond_to?(:href) ? node.namespace.href : @doc.namespaces["xmlns:#{node.namespace.href}"]
88
+ href = node.namespace.respond_to?(:href) ? node.namespace.href : @doc.namespaces["xmlns:#{node.namespace}"]
89
89
  case href
90
90
  when "http://schemas.xmlsoap.org/wsdl/soap/"
91
91
  :soap11
@@ -100,7 +100,7 @@ module Handsoap
100
100
  private :protocol_from_ns
101
101
 
102
102
  def is_wsdl2?(node)
103
- href = node.namespace.respond_to?(:href) ? node.namespace.href : @doc.namespaces["xmlns:#{node.namespace.href}"]
103
+ href = node.namespace.respond_to?(:href) ? node.namespace.href : @doc.namespaces["xmlns:#{node.namespace}"]
104
104
  case href
105
105
  when "http://schemas.xmlsoap.org/wsdl/"
106
106
  false
@@ -11,7 +11,11 @@ require 'handsoap/xml_mason'
11
11
  module Utf8StringPatch
12
12
  def to_utf8
13
13
  # HTMLEntities.decode_entities(self.serialize(:encoding => 'UTF-8'))
14
- self.serialize(:encoding => 'UTF-8').gsub('&lt;', '<').gsub('&gt;', '>').gsub('&quot;', '"').gsub('&apos;', "'").gsub('&amp;', '&')
14
+ if Gem.loaded_specs['nokogiri'].version >= Gem::Version.new('1.3.0')
15
+ self.serialize(:encoding => 'UTF-8').gsub('&lt;', '<').gsub('&gt;', '>').gsub('&quot;', '"').gsub('&apos;', "'").gsub('&amp;', '&')
16
+ else
17
+ self.serialize('UTF-8').gsub('&lt;', '<').gsub('&gt;', '>').gsub('&quot;', '"').gsub('&apos;', "'").gsub('&amp;', '&')
18
+ end
15
19
  end
16
20
  end
17
21
 
@@ -179,48 +183,33 @@ module Handsoap
179
183
  private
180
184
  # Helper to serialize a node into a ruby string
181
185
  def xml_to_str(node, xquery = nil)
182
- begin
183
- n = xquery ? node.xpath(xquery, ns).first : node
184
- n.to_utf8
185
- rescue Exception => ex
186
- nil
187
- end
186
+ n = xquery ? node.xpath(xquery, ns).first : node
187
+ return if n.nil?
188
+ n.to_utf8
188
189
  end
189
190
  # Helper to serialize a node into a ruby integer
190
191
  def xml_to_int(node, xquery = nil)
191
- begin
192
- n = xquery ? node.xpath(xquery, ns).first : node
193
- n.to_s.to_i
194
- rescue Exception => ex
195
- nil
196
- end
192
+ n = xquery ? node.xpath(xquery, ns).first : node
193
+ return if n.nil?
194
+ n.to_s.to_i
197
195
  end
198
196
  # Helper to serialize a node into a ruby float
199
197
  def xml_to_float(node, xquery = nil)
200
- begin
201
- n = xquery ? node.xpath(xquery, ns).first : node
202
- n.to_s.to_f
203
- rescue Exception => ex
204
- nil
205
- end
198
+ n = xquery ? node.xpath(xquery, ns).first : node
199
+ return if n.nil?
200
+ n.to_s.to_f
206
201
  end
207
202
  # Helper to serialize a node into a ruby boolean
208
203
  def xml_to_bool(node, xquery = nil)
209
- begin
210
- n = xquery ? node.xpath(xquery, ns).first : node
211
- n.to_s == "true"
212
- rescue Exception => ex
213
- nil
214
- end
204
+ n = xquery ? node.xpath(xquery, ns).first : node
205
+ return if n.nil?
206
+ n.to_s == "true"
215
207
  end
216
208
  # Helper to serialize a node into a ruby Time object
217
209
  def xml_to_date(node, xquery = nil)
218
- begin
219
- n = xquery ? node.xpath(xquery, ns).first : node
220
- Time.iso8601(n.to_s)
221
- rescue Exception => ex
222
- nil
223
- end
210
+ n = xquery ? node.xpath(xquery, ns).first : node
211
+ return if n.nil?
212
+ Time.iso8601(n.to_s)
224
213
  end
225
214
  def debug(message = nil)
226
215
  if @@logger
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: troelskn-handsoap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Troels Knak-Nielsen
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-08 00:00:00 -07:00
12
+ date: 2009-06-10 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -32,16 +32,6 @@ dependencies:
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.3.2
34
34
  version:
35
- - !ruby/object:Gem::Dependency
36
- name: htmlentities
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: 4.0.0
44
- version:
45
35
  description: Handsoap is a library for creating SOAP clients in Ruby
46
36
  email: troelskn@gmail.com
47
37
  executables: []