norma43_parser 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/ISSUE_TEMPLATE.md +13 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +5 -0
- data/.rubocop.yml +234 -0
- data/Gemfile +7 -1
- data/Gemfile.lock +73 -0
- data/README.md +1 -1
- data/Rakefile +2 -0
- data/lib/norma43.rb +9 -3
- data/lib/norma43/line_handlers.rb +2 -3
- data/lib/norma43/line_parsers/account_end.rb +18 -0
- data/lib/norma43/line_parsers/account_start.rb +18 -0
- data/lib/norma43/line_parsers/additional_currency.rb +12 -0
- data/lib/norma43/line_parsers/additional_item.rb +11 -0
- data/lib/norma43/line_parsers/document_end.rb +9 -0
- data/lib/norma43/line_parsers/document_start.rb +13 -0
- data/lib/norma43/line_parsers/file_format_validator.rb +15 -12
- data/lib/norma43/line_parsers/line_parser.rb +29 -28
- data/lib/norma43/line_parsers/transaction.rb +18 -0
- data/lib/norma43/line_processors.rb +2 -2
- data/lib/norma43/models.rb +5 -4
- data/lib/norma43/parser.rb +38 -42
- data/lib/norma43/utils/contexts.rb +40 -37
- data/lib/norma43/utils/string_helpers.rb +10 -6
- data/lib/norma43/utils/typecaster.rb +16 -12
- data/lib/norma43/version.rb +3 -1
- data/norma43_parser.gemspec +11 -9
- data/spec/example1_parse_spec.rb +12 -11
- data/spec/norma43/line_parsers/account_end_spec.rb +1 -1
- data/spec/norma43/line_parsers/account_start_spec.rb +1 -2
- data/spec/norma43/line_parsers/additional_currency_spec.rb +1 -1
- data/spec/norma43/line_parsers/additional_items_spec.rb +1 -1
- data/spec/norma43/line_parsers/document_end_spec.rb +1 -2
- data/spec/norma43/line_parsers/document_start_spec.rb +1 -1
- data/spec/norma43/line_parsers/transaction_spec.rb +1 -3
- data/spec/norma43/line_processors/account_end_spec.rb +6 -8
- data/spec/norma43/line_processors/account_start_spec.rb +8 -9
- data/spec/norma43/line_processors/additional_currency_spec.rb +6 -7
- data/spec/norma43/line_processors/additional_items_spec.rb +6 -7
- data/spec/norma43/line_processors/document_end_spec.rb +5 -6
- data/spec/norma43/line_processors/document_start_spec.rb +3 -4
- data/spec/norma43/line_processors/transaction_spec.rb +6 -7
- data/spec/norma43/parser_spec.rb +5 -4
- data/spec/norma43_spec.rb +2 -0
- data/spec/spec_helper.rb +1 -4
- data/spec/support/shared_examples_for_values_line_parsers.rb +2 -0
- metadata +41 -32
- data/lib/norma43/line_parsers/line_parsers.rb +0 -69
data/spec/norma43_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,85 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: norma43_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sequra engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: virtus
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
20
|
-
type: :
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: zeitwerk
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :
|
33
|
+
version: '2.0'
|
34
|
+
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
40
|
+
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
47
|
+
version: '1.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
54
|
+
version: '1.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
61
|
+
version: '10.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
68
|
+
version: '10.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
82
|
+
version: '3.0'
|
83
83
|
description:
|
84
84
|
email:
|
85
85
|
- dev@sequra.es
|
@@ -87,7 +87,11 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- ".github/ISSUE_TEMPLATE.md"
|
91
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
92
|
+
- ".rubocop.yml"
|
90
93
|
- Gemfile
|
94
|
+
- Gemfile.lock
|
91
95
|
- LICENSE
|
92
96
|
- README.md
|
93
97
|
- Rakefile
|
@@ -95,9 +99,15 @@ files:
|
|
95
99
|
- doc/cuaderno_43_-_junio_2012.pdf
|
96
100
|
- lib/norma43.rb
|
97
101
|
- lib/norma43/line_handlers.rb
|
102
|
+
- lib/norma43/line_parsers/account_end.rb
|
103
|
+
- lib/norma43/line_parsers/account_start.rb
|
104
|
+
- lib/norma43/line_parsers/additional_currency.rb
|
105
|
+
- lib/norma43/line_parsers/additional_item.rb
|
106
|
+
- lib/norma43/line_parsers/document_end.rb
|
107
|
+
- lib/norma43/line_parsers/document_start.rb
|
98
108
|
- lib/norma43/line_parsers/file_format_validator.rb
|
99
109
|
- lib/norma43/line_parsers/line_parser.rb
|
100
|
-
- lib/norma43/line_parsers/
|
110
|
+
- lib/norma43/line_parsers/transaction.rb
|
101
111
|
- lib/norma43/line_processors.rb
|
102
112
|
- lib/norma43/models.rb
|
103
113
|
- lib/norma43/parser.rb
|
@@ -138,15 +148,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
138
148
|
requirements:
|
139
149
|
- - "~>"
|
140
150
|
- !ruby/object:Gem::Version
|
141
|
-
version: '2.
|
151
|
+
version: '2.4'
|
142
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
153
|
requirements:
|
144
154
|
- - ">="
|
145
155
|
- !ruby/object:Gem::Version
|
146
156
|
version: '0'
|
147
157
|
requirements: []
|
148
|
-
|
149
|
-
rubygems_version: 2.4.6
|
158
|
+
rubygems_version: 3.0.2
|
150
159
|
signing_key:
|
151
160
|
specification_version: 4
|
152
161
|
summary: Parses banks transactions files specified in rule 43
|
@@ -1,69 +0,0 @@
|
|
1
|
-
require "norma43/line_parsers/line_parser"
|
2
|
-
|
3
|
-
module Norma43
|
4
|
-
module LineParsers
|
5
|
-
class DocumentStart < LineParser
|
6
|
-
field :id, 2..13
|
7
|
-
field :created_at, 14..33, :time
|
8
|
-
field :delivery_number, 34..35, :integer
|
9
|
-
field :file_type, 36..38
|
10
|
-
field :name, 39..48
|
11
|
-
end
|
12
|
-
|
13
|
-
class DocumentEnd < LineParser
|
14
|
-
field :record_number, 20..25, :integer
|
15
|
-
end
|
16
|
-
|
17
|
-
class AccountStart < LineParser
|
18
|
-
field :bank_code, 2..5, :integer
|
19
|
-
field :branch_code, 6..9, :integer
|
20
|
-
field :account_number, 10..19, :integer
|
21
|
-
field :start_date, 20..25, :date
|
22
|
-
field :end_date, 26..31, :date
|
23
|
-
field :balance_code, 32, :integer
|
24
|
-
field :balance_amount, 33..46, :integer
|
25
|
-
field :currency_code, 47..49, :integer
|
26
|
-
field :information_mode_code, 50, :integer
|
27
|
-
field :abbreviated_name, 51..76
|
28
|
-
end
|
29
|
-
|
30
|
-
class AccountEnd < LineParser
|
31
|
-
field :bank_code, 2..5, :integer
|
32
|
-
field :branch_code, 6..9, :integer
|
33
|
-
field :account_number, 10..19, :integer
|
34
|
-
field :debit_entries, 20..24, :integer
|
35
|
-
field :debit_amount, 25..38, :integer
|
36
|
-
field :credit_entries, 39..43, :integer
|
37
|
-
field :credit_amount, 44..57, :integer
|
38
|
-
field :balance_code, 58, :integer
|
39
|
-
field :balance_amount, 59..72, :integer
|
40
|
-
field :currency_code, 73..75, :integer
|
41
|
-
end
|
42
|
-
|
43
|
-
class Transaction < LineParser
|
44
|
-
field :origin_branch_code, 6..9, :integer
|
45
|
-
field :transaction_date, 10..15, :date
|
46
|
-
field :value_date, 16..21, :date
|
47
|
-
field :shared_item, 22..23, :integer
|
48
|
-
field :own_item, 24..26, :integer
|
49
|
-
field :amount_code, 27, :integer
|
50
|
-
field :amount, 28..41, :integer
|
51
|
-
field :document_number, 42..51, :integer
|
52
|
-
field :reference_1, 52..63, :integer
|
53
|
-
field :reference_2, 64..79
|
54
|
-
end
|
55
|
-
|
56
|
-
class AdditionalItem < LineParser
|
57
|
-
field :data_code, 2..3, :integer
|
58
|
-
field :item_1, 4..41
|
59
|
-
field :item_2, 42..79
|
60
|
-
end
|
61
|
-
|
62
|
-
class AdditionalCurrency < LineParser
|
63
|
-
field :data_code, 2..3, :integer
|
64
|
-
field :currency_code, 4..6, :integer
|
65
|
-
field :amount, 7..20, :integer
|
66
|
-
field :free, 21..79
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|