openils-mapper 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/edi/edi2json.rb CHANGED
@@ -31,6 +31,9 @@ class Collection
31
31
  end
32
32
  end
33
33
  end
34
+ if (result[child.name].is_a?(Array) or result[child.name].is_a?(Hash)) and result[child.name].empty?
35
+ result.delete(child.name)
36
+ end
34
37
  }
35
38
 
36
39
  # Segment groups last
@@ -57,7 +60,11 @@ class Interchange
57
60
 
58
61
  messages = []
59
62
  self.each { |message|
60
- messages << {message.name => message.to_hash}
63
+ if message.is_a?(MsgGroup)
64
+ messages += message.to_hash
65
+ else
66
+ messages << {message.name => message.to_hash}
67
+ end
61
68
  }
62
69
 
63
70
  {
@@ -90,6 +97,14 @@ class Message
90
97
 
91
98
  end
92
99
 
100
+ class MsgGroup
101
+
102
+ def to_hash
103
+ self.collect { |msg| { msg.name => msg.to_hash } }
104
+ end
105
+
106
+ end
107
+
93
108
  class E::UNA
94
109
  def to_hash
95
110
  result = {}
@@ -3,7 +3,7 @@ require 'edi/mapper'
3
3
  module OpenILS
4
4
 
5
5
  class Mapper < EDI::E::Mapper
6
- VERSION = '0.9.0'
6
+ VERSION = '0.9.1'
7
7
  end
8
8
 
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openils-mapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael B. Klein