nacha 0.1.18 → 0.2.00

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e12fa57ffdd8c85b2b84a29ef356879f3fe7d4c1e71096c9b6700e9b0487ce3
4
- data.tar.gz: 3872080ab8827c6328f96d6795f71221c6d31d7620e18b2bb8fbda72c4afad62
3
+ metadata.gz: 9e7e5a0b7067a5bc2fda825f05bc61f86992b4653056b5800892248b57561952
4
+ data.tar.gz: 547452686b682558a049c5c1b1d7985f9b55bec7219b9fc285a3c225c3ee5396
5
5
  SHA512:
6
- metadata.gz: 0cad7aa20bb7547161d2dcae751d155e537d465f4461f881a2653c9d9b0dc4f5adad08893454f9dc449e4fb913b7de7b229acb1bad12c6d92c491dd704883cae
7
- data.tar.gz: 67e29604d03b3e2c580840846d3ccf70d86527d1b4de7fd4396196e0b2eaaa9bdc710cd9c6d5c2f257063dfa8de89f82870352d2cd47e19fa7a42833091b704d
6
+ metadata.gz: f9d3b8d3e944540b87e2aa62061682c94786590bc1c1fdda8657a3bdf5e1ed57425a6a9e10cf9a0dcd71716ca01987d609cc8bb821460ff762e822c314734338
7
+ data.tar.gz: 21ed379b621b006d716e882d23f0e768269d39938e951bc2add70c3043670bb929117f19fa698ad69b1e6e9b2614b9582af25a3492eecaacbf8597601076b5bb
data/CHANGELOG.md CHANGED
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.0] - 2025-08-03
11
+
12
+ - Better interface to parsed records (Nacha::AchFile)
13
+
14
+ - Now Nacha::parse returns an AchFile
15
+
16
+
17
+ ## [0.1.19] - 2025-07-27
18
+
19
+ - Accept stdin for command line parsing.
20
+
10
21
  ## [0.1.18] - 2025-07-26
11
22
 
12
23
  - first build automatically pushed from Github Actions
data/README.md CHANGED
@@ -64,6 +64,19 @@ API may change at any time. Pull requests welcomed
64
64
 
65
65
  ```
66
66
  nacha parse ach_file.ach > ach_file.html`
67
+ nacha parse -f html ach_file.ach -o ach_file.html`
68
+ ```
69
+
70
+ ## Parse an ach file into a JSON file
71
+
72
+ ```
73
+ nacha parse -f json ach_file.ach > ach_file.json`
74
+ ```
75
+
76
+ ## Parse an ach file into Markdown
77
+
78
+ ```
79
+ nacha parse -f md ach_file.ach > ach_file.md`
67
80
  ```
68
81
 
69
82
  ## Discussion
data/ROADMAP.md CHANGED
@@ -48,6 +48,13 @@
48
48
  - [x] WebAddendaRecord
49
49
  - [x] WebEntryDetailRecord
50
50
  - [x] XckEntryDetailRecord
51
+ - [ ] External API Updates
52
+ - [ ] The interface to the gem needs some updating
53
+ - [ ] Create a Nacha::AchFile object to wrap the parsed records
54
+ - Encapsulate output formatting (json, markdown)
55
+ - Encapsulate file totals?
56
+ - [ ] Nacha::AchBatch object to wrap the batches include in the Nacha::AchFile
57
+
51
58
  - [ ] Debug / Inspection
52
59
  - [ ] Field Validations
53
60
  - [ ] Record Validations
data/exe/nacha CHANGED
@@ -19,24 +19,29 @@ module Nacha
19
19
  desc "parse FILE", "Parse an ACH file"
20
20
  option :output_file, aliases: "-o"
21
21
  option :format, aliases: "-f", default: "html",
22
- desc: "Output format (html, json, md, or ach)", enum: %w[html json md ach]
22
+ desc: "Output format (html, json, md, markdown, or ach)",
23
+ enum: %w[html json md markdown ach]
23
24
  option :md_flavor, default: "common_mark", enum: %w[common_mark github]
24
- def parse(file_path)
25
- unless File.exist?(file_path)
25
+ def parse(file_path = nil)
26
+ if file_path.nil? || file_path.empty?
27
+ input_file = $stdin
28
+ elsif File.exist?(file_path)
29
+ input_file = File.open(file_path)
30
+ else
26
31
  puts "Error: File not found at #{file_path}"
27
32
  exit 1
28
33
  end
29
34
 
30
- file = File.open(file_path)
31
- ach_file = Nacha.parse(file)
35
+ raw_records = input_file.read
36
+ ach_file = Nacha.parse(raw_records)
32
37
 
33
38
  if ach_file && ach_file.is_a?(Array) && !ach_file.empty?
34
39
  if options[:output_file]
35
40
  File.open(options[:output_file], "w") do |f|
36
- write_output(ach_file, f, file)
41
+ write_output(ach_file, f, input_file)
37
42
  end
38
43
  else
39
- write_output(ach_file, $stdout, file)
44
+ write_output(ach_file, $stdout, input_file)
40
45
  end
41
46
  else
42
47
  puts "Could not parse the file or the file was empty."
@@ -52,11 +57,10 @@ module Nacha
52
57
  def write_output(ach_records, io, file)
53
58
  formatter_options = {
54
59
  file_name: File.basename(file.path),
55
- file_size: file.size,
60
+ file_size: file.respond_to?(:size) ? file.size : nil,
56
61
  number_of_lines: ach_records.size,
57
- created_at: file.ctime,
58
- modified_at: file.mtime,
59
- checksum: OpenSSL::Digest::SHA256.file(File.expand_path(file.path)).hexdigest,
62
+ created_at: file.respond_to?(:ctime) ? file.ctime : Time.now,
63
+ modified_at: file.respond_to?(:mtime) ? file.mtime : Time.now,
60
64
  preamble: HTML_PREAMBLE_FILE,
61
65
  postamble: HTML_POSTAMBLE_FILE
62
66
  }
@@ -64,7 +68,7 @@ module Nacha
64
68
  case options[:format]
65
69
  when 'ach'
66
70
  output_ach(ach_records, io)
67
- when 'md'
71
+ when 'md', 'markdown'
68
72
  formatter_options[:flavor] = options[:md_flavor].to_sym
69
73
  formatter = Nacha::Formatter::FormatterFactory.get(:markdown, ach_records, formatter_options)
70
74
  io.puts formatter.format
data/lib/nacha/version.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Nacha
4
4
  module Version
5
- STRING = '0.1.18'
5
+ STRING = '0.2.00'
6
6
  end
7
7
  VERSION = Version::STRING
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nacha
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.2.00
5
5
  platform: ruby
6
6
  authors:
7
7
  - David H. Wilkins