ach 0.4.9 → 0.4.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4049660c0f3f3ed764549f2ca4841153182b687
4
- data.tar.gz: 4e0965b436351a9fa3b6362483e98a02b3a5791c
3
+ metadata.gz: 97e23049981832283f91fddbcd27d11e71b56474
4
+ data.tar.gz: f74a8004fc31c65d7d4ab3b6d8ba88a8ee1c7548
5
5
  SHA512:
6
- metadata.gz: 40dcf0cbeb86791665f58c43dd5caa6c53397dc1f3c31193e412aab997069f3ddc170d116645912528e7ffabeb8c1f4a46f00daa8af2d87946f96088cc913825
7
- data.tar.gz: 1bcd9d3197f705d6ff97aa4556956494efd58b1ac48e7a2ffa7c9170a0403646e136a22748eeb047e0db318220cb5db6c19c7750f3f3883529899ac1b1b7ddd4
6
+ metadata.gz: 4bed4dd45fcccb7297b9348354fd28428304ffd0344afd2044a143d06e5e6f3c26b0b8cb5f6c151f33b6a527e346ee4681ef736f8700a8590931f87df515b5fa
7
+ data.tar.gz: 627265288242992b6138ab190b61eebf2e9d8102eb8b87a8fe5f8eb0a56ebb860ae2b225a4972625e50e882f7d6d316df0c91b08ff8e3782508f85199feee754
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  #ACH
2
2
 
3
+ ![](https://travis-ci.org/jm81/ach.svg)
4
+
3
5
  ach is a Ruby helper for builder ACH files. In particular, it helps with field
4
6
  order and alignment, and adds padding lines to end of file.
5
7
 
data/lib/ach.rb CHANGED
@@ -27,6 +27,7 @@ require 'iconv' if RUBY_VERSION < '1.9'
27
27
  require 'ach/field_identifiers'
28
28
  require 'ach/ach_file'
29
29
  require 'ach/batch'
30
+ require 'ach/next_federal_reserve_effective_date'
30
31
  require 'ach/version'
31
32
 
32
33
  # Require records files
@@ -0,0 +1,40 @@
1
+ require 'holidays'
2
+
3
+ module ACH
4
+ class NextFederalReserveEffectiveDate
5
+ def initialize(submission_date)
6
+ @submission_date = submission_date
7
+ end
8
+
9
+ def result
10
+ @result = @submission_date
11
+ advance_to_next_business_day
12
+ advance_extra_day_if_submission_date_is_holiday_or_weekend
13
+ @result
14
+ end
15
+
16
+ private
17
+
18
+ def advance_extra_day_if_submission_date_is_holiday_or_weekend
19
+ if holiday_or_weekend?(@submission_date)
20
+ advance_to_next_business_day
21
+ end
22
+ end
23
+
24
+ def advance_to_next_business_day
25
+ @result = @result.next_day
26
+
27
+ while holiday_or_weekend?(@result)
28
+ @result = @result.next_day
29
+ end
30
+ end
31
+
32
+ def holiday?(date)
33
+ Holidays.on(date, :federal_reserve).any?
34
+ end
35
+
36
+ def holiday_or_weekend?(date)
37
+ date.saturday? || date.sunday? || holiday?(date)
38
+ end
39
+ end
40
+ end
@@ -1,3 +1,3 @@
1
1
  module ACH
2
- VERSION = '0.4.9'.freeze
2
+ VERSION = '0.4.10'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ach
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.9
4
+ version: 0.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Morgan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-31 00:00:00.000000000 Z
12
+ date: 2015-04-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -31,14 +31,34 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '2.0'
34
+ version: '3.2'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '2.0'
41
+ version: '3.2'
42
+ - !ruby/object:Gem::Dependency
43
+ name: holidays
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: 1.2.0
49
+ - - "<"
50
+ - !ruby/object:Gem::Version
51
+ version: 3.0.0
52
+ type: :runtime
53
+ prerelease: false
54
+ version_requirements: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: 1.2.0
59
+ - - "<"
60
+ - !ruby/object:Gem::Version
61
+ version: 3.0.0
42
62
  description: ach is a Ruby helper for building and parsing ACH files. In particular,
43
63
  it helps with field order and alignment, and adds padding lines to end of file.
44
64
  email: jmorgan@morgancreative.net
@@ -53,6 +73,7 @@ files:
53
73
  - lib/ach/ach_file.rb
54
74
  - lib/ach/batch.rb
55
75
  - lib/ach/field_identifiers.rb
76
+ - lib/ach/next_federal_reserve_effective_date.rb
56
77
  - lib/ach/records/addendum.rb
57
78
  - lib/ach/records/batch_control.rb
58
79
  - lib/ach/records/batch_header.rb