teamforge 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -62,10 +62,12 @@ module TeamForge
62
62
  unless req_msg.respond_to? :empty
63
63
  message = Hash[req_msg.each_pair.to_a]
64
64
 
65
- # if a TeamForge Struct was sent to the function it has to be converted to a hash first to be processed by Savon
66
- # Luckily there is an easy method to convert a Struct to a Hash
67
65
  message.each do |key, value|
68
- message[key] = rep_blank_with_nil(value)
66
+ if value.kind_of? Struct
67
+ message[key] = Hash[value.each_pair.to_a]
68
+ else
69
+ message[key] = value #rep_blank_with_nil(value)
70
+ end
69
71
  end
70
72
  end
71
73
 
@@ -124,7 +126,7 @@ module TeamForge
124
126
  return_msg[child.name.to_sym] = create_struct(multiref)
125
127
  end
126
128
  else
127
- return_msg[child.name.to_sym] = child.text
129
+ return_msg[child.name.to_sym] = rep_blank_with_nil(child.text)
128
130
  end
129
131
  end
130
132
  return return_msg
@@ -153,11 +155,11 @@ module TeamForge
153
155
  else
154
156
  if el_type == :array
155
157
  unless element.child.nil?
156
- new_struct[element.name.to_sym] = {element.name.to_sym => element.element_children.map {|chld| chld.text.to_s }, :attributes! => { element.child.name.to_sym => {'xsi:type' => element.child.attribute("type").to_s}}}
158
+ new_struct[element.name.to_sym] = {element.name.to_sym => element.element_children.map {|chld| rep_blank_with_nil(chld.text.to_s) }, :attributes! => { element.child.name.to_sym => {'xsi:type' => element.child.attribute("type").to_s}}}
157
159
  end
158
160
  attributes[element.name.to_sym] = {'soapenc:arrayType'=> element.attribute("arrayType").to_s, 'xsi:type' => element.attribute("type").to_s}
159
161
  else
160
- new_struct[element.name] = element.text.to_s
162
+ new_struct[element.name] = rep_blank_with_nil(element.text.to_s)
161
163
  attributes[element.name.to_sym] = {'xsi:type' => element.attribute("type").to_s}
162
164
  end
163
165
  end
@@ -171,25 +173,23 @@ module TeamForge
171
173
 
172
174
  def self.rep_blank_with_nil(value)
173
175
 
174
- if value.kind_of? Struct
175
- struct_param = Hash[value.each_pair.to_a]
176
-
177
- struct_param.each do |k, v|
178
- struct_param[k] = rep_blank_with_nil(v)
179
- end
180
-
181
- value = struct_param
182
-
183
- else
176
+ # if value.kind_of? Struct
177
+ # struct_param = Hash[value.each_pair.to_a]
178
+ #
179
+ # struct_param.each do |k, v|
180
+ # struct_param[k] = rep_blank_with_nil(v)
181
+ # end
182
+ #
183
+ # value = struct_param
184
+ #
185
+ # else
184
186
  unless value.nil?
185
187
  if value.blank?
186
188
  value = nil
187
- else value == "empty"
188
- value = ""
189
189
  end #if
190
190
 
191
191
  end #unless
192
- end #if
192
+ # end #if
193
193
  return value
194
194
  end #def
195
195
 
@@ -1,5 +1,5 @@
1
1
  module TeamForge
2
2
 
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teamforge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2013-04-16 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: savon
16
- requirement: &2153424040 !ruby/object:Gem::Requirement
16
+ requirement: &2157527700 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 1.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153424040
24
+ version_requirements: *2157527700
25
25
  description: A Ruby SOAP wrapper to communicate with TeamForge WebServices
26
26
  email: pwolf@collab.net
27
27
  executables: []