enrico 0.2.3 → 0.3.0

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
  SHA256:
3
- metadata.gz: 6aebe18d370cc0a185a2269a784488b142ebdaccb01be9d52b33e631acc83fef
4
- data.tar.gz: 3d320aeb1e28880d0ea0cc14ac316c1a2e50725e85af6d7f18111220a9b2739d
3
+ metadata.gz: b43bd20597a093f0054b22b3bb831b73fb3d60c95c6e50aace79d211ed21d595
4
+ data.tar.gz: ae54ff2170ca8d6ecc0ad3f3b5194e01ddfe59dff6be352274a59db1e835802f
5
5
  SHA512:
6
- metadata.gz: a444c959dc465dd321a43cc6d54a12a618523ba1ba290a07bb5ed800f86ad6bbe3e4afbf9dcefd0e3b0d3d74b4435c2d1387541503a28428d5676dddde339a00
7
- data.tar.gz: '0598d08ef9957773f62abb4c2cddd4fc017350f827370e11e86d781f6d2a622d8bf8112dabd00c35148849b16287d50555ac8d1ac2c19f6172fcdc99e35c50a4'
6
+ metadata.gz: 967040ecc9f0331727bc0208d584f6f64659604ef9f36af476e16909a630897164765b22a3d81ab770cc96cc8ee0a4435055e106c689336f7dc1a24f94efc296
7
+ data.tar.gz: 4678368306133896e90c3c9672bcb2bca0980c57a7e4e538a466235d4570219163fc6e2b7391411524dd469eb9c648cb08c15467b1128cbfcd79a810db6c1609
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.3.0
data/enrico.gemspec CHANGED
@@ -1,11 +1,11 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "enrico".freeze
3
- s.version = "0.2.3"
3
+ s.version = "0.3.0"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
6
6
  s.require_paths = ["lib".freeze]
7
7
  s.authors = ["Kalle Saas".freeze, "Martin Gregoire".freeze]
8
- s.date = "2026-01-06"
8
+ s.date = "2026-03-05"
9
9
  s.description = "https://github.com/easyPEP/enrico".freeze
10
10
  s.email = "kalle@easypep.de".freeze
11
11
  s.extra_rdoc_files = [
@@ -22,18 +22,18 @@ module Enrico
22
22
  self.class.all.select{|country| country["countryCode"] == self.country_code }.first
23
23
  end
24
24
 
25
- def holidays_for_month(date)
26
- response = self.get_holidays_for_month(date)
25
+ def holidays_for_month(date, holiday_type: nil)
26
+ response = self.get_holidays_for_month(date, holiday_type:)
27
27
  self.vacation_days_from_response(response)
28
28
  end
29
29
 
30
- def holidays_for_year(date)
31
- response = self.get_holidays_for_year(date)
30
+ def holidays_for_year(date, holiday_type: nil)
31
+ response = self.get_holidays_for_year(date, holiday_type:)
32
32
  self.vacation_days_from_response(response)
33
33
  end
34
34
 
35
- def holidays_for_date_range(from_date, to_date)
36
- response = self.get_holidays_for_date_range(from_date, to_date)
35
+ def holidays_for_date_range(from_date, to_date, holiday_type: nil)
36
+ response = self.get_holidays_for_date_range(from_date, to_date, holiday_type:)
37
37
  self.vacation_days_from_response(response)
38
38
  end
39
39
 
@@ -22,6 +22,22 @@ describe Enrico::Country do
22
22
  _(dates.first.local_name).must_equal "Neujahrstag"
23
23
  _(dates.first.english_name).must_equal "New Year's Day"
24
24
  end
25
+
26
+ it "forwards holiday_type to get_holidays_for_month" do
27
+ date = Date.parse('2020-01-15')
28
+ captured_holiday_type = nil
29
+
30
+ country.define_singleton_method(:get_holidays_for_month) do |d, holiday_type: nil|
31
+ captured_holiday_type = holiday_type
32
+ []
33
+ end
34
+
35
+ country.stub(:vacation_days_from_response, []) do
36
+ country.holidays_for_month(date, holiday_type: "public_holiday")
37
+ end
38
+
39
+ _(captured_holiday_type).must_equal "public_holiday"
40
+ end
25
41
  end
26
42
 
27
43
  describe "GET getHolidaysForYear" do
@@ -44,6 +60,22 @@ describe Enrico::Country do
44
60
  _(dates.last.local_name).must_equal "Zweiter Weihnachtsfeiertag"
45
61
  _(dates.last.english_name).must_equal "Boxing Day"
46
62
  end
63
+
64
+ it "forwards holiday_type to get_holidays_for_year" do
65
+ date = Date.parse('2020-06-01')
66
+ captured_holiday_type = nil
67
+
68
+ country.define_singleton_method(:get_holidays_for_year) do |d, holiday_type: nil|
69
+ captured_holiday_type = holiday_type
70
+ []
71
+ end
72
+
73
+ country.stub(:vacation_days_from_response, []) do
74
+ country.holidays_for_year(date, holiday_type: "public_holiday")
75
+ end
76
+
77
+ _(captured_holiday_type).must_equal "public_holiday"
78
+ end
47
79
  end
48
80
 
49
81
  describe "GET getForDateRange" do
@@ -66,6 +98,23 @@ describe Enrico::Country do
66
98
  _(dates.last.local_name).must_equal "Beginn der Sommerzeit"
67
99
  _(dates.last.english_name).must_equal "Daylight Saving Time Starts"
68
100
  end
101
+
102
+ it "forwards holiday_type to get_holidays_for_date_range" do
103
+ from_date = Date.parse('2020-01-01')
104
+ to_date = Date.parse('2020-03-31')
105
+ captured_holiday_type = nil
106
+
107
+ country.define_singleton_method(:get_holidays_for_date_range) do |fd, td, holiday_type: nil|
108
+ captured_holiday_type = holiday_type
109
+ []
110
+ end
111
+
112
+ country.stub(:vacation_days_from_response, []) do
113
+ country.holidays_for_date_range(from_date, to_date, holiday_type: "public_holiday")
114
+ end
115
+
116
+ _(captured_holiday_type).must_equal "public_holiday"
117
+ end
69
118
  end
70
119
 
71
120
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enrico
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kalle Saas
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2026-01-06 00:00:00.000000000 Z
12
+ date: 2026-03-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty