business_calendar 1.1.0 → 2.0.0

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
  SHA256:
3
- metadata.gz: 216930bd93cbe52079f053f6bb5f67cfb3efbaa0478bb4474a98e1b4912023b7
4
- data.tar.gz: 1b0242038fdbfd28978c7e9551b3f225ad43413bd7b19d19f9e9fe59c409e6e5
3
+ metadata.gz: 565c792e03739cdb3e5f506afba3f18c45098b204dda20051978333bcb5a5acc
4
+ data.tar.gz: 39de2f975e53ab66e32408c7591ec620b7596784277eebf1994c7231ecdd27af
5
5
  SHA512:
6
- metadata.gz: 4744b858e9faa599b605c0912337dff1480ac092644d9b3b3a9666c4657daaa8e98b5e905529246ac8580c793786f8334cdaf2023d62e8a07e2dd094ab124daf
7
- data.tar.gz: ef328442115bcbb191992c2279d99accb5a1bd39e3cadc753404a15504549e8943889f0cd6739ad4c265a5465aacb0ee4b5e6127544fe68e688a586466f9b864
6
+ metadata.gz: 6a671409be0e036f24dd0d15a8125702b37c0218387026a2a609cd1c22a6a8b25523dd4a78a16b2b5dfb688230fe2286bbf3f9f273cbdf26f0bca3a74b3b3d30
7
+ data.tar.gz: 59d51361f35e15405f208288c9865e1d602fdb4baef607a509e191273c5ba1f38600a6d70a80e76104dc944cdab8539b25c33c8881a811dde5d11aec8a91d00e
@@ -0,0 +1,30 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ continue-on-error: ${{ matrix.experimental }}
13
+ strategy:
14
+ matrix:
15
+ ruby-version: [2.3.1, 2.7.0]
16
+ experimental: [false]
17
+ include:
18
+ - ruby-version: head
19
+ experimental: true
20
+
21
+ steps:
22
+ - uses: actions/checkout@v2
23
+ - name: Set up Ruby ${{ matrix.ruby-version }}
24
+ uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: ${{ matrix.ruby-version }}
27
+ - name: Install dependencies
28
+ run: bundle install
29
+ - name: Run tests
30
+ run: bundle exec rspec
@@ -0,0 +1,29 @@
1
+ name: Ruby Gem
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - '*'
7
+
8
+ jobs:
9
+ build:
10
+ name: Build + Publish
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Set up Ruby 2.7
16
+ uses: actions/setup-ruby@v1
17
+ with:
18
+ ruby-version: 2.7
19
+
20
+ - name: Publish to RubyGems
21
+ run: |
22
+ mkdir -p $HOME/.gem
23
+ touch $HOME/.gem/credentials
24
+ chmod 0600 $HOME/.gem/credentials
25
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
26
+ gem build *.gemspec
27
+ gem push *.gem
28
+ env:
29
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
@@ -1,5 +1,10 @@
1
1
  # business_calendar changes by version
2
2
 
3
+ 2.0.0
4
+ ---------
5
+
6
+ - Remove UK weekend holidays, replace with the actual observed holiday dates [#26]
7
+
3
8
  1.1.0
4
9
  ---------
5
10
 
data/Gemfile CHANGED
@@ -1,6 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'coveralls'
4
-
5
3
  # Specify your gem's dependencies in business_calendar.gemspec
6
4
  gemspec
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # BusinessCalendar
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/business_calendar.svg)](https://rubygems.org/gems/business_calendar)
4
- [![Build Status](https://travis-ci.org/enova/business_calendar.svg)](https://travis-ci.org/enova/business_calendar)
5
- [![Coverage Status](https://coveralls.io/repos/github/enova/business_calendar/badge.svg?branch=master)](https://coveralls.io/github/enova/business_calendar?branch=master)
6
4
  [![Dependency Status](https://gemnasium.com/enova/business_calendar.svg)](https://gemnasium.com/enova/business_calendar)
7
5
 
8
6
  Need to know what days you can actually debit a customer on in excruciating detail? Fed up with singleton-based gems
@@ -32,7 +30,7 @@ Instantiate a calendar object with:
32
30
  bc = BusinessCalendar.for(:US)
33
31
  ```
34
32
 
35
- This will automatically load holidays based on the US banking holiday schedule, as configured in `data/holidays.yml`.
33
+ This will automatically load holidays based on the US banking holiday schedule, as configured in `data/US.yml`.
36
34
  Currently, this gem supports `:GB` and `:US` regions.
37
35
 
38
36
  Now, you can use it:
@@ -18,15 +18,11 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
-
22
21
  spec.add_dependency "holidays", "~> 1.0"
23
22
  spec.add_dependency "faraday"
24
- spec.add_dependency "faraday-conductivity"
25
23
 
26
- spec.add_development_dependency "bundler", "~> 1.3"
27
24
  spec.add_development_dependency "rake"
28
25
  spec.add_development_dependency "rspec", "~> 3.2"
29
26
  spec.add_development_dependency "webmock"
30
- spec.add_development_dependency "simplecov"
31
27
  spec.add_development_dependency "pry"
32
28
  end
@@ -26,12 +26,12 @@ GB:
26
26
  - '2015-12-26'
27
27
  - '2016-12-25'
28
28
  - '2017-01-01'
29
- - '2020-12-26'
30
- - '2021-12-25'
31
- - '2021-12-26'
32
- - '2022-01-01'
33
- - '2022-12-25'
34
- - '2023-01-01'
29
+ - '2020-12-28'
30
+ - '2021-12-27'
31
+ - '2021-12-28'
32
+ - '2022-01-03'
33
+ - '2022-12-27'
34
+ - '2023-01-02'
35
35
  removals:
36
36
  - '2002-05-28'
37
37
  - '2007-04-08'
@@ -44,9 +44,9 @@ GB:
44
44
  - '2013-03-31'
45
45
  - '2014-04-20'
46
46
  - '2015-12-28'
47
- - '2020-12-28'
48
- - '2021-12-27'
49
- - '2021-12-28'
50
- - '2022-01-03'
51
- - '2022-12-27'
52
- - '2023-01-02'
47
+ - '2020-12-26'
48
+ - '2021-12-25'
49
+ - '2021-12-26'
50
+ - '2022-01-01'
51
+ - '2022-12-25'
52
+ - '2023-01-01'
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'json', '< 2.3.0'
4
+
5
+ # Specify your gem's dependencies in business_calendar.gemspec
6
+ gemspec :path => '../'
@@ -1,5 +1,4 @@
1
1
  require 'faraday'
2
- require 'faraday/conductivity'
3
2
 
4
3
  module BusinessCalendar
5
4
  CountryNotSupported = Class.new(StandardError)
@@ -51,7 +50,7 @@ module BusinessCalendar
51
50
 
52
51
  def holiday_determiner_for_endpoint(additions_endpoint, removals_endpoint, opts)
53
52
  client = Faraday.new do |conn|
54
- conn.response :selective_errors
53
+ conn.response :raise_error
55
54
  conn.adapter :net_http
56
55
  end
57
56
 
@@ -1,3 +1,3 @@
1
1
  module BusinessCalendar
2
- VERSION = "1.1.0"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -20,12 +20,12 @@ describe "GB bank holidays" do
20
20
  2015-12-26
21
21
  2016-12-25
22
22
  2017-01-01
23
- 2020-12-26
24
- 2021-12-25
25
- 2021-12-26
26
- 2022-01-01
27
- 2022-12-25
28
- 2023-01-01
23
+ 2020-12-28
24
+ 2021-12-27
25
+ 2021-12-28
26
+ 2022-01-03
27
+ 2022-12-27
28
+ 2023-01-02
29
29
  ).map { |x| Date.parse x }.each do |expected_holiday|
30
30
  it "treats #{expected_holiday} as a holiday" do
31
31
  expect(BusinessCalendar.for(:GB).is_holiday?(expected_holiday)).to be true
@@ -35,12 +35,12 @@ describe "GB bank holidays" do
35
35
  %w(
36
36
  2012-05-28
37
37
  2015-12-28
38
- 2020-12-28
39
- 2021-12-27
40
- 2021-12-28
41
- 2022-01-03
42
- 2022-12-27
43
- 2023-01-02
38
+ 2020-12-26
39
+ 2021-12-25
40
+ 2021-12-26
41
+ 2022-01-01
42
+ 2022-12-25
43
+ 2023-01-01
44
44
  ).map { |x| Date.parse x }.each do |date|
45
45
  it "treats #{date} as not a holiday" do
46
46
  expect(BusinessCalendar.for(:GB).is_holiday?(date)).to be false
@@ -366,7 +366,7 @@ describe BusinessCalendar do
366
366
  before { stub_request(:get, additions).to_return(:status => 500) }
367
367
 
368
368
  it 'raises an error' do
369
- expect { subject.is_business_day?('2014-07-04'.to_date) }.to raise_error Faraday::ClientError
369
+ expect { subject.is_business_day?('2014-07-04'.to_date) }.to raise_error Faraday::Error
370
370
  end
371
371
  end
372
372
 
@@ -1,8 +1,6 @@
1
1
  require 'bundler/setup'
2
2
  Bundler.setup
3
3
 
4
- require 'simplecov'
5
-
6
4
  require 'business_calendar'
7
5
  require 'date'
8
6
  require 'webmock/rspec'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: business_calendar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Nubel
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-25 00:00:00.000000000 Z
11
+ date: 2020-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: holidays
@@ -38,34 +38,6 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: faraday-conductivity
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: bundler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '1.3'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '1.3'
69
41
  - !ruby/object:Gem::Dependency
70
42
  name: rake
71
43
  requirement: !ruby/object:Gem::Requirement
@@ -108,20 +80,6 @@ dependencies:
108
80
  - - ">="
109
81
  - !ruby/object:Gem::Version
110
82
  version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: simplecov
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
83
  - !ruby/object:Gem::Dependency
126
84
  name: pry
127
85
  requirement: !ruby/object:Gem::Requirement
@@ -144,10 +102,10 @@ executables: []
144
102
  extensions: []
145
103
  extra_rdoc_files: []
146
104
  files:
105
+ - ".github/workflows/ci.yml"
106
+ - ".github/workflows/gem-push.yml"
147
107
  - ".gitignore"
148
108
  - ".rspec"
149
- - ".simplecov"
150
- - ".travis.yml"
151
109
  - CHANGELOG.md
152
110
  - Gemfile
153
111
  - LICENSE.txt
@@ -160,6 +118,7 @@ files:
160
118
  - data/US.yml
161
119
  - data/org/captalys.yml
162
120
  - gemfiles/ree.gemfile
121
+ - gemfiles/ruby_1.9.3.gemfile
163
122
  - lib/business_calendar.rb
164
123
  - lib/business_calendar/calendar.rb
165
124
  - lib/business_calendar/holiday_determiner.rb
@@ -177,7 +136,7 @@ homepage: ''
177
136
  licenses:
178
137
  - MIT
179
138
  metadata: {}
180
- post_install_message:
139
+ post_install_message:
181
140
  rdoc_options: []
182
141
  require_paths:
183
142
  - lib
@@ -192,8 +151,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
151
  - !ruby/object:Gem::Version
193
152
  version: '0'
194
153
  requirements: []
195
- rubygems_version: 3.0.3
196
- signing_key:
154
+ rubygems_version: 3.1.2
155
+ signing_key:
197
156
  specification_version: 4
198
157
  summary: Country-aware business-date logic and handling.
199
158
  test_files:
data/.simplecov DELETED
@@ -1,8 +0,0 @@
1
- unless RUBY_VERSION == "1.8.7"
2
- require 'coveralls'
3
-
4
- Coveralls.wear! do
5
- add_filter "version.rb"
6
- add_filter "spec/"
7
- end
8
- end
@@ -1,25 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- cache: bundler
4
-
5
- matrix:
6
- include:
7
- - rmv: ree
8
- gemfile: gemfiles/ree.gemfile
9
- script: bundle exec rspec
10
- - rvm: 1.9.3
11
- script: bundle exec rspec
12
- - rvm: 2.3.1
13
- script: bundle exec rspec
14
-
15
- env:
16
- global:
17
- secure: klQ3BQNdKkGIq3Zfv8Sr6oZqaMg9GHx+LGhynQ5xt7A6SGvxbMuoXJlE9wW4me6u+B9S2D+q+pdKgGPE/+fHsVt/d0zDXRnrjVyo1eexT220AMfpjiFDAtya8sAcuuAICLhw8AmzTjns8yAWInv5U5vC6oejkLA71FXtHU//210=
18
-
19
- deploy:
20
- provider: rubygems
21
- api_key:
22
- secure: "c9QcNX+nk0Yzl22ZVknZtv+/G4fUeLph0TH9PS6hQ92zywM61wtXTJExZdBHulvKAaQbKaq20LcFjLw41qwJc6tvIEYXpOinfOaiemTKaGmKscDrIi3wUAxfjmTacXZAaTdEORQVqTOmppqsuKnP7cqmSNxTSI901Sz5Cy6Jpl0="
23
- on:
24
- tags: true
25
- repo: enova/business_calendar