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.
Files changed (48) hide show
  1. checksums.yaml +5 -5
  2. data/.github/ISSUE_TEMPLATE.md +13 -0
  3. data/.github/PULL_REQUEST_TEMPLATE.md +5 -0
  4. data/.rubocop.yml +234 -0
  5. data/Gemfile +7 -1
  6. data/Gemfile.lock +73 -0
  7. data/README.md +1 -1
  8. data/Rakefile +2 -0
  9. data/lib/norma43.rb +9 -3
  10. data/lib/norma43/line_handlers.rb +2 -3
  11. data/lib/norma43/line_parsers/account_end.rb +18 -0
  12. data/lib/norma43/line_parsers/account_start.rb +18 -0
  13. data/lib/norma43/line_parsers/additional_currency.rb +12 -0
  14. data/lib/norma43/line_parsers/additional_item.rb +11 -0
  15. data/lib/norma43/line_parsers/document_end.rb +9 -0
  16. data/lib/norma43/line_parsers/document_start.rb +13 -0
  17. data/lib/norma43/line_parsers/file_format_validator.rb +15 -12
  18. data/lib/norma43/line_parsers/line_parser.rb +29 -28
  19. data/lib/norma43/line_parsers/transaction.rb +18 -0
  20. data/lib/norma43/line_processors.rb +2 -2
  21. data/lib/norma43/models.rb +5 -4
  22. data/lib/norma43/parser.rb +38 -42
  23. data/lib/norma43/utils/contexts.rb +40 -37
  24. data/lib/norma43/utils/string_helpers.rb +10 -6
  25. data/lib/norma43/utils/typecaster.rb +16 -12
  26. data/lib/norma43/version.rb +3 -1
  27. data/norma43_parser.gemspec +11 -9
  28. data/spec/example1_parse_spec.rb +12 -11
  29. data/spec/norma43/line_parsers/account_end_spec.rb +1 -1
  30. data/spec/norma43/line_parsers/account_start_spec.rb +1 -2
  31. data/spec/norma43/line_parsers/additional_currency_spec.rb +1 -1
  32. data/spec/norma43/line_parsers/additional_items_spec.rb +1 -1
  33. data/spec/norma43/line_parsers/document_end_spec.rb +1 -2
  34. data/spec/norma43/line_parsers/document_start_spec.rb +1 -1
  35. data/spec/norma43/line_parsers/transaction_spec.rb +1 -3
  36. data/spec/norma43/line_processors/account_end_spec.rb +6 -8
  37. data/spec/norma43/line_processors/account_start_spec.rb +8 -9
  38. data/spec/norma43/line_processors/additional_currency_spec.rb +6 -7
  39. data/spec/norma43/line_processors/additional_items_spec.rb +6 -7
  40. data/spec/norma43/line_processors/document_end_spec.rb +5 -6
  41. data/spec/norma43/line_processors/document_start_spec.rb +3 -4
  42. data/spec/norma43/line_processors/transaction_spec.rb +6 -7
  43. data/spec/norma43/parser_spec.rb +5 -4
  44. data/spec/norma43_spec.rb +2 -0
  45. data/spec/spec_helper.rb +1 -4
  46. data/spec/support/shared_examples_for_values_line_parsers.rb +2 -0
  47. metadata +41 -32
  48. data/lib/norma43/line_parsers/line_parsers.rb +0 -69
data/spec/norma43_spec.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "norma43"
2
4
 
3
5
  RSpec.describe Norma43 do
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,4 @@
1
- if ENV["CI"]
2
- require "codeclimate-test-reporter"
3
- CodeClimate::TestReporter.start
4
- end
1
+ # frozen_string_literal: true
5
2
 
6
3
  RSpec.configure do |config|
7
4
  config.order = :random
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.shared_examples "a values line parser" do
2
4
  describe "#values" do
3
5
  it "finds first value" do
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: 1.0.1
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: 2016-03-11 00:00:00.000000000 Z
11
+ date: 2019-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: virtus
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.5'
20
- type: :development
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.5'
26
+ version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
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: :development
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: byebug
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: rspec
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: virtus
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: :runtime
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/line_parsers.rb
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.0'
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
- rubyforge_project:
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