enrico 0.2.1 → 0.2.2

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: e0b4284f18313432a7dee8a1e136124640ec57c209b6a561a587c3ea3d06040f
4
- data.tar.gz: 41e49cd778f06f64c40da5def29fa3bff9b3b4e6639484d907d22566d3630de2
3
+ metadata.gz: 6020686fdee607a43b3b047fca7ee6c155f19d04f0e1db8c17d9fa44ef0ca7d1
4
+ data.tar.gz: f389071f475e29281fe11ccdd41951392a2e3dbe09041058afa6713cc17d404b
5
5
  SHA512:
6
- metadata.gz: db42d425e79f2eb8994bb61599b010aa86e94cea6d901a0e65c93a2ccf5476043d25398b61e8035114dc04317bc8bed71964d9a0db82a27f8ba7f122f3b8c47b
7
- data.tar.gz: 7a601e5ae90395d6a1174fd8423fc1fe643c6ee46fedc5b290cb9de0dbcb4aaceef83361f2b7caea902c633d5e74aab12ed1e2d3f98258f8a06e9ecc54975a78
6
+ metadata.gz: c7935fae6ee4ddde3fa913d6d6b4dfeff248eb90e13ce81c44c8854b130ec1149722b998350725eae60184510bad6dbb170416ca0e39f586645e3817143d5b50
7
+ data.tar.gz: ad99a9f40c561b8cf9f9de63879ad83d450e04d391eaa04773d05c583169b11d3577a0ca6d2b9b6d70feb708d59ff98251eb5328e2df3c2ad56e06b272cbb3ae
@@ -15,7 +15,7 @@ jobs:
15
15
  - name: Setup Ruby
16
16
  uses: ruby/setup-ruby@v1
17
17
  with:
18
- ruby-version: 2.6.10
18
+ ruby-version: 3.2.8
19
19
  bundler-cache: true
20
20
  - name: Run tests
21
21
  run: bundle exec rake test
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.10
1
+ 3.2.8
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
- ruby '2.6.10'
3
+ ruby '3.2.8'
4
4
 
5
5
  # Add dependencies required to use your gem here.
6
6
  # Example:
@@ -12,16 +12,14 @@ gem 'httparty', '~> 0.21.0'
12
12
 
13
13
  group :development do
14
14
  gem "bundler"
15
- gem "jeweler"
16
15
  gem "simplecov"
17
16
  gem "rdoc"
18
17
  gem "shoulda"
19
- gem "minitest"
18
+ gem "minitest", "~> 5.0"
20
19
  end
21
20
 
22
21
  group :test do
23
22
  gem 'webmock'
24
23
  gem 'vcr'
25
- gem 'turn'
26
24
  gem 'rake'
27
25
  end
data/Gemfile.lock CHANGED
@@ -1,114 +1,94 @@
1
1
  GEM
2
- remote: http://rubygems.org/
2
+ remote: https://rubygems.org/
3
3
  specs:
4
- activesupport (5.2.4.3)
5
- concurrent-ruby (~> 1.0, >= 1.0.2)
6
- i18n (>= 0.7, < 2)
7
- minitest (~> 5.1)
8
- tzinfo (~> 1.1)
9
- addressable (2.7.0)
10
- public_suffix (>= 2.0.2, < 5.0)
11
- ansi (1.5.0)
12
- builder (3.2.4)
13
- concurrent-ruby (1.1.7)
14
- crack (0.4.3)
15
- safe_yaml (~> 1.0.0)
16
- descendants_tracker (0.0.4)
17
- thread_safe (~> 0.3, >= 0.3.1)
18
- docile (1.3.2)
19
- faraday (0.9.2)
20
- multipart-post (>= 1.2, < 3)
21
- git (1.7.0)
22
- rchardet (~> 1.8)
23
- github_api (0.11.3)
24
- addressable (~> 2.3)
25
- descendants_tracker (~> 0.0.1)
26
- faraday (~> 0.8, < 0.10)
27
- hashie (>= 1.2)
28
- multi_json (>= 1.7.5, < 2.0)
29
- nokogiri (~> 1.6.0)
30
- oauth2
31
- hashdiff (1.0.1)
32
- hashie (4.1.0)
33
- highline (2.0.3)
4
+ activesupport (8.0.2)
5
+ base64
6
+ benchmark (>= 0.3)
7
+ bigdecimal
8
+ concurrent-ruby (~> 1.0, >= 1.3.1)
9
+ connection_pool (>= 2.2.5)
10
+ drb
11
+ i18n (>= 1.6, < 2)
12
+ logger (>= 1.4.2)
13
+ minitest (>= 5.1)
14
+ securerandom (>= 0.3)
15
+ tzinfo (~> 2.0, >= 2.0.5)
16
+ uri (>= 0.13.1)
17
+ addressable (2.8.7)
18
+ public_suffix (>= 2.0.2, < 7.0)
19
+ base64 (0.3.0)
20
+ benchmark (0.4.1)
21
+ bigdecimal (3.2.2)
22
+ concurrent-ruby (1.3.5)
23
+ connection_pool (2.5.3)
24
+ crack (1.0.0)
25
+ bigdecimal
26
+ rexml
27
+ date (3.4.1)
28
+ docile (1.4.1)
29
+ drb (2.2.3)
30
+ erb (5.0.2)
31
+ hashdiff (1.2.0)
34
32
  httparty (0.21.0)
35
33
  mini_mime (>= 1.0.0)
36
34
  multi_xml (>= 0.5.2)
37
- i18n (1.8.5)
35
+ i18n (1.14.7)
38
36
  concurrent-ruby (~> 1.0)
39
- jeweler (2.3.5)
40
- builder
41
- bundler (>= 1.0)
42
- git (>= 1.2.5)
43
- github_api (~> 0.11.0)
44
- highline (>= 1.6.15)
45
- nokogiri (>= 1.5.10)
46
- psych (~> 2.2)
47
- rake
48
- rdoc
49
- semver2
50
- jwt (2.2.2)
37
+ logger (1.7.0)
51
38
  mini_mime (1.1.5)
52
- mini_portile2 (2.1.0)
53
- minitest (5.14.1)
54
- multi_json (1.15.0)
55
- multi_xml (0.6.0)
56
- multipart-post (2.1.1)
57
- nokogiri (1.6.8.1)
58
- mini_portile2 (~> 2.1.0)
59
- oauth2 (1.4.4)
60
- faraday (>= 0.8, < 2.0)
61
- jwt (>= 1.0, < 3.0)
62
- multi_json (~> 1.3)
63
- multi_xml (~> 0.5)
64
- rack (>= 1.2, < 3)
65
- psych (2.2.4)
66
- public_suffix (4.0.5)
67
- rack (2.2.3)
68
- rake (13.0.1)
69
- rchardet (1.8.0)
70
- rdoc (6.2.1)
71
- safe_yaml (1.0.5)
72
- semver2 (3.4.2)
39
+ minitest (5.25.5)
40
+ multi_xml (0.7.2)
41
+ bigdecimal (~> 3.1)
42
+ psych (5.2.6)
43
+ date
44
+ stringio
45
+ public_suffix (6.0.2)
46
+ rake (13.3.0)
47
+ rdoc (6.14.2)
48
+ erb
49
+ psych (>= 4.0.0)
50
+ rexml (3.4.1)
51
+ securerandom (0.4.1)
73
52
  shoulda (4.0.0)
74
53
  shoulda-context (~> 2.0)
75
54
  shoulda-matchers (~> 4.0)
76
55
  shoulda-context (2.0.0)
77
- shoulda-matchers (4.4.0)
56
+ shoulda-matchers (4.5.1)
78
57
  activesupport (>= 4.2.0)
79
- simplecov (0.18.5)
58
+ simplecov (0.22.0)
80
59
  docile (~> 1.1)
81
60
  simplecov-html (~> 0.11)
82
- simplecov-html (0.12.2)
83
- thread_safe (0.3.6)
84
- turn (0.9.6)
85
- ansi
86
- tzinfo (1.2.7)
87
- thread_safe (~> 0.1)
88
- vcr (6.0.0)
89
- webmock (3.8.3)
90
- addressable (>= 2.3.6)
61
+ simplecov_json_formatter (~> 0.1)
62
+ simplecov-html (0.13.2)
63
+ simplecov_json_formatter (0.1.4)
64
+ stringio (3.1.7)
65
+ tzinfo (2.0.6)
66
+ concurrent-ruby (~> 1.0)
67
+ uri (1.0.3)
68
+ vcr (6.3.1)
69
+ base64
70
+ webmock (3.25.1)
71
+ addressable (>= 2.8.0)
91
72
  crack (>= 0.3.2)
92
73
  hashdiff (>= 0.4.0, < 2.0.0)
93
74
 
94
75
  PLATFORMS
76
+ arm64-darwin-24
95
77
  ruby
96
78
 
97
79
  DEPENDENCIES
98
80
  bundler
99
81
  httparty (~> 0.21.0)
100
- jeweler
101
- minitest
82
+ minitest (~> 5.0)
102
83
  rake
103
84
  rdoc
104
85
  shoulda
105
86
  simplecov
106
- turn
107
87
  vcr
108
88
  webmock
109
89
 
110
90
  RUBY VERSION
111
- ruby 2.6.10p210
91
+ ruby 3.2.8p263
112
92
 
113
93
  BUNDLED WITH
114
- 2.0.2
94
+ 2.7.0
data/Rakefile CHANGED
@@ -11,20 +11,6 @@ rescue Bundler::BundlerError => e
11
11
  end
12
12
  require 'rake'
13
13
 
14
- require 'jeweler'
15
- Jeweler::Tasks.new do |gem|
16
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
- gem.name = "enrico"
18
- gem.homepage = "https://github.com/easyPEP/enrico"
19
- gem.license = "MIT"
20
- gem.summary = "A ruby wrapper around enrico holiday API"
21
- gem.description = "https://github.com/easyPEP/enrico"
22
- gem.email = "kalle@easypep.de"
23
- gem.authors = ["Kalle Saas"]
24
- # dependencies defined in Gemfile
25
- end
26
- Jeweler::RubygemsDotOrgTasks.new
27
-
28
14
  require 'rake/testtask'
29
15
  Rake::TestTask.new(:test) do |test|
30
16
  test.libs << 'lib' << 'test'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
data/enrico.gemspec CHANGED
@@ -2,15 +2,15 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: enrico 0.2.1 ruby lib
5
+ # stub: enrico 0.2.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "enrico".freeze
9
- s.version = "0.2.1"
9
+ s.version = "0.2.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
- s.authors = ["Kalle Saas".freeze]
13
+ s.authors = ["Kalle Saas".freeze, "Martin Gregoire".freeze]
14
14
  s.date = "2025-07-18"
15
15
  s.description = "https://github.com/easyPEP/enrico".freeze
16
16
  s.email = "kalle@easypep.de".freeze
@@ -43,7 +43,7 @@ module Enrico
43
43
  end
44
44
 
45
45
  def method_missing(name, *args, &block)
46
- method_name = name.to_s.camelize(:lower)
46
+ method_name = name.to_s.gsub(/_([a-z])/) { $1.upcase }
47
47
  details.has_key?(method_name) ? details[method_name] : super
48
48
  end
49
49
 
@@ -60,13 +60,13 @@ module Enrico
60
60
  end
61
61
 
62
62
  def country_parameters(params, holiday_type: nil)
63
- {
63
+ result = {
64
64
  country: self.country_code,
65
65
  region: self.region
66
- }
67
- .merge(params)
68
- .tap { |result| result[:holidayType] = holiday_type if holiday_type.present? }
69
- .to_query
66
+ }.merge(params)
67
+ result[:holidayType] = holiday_type if holiday_type && !holiday_type.empty?
68
+
69
+ URI.encode_www_form(result.compact)
70
70
  end
71
71
 
72
72
  def is_public_holiday(date)
@@ -7,7 +7,7 @@ module Enrico
7
7
  def initialize(args)
8
8
  self.date = Date.new( args["date"]["year"].to_i, args["date"]["month"].to_i, args["date"]["day"].to_i )
9
9
  self.local_name = args["name"][0]["text"]
10
- self.english_name = args["name"][1].present? ? args["name"][1]["text"] : args["name"][0]["text"]
10
+ self.english_name = args["name"][1] && !args["name"][1].empty? ? args["name"][1]["text"] : args["name"][0]["text"]
11
11
  end
12
12
  end
13
13
  end
data/lib/enrico.rb CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  require "httparty"
4
4
  require 'json'
5
- require 'active_support/all'
6
5
  require "addressable/uri"
7
6
 
8
7
  Dir[File.dirname(__FILE__) + '/enrico/*.rb'].each do |file|
data/mise.toml CHANGED
@@ -1,2 +1,2 @@
1
1
  [tools]
2
- ruby = "2.6.10"
2
+ ruby = "3.2.8"
@@ -2,69 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: http://kayaposoft.com/enrico/json/v2.0/?action=getHolidaysForDateRange&country=deu&fromDate=01-01-2020&region=&toDate=01-03-2020
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers: {}
10
- response:
11
- status:
12
- code: 200
13
- message: OK
14
- headers:
15
- Server:
16
- - openresty
17
- Date:
18
- - Wed, 08 Apr 2020 18:04:50 GMT
19
- Content-Type:
20
- - application/json
21
- Content-Length:
22
- - '169'
23
- Connection:
24
- - keep-alive
25
- Vary:
26
- - Accept-Encoding
27
- Access-Control-Allow-Origin:
28
- - "*"
29
- body:
30
- encoding: UTF-8
31
- string: '[{"date":{"day":1,"month":1,"year":2020,"dayOfWeek":3},"name":[{"lang":"de","text":"Neujahrstag"},{"lang":"en","text":"New
32
- Year''s Day"}],"holidayType":"public_holiday"}]'
33
- recorded_at: Wed, 08 Apr 2020 18:04:50 GMT
34
- - request:
35
- method: get
36
- uri: https://kayaposoft.com/enrico/json/v2.0/?action=getHolidaysForDateRange&country=deu&fromDate=01-01-2020&region=&toDate=01-03-2020
37
- body:
38
- encoding: US-ASCII
39
- string: ''
40
- headers: {}
41
- response:
42
- status:
43
- code: 200
44
- message: OK
45
- headers:
46
- Server:
47
- - openresty
48
- Date:
49
- - Tue, 14 Apr 2020 09:31:33 GMT
50
- Content-Type:
51
- - application/json
52
- Content-Length:
53
- - '169'
54
- Connection:
55
- - keep-alive
56
- Vary:
57
- - Accept-Encoding
58
- Access-Control-Allow-Origin:
59
- - "*"
60
- body:
61
- encoding: UTF-8
62
- string: '[{"date":{"day":1,"month":1,"year":2020,"dayOfWeek":3},"name":[{"lang":"de","text":"Neujahrstag"},{"lang":"en","text":"New
63
- Year''s Day"}],"holidayType":"public_holiday"}]'
64
- recorded_at: Tue, 14 Apr 2020 09:31:35 GMT
65
- - request:
66
- method: get
67
- uri: https://kayaposoft.com/enrico/json/v2.0/?action=getHolidaysForDateRange&country=deu&fromDate=01-01-2020&region=&toDate=31-03-2020
5
+ uri: https://kayaposoft.com/enrico/json/v2.0/?action=getHolidaysForDateRange&country=deu&fromDate=01-01-2020&toDate=31-03-2020
68
6
  body:
69
7
  encoding: US-ASCII
70
8
  string: ''
@@ -83,7 +21,7 @@ http_interactions:
83
21
  Server:
84
22
  - openresty
85
23
  Date:
86
- - Tue, 17 Jun 2025 12:38:32 GMT
24
+ - Fri, 18 Jul 2025 13:15:54 GMT
87
25
  Content-Type:
88
26
  - application/json
89
27
  Transfer-Encoding:
@@ -106,5 +44,5 @@ http_interactions:
106
44
  der Sommerzeit"},{"lang":"en","text":"Daylight Saving Time Starts"}],"note":[{"lang":"de","text":"Die
107
45
  Uhr wird um eine Stunde von 2:00 Uhr auf 3:00 Uhr vorgestellt"},{"lang":"en","text":"A
108
46
  one-hour shift occurs at 02:00 local time, the clock jumps forward to 03:00"}],"holidayType":"other_day"}]'
109
- recorded_at: Tue, 17 Jun 2025 12:38:32 GMT
110
- recorded_with: VCR 6.0.0
47
+ recorded_at: Fri, 18 Jul 2025 13:15:27 GMT
48
+ recorded_with: VCR 6.3.1
@@ -2,43 +2,17 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: http://kayaposoft.com/enrico/json/v2.0/?action=getHolidaysForMonth&country=deu&month=1&region=&year=2020
5
+ uri: https://kayaposoft.com/enrico/json/v2.0/?action=getHolidaysForMonth&country=deu&month=1&year=2020
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
- headers: {}
10
- response:
11
- status:
12
- code: 200
13
- message: OK
14
9
  headers:
15
- Server:
16
- - openresty
17
- Date:
18
- - Wed, 08 Apr 2020 18:04:51 GMT
19
- Content-Type:
20
- - application/json
21
- Content-Length:
22
- - '169'
23
- Connection:
24
- - keep-alive
25
- Vary:
26
- - Accept-Encoding
27
- Access-Control-Allow-Origin:
28
- - "*"
29
- body:
30
- encoding: UTF-8
31
- string: '[{"date":{"day":1,"month":1,"year":2020,"dayOfWeek":3},"name":[{"lang":"de","text":"Neujahrstag"},{"lang":"en","text":"New
32
- Year''s Day"}],"holidayType":"public_holiday"}]'
33
- http_version:
34
- recorded_at: Wed, 08 Apr 2020 18:04:50 GMT
35
- - request:
36
- method: get
37
- uri: https://kayaposoft.com/enrico/json/v2.0/?action=getHolidaysForMonth&country=deu&month=1&region=&year=2020
38
- body:
39
- encoding: US-ASCII
40
- string: ''
41
- headers: {}
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
42
16
  response:
43
17
  status:
44
18
  code: 200
@@ -47,21 +21,24 @@ http_interactions:
47
21
  Server:
48
22
  - openresty
49
23
  Date:
50
- - Tue, 14 Apr 2020 09:31:33 GMT
24
+ - Fri, 18 Jul 2025 13:15:54 GMT
51
25
  Content-Type:
52
26
  - application/json
53
- Content-Length:
54
- - '169'
27
+ Transfer-Encoding:
28
+ - chunked
55
29
  Connection:
56
30
  - keep-alive
31
+ Keep-Alive:
32
+ - timeout=10
57
33
  Vary:
58
34
  - Accept-Encoding
59
35
  Access-Control-Allow-Origin:
60
36
  - "*"
37
+ Alt-Svc:
38
+ - h3=":443"; ma=86400
61
39
  body:
62
- encoding: UTF-8
40
+ encoding: ASCII-8BIT
63
41
  string: '[{"date":{"day":1,"month":1,"year":2020,"dayOfWeek":3},"name":[{"lang":"de","text":"Neujahrstag"},{"lang":"en","text":"New
64
42
  Year''s Day"}],"holidayType":"public_holiday"}]'
65
- http_version:
66
- recorded_at: Tue, 14 Apr 2020 09:31:35 GMT
67
- recorded_with: VCR 2.8.0
43
+ recorded_at: Fri, 18 Jul 2025 13:15:28 GMT
44
+ recorded_with: VCR 6.3.1
@@ -2,59 +2,17 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: http://kayaposoft.com/enrico/json/v2.0/?action=getHolidaysForYear&country=deu&region=&year=2020
5
+ uri: https://kayaposoft.com/enrico/json/v2.0/?action=getHolidaysForYear&country=deu&year=2020
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
- headers: {}
10
- response:
11
- status:
12
- code: 200
13
- message: OK
14
9
  headers:
15
- Server:
16
- - openresty
17
- Date:
18
- - Wed, 08 Apr 2020 18:04:51 GMT
19
- Content-Type:
20
- - application/json
21
- Content-Length:
22
- - '2646'
23
- Connection:
24
- - keep-alive
25
- Vary:
26
- - Accept-Encoding
27
- Access-Control-Allow-Origin:
28
- - "*"
29
- body:
30
- encoding: UTF-8
31
- string: '[{"date":{"day":1,"month":1,"year":2020,"dayOfWeek":3},"name":[{"lang":"de","text":"Neujahrstag"},{"lang":"en","text":"New
32
- Year''s Day"}],"holidayType":"public_holiday"},{"date":{"day":29,"month":3,"year":2020,"dayOfWeek":7},"name":[{"lang":"de","text":"Beginn
33
- der Sommerzeit"},{"lang":"en","text":"Daylight Saving Time Starts"}],"note":[{"lang":"de","text":"Die
34
- Uhr wird um eine Stunde von 2:00 Uhr auf 3:00 Uhr vorgestellt"},{"lang":"en","text":"A
35
- one-hour shift occurs at 02:00 local time, the clock jumps forward to 03:00"}],"holidayType":"other_day"},{"date":{"day":10,"month":4,"year":2020,"dayOfWeek":5},"name":[{"lang":"de","text":"Karfreitag"},{"lang":"en","text":"Good
36
- Friday"}],"holidayType":"public_holiday"},{"date":{"day":13,"month":4,"year":2020,"dayOfWeek":1},"name":[{"lang":"de","text":"Ostermontag"},{"lang":"en","text":"Easter
37
- Monday"}],"holidayType":"public_holiday"},{"date":{"day":1,"month":5,"year":2020,"dayOfWeek":5},"name":[{"lang":"de","text":"Tag
38
- der Arbeit"},{"lang":"en","text":"Labour Day"}],"holidayType":"public_holiday"},{"date":{"day":10,"month":5,"year":2020,"dayOfWeek":7},"name":[{"lang":"de","text":"Muttertag"},{"lang":"en","text":"Mother''s
39
- Day"}],"holidayType":"other_day"},{"date":{"day":21,"month":5,"year":2020,"dayOfWeek":4},"name":[{"lang":"de","text":"Christi
40
- Himmelfahrt"},{"lang":"en","text":"Ascension Day"}],"holidayType":"public_holiday"},{"date":{"day":21,"month":5,"year":2020,"dayOfWeek":4},"name":[{"lang":"de","text":"Vatertag"},{"lang":"en","text":"Father''s
41
- Day"}],"holidayType":"other_day"},{"date":{"day":1,"month":6,"year":2020,"dayOfWeek":1},"name":[{"lang":"de","text":"Pfingstmontag"},{"lang":"en","text":"Whit
42
- Monday"}],"holidayType":"public_holiday"},{"date":{"day":3,"month":10,"year":2020,"dayOfWeek":6},"name":[{"lang":"de","text":"Tag
43
- der Deutschen Einheit"},{"lang":"en","text":"German Unity Day"}],"holidayType":"public_holiday"},{"date":{"day":25,"month":10,"year":2020,"dayOfWeek":7},"name":[{"lang":"de","text":"Ende
44
- der Sommerzeit"},{"lang":"en","text":"Daylight Saving Time Ends"}],"note":[{"lang":"de","text":"Die
45
- Uhr wird um eine Stunde von 3:00 Uhr auf 2:00 Uhr zur\u00fcckgestellt"},{"lang":"en","text":"A
46
- one-hour shift occurs at 03:00 local time, the clock jumps backward to 02:00"}],"holidayType":"other_day"},{"date":{"day":25,"month":12,"year":2020,"dayOfWeek":5},"name":[{"lang":"de","text":"Weihnachtstag"},{"lang":"en","text":"Christmas
47
- Day"}],"holidayType":"public_holiday"},{"date":{"day":26,"month":12,"year":2020,"dayOfWeek":6},"name":[{"lang":"de","text":"Zweiter
48
- Weihnachtsfeiertag"},{"lang":"en","text":"Boxing Day"}],"holidayType":"public_holiday"}]'
49
- http_version:
50
- recorded_at: Wed, 08 Apr 2020 18:04:50 GMT
51
- - request:
52
- method: get
53
- uri: https://kayaposoft.com/enrico/json/v2.0/?action=getHolidaysForYear&country=deu&region=&year=2020
54
- body:
55
- encoding: US-ASCII
56
- string: ''
57
- headers: {}
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
58
16
  response:
59
17
  status:
60
18
  code: 200
@@ -63,19 +21,23 @@ http_interactions:
63
21
  Server:
64
22
  - openresty
65
23
  Date:
66
- - Tue, 14 Apr 2020 09:31:34 GMT
24
+ - Fri, 18 Jul 2025 13:15:54 GMT
67
25
  Content-Type:
68
26
  - application/json
69
- Content-Length:
70
- - '2834'
27
+ Transfer-Encoding:
28
+ - chunked
71
29
  Connection:
72
30
  - keep-alive
31
+ Keep-Alive:
32
+ - timeout=10
73
33
  Vary:
74
34
  - Accept-Encoding
75
35
  Access-Control-Allow-Origin:
76
36
  - "*"
37
+ Alt-Svc:
38
+ - h3=":443"; ma=86400
77
39
  body:
78
- encoding: UTF-8
40
+ encoding: ASCII-8BIT
79
41
  string: '[{"date":{"day":1,"month":1,"year":2020,"dayOfWeek":3},"name":[{"lang":"de","text":"Neujahrstag"},{"lang":"en","text":"New
80
42
  Year''s Day"}],"holidayType":"public_holiday"},{"date":{"day":8,"month":3,"year":2020,"dayOfWeek":7},"name":[{"lang":"de","text":"Internationaler
81
43
  Frauentag"},{"lang":"en","text":"International Women''s Day"}],"holidayType":"other_day"},{"date":{"day":29,"month":3,"year":2020,"dayOfWeek":7},"name":[{"lang":"de","text":"Beginn
@@ -95,6 +57,5 @@ http_interactions:
95
57
  one-hour shift occurs at 03:00 local time, the clock jumps backward to 02:00"}],"holidayType":"other_day"},{"date":{"day":25,"month":12,"year":2020,"dayOfWeek":5},"name":[{"lang":"de","text":"Weihnachtstag"},{"lang":"en","text":"Christmas
96
58
  Day"}],"holidayType":"public_holiday"},{"date":{"day":26,"month":12,"year":2020,"dayOfWeek":6},"name":[{"lang":"de","text":"Zweiter
97
59
  Weihnachtsfeiertag"},{"lang":"en","text":"Boxing Day"}],"holidayType":"public_holiday"}]'
98
- http_version:
99
- recorded_at: Tue, 14 Apr 2020 09:31:35 GMT
100
- recorded_with: VCR 2.8.0
60
+ recorded_at: Fri, 18 Jul 2025 13:15:28 GMT
61
+ recorded_with: VCR 6.3.1
@@ -2,42 +2,17 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: http://kayaposoft.com/enrico/json/v2.0/?action=isPublicHoliday&country=deu&date=29-01-2020&region=
5
+ uri: https://kayaposoft.com/enrico/json/v2.0/?action=isPublicHoliday&country=deu&date=01-01-2020
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
- headers: {}
10
- response:
11
- status:
12
- code: 200
13
- message: OK
14
9
  headers:
15
- Server:
16
- - openresty
17
- Date:
18
- - Wed, 08 Apr 2020 18:04:51 GMT
19
- Content-Type:
20
- - application/json
21
- Content-Length:
22
- - '25'
23
- Connection:
24
- - keep-alive
25
- Vary:
26
- - Accept-Encoding
27
- Access-Control-Allow-Origin:
28
- - "*"
29
- body:
30
- encoding: UTF-8
31
- string: '{"isPublicHoliday":false}'
32
- http_version:
33
- recorded_at: Wed, 08 Apr 2020 18:04:50 GMT
34
- - request:
35
- method: get
36
- uri: http://kayaposoft.com/enrico/json/v2.0/?action=isPublicHoliday&country=deu&date=01-01-2020&region=
37
- body:
38
- encoding: US-ASCII
39
- string: ''
40
- headers: {}
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
41
16
  response:
42
17
  status:
43
18
  code: 200
@@ -46,60 +21,38 @@ http_interactions:
46
21
  Server:
47
22
  - openresty
48
23
  Date:
49
- - Wed, 08 Apr 2020 18:04:51 GMT
24
+ - Fri, 18 Jul 2025 13:16:10 GMT
50
25
  Content-Type:
51
26
  - application/json
52
27
  Content-Length:
53
28
  - '24'
54
29
  Connection:
55
30
  - keep-alive
31
+ Keep-Alive:
32
+ - timeout=10
56
33
  Vary:
57
34
  - Accept-Encoding
58
35
  Access-Control-Allow-Origin:
59
36
  - "*"
37
+ Alt-Svc:
38
+ - h3=":443"; ma=86400
60
39
  body:
61
40
  encoding: UTF-8
62
41
  string: '{"isPublicHoliday":true}'
63
- http_version:
64
- recorded_at: Wed, 08 Apr 2020 18:04:51 GMT
42
+ recorded_at: Fri, 18 Jul 2025 13:15:44 GMT
65
43
  - request:
66
44
  method: get
67
- uri: https://kayaposoft.com/enrico/json/v2.0/?action=isPublicHoliday&country=deu&date=01-01-2020&region=
45
+ uri: https://kayaposoft.com/enrico/json/v2.0/?action=isPublicHoliday&country=deu&date=29-01-2020
68
46
  body:
69
47
  encoding: US-ASCII
70
48
  string: ''
71
- headers: {}
72
- response:
73
- status:
74
- code: 200
75
- message: OK
76
49
  headers:
77
- Server:
78
- - openresty
79
- Date:
80
- - Tue, 14 Apr 2020 09:34:53 GMT
81
- Content-Type:
82
- - application/json
83
- Content-Length:
84
- - '24'
85
- Connection:
86
- - keep-alive
87
- Vary:
88
- - Accept-Encoding
89
- Access-Control-Allow-Origin:
90
- - "*"
91
- body:
92
- encoding: UTF-8
93
- string: '{"isPublicHoliday":true}'
94
- http_version:
95
- recorded_at: Tue, 14 Apr 2020 09:34:55 GMT
96
- - request:
97
- method: get
98
- uri: https://kayaposoft.com/enrico/json/v2.0/?action=isPublicHoliday&country=deu&date=29-01-2020&region=
99
- body:
100
- encoding: US-ASCII
101
- string: ''
102
- headers: {}
50
+ Accept-Encoding:
51
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
52
+ Accept:
53
+ - "*/*"
54
+ User-Agent:
55
+ - Ruby
103
56
  response:
104
57
  status:
105
58
  code: 200
@@ -108,20 +61,23 @@ http_interactions:
108
61
  Server:
109
62
  - openresty
110
63
  Date:
111
- - Tue, 14 Apr 2020 09:34:53 GMT
64
+ - Fri, 18 Jul 2025 13:18:13 GMT
112
65
  Content-Type:
113
66
  - application/json
114
67
  Content-Length:
115
68
  - '25'
116
69
  Connection:
117
70
  - keep-alive
71
+ Keep-Alive:
72
+ - timeout=10
118
73
  Vary:
119
74
  - Accept-Encoding
120
75
  Access-Control-Allow-Origin:
121
76
  - "*"
77
+ Alt-Svc:
78
+ - h3=":443"; ma=86400
122
79
  body:
123
80
  encoding: UTF-8
124
81
  string: '{"isPublicHoliday":false}'
125
- http_version:
126
- recorded_at: Tue, 14 Apr 2020 09:34:55 GMT
127
- recorded_with: VCR 2.8.0
82
+ recorded_at: Fri, 18 Jul 2025 13:17:47 GMT
83
+ recorded_with: VCR 6.3.1
@@ -8,7 +8,7 @@ describe Enrico::Country do
8
8
 
9
9
  describe "GET getHolidaysForMonth" do
10
10
  before(:each) do
11
- VCR.insert_cassette 'holidays_in_month', :record => :new_episodes
11
+ VCR.insert_cassette 'holidays_in_month'
12
12
  end
13
13
 
14
14
  after(:each) do
@@ -26,7 +26,7 @@ describe Enrico::Country do
26
26
 
27
27
  describe "GET getHolidaysForYear" do
28
28
  before(:each) do
29
- VCR.insert_cassette 'holidays_in_year', :record => :new_episodes
29
+ VCR.insert_cassette 'holidays_in_year'
30
30
  end
31
31
 
32
32
  after(:each) do
@@ -48,7 +48,7 @@ describe Enrico::Country do
48
48
 
49
49
  describe "GET getForDateRange" do
50
50
  before(:each) do
51
- VCR.insert_cassette 'holidays_in_date_range', :record => :new_episodes
51
+ VCR.insert_cassette 'holidays_in_date_range'
52
52
  end
53
53
 
54
54
  after(:each) do
@@ -7,7 +7,7 @@ require_relative '../../spec_helper'
7
7
  describe Enrico::Country do
8
8
 
9
9
  before(:each) do
10
- VCR.insert_cassette 'supported_countries', :record => :new_episodes
10
+ VCR.insert_cassette 'supported_countries'
11
11
  end
12
12
 
13
13
  after(:each) do
@@ -87,4 +87,75 @@ describe Enrico::Country do
87
87
 
88
88
  end
89
89
 
90
+ describe "method_missing" do
91
+ let(:country) { Enrico::Country.new("deu") }
92
+
93
+ before do
94
+ # Mock the details method to return a hash with test data
95
+ def country.details
96
+ {
97
+ "fullName" => "Germany",
98
+ "countryCode" => "deu",
99
+ "fromDate" => {"day"=>1, "month"=>1, "year"=>2011},
100
+ "toDate" => {"day"=>31, "month"=>12, "year"=>32767}
101
+ }
102
+ end
103
+ end
104
+
105
+ it "converts snake_case method names to camelCase for accessing details" do
106
+ _(country.full_name).must_equal "Germany"
107
+ _(country.country_code).must_equal "deu"
108
+ end
109
+
110
+ it "handles already camelCase properties" do
111
+ _(country.fromDate).must_equal({"day"=>1, "month"=>1, "year"=>2011})
112
+ _(country.toDate).must_equal({"day"=>31, "month"=>12, "year"=>32767})
113
+ end
114
+
115
+ it "raises NoMethodError for non-existent properties" do
116
+ assert_raises(NoMethodError) do
117
+ country.non_existent_property
118
+ end
119
+ end
120
+ end
121
+
122
+ describe "country_parameters" do
123
+ let(:country) { Enrico::Country.new("deu", "by") }
124
+ let(:country_no_region) { Enrico::Country.new("deu") }
125
+
126
+ it "includes country code and region in parameters" do
127
+ params = country.country_parameters({month: 1, year: 2024})
128
+ _(params).must_include "country=deu"
129
+ _(params).must_include "region=by"
130
+ _(params).must_include "month=1"
131
+ _(params).must_include "year=2024"
132
+ end
133
+
134
+ it "excludes nil region from parameters" do
135
+ params = country_no_region.country_parameters({month: 1, year: 2024})
136
+ _(params).must_include "country=deu"
137
+ _(params).wont_include "region="
138
+ end
139
+
140
+ it "includes holiday_type when provided and not empty" do
141
+ params = country.country_parameters({month: 1}, holiday_type: "public_holiday")
142
+ _(params).must_include "holidayType=public_holiday"
143
+ end
144
+
145
+ it "excludes holiday_type when nil" do
146
+ params = country.country_parameters({month: 1}, holiday_type: nil)
147
+ _(params).wont_include "holidayType"
148
+ end
149
+
150
+ it "excludes holiday_type when empty string" do
151
+ params = country.country_parameters({month: 1}, holiday_type: "")
152
+ _(params).wont_include "holidayType"
153
+ end
154
+
155
+ it "properly encodes parameters for URL" do
156
+ params = country.country_parameters({date: "01-01-2024"})
157
+ _(params).must_equal "country=deu&region=by&date=01-01-2024"
158
+ end
159
+ end
160
+
90
161
  end
@@ -8,7 +8,7 @@ describe Enrico::Country do
8
8
 
9
9
  describe "GET isPublicHoliday" do
10
10
  before(:each) do
11
- VCR.insert_cassette 'is_public_holiday', :record => :new_episodes
11
+ VCR.insert_cassette 'is_public_holiday'
12
12
  end
13
13
  after(:each) do
14
14
  VCR.eject_cassette
@@ -1,52 +1,95 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require_relative '../../spec_helper'
4
- # For Ruby < 1.9.3, use this instead of require_relative
5
- # require (File.expand_path('./../../../spec_helper', __FILE__))
6
4
 
7
5
  describe Enrico::VacationDay do
8
- describe "default instance attributes" do
9
- it "test initializer methods" do
10
- beginning_of_year = Date.today.beginning_of_year
6
+ describe "initialization" do
7
+ before(:each) do
8
+ VCR.insert_cassette 'holidays_in_month'
9
+ end
10
+
11
+ after(:each) do
12
+ VCR.eject_cassette
13
+ end
14
+
15
+ it "creates VacationDay from real API response" do
16
+ country = Enrico::Country.new("deu")
17
+ vacation_days = country.holidays_for_month(Date.parse('2020-01-15'))
18
+
19
+ day = vacation_days.first
20
+ _(day).must_be_instance_of Enrico::VacationDay
21
+ _(day.date).must_equal Date.new(2020, 1, 1)
22
+ _(day.local_name).must_equal "Neujahrstag"
23
+ _(day.english_name).must_equal "New Year's Day"
24
+ end
25
+
26
+ it "handles multi-language holidays" do
11
27
  rsp = {
12
- "date"=>{"day"=> beginning_of_year.day, "month" => beginning_of_year.month, "year"=>beginning_of_year.year, "dayOfWeek"=>beginning_of_year.wday},
28
+ "date"=>{"day"=>1, "month"=>1, "year"=>2020, "dayOfWeek"=>3},
13
29
  "name"=>[
14
- {
15
- "lang"=>"de",
16
- "text"=>"Neujahrstag"
17
- },
18
- {
19
- "lang"=>"en",
20
- "text"=>"New Year's Day"
21
- }
30
+ {"lang"=>"de", "text"=>"Neujahrstag"},
31
+ {"lang"=>"en", "text"=>"New Year's Day"}
22
32
  ],
23
33
  "holidayType"=>"public_holiday"
24
34
  }
25
35
  day = Enrico::VacationDay.new(rsp)
26
- _(day.date).must_equal Date.today.beginning_of_year
36
+ _(day.date).must_equal Date.new(2020, 1, 1)
27
37
  _(day.local_name).must_equal "Neujahrstag"
28
38
  _(day.english_name).must_equal "New Year's Day"
29
39
  end
30
40
 
31
- describe 'when country has only one language' do
32
- it "returns same names" do
33
- beginning_of_year = Date.today.beginning_of_year
34
- rsp = {
35
- "date"=>{"day"=> beginning_of_year.day, "month" => beginning_of_year.month, "year"=>beginning_of_year.year, "dayOfWeek"=>beginning_of_year.wday},
36
- "name"=>[
37
- {
38
- "lang"=>"en",
39
- "text"=>"New Year's Day"
40
- }
41
- ],
42
- "holidayType"=>"public_holiday"
43
- }
44
- day = Enrico::VacationDay.new(rsp)
45
- _(day.date).must_equal Date.today.beginning_of_year
46
- _(day.local_name).must_equal "New Year's Day"
47
- _(day.english_name).must_equal "New Year's Day"
48
- end
41
+ it "handles single-language holidays" do
42
+ rsp = {
43
+ "date"=>{"day"=>4, "month"=>7, "year"=>2020, "dayOfWeek"=>6},
44
+ "name"=>[
45
+ {"lang"=>"en", "text"=>"Independence Day"}
46
+ ],
47
+ "holidayType"=>"public_holiday"
48
+ }
49
+ day = Enrico::VacationDay.new(rsp)
50
+ _(day.date).must_equal Date.new(2020, 7, 4)
51
+ _(day.local_name).must_equal "Independence Day"
52
+ _(day.english_name).must_equal "Independence Day"
53
+ end
54
+
55
+ it "falls back to local name when second language is nil" do
56
+ rsp = {
57
+ "date"=>{"day"=>25, "month"=>12, "year"=>2020, "dayOfWeek"=>5},
58
+ "name"=>[
59
+ {"lang"=>"fr", "text"=>"Noël"},
60
+ nil
61
+ ],
62
+ "holidayType"=>"public_holiday"
63
+ }
64
+ day = Enrico::VacationDay.new(rsp)
65
+ _(day.local_name).must_equal "Noël"
66
+ _(day.english_name).must_equal "Noël"
67
+ end
68
+
69
+ it "falls back to local name when second language is empty" do
70
+ rsp = {
71
+ "date"=>{"day"=>1, "month"=>5, "year"=>2020, "dayOfWeek"=>5},
72
+ "name"=>[
73
+ {"lang"=>"es", "text"=>"Día del Trabajo"},
74
+ {}
75
+ ],
76
+ "holidayType"=>"public_holiday"
77
+ }
78
+ day = Enrico::VacationDay.new(rsp)
79
+ _(day.local_name).must_equal "Día del Trabajo"
80
+ _(day.english_name).must_equal "Día del Trabajo"
81
+ end
49
82
 
83
+ it "parses dates with string values" do
84
+ rsp = {
85
+ "date"=>{"day"=>"15", "month"=>"8", "year"=>"2020", "dayOfWeek"=>6},
86
+ "name"=>[
87
+ {"lang"=>"it", "text"=>"Ferragosto"}
88
+ ],
89
+ "holidayType"=>"public_holiday"
90
+ }
91
+ day = Enrico::VacationDay.new(rsp)
92
+ _(day.date).must_equal Date.new(2020, 8, 15)
50
93
  end
51
94
  end
52
95
  end
metadata CHANGED
@@ -1,10 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enrico
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kalle Saas
8
+ - Martin Gregoire
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
@@ -161,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
162
  - !ruby/object:Gem::Version
162
163
  version: '0'
163
164
  requirements: []
164
- rubygems_version: 3.0.3.1
165
+ rubygems_version: 3.4.19
165
166
  signing_key:
166
167
  specification_version: 4
167
168
  summary: A ruby wrapper around enrico holiday API