enrico 0.2.1 → 0.2.3
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/.github/workflows/test.yml +1 -1
- data/.ruby-version +1 -1
- data/Gemfile +4 -6
- data/Gemfile.lock +65 -83
- data/Rakefile +0 -14
- data/VERSION +1 -1
- data/enrico.gemspec +6 -12
- data/lib/enrico/country.rb +6 -6
- data/lib/enrico/vacation_day.rb +1 -1
- data/lib/enrico.rb +0 -1
- data/mise.toml +1 -1
- data/spec/fixtures/vcr_cassettes/holidays_in_date_range.yml +4 -66
- data/spec/fixtures/vcr_cassettes/holidays_in_month.yml +17 -40
- data/spec/fixtures/vcr_cassettes/holidays_in_year.yml +17 -56
- data/spec/fixtures/vcr_cassettes/is_public_holiday.yml +27 -71
- data/spec/lib/enrico/country_public_holidays_for_month_spec.rb +3 -3
- data/spec/lib/enrico/country_spec.rb +72 -1
- data/spec/lib/enrico/is_public_holiday_spec.rb +1 -1
- data/spec/lib/enrico/vacation_day_spec.rb +76 -33
- metadata +6 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6aebe18d370cc0a185a2269a784488b142ebdaccb01be9d52b33e631acc83fef
|
|
4
|
+
data.tar.gz: 3d320aeb1e28880d0ea0cc14ac316c1a2e50725e85af6d7f18111220a9b2739d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a444c959dc465dd321a43cc6d54a12a618523ba1ba290a07bb5ed800f86ad6bbe3e4afbf9dcefd0e3b0d3d74b4435c2d1387541503a28428d5676dddde339a00
|
|
7
|
+
data.tar.gz: '0598d08ef9957773f62abb4c2cddd4fc017350f827370e11e86d781f6d2a622d8bf8112dabd00c35148849b16287d50555ac8d1ac2c19f6172fcdc99e35c50a4'
|
data/.github/workflows/test.yml
CHANGED
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
3.2.8
|
data/Gemfile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
source "
|
|
1
|
+
source "https://rubygems.org"
|
|
2
2
|
|
|
3
|
-
ruby '2.
|
|
3
|
+
ruby '3.2.8'
|
|
4
4
|
|
|
5
5
|
# Add dependencies required to use your gem here.
|
|
6
6
|
# Example:
|
|
@@ -8,20 +8,18 @@ ruby '2.6.10'
|
|
|
8
8
|
|
|
9
9
|
# Add dependencies to develop your gem here.
|
|
10
10
|
# Include everything needed to run rake, tests, features, etc.
|
|
11
|
-
gem 'httparty', '~> 0.
|
|
11
|
+
gem 'httparty', '~> 0.24.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,96 @@
|
|
|
1
1
|
GEM
|
|
2
|
-
remote:
|
|
2
|
+
remote: https://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
activesupport (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
+
csv (3.3.5)
|
|
28
|
+
date (3.4.1)
|
|
29
|
+
docile (1.4.1)
|
|
30
|
+
drb (2.2.3)
|
|
31
|
+
erb (5.0.2)
|
|
32
|
+
hashdiff (1.2.0)
|
|
33
|
+
httparty (0.24.0)
|
|
34
|
+
csv
|
|
35
35
|
mini_mime (>= 1.0.0)
|
|
36
36
|
multi_xml (>= 0.5.2)
|
|
37
|
-
i18n (1.
|
|
37
|
+
i18n (1.14.7)
|
|
38
38
|
concurrent-ruby (~> 1.0)
|
|
39
|
-
|
|
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)
|
|
39
|
+
logger (1.7.0)
|
|
51
40
|
mini_mime (1.1.5)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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)
|
|
41
|
+
minitest (5.25.5)
|
|
42
|
+
multi_xml (0.7.2)
|
|
43
|
+
bigdecimal (~> 3.1)
|
|
44
|
+
psych (5.2.6)
|
|
45
|
+
date
|
|
46
|
+
stringio
|
|
47
|
+
public_suffix (6.0.2)
|
|
48
|
+
rake (13.3.0)
|
|
49
|
+
rdoc (6.14.2)
|
|
50
|
+
erb
|
|
51
|
+
psych (>= 4.0.0)
|
|
52
|
+
rexml (3.4.2)
|
|
53
|
+
securerandom (0.4.1)
|
|
73
54
|
shoulda (4.0.0)
|
|
74
55
|
shoulda-context (~> 2.0)
|
|
75
56
|
shoulda-matchers (~> 4.0)
|
|
76
57
|
shoulda-context (2.0.0)
|
|
77
|
-
shoulda-matchers (4.
|
|
58
|
+
shoulda-matchers (4.5.1)
|
|
78
59
|
activesupport (>= 4.2.0)
|
|
79
|
-
simplecov (0.
|
|
60
|
+
simplecov (0.22.0)
|
|
80
61
|
docile (~> 1.1)
|
|
81
62
|
simplecov-html (~> 0.11)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
tzinfo (
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
63
|
+
simplecov_json_formatter (~> 0.1)
|
|
64
|
+
simplecov-html (0.13.2)
|
|
65
|
+
simplecov_json_formatter (0.1.4)
|
|
66
|
+
stringio (3.1.7)
|
|
67
|
+
tzinfo (2.0.6)
|
|
68
|
+
concurrent-ruby (~> 1.0)
|
|
69
|
+
uri (1.0.4)
|
|
70
|
+
vcr (6.3.1)
|
|
71
|
+
base64
|
|
72
|
+
webmock (3.25.1)
|
|
73
|
+
addressable (>= 2.8.0)
|
|
91
74
|
crack (>= 0.3.2)
|
|
92
75
|
hashdiff (>= 0.4.0, < 2.0.0)
|
|
93
76
|
|
|
94
77
|
PLATFORMS
|
|
78
|
+
arm64-darwin-24
|
|
95
79
|
ruby
|
|
96
80
|
|
|
97
81
|
DEPENDENCIES
|
|
98
82
|
bundler
|
|
99
|
-
httparty (~> 0.
|
|
100
|
-
|
|
101
|
-
minitest
|
|
83
|
+
httparty (~> 0.24.0)
|
|
84
|
+
minitest (~> 5.0)
|
|
102
85
|
rake
|
|
103
86
|
rdoc
|
|
104
87
|
shoulda
|
|
105
88
|
simplecov
|
|
106
|
-
turn
|
|
107
89
|
vcr
|
|
108
90
|
webmock
|
|
109
91
|
|
|
110
92
|
RUBY VERSION
|
|
111
|
-
ruby 2.
|
|
93
|
+
ruby 3.2.8p263
|
|
112
94
|
|
|
113
95
|
BUNDLED WITH
|
|
114
|
-
2.0
|
|
96
|
+
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
|
+
0.2.3
|
data/enrico.gemspec
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
# Generated by jeweler
|
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
|
-
# -*- encoding: utf-8 -*-
|
|
5
|
-
# stub: enrico 0.2.1 ruby lib
|
|
6
|
-
|
|
7
1
|
Gem::Specification.new do |s|
|
|
8
2
|
s.name = "enrico".freeze
|
|
9
|
-
s.version = "0.2.
|
|
3
|
+
s.version = "0.2.3"
|
|
10
4
|
|
|
11
5
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
12
6
|
s.require_paths = ["lib".freeze]
|
|
13
|
-
s.authors = ["Kalle Saas".freeze]
|
|
14
|
-
s.date = "
|
|
7
|
+
s.authors = ["Kalle Saas".freeze, "Martin Gregoire".freeze]
|
|
8
|
+
s.date = "2026-01-06"
|
|
15
9
|
s.description = "https://github.com/easyPEP/enrico".freeze
|
|
16
10
|
s.email = "kalle@easypep.de".freeze
|
|
17
11
|
s.extra_rdoc_files = [
|
|
@@ -55,7 +49,7 @@ Gem::Specification.new do |s|
|
|
|
55
49
|
s.specification_version = 4
|
|
56
50
|
|
|
57
51
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
58
|
-
s.add_runtime_dependency(%q<httparty>.freeze, ["~> 0.
|
|
52
|
+
s.add_runtime_dependency(%q<httparty>.freeze, ["~> 0.24.0"])
|
|
59
53
|
s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
|
|
60
54
|
s.add_development_dependency(%q<jeweler>.freeze, [">= 0"])
|
|
61
55
|
s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
|
|
@@ -63,7 +57,7 @@ Gem::Specification.new do |s|
|
|
|
63
57
|
s.add_development_dependency(%q<shoulda>.freeze, [">= 0"])
|
|
64
58
|
s.add_development_dependency(%q<minitest>.freeze, [">= 0"])
|
|
65
59
|
else
|
|
66
|
-
s.add_dependency(%q<httparty>.freeze, ["~> 0.
|
|
60
|
+
s.add_dependency(%q<httparty>.freeze, ["~> 0.24.0"])
|
|
67
61
|
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
|
68
62
|
s.add_dependency(%q<jeweler>.freeze, [">= 0"])
|
|
69
63
|
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
|
@@ -72,7 +66,7 @@ Gem::Specification.new do |s|
|
|
|
72
66
|
s.add_dependency(%q<minitest>.freeze, [">= 0"])
|
|
73
67
|
end
|
|
74
68
|
else
|
|
75
|
-
s.add_dependency(%q<httparty>.freeze, ["~> 0.
|
|
69
|
+
s.add_dependency(%q<httparty>.freeze, ["~> 0.24.0"])
|
|
76
70
|
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
|
77
71
|
s.add_dependency(%q<jeweler>.freeze, [">= 0"])
|
|
78
72
|
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
data/lib/enrico/country.rb
CHANGED
|
@@ -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.
|
|
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
|
-
.
|
|
68
|
-
|
|
69
|
-
.
|
|
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)
|
data/lib/enrico/vacation_day.rb
CHANGED
|
@@ -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].
|
|
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
data/mise.toml
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
[tools]
|
|
2
|
-
ruby = "2.
|
|
2
|
+
ruby = "3.2.8"
|
|
@@ -2,69 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: get
|
|
5
|
-
uri:
|
|
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®ion=&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®ion=&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
|
-
-
|
|
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:
|
|
110
|
-
recorded_with: VCR 6.
|
|
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:
|
|
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
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
-
|
|
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®ion=&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
|
-
-
|
|
24
|
+
- Fri, 18 Jul 2025 13:15:54 GMT
|
|
51
25
|
Content-Type:
|
|
52
26
|
- application/json
|
|
53
|
-
|
|
54
|
-
-
|
|
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:
|
|
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
|
-
|
|
66
|
-
|
|
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:
|
|
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
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
-
|
|
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®ion=&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
|
-
-
|
|
24
|
+
- Fri, 18 Jul 2025 13:15:54 GMT
|
|
67
25
|
Content-Type:
|
|
68
26
|
- application/json
|
|
69
|
-
|
|
70
|
-
-
|
|
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:
|
|
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
|
-
|
|
99
|
-
|
|
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:
|
|
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
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
-
|
|
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®ion=
|
|
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
|
-
-
|
|
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
|
-
|
|
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=
|
|
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
|
-
|
|
78
|
-
-
|
|
79
|
-
|
|
80
|
-
-
|
|
81
|
-
|
|
82
|
-
-
|
|
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®ion=
|
|
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
|
-
-
|
|
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
|
-
|
|
126
|
-
|
|
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'
|
|
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'
|
|
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'
|
|
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'
|
|
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®ion=by&date=01-01-2024"
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
|
|
90
161
|
end
|
|
@@ -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 "
|
|
9
|
-
|
|
10
|
-
|
|
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"=>
|
|
28
|
+
"date"=>{"day"=>1, "month"=>1, "year"=>2020, "dayOfWeek"=>3},
|
|
13
29
|
"name"=>[
|
|
14
|
-
{
|
|
15
|
-
|
|
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.
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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,14 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: enrico
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
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: []
|
|
11
|
-
date:
|
|
12
|
+
date: 2026-01-06 00:00:00.000000000 Z
|
|
12
13
|
dependencies:
|
|
13
14
|
- !ruby/object:Gem::Dependency
|
|
14
15
|
name: httparty
|
|
@@ -16,14 +17,14 @@ dependencies:
|
|
|
16
17
|
requirements:
|
|
17
18
|
- - "~>"
|
|
18
19
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.
|
|
20
|
+
version: 0.24.0
|
|
20
21
|
type: :runtime
|
|
21
22
|
prerelease: false
|
|
22
23
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
24
|
requirements:
|
|
24
25
|
- - "~>"
|
|
25
26
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.
|
|
27
|
+
version: 0.24.0
|
|
27
28
|
- !ruby/object:Gem::Dependency
|
|
28
29
|
name: bundler
|
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -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.
|
|
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
|