verified_holidays 0.3.2 → 0.3.4
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 +4 -4
- data/CHANGELOG.md +24 -0
- data/README.md +10 -5
- data/lib/verified_holidays/cabinet_office.rb +17 -6
- data/lib/verified_holidays/holiday.rb +5 -0
- data/lib/verified_holidays/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d186fe8ed73808973f6b26f39f6df46e13c6698a313cb0ce553ff75aa904c326
|
|
4
|
+
data.tar.gz: b10b97ba039418b44da7a060bc9e87f308d0c509406f7468ca5edc5eff908f7a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a6d51fdfb12c95c010759c5ff232375d30c43989436b6e2c3ed1a9525f7628db4a2444c664fcae8edae1f41876d9cea9fbf834a7eb413205b45d4112d528f741
|
|
7
|
+
data.tar.gz: 3cdd6197eba3529b28a9abd65949be30368eb928bad0413fccfad569bf101bfb2c647bfcc688cd60f7d16fec62d457b29e5cab10b605c4547a04ea3b349031b2
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.4](https://github.com/verified-holidays/verified_holidays/compare/verified_holidays/v0.3.3...verified_holidays/v0.3.4) (2026-08-22)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous
|
|
7
|
+
|
|
8
|
+
* drop support for Ruby 3.1 ([#37](https://github.com/verified-holidays/verified_holidays/issues/37)) ([4ee7b8e](https://github.com/verified-holidays/verified_holidays/commit/4ee7b8e45afeb0a6f66306b5044097605e7fc8a5))
|
|
9
|
+
* replace deprecated SimpleCov.add_filter with skip ([#36](https://github.com/verified-holidays/verified_holidays/issues/36)) ([51e2234](https://github.com/verified-holidays/verified_holidays/commit/51e223446e74b6290393f0022bab7b55edb9286d))
|
|
10
|
+
|
|
11
|
+
## [0.3.3](https://github.com/verified-holidays/verified_holidays/compare/verified_holidays/v0.3.2...verified_holidays/v0.3.3) (2026-08-22)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* add English names for holidays present in the dataset ([#32](https://github.com/verified-holidays/verified_holidays/issues/32)) ([1f92812](https://github.com/verified-holidays/verified_holidays/commit/1f92812aea09b9f27d6034556f0576997bdac1db))
|
|
17
|
+
* raise FetchError on a non-success Cabinet Office response ([#28](https://github.com/verified-holidays/verified_holidays/issues/28)) ([6d55172](https://github.com/verified-holidays/verified_holidays/commit/6d55172f5eac707e54f5039cf2fbed3ea224af08))
|
|
18
|
+
* reject a Cabinet Office response that holds no holidays ([#30](https://github.com/verified-holidays/verified_holidays/issues/30)) ([9040ff5](https://github.com/verified-holidays/verified_holidays/commit/9040ff5f089dcecfdad827f480cac5950663fc99))
|
|
19
|
+
* use YAML.dump when writing holidays.yml ([#31](https://github.com/verified-holidays/verified_holidays/issues/31)) ([be2879b](https://github.com/verified-holidays/verified_holidays/commit/be2879b143408af0764057c1e83343f6e9235a9c))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Miscellaneous
|
|
23
|
+
|
|
24
|
+
* label docs/ branches from the branch prefix ([#33](https://github.com/verified-holidays/verified_holidays/issues/33)) ([b6867f6](https://github.com/verified-holidays/verified_holidays/commit/b6867f6febe29cfc06d423a4b94a948287437c2e))
|
|
25
|
+
* point the tests label at test/ instead of spec/ ([#35](https://github.com/verified-holidays/verified_holidays/issues/35)) ([f86d05b](https://github.com/verified-holidays/verified_holidays/commit/f86d05b29643c5bdb191aef8b17c72a1874b6f39))
|
|
26
|
+
|
|
3
27
|
## [0.3.2](https://github.com/verified-holidays/verified_holidays/compare/verified_holidays/v0.3.1...verified_holidays/v0.3.2) (2026-08-22)
|
|
4
28
|
|
|
5
29
|
|
data/README.md
CHANGED
|
@@ -54,11 +54,11 @@ VerifiedHolidays.year(2026)
|
|
|
54
54
|
|
|
55
55
|
```ruby
|
|
56
56
|
holiday = VerifiedHolidays.between(Date.new(2026, 1, 1), Date.new(2026, 1, 1)).first
|
|
57
|
-
holiday.date
|
|
58
|
-
holiday.name
|
|
59
|
-
holiday.name_en
|
|
60
|
-
holiday.wday_name # => "
|
|
61
|
-
holiday.week
|
|
57
|
+
holiday.date # => #<Date: 2026-01-01>
|
|
58
|
+
holiday.name # => "元日"
|
|
59
|
+
holiday.name_en # => "New Year's Day"
|
|
60
|
+
holiday.wday_name # => "木"
|
|
61
|
+
holiday.week # => "木" (alias for wday_name)
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
## Compatibility with holiday_jp
|
|
@@ -85,6 +85,11 @@ result.extra # => entries in Cabinet Office CSV but not in local data
|
|
|
85
85
|
result.mismatched # => entries with different names
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
+
If the Cabinet Office responds with anything other than success — an outage, a
|
|
89
|
+
moved file, a redirect — or answers with something that holds no holidays at
|
|
90
|
+
all, `verify!` raises `VerifiedHolidays::CabinetOffice::FetchError` rather than
|
|
91
|
+
reporting the data as mismatched.
|
|
92
|
+
|
|
88
93
|
Or via Rake:
|
|
89
94
|
|
|
90
95
|
```sh
|
|
@@ -9,19 +9,30 @@ module VerifiedHolidays
|
|
|
9
9
|
class CabinetOffice
|
|
10
10
|
CSV_URL = 'https://www8.cao.go.jp/chosei/shukujitsu/syukujitsu.csv'
|
|
11
11
|
|
|
12
|
+
# Raised when the Cabinet Office CSV cannot be retrieved.
|
|
13
|
+
class FetchError < StandardError; end
|
|
14
|
+
|
|
12
15
|
def self.fetch
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
holidays = parse(download_csv)
|
|
17
|
+
raise FetchError, "#{CSV_URL} returned no holidays" if holidays.empty?
|
|
18
|
+
|
|
19
|
+
holidays
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.download_csv
|
|
23
|
+
response = Net::HTTP.get_response(URI.parse(CSV_URL))
|
|
24
|
+
unless response.is_a?(Net::HTTPSuccess)
|
|
25
|
+
raise FetchError, "Failed to fetch #{CSV_URL}: HTTP #{response.code} #{response.message}"
|
|
26
|
+
end
|
|
15
27
|
|
|
16
28
|
# Remove UTF-8 BOM bytes if present (before encoding conversion)
|
|
17
|
-
raw = response.b
|
|
29
|
+
raw = response.body.b
|
|
18
30
|
raw = raw.byteslice(3..) if raw.byteslice(0, 3) == "\xEF\xBB\xBF".b
|
|
19
31
|
|
|
20
32
|
# Convert from CP932 (Shift_JIS) to UTF-8
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
parse(utf8)
|
|
33
|
+
raw.force_encoding('CP932').encode('UTF-8')
|
|
24
34
|
end
|
|
35
|
+
private_class_method :download_csv
|
|
25
36
|
|
|
26
37
|
def self.presence(str)
|
|
27
38
|
str&.strip&.then { |s| s unless s.empty? }
|
|
@@ -23,12 +23,17 @@ module VerifiedHolidays
|
|
|
23
23
|
'勤労感謝の日' => 'Labor Thanksgiving Day',
|
|
24
24
|
'振替休日' => 'Substitute Holiday',
|
|
25
25
|
'休日' => "Citizens' Holiday",
|
|
26
|
+
'休日(祝日扱い)' => 'Public Holiday',
|
|
26
27
|
'体育の日' => 'Health and Sports Day',
|
|
28
|
+
'体育の日(スポーツの日)' => 'Health and Sports Day (Sports Day)',
|
|
27
29
|
'国民の休日' => "Citizens' Holiday",
|
|
30
|
+
'即位礼正殿の儀' => 'Enthronement Ceremony',
|
|
28
31
|
'即位礼正殿の儀の行われる日' => 'Enthronement Ceremony',
|
|
29
32
|
'即位の日' => 'Enthronement Day',
|
|
30
33
|
'天皇の即位の日及び即位礼正殿の儀の行われる日を休日とする法律' => 'Holiday by Law',
|
|
31
34
|
'みどりの日(国民の休日)' => "Greenery Day (Citizens' Holiday)",
|
|
35
|
+
'結婚の儀' => 'Imperial Wedding Ceremony',
|
|
36
|
+
'大喪の礼' => 'Imperial Funeral Ceremony',
|
|
32
37
|
}.freeze
|
|
33
38
|
|
|
34
39
|
attr_reader :date, :name
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: verified_holidays
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kenta Ishizaki
|
|
@@ -58,7 +58,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
58
58
|
requirements:
|
|
59
59
|
- - ">="
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '3.
|
|
61
|
+
version: '3.2'
|
|
62
62
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
63
|
requirements:
|
|
64
64
|
- - ">="
|