headache 0.1.0 → 0.1.1

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
  SHA1:
3
- metadata.gz: 666d14df0f9f60429e47c14b581ad73fd37611e7
4
- data.tar.gz: e75fd53aa8b9c3e8708ad252e9adc83722aefd66
3
+ metadata.gz: 38197db347ba22937f9bd2ac2c4ec0f08a7b1912
4
+ data.tar.gz: 81698a7ed860a42987faaf609cef7fff299e3b67
5
5
  SHA512:
6
- metadata.gz: a79fdbed3a9c657c79137485d88315209af552f135dab39f2e50ab366aa996cae2d53de1062c5fa5181a5af668c633cb17d2b6641030b20b4bc8c3cbc7c9c884
7
- data.tar.gz: cac050138755d8ca8575441db4736c8a2aa3a60b879af9aa90617e131a3b087cc8fb73275c1c31fce08f770b638fc0237e0c1823360f7f138461bfe680f6427b
6
+ metadata.gz: 724993f4ab4e3bd4421d83b59c7d467be8ea86161efb4c464ee35317959de419c9edd239a6634b436fb8cfa7b067a54fae32f17110ab5ee9148ebd7665e5a2f0
7
+ data.tar.gz: 7332c63174ef2162947174fd5455d6f2e2f3837a02d1989a22fd8507b24bd9cef312961649aadd9e5c1306f8f2790b9a83eca254cee0edda368199237bae821c
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # HeadACHe
2
2
 
3
+ [![Code Climate](https://img.shields.io/codeclimate/github/teampayoff/headache.svg?style=flat-square)](https://codeclimate.com/github/teampayoff/headache)
4
+
3
5
  Headache takes a lot of the guesswork out of building [ACH (Automated Clearing House)](https://en.wikipedia.org/wiki/Automated_Clearing_House) files to move money around between banks.
4
6
 
5
7
  Headache is built on top of the excellent [Fixy gem](https://github.com/Chetane/fixy) for handling fixed-width files.
@@ -49,7 +51,7 @@ Further, Headache abstracts an ACH record _definition_ from the record itself; s
49
51
  Create a new ACH document (some optional fields are omitted in this example):
50
52
 
51
53
  ```ruby
52
- document = Headache::Document.new.tap do |document|
54
+ ach_doc = Headache::Document.new.tap do |document|
53
55
  document.header.tap do |file_header|
54
56
  file_header.destination_name = '1ST INTERNET BANK'
55
57
  file_header.destination = '111111111' # Originating DFI number
@@ -57,6 +59,7 @@ document = Headache::Document.new.tap do |document|
57
59
  file_header.origin = '1111111111'
58
60
  file_header.reference_code = '11111111'
59
61
  end
62
+
60
63
  document.batch.tap do |batch|
61
64
  batch.type = :debit
62
65
  batch.odfi_id = '11111111'
@@ -87,7 +90,7 @@ end
87
90
  Finally, you can generate the file:
88
91
 
89
92
  ```ruby
90
- document.generate_to_file 'ACH.txt'
93
+ ach_doc.generate_to_file 'ACH.txt'
91
94
  ```
92
95
 
93
96
  ## Development
@@ -64,7 +64,7 @@ module Headache
64
64
  end
65
65
 
66
66
  def <<(entry_or_entries)
67
- (entries.is_a?(Array) ? entry_or_entries : [entry_or_entries]).each { |e| add_entry e }
67
+ [(entries.is_a?(Array) ? entry_or_entries : [entry_or_entries])].flatten.each { |e| add_entry e }
68
68
  self
69
69
  end
70
70
 
@@ -6,16 +6,16 @@ module Headache
6
6
  included do
7
7
  include Common
8
8
 
9
- field :service_code, 3, '2-4', :alphanumeric # Field2
10
- field :entry_count, 6, '5-10', :numeric # Field3
11
- field :entry_hash, 10, '11-20', :numeric # Field4
12
- field :total_debit, 12, '21-32', :numeric # Field5
13
- field :total_credit, 12, '33-44', :numeric # Field6
14
- field :company_identification, 10, '45-54', :alphanumeric # Field7
15
- field :message_authentication_code, 19, '55-73', :nothing # Field8
16
- field :reserved, 6, '74-79', :nothing # Field9
17
- field :odfi_id, 8, '80-87', :alphanumeric # Field10
18
- field :batch_number, 7, '88-94', :numeric # Field11
9
+ field :service_code, 3, '2-4', :alphanumeric
10
+ field :entry_count, 6, '5-10', :numeric
11
+ field :entry_hash, 10, '11-20', :numeric
12
+ field :total_debit, 12, '21-32', :numeric
13
+ field :total_credit, 12, '33-44', :numeric
14
+ field :company_identification, 10, '45-54', :alphanumeric
15
+ field :message_authentication_code, 19, '55-73', :nothing
16
+ field :reserved, 6, '74-79', :nothing
17
+ field :odfi_id, 8, '80-87', :alphanumeric
18
+ field :batch_number, 7, '88-94', :numeric
19
19
 
20
20
  field_value :message_authentication_code, ''
21
21
  field_value :reserved, ''
@@ -6,18 +6,18 @@ module Headache
6
6
  included do
7
7
  include Common
8
8
 
9
- field :service_code, 3, '2-4', :alphanumeric # Field2 credits = 220, debits = 225
10
- field :company_name, 16, '5-20', :alphanumeric # Field3
11
- field :discretionary, 20, '21-40', :alphanumeric # Field4
12
- field :company_identification, 10, '41-50', :alphanumeric # Field5
13
- field :entry_class_code, 3, '51-53', :alphanumeric # Field6
14
- field :entry_description, 10, '54-63', :alphanumeric # Field7
15
- field :descriptive_date, 6, '64-69', :nothing # Field8
16
- field :effective_date, 6, '70-75', :date # Field9
17
- field :settlement_date, 3, '76-78', :nothing # Field10
18
- field :originator_status_code, 1, '79-79', :alphanumeric # Field11
19
- field :odfi_id, 8, '80-87', :alphanumeric # Field12
20
- field :batch_number, 7, '88-94', :alphanumeric # Field13
9
+ field :service_code, 3, '2-4', :alphanumeric
10
+ field :company_name, 16, '5-20', :alphanumeric
11
+ field :discretionary, 20, '21-40', :alphanumeric
12
+ field :company_identification, 10, '41-50', :alphanumeric
13
+ field :entry_class_code, 3, '51-53', :alphanumeric
14
+ field :entry_description, 10, '54-63', :alphanumeric
15
+ field :descriptive_date, 6, '64-69', :nothing
16
+ field :effective_date, 6, '70-75', :date
17
+ field :settlement_date, 3, '76-78', :nothing
18
+ field :originator_status_code, 1, '79-79', :alphanumeric
19
+ field :odfi_id, 8, '80-87', :alphanumeric
20
+ field :batch_number, 7, '88-94', :alphanumeric
21
21
 
22
22
  field_value :descriptive_date, ''
23
23
  field_value :settlement_date, ''
@@ -6,16 +6,16 @@ module Headache
6
6
  included do
7
7
  include Common
8
8
 
9
- field :transaction_code, 2, '2-3', :alphanumeric # Field2
10
- field :routing_identification, 8, '4-11', :numeric # Field3
11
- field :check_digit, 1, '12-12', :numeric # Field4
12
- field :account_number, 17, '13-29', :alphanumeric # Field5
13
- field :amount, 10, '30-39', :numeric # Field6
14
- field :internal_id, 15, '40-54', :alphanumeric # Field7
15
- field :individual_name, 22, '55-76', :alphanumeric # Field8
16
- field :discretionary, 2, '77-78', :alphanumeric # Field9
17
- field :addenda_record, 1, '79-79', :alphanumeric # Field10
18
- field :trace_number, 15, '80-94', :alphanumeric # Field11
9
+ field :transaction_code, 2, '2-3', :alphanumeric
10
+ field :routing_identification, 8, '4-11', :numeric
11
+ field :check_digit, 1, '12-12', :numeric
12
+ field :account_number, 17, '13-29', :alphanumeric
13
+ field :amount, 10, '30-39', :numeric
14
+ field :internal_id, 15, '40-54', :alphanumeric
15
+ field :individual_name, 22, '55-76', :alphanumeric
16
+ field :discretionary, 2, '77-78', :alphanumeric
17
+ field :addenda_record, 1, '79-79', :alphanumeric
18
+ field :trace_number, 15, '80-94', :alphanumeric
19
19
 
20
20
  field_value :addenda_record, '0'
21
21
  field_value :discretionary, ''
@@ -13,7 +13,7 @@ module Headache
13
13
  field :total_debit, 12, '32-43', :numeric
14
14
  field :total_credit, 12, '44-55', :numeric
15
15
  field :reserved, 39, '56-94', :nothing
16
-
16
+
17
17
  field_value :reserved, ''
18
18
  end
19
19
  end
@@ -2,22 +2,22 @@ module Headache
2
2
  module Definition
3
3
  module FileHeader
4
4
  extend ActiveSupport::Concern
5
-
5
+
6
6
  included do
7
7
  include Common
8
8
 
9
- field :priority_code, 2, '2-3', :numeric # Field2
10
- field :destination, 10, '4-13', :alphanumeric # Field3
11
- field :origin, 10, '14-23', :alphanumeric # Field4
12
- field :creation_date, 6, '24-29', :date # Field5
13
- field :creation_time, 4, '30-33', :time # Field6
14
- field :id_modifier, 1, '34-34', :alphanumeric # Field7
15
- field :record_size, 3, '35-37', :alphanumeric # Field8
16
- field :blocking_factor, 2, '38-39', :alphanumeric # Field9
17
- field :format_code, 1, '40-40', :alphanumeric # Field10
18
- field :destination_name, 23, '41-63', :alphanumeric # Field11
19
- field :origin_name, 23, '64-86', :alphanumeric # Field12
20
- field :reference_code, 8, '87-94', :alphanumeric # Field13
9
+ field :priority_code, 2, '2-3', :numeric
10
+ field :destination, 10, '4-13', :alphanumeric
11
+ field :origin, 10, '14-23', :alphanumeric
12
+ field :creation_date, 6, '24-29', :date
13
+ field :creation_time, 4, '30-33', :time
14
+ field :id_modifier, 1, '34-34', :alphanumeric
15
+ field :record_size, 3, '35-37', :alphanumeric
16
+ field :blocking_factor, 2, '38-39', :alphanumeric
17
+ field :format_code, 1, '40-40', :alphanumeric
18
+ field :destination_name, 23, '41-63', :alphanumeric
19
+ field :origin_name, 23, '64-86', :alphanumeric
20
+ field :reference_code, 8, '87-94', :alphanumeric
21
21
 
22
22
  field_value :priority_code, '01'
23
23
  field_value :record_size, '094'
@@ -1,3 +1,3 @@
1
1
  module Headache
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: headache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Payoff, Inc.
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2015-08-13 00:00:00.000000000 Z
12
+ date: 2015-09-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fixy
@@ -170,3 +170,4 @@ signing_key:
170
170
  specification_version: 4
171
171
  summary: Take the pain out of building ACH files.
172
172
  test_files: []
173
+ has_rdoc: