camt_parser 2.15.1 → 2.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8bf47570443ce3a304c5a90034e60d539dc7e610140818eeb1793e660c671966
4
- data.tar.gz: 299bd9ee5807d26c89ac2dd522959836e588ae3888043d5a747732f432f01d5c
3
+ metadata.gz: b4e8b8d1e4e21afe2b53266c382ff420a8d2939d81d55628ee79709f86971dbc
4
+ data.tar.gz: 1ba97dc056cad8eb338852e4e2bd722c429cff195d0d4b06381714ef6d8b27c8
5
5
  SHA512:
6
- metadata.gz: d6d170663b314dfb467b609dcc72be2d0ad4038f2b6d9f9960b4dcda2d348b308dcdcfd0eb6911a4868b27db353ef94ba39a1b223cfe9058bcdbdb23b3b371d9
7
- data.tar.gz: fead7e44257cd34e028b90af6debf00718a25d569471d9252e4a011eae51f45528d8561e59322f470e495578483246474b1eb0bb3e304026a6dc3156c80aa312
6
+ metadata.gz: 057c649ed3518428a38fc1a6e9d65fea77951ef2689d79fa30886d7d5c58634a9424683eff73fe24083003754e178a9e797cca41f1388c1c6bf64ab0c722c46a
7
+ data.tar.gz: c57e1015124b0f735ae4871883ba48e15f1ee376ff07969bed909bd4760cb698184a4acd4261c0f4e134fcae847b032746685490da17d19a13f4a853f19d00b0
@@ -28,5 +28,17 @@ module CamtParser
28
28
  def bank_name
29
29
  @bank_name ||= xml_data.xpath('RltdAgts/CdtrAgt/FinInstnId/Nm/text()').text
30
30
  end
31
+
32
+ # @return [CamtParser::PostalAddress, nil]
33
+ def postal_address # May be missing
34
+ postal_address = [
35
+ xml_data.xpath('RltdPties/Cdtr/PstlAdr'),
36
+ xml_data.xpath('RltdPties/Cdtr/Pty/PstlAdr'),
37
+ ].reject(&:empty?).first
38
+
39
+ return nil if postal_address == nil || postal_address.empty?
40
+
41
+ @address ||= CamtParser::PostalAddress.new(postal_address)
42
+ end
31
43
  end
32
44
  end
@@ -28,5 +28,17 @@ module CamtParser
28
28
  def bank_name
29
29
  @bank_name ||= xml_data.xpath('RltdAgts/DbtrAgt/FinInstnId/Nm/text()').text
30
30
  end
31
+
32
+ # @return [CamtParser::PostalAddress, nil]
33
+ def postal_address # May be missing
34
+ postal_address = [
35
+ xml_data.xpath('RltdPties/Dbtr/PstlAdr'),
36
+ xml_data.xpath('RltdPties/Dbtr/Pty/PstlAdr'),
37
+ ].reject(&:empty?).first
38
+
39
+ return nil if postal_address == nil || postal_address.empty?
40
+
41
+ @address ||= CamtParser::PostalAddress.new(postal_address)
42
+ end
31
43
  end
32
44
  end
@@ -0,0 +1,43 @@
1
+ module CamtParser
2
+ class PostalAddress
3
+
4
+ attr_reader :xml_data
5
+
6
+ def initialize(xml_data)
7
+ @xml_data = xml_data
8
+ end
9
+
10
+ # @return [Array<String>]
11
+ def lines # May be empty
12
+ xml_data.xpath('AdrLine').map do |x|
13
+ x.xpath('text()').text
14
+ end
15
+ end
16
+
17
+ # @return [String]
18
+ def street_name # May be missing
19
+ xml_data.xpath('StrtNm/text()').text
20
+ end
21
+
22
+ # @return [String]
23
+ def building_number # May be missing
24
+ xml_data.xpath('BldgNb/text()').text
25
+ end
26
+
27
+ # @return [String]
28
+ def postal_code # May be missing
29
+ xml_data.xpath('PstCd/text()').text
30
+ end
31
+
32
+ # @return [String]
33
+ def town_name # May be missing
34
+ xml_data.xpath('TwnNm/text()').text
35
+ end
36
+
37
+ # @return [String]
38
+ def country # May be missing
39
+ xml_data.xpath('Ctry/text()').text
40
+ end
41
+
42
+ end
43
+ end
@@ -42,6 +42,10 @@ module CamtParser
42
42
  credit? ? debitor.bic : creditor.bic
43
43
  end
44
44
 
45
+ def postal_address
46
+ credit? ? debitor.postal_address : creditor.postal_address
47
+ end
48
+
45
49
  def credit?
46
50
  !debit
47
51
  end
@@ -1,3 +1,3 @@
1
1
  module CamtParser
2
- VERSION = '2.15.1'.freeze
2
+ VERSION = '2.16.0'.freeze
3
3
  end
data/lib/camt_parser.rb CHANGED
@@ -16,6 +16,7 @@ require_relative "camt_parser/general/charges"
16
16
  require_relative "camt_parser/general/account"
17
17
  require_relative "camt_parser/general/batch_detail"
18
18
  require_relative "camt_parser/general/group_header"
19
+ require_relative "camt_parser/general/postal_address"
19
20
  require_relative "camt_parser/general/transaction"
20
21
  require_relative "camt_parser/general/type/builder"
21
22
  require_relative "camt_parser/general/type/code"
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.15.1
4
+ version: 2.16.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: 2023-07-31 00:00:00.000000000 Z
11
+ date: 2023-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -90,6 +90,7 @@ files:
90
90
  - lib/camt_parser/general/debitor.rb
91
91
  - lib/camt_parser/general/entry.rb
92
92
  - lib/camt_parser/general/group_header.rb
93
+ - lib/camt_parser/general/postal_address.rb
93
94
  - lib/camt_parser/general/record.rb
94
95
  - lib/camt_parser/general/transaction.rb
95
96
  - lib/camt_parser/general/type/builder.rb
@@ -119,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
120
  - !ruby/object:Gem::Version
120
121
  version: '0'
121
122
  requirements: []
122
- rubygems_version: 3.4.13
123
+ rubygems_version: 3.4.20
123
124
  signing_key:
124
125
  specification_version: 4
125
126
  summary: Gem for parsing camt files into a speaking object.