openils-mapper 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/edi/edi2json.rb +16 -1
- data/lib/openils/mapper.rb +1 -1
- metadata +1 -1
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
|
-
|
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 = {}
|
data/lib/openils/mapper.rb
CHANGED