camt_parser 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/camt_parser.rb +2 -0
- data/lib/camt_parser/054/base.rb +14 -0
- data/lib/camt_parser/054/notification.rb +41 -0
- data/lib/camt_parser/general/entry.rb +8 -0
- data/lib/camt_parser/version.rb +1 -1
- data/lib/camt_parser/xml.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cea54db82055dc9825dec0bd1dc69860c3e241a
|
4
|
+
data.tar.gz: 71af9966dc5c6b135b27b3b0b585c19b85206b05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98fca3ade4834b9daad53f3f933a4d77b539744c028fda5deda730f4bc26dd8f07c009bc01287bbce749bc7929cf0a2691a911550698025127d1c278a577d415
|
7
|
+
data.tar.gz: 52f3495532f6c3c88b0bce030edf174af6e22cad7e43e5a9eedf7e6ebed5ca6149a33ba9bdbff221f6f5c0c850ed7072159860bd1f476ced55de657c71fe129c
|
data/lib/camt_parser.rb
CHANGED
@@ -18,6 +18,8 @@ require_relative "camt_parser/052/report"
|
|
18
18
|
require_relative "camt_parser/052/base"
|
19
19
|
require_relative "camt_parser/053/statement"
|
20
20
|
require_relative "camt_parser/053/base"
|
21
|
+
require_relative "camt_parser/054/notification"
|
22
|
+
require_relative "camt_parser/054/base"
|
21
23
|
require_relative "camt_parser/file"
|
22
24
|
require_relative "camt_parser/string"
|
23
25
|
require_relative "camt_parser/xml"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module CamtParser
|
2
|
+
module Format054
|
3
|
+
class Base
|
4
|
+
attr_reader :group_header, :notifications
|
5
|
+
|
6
|
+
def initialize(xml_data)
|
7
|
+
grphdr = xml_data.xpath('BkToCstmrDbtCdtNtfctn/GrpHdr')
|
8
|
+
@group_header = GroupHeader.new(grphdr)
|
9
|
+
notifications = xml_data.xpath('BkToCstmrDbtCdtNtfctn/Ntfctn')
|
10
|
+
@notifications = notifications.map{ |x| Notification.new(x) }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module CamtParser
|
2
|
+
module Format054
|
3
|
+
class Notification
|
4
|
+
def initialize(xml_data)
|
5
|
+
@xml_data = xml_data
|
6
|
+
end
|
7
|
+
|
8
|
+
def identification
|
9
|
+
@identification ||= @xml_data.xpath('Id/text()').text
|
10
|
+
end
|
11
|
+
|
12
|
+
def generation_date
|
13
|
+
@generation_date ||= Time.parse(@xml_data.xpath('CreDtTm/text()').text)
|
14
|
+
end
|
15
|
+
|
16
|
+
def from_date_time
|
17
|
+
@from_date_time ||= (x = @xml_data.xpath('FrToDt/FrDtTm')).empty? ? nil : Time.parse(x.first.content)
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_date_time
|
21
|
+
@to_date_time ||= (x = @xml_data.xpath('FrToDt/ToDtTm')).empty? ? nil : Time.parse(x.first.content)
|
22
|
+
end
|
23
|
+
|
24
|
+
def account
|
25
|
+
@account ||= Account.new(@xml_data.xpath('Acct').first)
|
26
|
+
end
|
27
|
+
|
28
|
+
def entries
|
29
|
+
@entries ||= @xml_data.xpath('Ntry').map{ |x| Entry.new(x) }
|
30
|
+
end
|
31
|
+
|
32
|
+
def source
|
33
|
+
@xml_data.to_s
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.parse(xml)
|
37
|
+
self.new Nokogiri::XML(xml).xpath('Ntfctn')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -45,6 +45,14 @@ module CamtParser
|
|
45
45
|
credit? ? 1 : -1
|
46
46
|
end
|
47
47
|
|
48
|
+
def reversal?
|
49
|
+
@reversal ||= @xml_data.xpath('RvslInd/text()').text.downcase == 'true'
|
50
|
+
end
|
51
|
+
|
52
|
+
def booked?
|
53
|
+
@booked ||= @xml_data.xpath('Sts/text()').text.upcase == 'BOOK'
|
54
|
+
end
|
55
|
+
|
48
56
|
def additional_information
|
49
57
|
@additional_information ||= @xml_data.xpath('AddtlNtryInf/text()').text
|
50
58
|
end
|
data/lib/camt_parser/version.rb
CHANGED
data/lib/camt_parser/xml.rb
CHANGED
@@ -11,6 +11,8 @@ module CamtParser
|
|
11
11
|
return CamtParser::Format052::Base.new(doc.xpath('Document'))
|
12
12
|
when 'urn:iso:std:iso:20022:tech:xsd:camt.053.001.02'
|
13
13
|
return CamtParser::Format053::Base.new(doc.xpath('Document'))
|
14
|
+
when 'urn:iso:std:iso:20022:tech:xsd:camt.054.001.04'
|
15
|
+
return CamtParser::Format054::Base.new(doc.xpath('Document'))
|
14
16
|
else
|
15
17
|
raise CamtParser::Errors::UnsupportedNamespaceError, namespaces
|
16
18
|
end
|
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.2.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-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -92,6 +92,8 @@ files:
|
|
92
92
|
- lib/camt_parser/052/report.rb
|
93
93
|
- lib/camt_parser/053/base.rb
|
94
94
|
- lib/camt_parser/053/statement.rb
|
95
|
+
- lib/camt_parser/054/base.rb
|
96
|
+
- lib/camt_parser/054/notification.rb
|
95
97
|
- lib/camt_parser/errors.rb
|
96
98
|
- lib/camt_parser/file.rb
|
97
99
|
- lib/camt_parser/general/account.rb
|