openils-mapper 0.9.7 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/edi/edi2json.rb +6 -1
- data/lib/edi/mapper.rb +7 -2
- data/lib/openils/mapper.rb +1 -1
- data/test/map_spec.rb +1 -1
- metadata +4 -4
data/lib/edi/edi2json.rb
CHANGED
data/lib/edi/mapper.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'forwardable'
|
1
2
|
require 'edi4r'
|
2
3
|
require 'edi4r/edifact'
|
3
4
|
begin
|
@@ -5,8 +6,12 @@ begin
|
|
5
6
|
rescue LoadError
|
6
7
|
warn "WARNING: edi4r-tdid not found. Only EDIFACT versions d96a and d01b will be supported!"
|
7
8
|
end
|
8
|
-
|
9
|
-
require 'json'
|
9
|
+
begin
|
10
|
+
require 'json/pure'
|
11
|
+
rescue LoadError
|
12
|
+
warn "WARNING: json-pure not found. Trying json."
|
13
|
+
require 'json'
|
14
|
+
end
|
10
15
|
|
11
16
|
class String
|
12
17
|
|
data/lib/openils/mapper.rb
CHANGED
data/test/map_spec.rb
CHANGED
@@ -114,7 +114,7 @@ describe EDI::E::Mapper do
|
|
114
114
|
}
|
115
115
|
# Can't compare everything because of timestamping, so we'll just compare
|
116
116
|
# the bodies for a high degree of confidence
|
117
|
-
interchange.to_hash['body'].should == [{"ORDERS"=>[["UNH", {"S009"=>{"0052"=>"D", "0054"=>"96A", "0065"=>"ORDERS", "0051"=>"UN"}, "0062"=>"1"}], ["BGM", {"1225"=>"9", "C002"=>{"1001"=>"220"}, "1004"=>"2"}], ["DTM", {"C507"=>{"2379"=>"102", "2380"=>"20090331", "2005"=>"137"}}], ["NAD", {"3035"=>"BY", "
|
117
|
+
interchange.to_hash['body'].should == [{"ORDERS"=>[["UNH", {"S009"=>{"0052"=>"D", "0054"=>"96A", "0065"=>"ORDERS", "0051"=>"UN"}, "0062"=>"1"}], ["BGM", {"1225"=>"9", "C002"=>{"1001"=>"220"}, "1004"=>"2"}], ["DTM", {"C507"=>{"2379"=>"102", "2380"=>"20090331", "2005"=>"137"}}], ["SG2", [["NAD", {"3035"=>"BY", "C082"=>{"3039"=>"3472205", "3055"=>"91"}}], ["SG3", [["RFF", {"C506"=>{"1153"=>"API", "1154"=>"3472205 0001"}}]]]]], ["SG2", [["NAD", {"3035"=>"BY", "C082"=>{"3039"=>"3472205", "3055"=>"31B"}}], ["SG3", [["RFF", {"C506"=>{"1153"=>"API", "1154"=>"3472205 0001"}}]]]]], ["SG2", [["NAD", {"3035"=>"SU", "C082"=>{"3039"=>"1556150", "3055"=>"31B"}}]]], ["SG2", [["NAD", {"3035"=>"SU", "C082"=>{"3039"=>"1556150", "3055"=>"91"}}], ["SG3", [["RFF", {"C506"=>{"1153"=>"IA", "1154"=>"1865"}}]]]]], ["SG7", [["CUX", {"C504"=>[{"6345"=>"USD", "6347"=>"2", "6343"=>"9"}]}]]], ["SG25", [["LIN", {"1082"=>1}], ["PIA", {"4347"=>"5", "C212"=>[{"7140"=>"03-0010837", "7143"=>"SA"}]}], ["IMD", {"C273"=>{"7008"=>["Discernment"]}, "7077"=>"F", "7081"=>"BTI"}], ["IMD", {"C273"=>{"7008"=>["Concord Records,"]}, "7077"=>"F", "7081"=>"BPU"}], ["IMD", {"C273"=>{"7008"=>["1986."]}, "7077"=>"F", "7081"=>"BPD"}], ["IMD", {"C273"=>{"7008"=>["1 sound disc :"]}, "7077"=>"F", "7081"=>"BPH"}], ["QTY", {"C186"=>{"6060"=>2, "6063"=>"21"}}], ["SG28", [["PRI", {"C509"=>{"5125"=>"AAB", "5118"=>35.95}}]]], ["SG29", [["RFF", {"C506"=>{"1153"=>"LI", "1154"=>"2/1"}}]]]]], ["SG25", [["LIN", {"1082"=>2}], ["PIA", {"4347"=>"5", "C212"=>[{"7140"=>"03-0010840", "7143"=>"SA"}]}], ["IMD", {"C273"=>{"7008"=>["The inner source"]}, "7077"=>"F", "7081"=>"BTI"}], ["IMD", {"C273"=>{"7008"=>["Duke, George, 1946-"]}, "7077"=>"F", "7081"=>"BAU"}], ["IMD", {"C273"=>{"7008"=>["MPS Records,"]}, "7077"=>"F", "7081"=>"BPU"}], ["IMD", {"C273"=>{"7008"=>["1973."]}, "7077"=>"F", "7081"=>"BPD"}], ["IMD", {"C273"=>{"7008"=>["2 sound discs :"]}, "7077"=>"F", "7081"=>"BPH"}], ["QTY", {"C186"=>{"6060"=>1, "6063"=>"21"}}], ["SG28", [["PRI", {"C509"=>{"5125"=>"AAB", "5118"=>28.95}}]]], ["SG29", [["RFF", {"C506"=>{"1153"=>"LI", "1154"=>"2/2"}}]]]]], ["UNS", {"0081"=>"S"}], ["CNT", {"C270"=>{"6069"=>"2", "6066"=>2}}], ["UNT", {"0074"=>33, "0062"=>"1"}]]}]
|
118
118
|
end
|
119
119
|
|
120
120
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openils-mapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 43
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 8
|
10
|
+
version: 0.9.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael B. Klein
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-21 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|