camt_parser 2.0.0 → 2.1.0
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.
- checksums.yaml +4 -4
- data/lib/camt_parser/errors.rb +3 -0
- data/lib/camt_parser/string.rb +1 -12
- data/lib/camt_parser/version.rb +1 -1
- data/lib/camt_parser/xml.rb +19 -0
- data/lib/camt_parser.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31140c9ad0b6f028ce771ffdecd8a561eb492b72
|
4
|
+
data.tar.gz: ebe9f6cd6204ca39036a2b52844aa9be6a1698fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 742a48549a6274d2e7a8615260c490fbd3a61523397832e569d3337575eb2bacaa384355cf03ae7bd00728bb6db71036068c035c43793ea720d858ef0afc5ae6
|
7
|
+
data.tar.gz: 923fdcf651f4575c65310a5e9375bec65d8e3f106ebd6b6f653bc81317d538bc312eb17e77868596f3ede3406301f3e5f96a7d8c294457c8dbe135903eeff3e6
|
data/lib/camt_parser/errors.rb
CHANGED
data/lib/camt_parser/string.rb
CHANGED
@@ -2,18 +2,7 @@ module CamtParser
|
|
2
2
|
class String
|
3
3
|
def self.parse(raw_camt)
|
4
4
|
doc = Nokogiri::XML raw_camt
|
5
|
-
|
6
|
-
namespaces = doc.namespaces['xmlns']
|
7
|
-
doc.remove_namespaces!
|
8
|
-
|
9
|
-
case namespaces
|
10
|
-
when 'urn:iso:std:iso:20022:tech:xsd:camt.052.001.02'
|
11
|
-
return CamtParser::Format052::Base.new(doc.xpath('Document'))
|
12
|
-
when 'urn:iso:std:iso:20022:tech:xsd:camt.053.001.02'
|
13
|
-
return CamtParser::Format053::Base.new(doc.xpath('Document'))
|
14
|
-
else
|
15
|
-
raise CamtParser::Errors::UnsupportedNamespaceError, namespaces
|
16
|
-
end
|
5
|
+
CamtParser::Xml.parse(doc)
|
17
6
|
end
|
18
7
|
end
|
19
8
|
end
|
data/lib/camt_parser/version.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
module CamtParser
|
2
|
+
class Xml
|
3
|
+
def self.parse(doc)
|
4
|
+
raise CamtParser::Errors::NotXMLError, doc.class unless doc.is_a? Nokogiri::XML::Document
|
5
|
+
|
6
|
+
namespaces = doc.namespaces['xmlns']
|
7
|
+
doc.remove_namespaces!
|
8
|
+
|
9
|
+
case namespaces
|
10
|
+
when 'urn:iso:std:iso:20022:tech:xsd:camt.052.001.02'
|
11
|
+
return CamtParser::Format052::Base.new(doc.xpath('Document'))
|
12
|
+
when 'urn:iso:std:iso:20022:tech:xsd:camt.053.001.02'
|
13
|
+
return CamtParser::Format053::Base.new(doc.xpath('Document'))
|
14
|
+
else
|
15
|
+
raise CamtParser::Errors::UnsupportedNamespaceError, namespaces
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/camt_parser.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: camt_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Schoknecht
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- lib/camt_parser/misc.rb
|
105
105
|
- lib/camt_parser/string.rb
|
106
106
|
- lib/camt_parser/version.rb
|
107
|
+
- lib/camt_parser/xml.rb
|
107
108
|
homepage: https://github.com/Barzahlen/camt_parser
|
108
109
|
licenses:
|
109
110
|
- MIT
|