enrico 0.1.6 → 0.2.1
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 +5 -13
- data/.github/workflows/test.yml +21 -0
- data/.ruby-version +1 -0
- data/Gemfile +6 -3
- data/Gemfile.lock +87 -71
- data/README.md +14 -11
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/enrico.gemspec +40 -39
- data/lib/enrico/country.rb +24 -23
- data/lib/enrico/vacation_day.rb +2 -4
- data/mise.toml +2 -0
- data/spec/fixtures/vcr_cassettes/holidays_in_date_range.yml +110 -0
- data/spec/fixtures/vcr_cassettes/holidays_in_month.yml +67 -0
- data/spec/fixtures/vcr_cassettes/holidays_in_year.yml +100 -0
- data/spec/fixtures/vcr_cassettes/is_public_holiday.yml +80 -14
- data/spec/fixtures/vcr_cassettes/supported_countries.yml +245 -101
- data/spec/lib/enrico/country_public_holidays_for_month_spec.rb +31 -27
- data/spec/lib/enrico/country_spec.rb +17 -17
- data/spec/lib/enrico/is_public_holiday_spec.rb +5 -6
- data/spec/lib/enrico/vacation_day_spec.rb +36 -18
- metadata +35 -39
- data/enrico-0.1.5.gem +0 -0
- data/enrico-0.1.6.gem +0 -0
- data/spec/fixtures/vcr_cassettes/public_holidays_in_date_range.yml +0 -33
- data/spec/fixtures/vcr_cassettes/public_holidays_in_month.yml +0 -33
- data/spec/fixtures/vcr_cassettes/public_holidays_in_year.yml +0 -41
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MDRhZGI5OTQ3ZTE4MDlmNzYyZWMyNGU2YWRkMDAwMWZiM2YwZDBhNw==
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e0b4284f18313432a7dee8a1e136124640ec57c209b6a561a587c3ea3d06040f
|
4
|
+
data.tar.gz: 41e49cd778f06f64c40da5def29fa3bff9b3b4e6639484d907d22566d3630de2
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
NjllMDQxMTNiMmU0MTk3MWIyMTQyYTdmZWFjMTYxMzYwZDM1ZjE4ZDIyMWY2
|
11
|
-
MzE1ZWQwMWYxMmJlMzM5YzhmNzA1ZWRlYWIxMzQ5NTFlZTEyMzI=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YzZmMzlmNjU5YmM1MWRjMmYyOTY2MjQ5ZDM1Zjg1ODA4NDQxN2I2NGViMjIw
|
14
|
-
MWFjOTE0OGU2OWZhMGUyYWEzOGQwN2UwM2MzNGU4MzhlY2U2YWYzZTRhMWIx
|
15
|
-
MzI1NGQxNjBkZTMzM2ZmN2YwN2QwNDk0Y2ExZDI3NjY2MmRlOGY=
|
6
|
+
metadata.gz: db42d425e79f2eb8994bb61599b010aa86e94cea6d901a0e65c93a2ccf5476043d25398b61e8035114dc04317bc8bed71964d9a0db82a27f8ba7f122f3b8c47b
|
7
|
+
data.tar.gz: 7a601e5ae90395d6a1174fd8423fc1fe643c6ee46fedc5b290cb9de0dbcb4aaceef83361f2b7caea902c633d5e74aab12ed1e2d3f98258f8a06e9ecc54975a78
|
@@ -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: 2.6.10
|
19
|
+
bundler-cache: true
|
20
|
+
- name: Run tests
|
21
|
+
run: bundle exec rake test
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.6.10
|
data/Gemfile
CHANGED
@@ -1,15 +1,18 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
|
+
|
3
|
+
ruby '2.6.10'
|
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.
|
11
|
+
gem 'httparty', '~> 0.21.0'
|
9
12
|
|
10
13
|
group :development do
|
11
14
|
gem "bundler"
|
12
|
-
gem "jeweler"
|
15
|
+
gem "jeweler"
|
13
16
|
gem "simplecov"
|
14
17
|
gem "rdoc"
|
15
18
|
gem "shoulda"
|
@@ -17,7 +20,7 @@ group :development do
|
|
17
20
|
end
|
18
21
|
|
19
22
|
group :test do
|
20
|
-
gem 'webmock'
|
23
|
+
gem 'webmock'
|
21
24
|
gem 'vcr'
|
22
25
|
gem 'turn'
|
23
26
|
gem 'rake'
|
data/Gemfile.lock
CHANGED
@@ -1,93 +1,103 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (4.
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
ansi (1.
|
12
|
-
|
13
|
-
|
14
|
-
crack (0.4.
|
15
|
-
safe_yaml (~> 0.
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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)
|
23
27
|
hashie (>= 1.2)
|
24
|
-
multi_json (
|
25
|
-
nokogiri (~> 1.
|
28
|
+
multi_json (>= 1.7.5, < 2.0)
|
29
|
+
nokogiri (~> 1.6.0)
|
26
30
|
oauth2
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
+
hashdiff (1.0.1)
|
32
|
+
hashie (4.1.0)
|
33
|
+
highline (2.0.3)
|
34
|
+
httparty (0.21.0)
|
35
|
+
mini_mime (>= 1.0.0)
|
31
36
|
multi_xml (>= 0.5.2)
|
32
|
-
|
33
|
-
|
34
|
-
jeweler (
|
37
|
+
i18n (1.8.5)
|
38
|
+
concurrent-ruby (~> 1.0)
|
39
|
+
jeweler (2.3.5)
|
35
40
|
builder
|
36
|
-
bundler (
|
41
|
+
bundler (>= 1.0)
|
37
42
|
git (>= 1.2.5)
|
38
|
-
github_api (
|
43
|
+
github_api (~> 0.11.0)
|
39
44
|
highline (>= 1.6.15)
|
40
|
-
nokogiri (
|
45
|
+
nokogiri (>= 1.5.10)
|
46
|
+
psych (~> 2.2)
|
41
47
|
rake
|
42
48
|
rdoc
|
43
|
-
|
44
|
-
jwt (
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
49
|
+
semver2
|
50
|
+
jwt (2.2.2)
|
51
|
+
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)
|
56
63
|
multi_xml (~> 0.5)
|
57
|
-
rack (
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
shoulda
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
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)
|
73
|
+
shoulda (4.0.0)
|
74
|
+
shoulda-context (~> 2.0)
|
75
|
+
shoulda-matchers (~> 4.0)
|
76
|
+
shoulda-context (2.0.0)
|
77
|
+
shoulda-matchers (4.4.0)
|
78
|
+
activesupport (>= 4.2.0)
|
79
|
+
simplecov (0.18.5)
|
80
|
+
docile (~> 1.1)
|
81
|
+
simplecov-html (~> 0.11)
|
82
|
+
simplecov-html (0.12.2)
|
83
|
+
thread_safe (0.3.6)
|
76
84
|
turn (0.9.6)
|
77
85
|
ansi
|
78
|
-
tzinfo (
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
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)
|
91
|
+
crack (>= 0.3.2)
|
92
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
83
93
|
|
84
94
|
PLATFORMS
|
85
95
|
ruby
|
86
96
|
|
87
97
|
DEPENDENCIES
|
88
98
|
bundler
|
89
|
-
httparty (
|
90
|
-
jeweler
|
99
|
+
httparty (~> 0.21.0)
|
100
|
+
jeweler
|
91
101
|
minitest
|
92
102
|
rake
|
93
103
|
rdoc
|
@@ -95,4 +105,10 @@ DEPENDENCIES
|
|
95
105
|
simplecov
|
96
106
|
turn
|
97
107
|
vcr
|
98
|
-
webmock
|
108
|
+
webmock
|
109
|
+
|
110
|
+
RUBY VERSION
|
111
|
+
ruby 2.6.10p210
|
112
|
+
|
113
|
+
BUNDLED WITH
|
114
|
+
2.0.2
|
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.
|
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.
|
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.
|
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
@@ -15,10 +15,10 @@ require 'jeweler'
|
|
15
15
|
Jeweler::Tasks.new do |gem|
|
16
16
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
17
|
gem.name = "enrico"
|
18
|
-
gem.homepage = "
|
18
|
+
gem.homepage = "https://github.com/easyPEP/enrico"
|
19
19
|
gem.license = "MIT"
|
20
20
|
gem.summary = "A ruby wrapper around enrico holiday API"
|
21
|
-
gem.description = "
|
21
|
+
gem.description = "https://github.com/easyPEP/enrico"
|
22
22
|
gem.email = "kalle@easypep.de"
|
23
23
|
gem.authors = ["Kalle Saas"]
|
24
24
|
# dependencies defined in Gemfile
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1
|
1
|
+
0.2.1
|
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
|
5
|
+
# stub: enrico 0.2.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
|
-
s.name = "enrico"
|
9
|
-
s.version = "0.1
|
8
|
+
s.name = "enrico".freeze
|
9
|
+
s.version = "0.2.1"
|
10
10
|
|
11
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
-
s.
|
13
|
-
s.
|
14
|
-
s.
|
15
|
-
s.
|
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]
|
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 = "
|
48
|
-
s.licenses = ["MIT"]
|
49
|
-
s.
|
50
|
-
s.
|
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
|
58
|
-
s.add_development_dependency(%q<bundler
|
59
|
-
s.add_development_dependency(%q<jeweler
|
60
|
-
s.add_development_dependency(%q<simplecov
|
61
|
-
s.add_development_dependency(%q<rdoc
|
62
|
-
s.add_development_dependency(%q<shoulda
|
63
|
-
s.add_development_dependency(%q<minitest
|
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
|
66
|
-
s.add_dependency(%q<bundler
|
67
|
-
s.add_dependency(%q<jeweler
|
68
|
-
s.add_dependency(%q<simplecov
|
69
|
-
s.add_dependency(%q<rdoc
|
70
|
-
s.add_dependency(%q<shoulda
|
71
|
-
s.add_dependency(%q<minitest
|
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
|
75
|
-
s.add_dependency(%q<bundler
|
76
|
-
s.add_dependency(%q<jeweler
|
77
|
-
s.add_dependency(%q<simplecov
|
78
|
-
s.add_dependency(%q<rdoc
|
79
|
-
s.add_dependency(%q<shoulda
|
80
|
-
s.add_dependency(%q<minitest
|
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
|
|
data/lib/enrico/country.rb
CHANGED
@@ -7,7 +7,7 @@ module Enrico
|
|
7
7
|
|
8
8
|
include HTTParty
|
9
9
|
|
10
|
-
base_uri '
|
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
|
26
|
-
response = self.
|
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
|
31
|
-
response = self.
|
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
|
36
|
-
response = self.
|
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
|
|
@@ -59,10 +59,14 @@ module Enrico
|
|
59
59
|
vacation_days
|
60
60
|
end
|
61
61
|
|
62
|
-
def country_parameters(params)
|
63
|
-
|
64
|
-
|
65
|
-
|
62
|
+
def country_parameters(params, holiday_type: nil)
|
63
|
+
{
|
64
|
+
country: self.country_code,
|
65
|
+
region: self.region
|
66
|
+
}
|
67
|
+
.merge(params)
|
68
|
+
.tap { |result| result[:holidayType] = holiday_type if holiday_type.present? }
|
69
|
+
.to_query
|
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
|
74
|
-
params = country_parameters({month: date.month, year: date.year})
|
75
|
-
self.class.get("/?action=
|
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
|
79
|
-
params = country_parameters({year: date.year})
|
80
|
-
self.class.get("/?action=
|
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
|
84
|
-
params = country_parameters({fromDate: from_date.strftime("%d-%m-%Y"), toDate: to_date.strftime("%d-%m-%Y")})
|
85
|
-
self.class.get("/?action=
|
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
|
-
|
data/lib/enrico/vacation_day.rb
CHANGED
@@ -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["
|
11
|
-
self.english_name = args["
|
9
|
+
self.local_name = args["name"][0]["text"]
|
10
|
+
self.english_name = args["name"][1].present? ? args["name"][1]["text"] : args["name"][0]["text"]
|
12
11
|
end
|
13
|
-
|
14
12
|
end
|
15
13
|
end
|
data/mise.toml
ADDED