banking_calendar 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cb51632a085695d1691c98c6cb374298d267d49395058f8a0796be41a298a761
4
+ data.tar.gz: 2b863ad87135df45c0b3bd13040bdd43399bfcea6af2d745fd1b28a7c0275a05
5
+ SHA512:
6
+ metadata.gz: c359e64cbe4156d9824401039ce59d7cd72a74f9a1e34bfbdcec3ff77adfa7381bb59083b90567100b6b3755626d6dac36424758a2cbc5dca39daa50c06fce20
7
+ data.tar.gz: 12a24e0a24314394b2eb20a6e4782a954fcb1b65f2f3155373e439bf31942d68f419e6a059be5a0131e08b0ce4aebba3a98e774ec4aaf2caf28d93f05e47897b
@@ -0,0 +1,50 @@
1
+ version: 2.1
2
+ jobs:
3
+ test:
4
+ docker:
5
+ - image: circleci/ruby:<< parameters.ruby-version >>
6
+ parameters:
7
+ ruby-version:
8
+ type: string
9
+ steps:
10
+ - checkout
11
+ - run:
12
+ name: Update bundler
13
+ command: |
14
+ gem update --system
15
+ gem install bundler
16
+ - run:
17
+ name: Which bundler?
18
+ command: bundle -v
19
+ - restore_cache:
20
+ keys:
21
+ - bundle-v1-<< parameters.ruby-version >>-{{ checksum "banking_calendar.gemspec" }}
22
+ - bundle-v1-<< parameters.ruby-version >>-
23
+ - run:
24
+ name: Bundle install
25
+ command: bundle install --clean --no-cache --path vendor/bundle --jobs=4 --retry=3
26
+ - save_cache:
27
+ key: bundle-v1-<< parameters.ruby-version >>-{{ checksum "banking_calendar.gemspec" }}
28
+ paths:
29
+ - vendor/bundle
30
+ - run:
31
+ name: Run rspec
32
+ command: |
33
+ mkdir -p test_resuts/rspec test_artifacts
34
+ TESTFILES=$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
35
+ bundle exec rspec --profile 10 \
36
+ --color \
37
+ --order random \
38
+ --format RspecJunitFormatter \
39
+ --out test_results/rspec.xml \
40
+ --format progress \
41
+ -- ${TESTFILES}
42
+
43
+ workflows:
44
+ default:
45
+ jobs:
46
+ - test:
47
+ name: Ruby << matrix.ruby-version >>
48
+ matrix:
49
+ parameters:
50
+ ruby-version: ["2.5.8", "2.6.6", "2.7.1"]
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ .DS_Store
2
+ .bundle
3
+ *.gem
4
+ Gemfile.lock
5
+ coverage/
6
+ doc/
7
+ spec/coverage
8
+ spec/reports
9
+ tmp
data/CHANGELOG.md ADDED
File without changes
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2020 PayMongo
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,124 @@
1
+ # Banking Calendar
2
+
3
+ [![CircleCI](https://circleci.com/gh/paymongo/banking_calendar.svg?style=svg)](https://circleci.com/gh/paymongo/banking_calendar)
4
+
5
+ This Banking Calendar library provides a way to calculate days based on the banking calendar.
6
+
7
+ # How to use
8
+
9
+ ## Basic usage
10
+
11
+ You can create a banking calendar by creating an instance of the `Calendar` class and specifying
12
+ the `banking_days` and `bank_holidays`.
13
+
14
+ ```ruby
15
+ calendar = BankingCalendar::Calendar.new(
16
+ banking_days: %w(monday tuesday wednesday thursday friday),
17
+ banking_holidays: %w(2020-01-01 2020-01-25)
18
+ )
19
+ ```
20
+ If `banking_days` value is not provided, then the default used is Monday to Friday.
21
+
22
+ ## Using default calendars
23
+
24
+ Some few calendar configurations are provided. You may use them by calling `load_calendar` and
25
+ the name of the calendar you want to load. You may refer to the list of available calendars below.
26
+
27
+ ```ruby
28
+ calendar = BankingCalendar::Calendar.load_calendar('bsp')
29
+ ```
30
+
31
+ ## Useful methods
32
+
33
+ ### banking_day?(date)
34
+ Determine if a provided `date` is a banking day in the calendar.
35
+
36
+ ```ruby
37
+ calendar.banking_day?(Date.parse('2020-05-01'))
38
+ # => false
39
+ calendar.banking_day?(Date.parse('15 April 2020'))
40
+ # => true
41
+ ```
42
+
43
+ ### banking_days_after(date, interval)
44
+ Given a `date`, this method returns the date after `interval` number of business days. If the given
45
+ `date` falls on a non-banking day, the calculation starts at the next possible banking day.
46
+
47
+ ```ruby
48
+ # May 4, Monday is a banking day
49
+ date = Date.parse('2020-05-04')
50
+ calendar.banking_days_after(date, 4).strftime("%A, %B %d, %Y")
51
+ # => Friday, May 08, 2020
52
+
53
+ # May 1, Friday is a bank holiday
54
+ date = Date.parse('2020-05-01')
55
+ # Next banking day is May 4, Monday
56
+ calendar.banking_days_after(date, 2).strftime("%A, %B %d, %Y")
57
+ # => Wednesday, May 06, 2020
58
+ ```
59
+
60
+ ### banking_days_before(date, interval)
61
+ Given a `date`, this method returns the prior `interval` number of business days. If the given
62
+ `date` falls on a non-banking day, the calculation starts at the first previous possible banking day.
63
+
64
+ ```ruby
65
+ # May 22, 2020 Friday is a banking day
66
+ date = Date.parse('2020-05-22')
67
+ calendar.banking_days_before(date, 4).strftime("%A, %B %d, %Y")
68
+ # => Monday, May 18, 2020
69
+
70
+ # May 1, 2020 Friday is a bank holiday
71
+ date = Date.parse('2020-05-01')
72
+ # Previous banking day is April 30, 2020 Thursday
73
+ calendar.banking_days_after(date, 2).strftime("%A, %B %d, %Y")
74
+ # => Tuesday, April 28, 2020
75
+ ```
76
+
77
+ ### next_banking_day(date)
78
+ This method returns the next possible banking day after a given `date`.
79
+
80
+ ```ruby
81
+ # April 15, 2020 Wednesday is a banking day
82
+ date = Date.parse('2020-04-15')
83
+ calendar.next_banking_day(date).strftime("%A, %B %d, %Y")
84
+ # => Thursday, April 16, 2020
85
+
86
+ # May 15, 2020 Friday is a banking day
87
+ date = Date.parse('2020-05-15')
88
+ # The following day May 16, 2020 is a Saturday
89
+ calendar.next_banking_day(date).strftime("%A, %B %d, %Y")
90
+ # => Monday, May 18, 2020
91
+
92
+ # June 06, 2020 Friday is a banking day
93
+ date = Date.parse('2020-06-06')
94
+ # The following day June 07, 2020 is a Sunday
95
+ calendar.next_banking_day(date).strftime("%A, %B %d, %Y")
96
+ # => Monday, June 08, 2020
97
+ ```
98
+
99
+ ### previous_banking_day(date)
100
+ This method returns the previous possible banking day before a given `date`.
101
+
102
+ ```ruby
103
+ # April 15, 2020 Wednesday is a banking day
104
+ date = Date.parse('2020-04-15')
105
+ calendar.previous_banking_day(date).strftime("%A, %B %d, %Y")
106
+ # => Tuesday, April 14, 2020
107
+
108
+ # May 16, 2020 Saturday is non-banking day
109
+ date = Date.parse('2020-05-16')
110
+ calendar.previous_banking_day(date).strftime("%A, %B %d, %Y")
111
+ # => Friday, May 15, 2020
112
+
113
+ # June 08, 2020 Monday is a banking day
114
+ date = Date.parse('2020-06-08')
115
+ # The previous day June 07, 2020 is a Sunday
116
+ calendar.previous_banking_day(date).strftime("%A, %B %d, %Y")
117
+ # => Friday, June 06, 2020
118
+ ```
119
+
120
+ ## Available pre-configured calendars
121
+
122
+ The following are the pre-configured calendars available in this library:
123
+
124
+ - `bsp` - Banking calendar of the Philippines, as provided by the Bangko Sentral ng Pilipinas
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift(::File.join(::File.dirname(__FILE__), 'lib'))
4
+
5
+ require 'banking_calendar/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = 'banking_calendar'
9
+ s.version = BankingCalendar::VERSION
10
+ s.required_ruby_version = '>= 2.5.0'
11
+ s.summary = 'Calculate dates based on the banking calendar'
12
+ s.description = 'Calculate dates based on the banking calendar.'
13
+ s.author = 'PayMongo'
14
+ s.email = 'support@paymongo.com'
15
+ s.homepage = 'https://github.com/paymongo/banking_calendar'
16
+ s.license = 'MIT'
17
+
18
+ s.files = `git ls-files`.split($/)
19
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
20
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
+ s.require_paths = ['lib']
22
+
23
+ s.add_development_dependency 'rspec', '~> 3.1'
24
+ s.add_development_dependency 'rspec_junit_formatter', '~> 0.4.1'
25
+ end
@@ -0,0 +1,130 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yaml'
4
+
5
+ module BankingCalendar
6
+ class Calendar
7
+ class << self
8
+ attr_accessor :additional_load_paths
9
+
10
+ def load(calendar)
11
+ file_name = "#{calendar}.yml"
12
+
13
+ directory = calendars.find do |d|
14
+ File.exist?(File.join(d, file_name))
15
+ end
16
+ raise "Cannot find calendar #{calendar}" unless directory
17
+
18
+ yaml = YAML.load_file(
19
+ File.join(directory, file_name)
20
+ ).transform_keys(&:to_sym)
21
+
22
+ new(yaml)
23
+ end
24
+
25
+ def load_calendar(calendar)
26
+ @semaphore.synchronize do
27
+ @cached_calendars ||= {}
28
+ unless @cached_calendars.include?(calendar)
29
+ @cached_calendars[calendar] = load(calendar)
30
+ end
31
+ @cached_calendars[calendar]
32
+ end
33
+ end
34
+
35
+ private
36
+
37
+ def calendars
38
+ (@additional_load_paths || []) +
39
+ [File.join(File.dirname(__FILE__), 'data')]
40
+ end
41
+ end
42
+
43
+ DEFAULT_BANKING_DAYS = %w[mon tue wed thu fri].freeze
44
+ VALID_CALENDAR_KEYS = %i[banking_days bank_holidays].freeze
45
+ VALID_DAYS = %w[sun mon tue wed thu fri sat].freeze
46
+
47
+ @semaphore = Mutex.new
48
+
49
+ def initialize(config)
50
+ @config = config
51
+ validate_config
52
+ end
53
+
54
+ def validate_config
55
+ unless (@config.keys - VALID_CALENDAR_KEYS).empty?
56
+ raise "Only the following keys are valid: #{VALID_CALENDAR_KEYS.join(', ')}"
57
+ end
58
+ end
59
+
60
+ def next_banking_day(date)
61
+ loop do
62
+ date += duration_for(date)
63
+ break if banking_day?(date)
64
+ end
65
+
66
+ date
67
+ end
68
+
69
+ def previous_banking_day(date)
70
+ loop do
71
+ date -= duration_for(date)
72
+ break if banking_day?(date)
73
+ end
74
+
75
+ date
76
+ end
77
+
78
+ def banking_days_after(date, interval)
79
+ date = next_banking_day(date) unless banking_day?(date)
80
+ interval.times do
81
+ date = next_banking_day(date)
82
+ end
83
+
84
+ date
85
+ end
86
+
87
+ def banking_days_before(date, interval)
88
+ date = previous_banking_day(date) unless banking_day?(date)
89
+ interval.times do
90
+ date = previous_banking_day(date)
91
+ end
92
+
93
+ date
94
+ end
95
+
96
+ def banking_day?(date)
97
+ date = date.to_date
98
+ day = date.strftime('%a').downcase
99
+
100
+ return false if bank_holidays.include?(date)
101
+ return false unless banking_days.include?(day)
102
+
103
+ true
104
+ end
105
+
106
+ private
107
+
108
+ def duration_for(date, interval = 1)
109
+ date.is_a?(Date) ? interval : 3600 * 24 * interval
110
+ end
111
+
112
+ def parse_dates(dates)
113
+ (dates || []).map do |date|
114
+ date.is_a?(Date) ? date : Date.parse(date)
115
+ end
116
+ end
117
+
118
+ def banking_days
119
+ @banking_days ||= (@config[:banking_days] || DEFAULT_BANKING_DAYS).map do |day|
120
+ day.downcase.strip[0..2].tap do |shortened_day|
121
+ raise "#{day} is an invalid day." unless VALID_DAYS.include?(shortened_day)
122
+ end
123
+ end
124
+ end
125
+
126
+ def bank_holidays
127
+ @bank_holidays ||= parse_dates(@config[:bank_holidays])
128
+ end
129
+ end
130
+ end
@@ -0,0 +1,26 @@
1
+ banking_days:
2
+ - monday
3
+ - tuesday
4
+ - wednesday
5
+ - thursday
6
+ - friday
7
+
8
+ bank_holidays:
9
+ - 2020-01-01
10
+ - 2020-01-25
11
+ - 2020-02-25
12
+ - 2020-04-09
13
+ - 2020-04-10
14
+ - 2020-04-11
15
+ - 2020-05-01
16
+ - 2020-06-12
17
+ - 2020-08-21
18
+ - 2020-08-31
19
+ - 2020-11-01
20
+ - 2020-11-02
21
+ - 2020-11-30
22
+ - 2020-12-08
23
+ - 2020-12-24
24
+ - 2020-12-25
25
+ - 2020-12-30
26
+ - 2020-12-31
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BankingCalendar
4
+ VERSION = '0.0.1'
5
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'banking_calendar/calendar'
@@ -0,0 +1,218 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'banking_calendar/calendar'
4
+ require 'time'
5
+
6
+ RSpec.configure do |config|
7
+ config.mock_with(:rspec) { |mocks| mocks.verify_partial_doubles = true }
8
+ config.raise_errors_for_deprecations!
9
+ end
10
+
11
+ describe BankingCalendar::Calendar do
12
+ describe '.load_calendar' do
13
+ before do
14
+ path = File.join(File.dirname(__FILE__), 'fixtures', 'calendars')
15
+ BankingCalendar::Calendar.additional_load_paths = [path]
16
+ end
17
+
18
+ context 'when calendar is valid' do
19
+ subject { BankingCalendar::Calendar.load_calendar('bsp') }
20
+
21
+ it { is_expected.to be_a BankingCalendar::Calendar }
22
+ end
23
+
24
+ context 'when calendar is invalid' do
25
+ subject { BankingCalendar::Calendar.load_calendar('invalid_calendar') }
26
+ it 'raises an error' do
27
+ expect { subject }.to raise_error(
28
+ 'Only the following keys are valid: banking_days, bank_holidays'
29
+ )
30
+ end
31
+ end
32
+
33
+ context 'when calendar does not exist' do
34
+ subject { BankingCalendar::Calendar.load_calendar('no_such_calendar') }
35
+
36
+ it 'raises an error' do
37
+ expect { subject }.to raise_error(
38
+ 'Cannot find calendar no_such_calendar'
39
+ )
40
+ end
41
+ end
42
+
43
+ context 'when calendar is from an additional directory' do
44
+ after { BankingCalendar::Calendar.additional_load_paths = nil }
45
+ subject { BankingCalendar::Calendar.load_calendar('valid_calendar') }
46
+
47
+ it { is_expected.to be_a BankingCalendar::Calendar }
48
+
49
+ context 'when also a default calendar' do
50
+ subject { BankingCalendar::Calendar.load_calendar('bsp') }
51
+
52
+ it 'uses the custom calendar' do
53
+ expect(subject.banking_day?(Date.parse('2020-01-01'))).to eq(true)
54
+ end
55
+ end
56
+ end
57
+ end
58
+
59
+ shared_examples 'shared' do
60
+ describe '#banking_day?' do
61
+ let(:cal) { BankingCalendar::Calendar.new(bank_holidays: ['2020-01-01']) }
62
+ subject { cal.banking_day?(date) }
63
+
64
+ context 'when it is a banking day' do
65
+ let(:date) { date_class.parse('2020-01-02') }
66
+ it { is_expected.to be_truthy }
67
+ end
68
+
69
+ context 'when it is a non-banking day' do
70
+ let(:date) { date_class.parse('2020-01-04') }
71
+ it { is_expected.to be_falsey }
72
+ end
73
+
74
+ context 'when it is a holiday' do
75
+ let(:date) { date_class.parse('2020-01-01') }
76
+ it { is_expected.to be_falsey }
77
+ end
78
+ end
79
+
80
+ describe '#next_banking_day' do
81
+ let(:cal) { BankingCalendar::Calendar.new(bank_holidays: ['2020-01-01']) }
82
+ subject { cal.next_banking_day(date) }
83
+
84
+ context 'when it is a banking day' do
85
+ context 'followed by a banking day' do
86
+ let(:date) { date_class.parse('2020-01-07') }
87
+ it { is_expected.to eq(date + interval) }
88
+ end
89
+
90
+ context 'followed by a non-banking day' do
91
+ let(:date) { date_class.parse('2020-01-10') }
92
+ it { is_expected.to eq(date + 3 * interval) }
93
+ end
94
+ end
95
+
96
+ context 'when it is a non-banking day' do
97
+ context 'followed by a banking day' do
98
+ let(:date) { date_class.parse('2020-01-01') }
99
+ it { is_expected.to eq(date + interval) }
100
+ end
101
+
102
+ context 'followed by a non-banking day' do
103
+ let(:date) { date_class.parse('2020-01-11') }
104
+ it { is_expected.to eq(date + 2 * interval) }
105
+ end
106
+ end
107
+ end
108
+
109
+ describe '#previous_banking_day' do
110
+ let(:cal) { BankingCalendar::Calendar.new(bank_holidays: ['2020-01-01']) }
111
+ subject { cal.previous_banking_day(date) }
112
+
113
+ context 'when it is a banking day' do
114
+ context 'preceded by a banking day' do
115
+ let(:date) { date_class.parse('2020-01-07') }
116
+ it { is_expected.to eq(date - interval) }
117
+ end
118
+
119
+ context 'preceded by a non-banking day' do
120
+ let(:date) { date_class.parse('2020-01-06') }
121
+ it { is_expected.to eq(date - 3 * interval) }
122
+ end
123
+ end
124
+
125
+ context 'when it is a non-banking day' do
126
+ context 'preceded by a banking day' do
127
+ let(:date) { date_class.parse('2020-01-04') }
128
+ it { is_expected.to eq(date - interval) }
129
+ end
130
+
131
+ context 'followed by a non-banking day' do
132
+ let(:date) { date_class.parse('2020-01-05') }
133
+ it { is_expected.to eq(date - 2 * interval) }
134
+ end
135
+ end
136
+ end
137
+
138
+ describe '#banking_days_after' do
139
+ let(:cal) do
140
+ BankingCalendar::Calendar.new(bank_holidays: %w[2020-01-01 2020-01-08])
141
+ end
142
+ subject { cal.banking_days_after(date, delta) }
143
+
144
+ context 'when it is a banking day' do
145
+ context 'followed only by banking days' do
146
+ let(:date) { date_class.parse('2020-01-13') }
147
+ let(:delta) { 3 }
148
+ it { is_expected.to eq(date + delta * interval) }
149
+ end
150
+
151
+ context 'followed by a weekend' do
152
+ let(:date) { date_class.parse('2020-01-10') }
153
+ let(:delta) { 3 }
154
+ it { is_expected.to eq(date + (delta + 2) * interval) }
155
+ end
156
+
157
+ context 'followed by banking days and a holiday' do
158
+ let(:date) { date_class.parse('2020-01-06') }
159
+ let(:delta) { 3 }
160
+ it { is_expected.to eq(date + (delta + 1) * interval) }
161
+ end
162
+ end
163
+
164
+ context 'when it is a non-banking day' do
165
+ let(:date) { date_class.parse('2020-01-11') }
166
+ let(:delta) { 3 }
167
+ it { is_expected.to eq(date + (delta + 2) * interval) }
168
+ end
169
+ end
170
+
171
+ describe '#banking_days_before' do
172
+ let(:cal) do
173
+ BankingCalendar::Calendar.new(bank_holidays: %w[2020-01-01 2020-01-08])
174
+ end
175
+ subject { cal.banking_days_before(date, delta) }
176
+
177
+ context 'when it is a banking day' do
178
+ context 'preceded only by banking days' do
179
+ let(:date) { date_class.parse('2020-01-16') }
180
+ let(:delta) { 3 }
181
+ it { is_expected.to eq(date - delta * interval) }
182
+ end
183
+
184
+ context 'preceded by a weekend' do
185
+ let(:date) { date_class.parse('2020-01-20') }
186
+ let(:delta) { 3 }
187
+ it { is_expected.to eq(date - (delta + 2) * interval) }
188
+ end
189
+
190
+ context 'followed by banking days and a holiday' do
191
+ let(:date) { date_class.parse('2020-01-10') }
192
+ let(:delta) { 3 }
193
+ it { is_expected.to eq(date - (delta + 1) * interval) }
194
+ end
195
+ end
196
+
197
+ context 'when it is a non-banking day' do
198
+ let(:date) { date_class.parse('2020-01-19') }
199
+ let(:delta) { 3 }
200
+ it { is_expected.to eq(date - (delta + 2) * interval) }
201
+ end
202
+ end
203
+ end
204
+
205
+ context 'when using Date objects' do
206
+ let(:date_class) { Date }
207
+ let(:interval) { 1 }
208
+
209
+ it_behaves_like 'shared'
210
+ end
211
+
212
+ context 'when using Time objects' do
213
+ let(:date_class) { Time }
214
+ let(:interval) { 3_600 * 24 }
215
+
216
+ it_behaves_like 'shared'
217
+ end
218
+ end
@@ -0,0 +1,25 @@
1
+ banking_days:
2
+ - monday
3
+ - tuesday
4
+ - wednesday
5
+ - thursday
6
+ - friday
7
+
8
+ bank_holidays:
9
+ - 2020-01-25
10
+ - 2020-02-25
11
+ - 2020-04-09
12
+ - 2020-04-10
13
+ - 2020-04-11
14
+ - 2020-05-01
15
+ - 2020-06-12
16
+ - 2020-08-21
17
+ - 2020-08-31
18
+ - 2020-11-01
19
+ - 2020-11-02
20
+ - 2020-11-30
21
+ - 2020-12-08
22
+ - 2020-12-24
23
+ - 2020-12-25
24
+ - 2020-12-30
25
+ - 2020-12-31
@@ -0,0 +1,26 @@
1
+ working_days:
2
+ - monday
3
+ - tuesday
4
+ - wednesday
5
+ - thursday
6
+ - friday
7
+
8
+ bank_holidays:
9
+ - 2020-01-01
10
+ - 2020-01-25
11
+ - 2020-02-25
12
+ - 2020-04-09
13
+ - 2020-04-10
14
+ - 2020-04-11
15
+ - 2020-05-01
16
+ - 2020-06-12
17
+ - 2020-08-21
18
+ - 2020-08-31
19
+ - 2020-11-01
20
+ - 2020-11-02
21
+ - 2020-11-30
22
+ - 2020-12-08
23
+ - 2020-12-24
24
+ - 2020-12-25
25
+ - 2020-12-30
26
+ - 2020-12-31
@@ -0,0 +1,26 @@
1
+ banking_days:
2
+ - monday
3
+ - tuesday
4
+ - wednesday
5
+ - thursday
6
+ - friday
7
+
8
+ bank_holidays:
9
+ - 2020-01-01
10
+ - 2020-01-25
11
+ - 2020-02-25
12
+ - 2020-04-09
13
+ - 2020-04-10
14
+ - 2020-04-11
15
+ - 2020-05-01
16
+ - 2020-06-12
17
+ - 2020-08-21
18
+ - 2020-08-31
19
+ - 2020-11-01
20
+ - 2020-11-02
21
+ - 2020-11-30
22
+ - 2020-12-08
23
+ - 2020-12-24
24
+ - 2020-12-25
25
+ - 2020-12-30
26
+ - 2020-12-31
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: banking_calendar
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - PayMongo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-05-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.1'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec_junit_formatter
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.4.1
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.4.1
41
+ description: Calculate dates based on the banking calendar.
42
+ email: support@paymongo.com
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - ".circleci/config.yml"
48
+ - ".gitignore"
49
+ - CHANGELOG.md
50
+ - Gemfile
51
+ - LICENSE
52
+ - README.md
53
+ - banking_calendar.gemspec
54
+ - lib/banking_calendar.rb
55
+ - lib/banking_calendar/calendar.rb
56
+ - lib/banking_calendar/data/bsp.yml
57
+ - lib/banking_calendar/version.rb
58
+ - spec/calendar_spec.rb
59
+ - spec/fixtures/calendars/bsp.yml
60
+ - spec/fixtures/calendars/invalid_calendar.yml
61
+ - spec/fixtures/calendars/valid_calendar.yml
62
+ homepage: https://github.com/paymongo/banking_calendar
63
+ licenses:
64
+ - MIT
65
+ metadata: {}
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 2.5.0
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubygems_version: 3.0.6
82
+ signing_key:
83
+ specification_version: 4
84
+ summary: Calculate dates based on the banking calendar
85
+ test_files:
86
+ - spec/calendar_spec.rb
87
+ - spec/fixtures/calendars/bsp.yml
88
+ - spec/fixtures/calendars/invalid_calendar.yml
89
+ - spec/fixtures/calendars/valid_calendar.yml