enrico 0.1.6 → 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,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NzI4ZjMxMDE2MGZjNTkxYjFjMzQyNDA0Mzg4Y2RmNWVkMmNiMmZjMQ==
5
- data.tar.gz: !binary |-
6
- MDRhZGI5OTQ3ZTE4MDlmNzYyZWMyNGU2YWRkMDAwMWZiM2YwZDBhNw==
2
+ SHA256:
3
+ metadata.gz: 6020686fdee607a43b3b047fca7ee6c155f19d04f0e1db8c17d9fa44ef0ca7d1
4
+ data.tar.gz: f389071f475e29281fe11ccdd41951392a2e3dbe09041058afa6713cc17d404b
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ZjViZTNkNDRkM2IxZTVlNjc0OWQ1ZWY3Mjk4NTNmMTdiNDEyZjkyMWU0ZjNi
10
- NjllMDQxMTNiMmU0MTk3MWIyMTQyYTdmZWFjMTYxMzYwZDM1ZjE4ZDIyMWY2
11
- MzE1ZWQwMWYxMmJlMzM5YzhmNzA1ZWRlYWIxMzQ5NTFlZTEyMzI=
12
- data.tar.gz: !binary |-
13
- YzZmMzlmNjU5YmM1MWRjMmYyOTY2MjQ5ZDM1Zjg1ODA4NDQxN2I2NGViMjIw
14
- MWFjOTE0OGU2OWZhMGUyYWEzOGQwN2UwM2MzNGU4MzhlY2U2YWYzZTRhMWIx
15
- MzI1NGQxNjBkZTMzM2ZmN2YwN2QwNDk0Y2ExZDI3NjY2MmRlOGY=
6
+ metadata.gz: c7935fae6ee4ddde3fa913d6d6b4dfeff248eb90e13ce81c44c8854b130ec1149722b998350725eae60184510bad6dbb170416ca0e39f586645e3817143d5b50
7
+ data.tar.gz: ad99a9f40c561b8cf9f9de63879ad83d450e04d391eaa04773d05c583169b11d3577a0ca6d2b9b6d70feb708d59ff98251eb5328e2df3c2ad56e06b272cbb3ae
@@ -0,0 +1,21 @@
1
+ name: test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - "**"
7
+ tags-ignore:
8
+ - "*.*"
9
+
10
+ jobs:
11
+ minitest:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - name: Setup Ruby
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: 3.2.8
19
+ bundler-cache: true
20
+ - name: Run tests
21
+ run: bundle exec rake test
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2.8
data/Gemfile CHANGED
@@ -1,24 +1,25 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
+
3
+ ruby '3.2.8'
4
+
2
5
  # Add dependencies required to use your gem here.
3
6
  # Example:
4
7
  # gem "activesupport", ">= 2.3.5"
5
8
 
6
9
  # Add dependencies to develop your gem here.
7
10
  # Include everything needed to run rake, tests, features, etc.
8
- gem 'httparty', '0.12.0'
11
+ gem 'httparty', '~> 0.21.0'
9
12
 
10
13
  group :development do
11
14
  gem "bundler"
12
- gem "jeweler", "1.8.8"
13
15
  gem "simplecov"
14
16
  gem "rdoc"
15
17
  gem "shoulda"
16
- gem "minitest"
18
+ gem "minitest", "~> 5.0"
17
19
  end
18
20
 
19
21
  group :test do
20
- gem 'webmock', "< 1.9"
22
+ gem 'webmock'
21
23
  gem 'vcr'
22
- gem 'turn'
23
24
  gem 'rake'
24
25
  end
data/Gemfile.lock CHANGED
@@ -1,98 +1,94 @@
1
1
  GEM
2
- remote: http://rubygems.org/
2
+ remote: https://rubygems.org/
3
3
  specs:
4
- activesupport (4.0.1)
5
- i18n (~> 0.6, >= 0.6.4)
6
- minitest (~> 4.2)
7
- multi_json (~> 1.3)
8
- thread_safe (~> 0.1)
9
- tzinfo (~> 0.3.37)
10
- addressable (2.3.5)
11
- ansi (1.4.3)
12
- atomic (1.1.14)
13
- builder (3.2.2)
14
- crack (0.4.1)
15
- safe_yaml (~> 0.9.0)
16
- docile (1.1.1)
17
- faraday (0.8.8)
18
- multipart-post (~> 1.2.0)
19
- git (1.2.6)
20
- github_api (0.10.1)
21
- addressable
22
- faraday (~> 0.8.1)
23
- hashie (>= 1.2)
24
- multi_json (~> 1.4)
25
- nokogiri (~> 1.5.2)
26
- oauth2
27
- hashie (2.0.5)
28
- highline (1.6.20)
29
- httparty (0.12.0)
30
- json (~> 1.8)
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)
32
+ httparty (0.21.0)
33
+ mini_mime (>= 1.0.0)
31
34
  multi_xml (>= 0.5.2)
32
- httpauth (0.2.0)
33
- i18n (0.6.5)
34
- jeweler (1.8.8)
35
- builder
36
- bundler (~> 1.0)
37
- git (>= 1.2.5)
38
- github_api (= 0.10.1)
39
- highline (>= 1.6.15)
40
- nokogiri (= 1.5.10)
41
- rake
42
- rdoc
43
- json (1.8.1)
44
- jwt (0.1.8)
45
- multi_json (>= 1.5)
46
- minitest (4.7.5)
47
- multi_json (1.8.2)
48
- multi_xml (0.5.5)
49
- multipart-post (1.2.0)
50
- nokogiri (1.5.10)
51
- oauth2 (0.9.2)
52
- faraday (~> 0.8)
53
- httpauth (~> 0.2)
54
- jwt (~> 0.1.4)
55
- multi_json (~> 1.0)
56
- multi_xml (~> 0.5)
57
- rack (~> 1.2)
58
- rack (1.5.2)
59
- rake (10.1.0)
60
- rdoc (4.0.1)
61
- json (~> 1.4)
62
- safe_yaml (0.9.7)
63
- shoulda (3.5.0)
64
- shoulda-context (~> 1.0, >= 1.0.1)
65
- shoulda-matchers (>= 1.4.1, < 3.0)
66
- shoulda-context (1.1.6)
67
- shoulda-matchers (2.4.0)
68
- activesupport (>= 3.0.0)
69
- simplecov (0.8.2)
70
- docile (~> 1.1.0)
71
- multi_json
72
- simplecov-html (~> 0.8.0)
73
- simplecov-html (0.8.0)
74
- thread_safe (0.1.3)
75
- atomic
76
- turn (0.9.6)
77
- ansi
78
- tzinfo (0.3.38)
79
- vcr (2.8.0)
80
- webmock (1.8.11)
81
- addressable (>= 2.2.7)
82
- crack (>= 0.1.7)
35
+ i18n (1.14.7)
36
+ concurrent-ruby (~> 1.0)
37
+ logger (1.7.0)
38
+ mini_mime (1.1.5)
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)
52
+ shoulda (4.0.0)
53
+ shoulda-context (~> 2.0)
54
+ shoulda-matchers (~> 4.0)
55
+ shoulda-context (2.0.0)
56
+ shoulda-matchers (4.5.1)
57
+ activesupport (>= 4.2.0)
58
+ simplecov (0.22.0)
59
+ docile (~> 1.1)
60
+ simplecov-html (~> 0.11)
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)
72
+ crack (>= 0.3.2)
73
+ hashdiff (>= 0.4.0, < 2.0.0)
83
74
 
84
75
  PLATFORMS
76
+ arm64-darwin-24
85
77
  ruby
86
78
 
87
79
  DEPENDENCIES
88
80
  bundler
89
- httparty (= 0.12.0)
90
- jeweler (= 1.8.8)
91
- minitest
81
+ httparty (~> 0.21.0)
82
+ minitest (~> 5.0)
92
83
  rake
93
84
  rdoc
94
85
  shoulda
95
86
  simplecov
96
- turn
97
87
  vcr
98
- webmock (< 1.9)
88
+ webmock
89
+
90
+ RUBY VERSION
91
+ ruby 3.2.8p263
92
+
93
+ BUNDLED WITH
94
+ 2.7.0
data/README.md CHANGED
@@ -1,18 +1,18 @@
1
1
  enrico
2
2
  ===========
3
3
 
4
- enrico is a small wrapper around the JSON API from [enrico](http://kayaposoft.com/enrico/json/)
4
+ enrico is a small wrapper around the JSON API from [enrico v2](http://kayaposoft.com/enrico/json/)
5
5
 
6
6
  The Enrico Service
7
7
  ------------------
8
8
 
9
9
  ```
10
- Enrico Service is a free service written in PHP providing public holidays for several
11
- countries. You can use either web service or json to get public holidays from Enrico.
12
- Each provided public holiday includes date and name of the holiday in the local language
13
- and English. Public holidays for the countries like U.S. or Germany are provided separately for each state.
14
- You can use Enrico Service to display public holidays on your website or in your desktop application written in any programming language.
15
- lthough Enrico is free to use, we do not provide the source code for download. If you are interested in hosting Enrico on your
10
+ Enrico Service is a free service written in PHP providing public holidays for several
11
+ countries. You can use either web service or json to get public holidays from Enrico.
12
+ Each provided public holiday includes date and name of the holiday in the local language
13
+ and English. Public holidays for the countries like U.S. or Germany are provided separately for each state.
14
+ You can use Enrico Service to display public holidays on your website or in your desktop application written in any programming language.
15
+ lthough Enrico is free to use, we do not provide the source code for download. If you are interested in hosting Enrico on your
16
16
  server, please contact us on enrico@kayaposoft.com.
17
17
  ```
18
18
 
@@ -39,15 +39,18 @@ country.regions
39
39
  enrico implements only a couple of methods, which are pretty much self explanatory:
40
40
 
41
41
  ```ruby
42
- country.public_holidays_for_month(Date.today)
42
+ country.holidays_for_month(Date.today)
43
+ country.holidays_for_month(Date.today, holiday_type: 'public_holiday')
43
44
  ```
44
45
 
45
46
  ```ruby
46
- country.public_holidays_for_year(Date.today)
47
+ country.holidays_for_year(Date.today)
48
+ country.holidays_for_year(Date.today, holiday_type: 'public_holiday')
47
49
  ```
48
50
 
49
51
  ```ruby
50
- country.public_holidays_for_date_range(Date.today, Date.today + 2.month)
52
+ country.holidays_for_year(Date.today)
53
+ country.holidays_for_year(Date.today, holiday_type: 'public_holiday')
51
54
  ```
52
55
 
53
56
  ```ruby
@@ -80,7 +83,7 @@ Copyright (c) 2012 easyPEP UG
80
83
 
81
84
  Permission is hereby granted, free of charge, to any person obtaining
82
85
  a copy of this software and associated documentation files (the
83
- "Software"), to use, copy and modify copies of the Software, subject
86
+ "Software"), to use, copy and modify copies of the Software, subject
84
87
  to the following conditions:
85
88
 
86
89
  The above copyright notice and this permission notice shall be
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 = "http://github.com/easyPEP/enrico"
19
- gem.license = "MIT"
20
- gem.summary = "A ruby wrapper around enrico holiday API"
21
- gem.description = "http://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.1.6
1
+ 0.2.2
data/enrico.gemspec CHANGED
@@ -2,17 +2,18 @@
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.1.6 ruby lib
5
+ # stub: enrico 0.2.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
- s.name = "enrico"
9
- s.version = "0.1.6"
8
+ s.name = "enrico".freeze
9
+ s.version = "0.2.2"
10
10
 
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.authors = ["Kalle Saas"]
13
- s.date = "2013-12-02"
14
- s.description = "http://github.com/easyPEP/enrico"
15
- s.email = "kalle@easypep.de"
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib".freeze]
13
+ s.authors = ["Kalle Saas".freeze, "Martin Gregoire".freeze]
14
+ s.date = "2025-07-18"
15
+ s.description = "https://github.com/easyPEP/enrico".freeze
16
+ s.email = "kalle@easypep.de".freeze
16
17
  s.extra_rdoc_files = [
17
18
  "LICENSE.txt",
18
19
  "README.md",
@@ -20,6 +21,8 @@ Gem::Specification.new do |s|
20
21
  ]
21
22
  s.files = [
22
23
  ".document",
24
+ ".github/workflows/test.yml",
25
+ ".ruby-version",
23
26
  "Gemfile",
24
27
  "Gemfile.lock",
25
28
  "LICENSE.txt",
@@ -27,16 +30,15 @@ Gem::Specification.new do |s|
27
30
  "README.rdoc",
28
31
  "Rakefile",
29
32
  "VERSION",
30
- "enrico-0.1.5.gem",
31
- "enrico-0.1.6.gem",
32
33
  "enrico.gemspec",
33
34
  "lib/enrico.rb",
34
35
  "lib/enrico/country.rb",
35
36
  "lib/enrico/vacation_day.rb",
37
+ "mise.toml",
38
+ "spec/fixtures/vcr_cassettes/holidays_in_date_range.yml",
39
+ "spec/fixtures/vcr_cassettes/holidays_in_month.yml",
40
+ "spec/fixtures/vcr_cassettes/holidays_in_year.yml",
36
41
  "spec/fixtures/vcr_cassettes/is_public_holiday.yml",
37
- "spec/fixtures/vcr_cassettes/public_holidays_in_date_range.yml",
38
- "spec/fixtures/vcr_cassettes/public_holidays_in_month.yml",
39
- "spec/fixtures/vcr_cassettes/public_holidays_in_year.yml",
40
42
  "spec/fixtures/vcr_cassettes/supported_countries.yml",
41
43
  "spec/lib/enrico/country_public_holidays_for_month_spec.rb",
42
44
  "spec/lib/enrico/country_spec.rb",
@@ -44,40 +46,39 @@ Gem::Specification.new do |s|
44
46
  "spec/lib/enrico/vacation_day_spec.rb",
45
47
  "spec/spec_helper.rb"
46
48
  ]
47
- s.homepage = "http://github.com/easyPEP/enrico"
48
- s.licenses = ["MIT"]
49
- s.require_paths = ["lib"]
50
- s.rubygems_version = "2.1.5"
51
- s.summary = "A ruby wrapper around enrico holiday API"
49
+ s.homepage = "https://github.com/easyPEP/enrico".freeze
50
+ s.licenses = ["MIT".freeze]
51
+ s.rubygems_version = "3.0.3.1".freeze
52
+ s.summary = "A ruby wrapper around enrico holiday API".freeze
52
53
 
53
54
  if s.respond_to? :specification_version then
54
55
  s.specification_version = 4
55
56
 
56
57
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
57
- s.add_runtime_dependency(%q<httparty>, ["= 0.12.0"])
58
- s.add_development_dependency(%q<bundler>, [">= 0"])
59
- s.add_development_dependency(%q<jeweler>, ["= 1.8.8"])
60
- s.add_development_dependency(%q<simplecov>, [">= 0"])
61
- s.add_development_dependency(%q<rdoc>, [">= 0"])
62
- s.add_development_dependency(%q<shoulda>, [">= 0"])
63
- s.add_development_dependency(%q<minitest>, [">= 0"])
58
+ s.add_runtime_dependency(%q<httparty>.freeze, ["~> 0.21.0"])
59
+ s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
60
+ s.add_development_dependency(%q<jeweler>.freeze, [">= 0"])
61
+ s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
62
+ s.add_development_dependency(%q<rdoc>.freeze, [">= 0"])
63
+ s.add_development_dependency(%q<shoulda>.freeze, [">= 0"])
64
+ s.add_development_dependency(%q<minitest>.freeze, [">= 0"])
64
65
  else
65
- s.add_dependency(%q<httparty>, ["= 0.12.0"])
66
- s.add_dependency(%q<bundler>, [">= 0"])
67
- s.add_dependency(%q<jeweler>, ["= 1.8.8"])
68
- s.add_dependency(%q<simplecov>, [">= 0"])
69
- s.add_dependency(%q<rdoc>, [">= 0"])
70
- s.add_dependency(%q<shoulda>, [">= 0"])
71
- s.add_dependency(%q<minitest>, [">= 0"])
66
+ s.add_dependency(%q<httparty>.freeze, ["~> 0.21.0"])
67
+ s.add_dependency(%q<bundler>.freeze, [">= 0"])
68
+ s.add_dependency(%q<jeweler>.freeze, [">= 0"])
69
+ s.add_dependency(%q<simplecov>.freeze, [">= 0"])
70
+ s.add_dependency(%q<rdoc>.freeze, [">= 0"])
71
+ s.add_dependency(%q<shoulda>.freeze, [">= 0"])
72
+ s.add_dependency(%q<minitest>.freeze, [">= 0"])
72
73
  end
73
74
  else
74
- s.add_dependency(%q<httparty>, ["= 0.12.0"])
75
- s.add_dependency(%q<bundler>, [">= 0"])
76
- s.add_dependency(%q<jeweler>, ["= 1.8.8"])
77
- s.add_dependency(%q<simplecov>, [">= 0"])
78
- s.add_dependency(%q<rdoc>, [">= 0"])
79
- s.add_dependency(%q<shoulda>, [">= 0"])
80
- s.add_dependency(%q<minitest>, [">= 0"])
75
+ s.add_dependency(%q<httparty>.freeze, ["~> 0.21.0"])
76
+ s.add_dependency(%q<bundler>.freeze, [">= 0"])
77
+ s.add_dependency(%q<jeweler>.freeze, [">= 0"])
78
+ s.add_dependency(%q<simplecov>.freeze, [">= 0"])
79
+ s.add_dependency(%q<rdoc>.freeze, [">= 0"])
80
+ s.add_dependency(%q<shoulda>.freeze, [">= 0"])
81
+ s.add_dependency(%q<minitest>.freeze, [">= 0"])
81
82
  end
82
83
  end
83
84
 
@@ -7,7 +7,7 @@ module Enrico
7
7
 
8
8
  include HTTParty
9
9
 
10
- base_uri 'http://kayaposoft.com/enrico/json/v1.0'
10
+ base_uri 'https://kayaposoft.com/enrico/json/v2.0'
11
11
 
12
12
  def initialize(country_code, region = nil)
13
13
  self.country_code = country_code
@@ -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 public_holidays_for_month(date)
26
- response = self.get_public_holidays_for_month(date)
25
+ def holidays_for_month(date)
26
+ response = self.get_holidays_for_month(date)
27
27
  self.vacation_days_from_response(response)
28
28
  end
29
29
 
30
- def public_holidays_for_year(date)
31
- response = self.get_public_holidays_for_year(date)
30
+ def holidays_for_year(date)
31
+ response = self.get_holidays_for_year(date)
32
32
  self.vacation_days_from_response(response)
33
33
  end
34
34
 
35
- def public_holidays_for_date_range(from_date, to_date)
36
- response = self.get_public_holidays_for_date_range(from_date, to_date)
35
+ def holidays_for_date_range(from_date, to_date)
36
+ response = self.get_holidays_for_date_range(from_date, to_date)
37
37
  self.vacation_days_from_response(response)
38
38
  end
39
39
 
@@ -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
 
@@ -59,10 +59,14 @@ module Enrico
59
59
  vacation_days
60
60
  end
61
61
 
62
- def country_parameters(params)
63
- base = { country: self.country_code, region: self.region }
64
- base.merge!(params)
65
- base.to_query
62
+ def country_parameters(params, holiday_type: nil)
63
+ result = {
64
+ country: self.country_code,
65
+ region: self.region
66
+ }.merge(params)
67
+ result[:holidayType] = holiday_type if holiday_type && !holiday_type.empty?
68
+
69
+ URI.encode_www_form(result.compact)
66
70
  end
67
71
 
68
72
  def is_public_holiday(date)
@@ -70,23 +74,20 @@ module Enrico
70
74
  self.class.get("/?action=isPublicHoliday&#{params}")
71
75
  end
72
76
 
73
- def get_public_holidays_for_month(date)
74
- params = country_parameters({month: date.month, year: date.year})
75
- self.class.get("/?action=getPublicHolidaysForMonth&#{params}")
77
+ def get_holidays_for_month(date, holiday_type: nil)
78
+ params = country_parameters({month: date.month, year: date.year}, holiday_type: holiday_type)
79
+ self.class.get("/?action=getHolidaysForMonth&#{params}")
76
80
  end
77
81
 
78
- def get_public_holidays_for_year(date)
79
- params = country_parameters({year: date.year})
80
- self.class.get("/?action=getPublicHolidaysForYear&#{params}")
82
+ def get_holidays_for_year(date, holiday_type: nil)
83
+ params = country_parameters({year: date.year}, holiday_type: holiday_type)
84
+ self.class.get("/?action=getHolidaysForYear&#{params}")
81
85
  end
82
86
 
83
- def get_public_holidays_for_date_range(from_date, to_date)
84
- params = country_parameters({fromDate: from_date.strftime("%d-%m-%Y"), toDate: to_date.strftime("%d-%m-%Y")})
85
- self.class.get("/?action=getPublicHolidaysForDateRange&#{params}")
87
+ def get_holidays_for_date_range(from_date, to_date, holiday_type: nil)
88
+ params = country_parameters({fromDate: from_date.strftime("%d-%m-%Y"), toDate: to_date.strftime("%d-%m-%Y")}, holiday_type: holiday_type)
89
+ self.class.get("/?action=getHolidaysForDateRange&#{params}")
86
90
  end
87
91
 
88
92
  end
89
93
  end
90
-
91
-
92
-
@@ -2,14 +2,12 @@
2
2
 
3
3
  module Enrico
4
4
  class VacationDay
5
-
6
5
  attr_accessor :date, :local_name, :english_name
7
6
 
8
7
  def initialize(args)
9
8
  self.date = Date.new( args["date"]["year"].to_i, args["date"]["month"].to_i, args["date"]["day"].to_i )
10
- self.local_name = args["localName"]
11
- self.english_name = args["englishName"]
9
+ self.local_name = args["name"][0]["text"]
10
+ self.english_name = args["name"][1] && !args["name"][1].empty? ? args["name"][1]["text"] : args["name"][0]["text"]
12
11
  end
13
-
14
12
  end
15
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 ADDED
@@ -0,0 +1,2 @@
1
+ [tools]
2
+ ruby = "3.2.8"
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://kayaposoft.com/enrico/json/v2.0/?action=getHolidaysForDateRange&country=deu&fromDate=01-01-2020&toDate=31-03-2020
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ 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
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - openresty
23
+ Date:
24
+ - Fri, 18 Jul 2025 13:15:54 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Keep-Alive:
32
+ - timeout=10
33
+ Vary:
34
+ - Accept-Encoding
35
+ Access-Control-Allow-Origin:
36
+ - "*"
37
+ Alt-Svc:
38
+ - h3=":443"; ma=86400
39
+ body:
40
+ encoding: ASCII-8BIT
41
+ string: '[{"date":{"day":1,"month":1,"year":2020,"dayOfWeek":3},"name":[{"lang":"de","text":"Neujahrstag"},{"lang":"en","text":"New
42
+ Year''s Day"}],"holidayType":"public_holiday"},{"date":{"day":8,"month":3,"year":2020,"dayOfWeek":7},"name":[{"lang":"de","text":"Internationaler
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
44
+ der Sommerzeit"},{"lang":"en","text":"Daylight Saving Time Starts"}],"note":[{"lang":"de","text":"Die
45
+ Uhr wird um eine Stunde von 2:00 Uhr auf 3:00 Uhr vorgestellt"},{"lang":"en","text":"A
46
+ one-hour shift occurs at 02:00 local time, the clock jumps forward to 03:00"}],"holidayType":"other_day"}]'
47
+ recorded_at: Fri, 18 Jul 2025 13:15:27 GMT
48
+ recorded_with: VCR 6.3.1