guevara 0.1.1 → 0.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/guevara/batch_header.rb +5 -2
- data/lib/guevara/version.rb +1 -1
- data/test/helper.rb +8 -7
- data/test/test_batch_generation.rb +18 -3
- data/test/test_batch_header.rb +14 -11
- data/test/test_file_generation.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4e1510670c4ccbbd4a0a504bd55f8152cd9427a
|
4
|
+
data.tar.gz: cf4ef4f6e81b02f56e8d44abd051a6f9375d8767
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58ddcc31c09e9e5c08af945726f02e884493681d100ff4b88729a60d1bbd435812f484f2d80ccd75fdcd83f0c089de89eef4b140ec002790c26100d3e733b2af
|
7
|
+
data.tar.gz: 9c9e9c3891bb43f1f18e5d4e714b48d9635760387b34e64b8cfa7671c077ccb131437e8e502db159478e79e7f1b957f56b622f3c1f5d0c49d7e99ec59029c515
|
data/lib/guevara/batch_header.rb
CHANGED
@@ -5,7 +5,9 @@ module Guevara
|
|
5
5
|
class BatchHeader < Row
|
6
6
|
|
7
7
|
def default_attributes
|
8
|
-
{
|
8
|
+
{
|
9
|
+
discretionary_data: ''
|
10
|
+
}
|
9
11
|
end
|
10
12
|
|
11
13
|
def format_attributes
|
@@ -21,7 +23,8 @@ module Guevara
|
|
21
23
|
"%<company_name>-16.16s",
|
22
24
|
"%<discretionary_data>-20.20s",
|
23
25
|
"%<company_id>10.10s",
|
24
|
-
"PPD
|
26
|
+
"PPD",
|
27
|
+
"%<entry_description>10.10s",
|
25
28
|
"%<company_date>s",
|
26
29
|
"%<effective_date>s",
|
27
30
|
" 1",
|
data/lib/guevara/version.rb
CHANGED
data/test/helper.rb
CHANGED
@@ -21,13 +21,14 @@ end
|
|
21
21
|
|
22
22
|
def sample_batch
|
23
23
|
{
|
24
|
-
service_class:
|
25
|
-
company_name:
|
26
|
-
company_id:
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
service_class: '200',
|
25
|
+
company_name: 'rubylit',
|
26
|
+
company_id: 'Ruby123',
|
27
|
+
entry_description: 'payments',
|
28
|
+
company_date: '2014-09-18',
|
29
|
+
origin_id: '12345678',
|
30
|
+
effective_date: '2014-09-21',
|
31
|
+
transactions: [ sample_transaction ]
|
31
32
|
}
|
32
33
|
end
|
33
34
|
|
@@ -2,12 +2,27 @@ require_relative 'helper.rb'
|
|
2
2
|
require_relative '../lib/guevara/batch'
|
3
3
|
|
4
4
|
setup do
|
5
|
-
|
5
|
+
sample_batch.merge(:number => 1)
|
6
6
|
end
|
7
7
|
|
8
|
-
test 'generates the batch' do |
|
8
|
+
test 'generates the batch' do |attributes|
|
9
|
+
batch = Guevara::Batch.new attributes
|
9
10
|
expected = <<NACHA
|
10
|
-
5200rubylit Ruby123PPD
|
11
|
+
5200rubylit Ruby123PPD payments140918140921 1123456780000001
|
12
|
+
6271031001953ACCOUNT234 0000001600FD00AFA8A0F7 marge baker 1123456780000001
|
13
|
+
705wellsville|KS|66092|101 2nd st| 00010000001
|
14
|
+
82000000020010310019000000001600000000000000 Ruby123 123456780000001
|
15
|
+
NACHA
|
16
|
+
batch.to_s.lines.to_a.each_with_index do |line, index|
|
17
|
+
debugger_equal line, expected.lines.to_a[index]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
test 'discretionary data is added to the batch header' do |attributes|
|
22
|
+
batch = Guevara::Batch.new attributes.merge(
|
23
|
+
discretionary_data: 'something custom')
|
24
|
+
expected = <<NACHA
|
25
|
+
5200rubylit something custom Ruby123PPD payments140918140921 1123456780000001
|
11
26
|
6271031001953ACCOUNT234 0000001600FD00AFA8A0F7 marge baker 1123456780000001
|
12
27
|
705wellsville|KS|66092|101 2nd st| 00010000001
|
13
28
|
82000000020010310019000000001600000000000000 Ruby123 123456780000001
|
data/test/test_batch_header.rb
CHANGED
@@ -2,19 +2,22 @@ require_relative 'helper.rb'
|
|
2
2
|
require_relative '../lib/guevara/batch_header'
|
3
3
|
|
4
4
|
setup do
|
5
|
-
|
6
|
-
service_class: '200',
|
7
|
-
company_name: 'rubylit',
|
8
|
-
company_id: '7654321',
|
9
|
-
company_date: '2014-09-18',
|
10
|
-
effective_date: '2014-09-21',
|
11
|
-
origin_id: '12345678',
|
12
|
-
number: 1
|
13
|
-
)
|
5
|
+
sample_batch.merge(number: 1)
|
14
6
|
end
|
15
7
|
|
16
|
-
test 'generates the batch header' do |
|
8
|
+
test 'generates the batch header' do |attributes|
|
9
|
+
batch_header = Guevara::BatchHeader.new attributes
|
10
|
+
|
11
|
+
debugger_equal batch_header.to_s, <<NACHA
|
12
|
+
5200rubylit Ruby123PPD payments140918140921 1123456780000001
|
13
|
+
NACHA
|
14
|
+
end
|
15
|
+
|
16
|
+
test 'discretionary data can be added' do |attributes|
|
17
|
+
batch_header = Guevara::BatchHeader.new attributes.merge(
|
18
|
+
discretionary_data: 'something here')
|
19
|
+
|
17
20
|
debugger_equal batch_header.to_s, <<NACHA
|
18
|
-
5200rubylit
|
21
|
+
5200rubylit something here Ruby123PPD payments140918140921 1123456780000001
|
19
22
|
NACHA
|
20
23
|
end
|
@@ -4,7 +4,7 @@ require 'guevara'
|
|
4
4
|
test 'generates nacha sample file' do |batch|
|
5
5
|
expected = <<NACHA
|
6
6
|
101 012345678 0123456781411281330A094101 Rubylit Zest 0
|
7
|
-
5200rubylit Ruby123PPD
|
7
|
+
5200rubylit Ruby123PPD payments140918140921 1123456780000001
|
8
8
|
6271031001953ACCOUNT234 0000001600FD00AFA8A0F7 marge baker 1123456780000001
|
9
9
|
705wellsville|KS|66092|101 2nd st| 00010000001
|
10
10
|
82000000020010310019000000001600000000000000 Ruby123 123456780000001
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guevara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gaston Ramos
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-10-
|
12
|
+
date: 2014-10-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -122,3 +122,4 @@ test_files:
|
|
122
122
|
- test/test_file_control.rb
|
123
123
|
- test/test_file_generation.rb
|
124
124
|
- test/test_file_header.rb
|
125
|
+
has_rdoc:
|