pgericson-handsoap 1.1.9 → 1.1.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  ---
2
+ :patch: 6
2
3
  :major: 1
3
4
  :minor: 1
4
- :patch: 5
5
5
  :build:
@@ -226,12 +226,14 @@ module Handsoap
226
226
  end
227
227
  doc = make_envelope do |body,header|
228
228
  if options[:soap_header]
229
- iterate_hash(header, options[:soap_header])
229
+ iterate_hash_array(header, options[:soap_header])
230
230
  end
231
231
 
232
- body.add action
233
232
  if options[:soap_body]
234
- iterate_hash(body, options[:soap_body])
233
+ action_hash = { action => options[:soap_body] }
234
+ iterate_hash_array(body, action_hash)
235
+ else
236
+ body.add(action)
235
237
  end
236
238
  end
237
239
  if block_given?
@@ -325,13 +327,16 @@ module Handsoap
325
327
 
326
328
 
327
329
  #Used to iterate over a Hash, that can include Hash, Array or String/Float/Integer etc and insert it in the correct element.
328
- def iterate_hash(element, hash)
329
- hash.each do |name,value|
330
+ def iterate_hash_array(element, hash_array)
331
+ hash_array.each {|hash| iterate_hash_array(element, hash) } if hash_array.is_a?(Array)
332
+ hash_array.each do |name,value|
330
333
  if value.is_a?(Hash)
331
- element.add(name){|subelement| iterate_hash(subelement, value)}
334
+ element.add(name){|subelement| iterate_hash_array(subelement, value)}
332
335
  elsif value.is_a?(Array)
333
- value.each do |item|
334
- element.add(name, iterate_hash(element,item)) if item.is_a?(Hash)
336
+ element.add(name) do |subelement|
337
+ value.each do |item|
338
+ iterate_hash_array(subelement, item) if item.is_a?(Hash)
339
+ end
335
340
  end
336
341
  else
337
342
  element.add name, value.to_s
@@ -15,9 +15,9 @@ module Handsoap
15
15
  def initialize
16
16
  @namespaces = {}
17
17
  end
18
- def add(node_name, value = nil, *flags) # :yields: Handsoap::XmlMason::Element
18
+ def add(node_name, value = nil, options = {}) # :yields: Handsoap::XmlMason::Element
19
19
  prefix, name = parse_ns(node_name)
20
- node = append_child Element.new(self, prefix, name, value, flags)
20
+ node = append_child Element.new(self, prefix, name, value, options)
21
21
  if block_given?
22
22
  yield node
23
23
  end
@@ -105,7 +105,7 @@ module Handsoap
105
105
  end
106
106
 
107
107
  class Element < Node
108
- def initialize(parent, prefix, node_name, value = nil, flags = []) # :yields: Handsoap::XmlMason::Element
108
+ def initialize(parent, prefix, node_name, value = nil, options = {}) # :yields: Handsoap::XmlMason::Element
109
109
  super()
110
110
  # if prefix.to_s == ""
111
111
  # raise "missing prefix"
@@ -115,8 +115,11 @@ module Handsoap
115
115
  @node_name = node_name
116
116
  @children = []
117
117
  @attributes = {}
118
+ if options[:attributes]
119
+ @attributes = options[:attributes]
120
+ end
118
121
  if not value.nil?
119
- set_value value.to_s, *flags
122
+ set_value value.to_s, options
120
123
  end
121
124
  if block_given?
122
125
  yield self
@@ -142,14 +145,14 @@ module Handsoap
142
145
  end
143
146
  # Sets the inner text of this element.
144
147
  #
145
- # By default the string is escaped, but you can pass the flag :raw to inject XML.
148
+ # By default the string is escaped, but you can pass the option flag :raw to inject XML.
146
149
  #
147
150
  # You usually won't need to call this method, but will rather use +add+
148
- def set_value(value, *flags)
151
+ def set_value(value, options = {})
149
152
  if @children.length > 0
150
153
  raise "Element already has children. Can't set value"
151
154
  end
152
- if flags && flags.include?(:raw)
155
+ if options && options.include?(:raw)
153
156
  @children = [RawContent.new(value)]
154
157
  else
155
158
  @children = [TextNode.new(value)]
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgericson-handsoap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.9
4
+ version: 1.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Troels Knak-Nielsen
8
8
  - Jimmi Westerberg
9
+ - Peter Ericson
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
13
 
13
- date: 2010-01-18 00:00:00 +01:00
14
+ date: 2010-02-05 00:00:00 +01:00
14
15
  default_executable:
15
16
  dependencies: []
16
17
 
@@ -18,6 +19,7 @@ description: Handsoap is a library for creating SOAP clients in Ruby
18
19
  email:
19
20
  - troelskn@gmail.com
20
21
  - frontend@unwire.dk
22
+ - pg.ericson@gmail.com
21
23
  executables: []
22
24
 
23
25
  extensions: []