enrico 0.1.2 → 0.1.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.
- data/README.md +7 -31
- data/VERSION +1 -1
- data/enrico.gemspec +1 -1
- data/lib/enrico/country.rb +4 -4
- data/spec/lib/enrico/vacation_day_spec.rb +9 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -28,55 +28,31 @@ require "enrico"
|
|
28
28
|
Enrico::Country.all
|
29
29
|
```
|
30
30
|
|
31
|
-
If you want to get in more details
|
31
|
+
If you want to get in more details about a country, initial Enrico with the ’country_code’
|
32
32
|
|
33
|
-
<<<<<<< HEAD
|
34
|
-
country = Enrico::Country.new("ger")
|
35
|
-
country.details
|
36
|
-
country.regions
|
37
|
-
|
38
|
-
Enrico implements only a couple of methods, which are pretty much self explenatory:
|
39
|
-
|
40
|
-
```
|
41
|
-
country.public_holidays_for_month(Date.today)
|
42
|
-
```
|
43
|
-
|
44
|
-
```
|
45
|
-
country.public_holidays_for_year(Date.today)
|
46
|
-
```
|
47
|
-
|
48
|
-
```
|
49
|
-
country.public_holidays_for_date_range(Date.today, Date.today + 2.month)
|
50
|
-
```
|
51
|
-
|
52
|
-
```
|
53
|
-
country.is_public_holiday?(date)
|
54
|
-
```
|
55
|
-
=======
|
56
33
|
```ruby
|
57
34
|
country = Enrico::Country.new("ger")
|
58
35
|
country.details
|
59
36
|
country.regions
|
60
37
|
```
|
61
38
|
|
62
|
-
|
39
|
+
enrico implements only a couple of methods, which are pretty much self explanatory:
|
63
40
|
|
64
|
-
```
|
41
|
+
```ruby
|
65
42
|
country.public_holidays_for_month(Date.today)
|
66
43
|
```
|
67
44
|
|
68
|
-
```
|
45
|
+
```ruby
|
69
46
|
country.public_holidays_for_year(Date.today)
|
70
47
|
```
|
71
48
|
|
72
|
-
```
|
49
|
+
```ruby
|
73
50
|
country.public_holidays_for_date_range(Date.today, Date.today + 2.month)
|
74
51
|
```
|
75
52
|
|
53
|
+
```ruby
|
54
|
+
country.is_public_holiday?(Date.today)
|
76
55
|
```
|
77
|
-
country.is_public_holiday?(date)
|
78
|
-
```
|
79
|
-
>>>>>>> a4214e5fbbb2b9df5a0110e2a93e0b1913fec159
|
80
56
|
|
81
57
|
Installation
|
82
58
|
------------
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/enrico.gemspec
CHANGED
data/lib/enrico/country.rb
CHANGED
@@ -60,19 +60,19 @@ module Enrico
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def is_public_holiday(date)
|
63
|
-
JSON.parse(self.class.get("/?action=isPublicHoliday&date=#{date.strftime("%d-%m-%Y")}&country=#{self.country_code}®ion=#{self.region}"))
|
63
|
+
JSON.parse(self.class.get("/?action=isPublicHoliday&date=#{date.strftime("%d-%m-%Y")}&country=#{URI::encode(self.country_code)}®ion=#{URI::encode(self.region)}"))
|
64
64
|
end
|
65
65
|
|
66
66
|
def get_public_holidays_for_month(date)
|
67
|
-
JSON.parse(self.class.get("/?action=getPublicHolidaysForMonth&month=#{date.month}&year=#{date.year}&country=#{self.country_code}®ion=#{self.region}"))
|
67
|
+
JSON.parse(self.class.get("/?action=getPublicHolidaysForMonth&month=#{date.month}&year=#{date.year}&country=#{URI::encode(self.country_code)}®ion=#{URI::encode(self.region)}"))
|
68
68
|
end
|
69
69
|
|
70
70
|
def get_public_holidays_for_year(date)
|
71
|
-
JSON.parse(self.class.get("/?action=getPublicHolidaysForYear&year=#{date.year}&country=#{self.country_code}®ion=#{self.region}"))
|
71
|
+
JSON.parse(self.class.get("/?action=getPublicHolidaysForYear&year=#{date.year}&country=#{URI::encode(self.country_code)}®ion=#{URI::encode(self.region)}"))
|
72
72
|
end
|
73
73
|
|
74
74
|
def get_public_holidays_for_date_range(from_date, to_date)
|
75
|
-
JSON.parse(self.class.get("/?action=getPublicHolidaysForDateRange&fromDate=#{from_date.strftime("%d-%m-%Y")}&toDate=#{to_date.strftime("%d-%m-%Y")}&country=#{self.country_code}®ion=#{self.region}"))
|
75
|
+
JSON.parse(self.class.get("/?action=getPublicHolidaysForDateRange&fromDate=#{from_date.strftime("%d-%m-%Y")}&toDate=#{to_date.strftime("%d-%m-%Y")}&country=#{URI::encode(self.country_code)}®ion=#{URI::encode(self.region)}"))
|
76
76
|
end
|
77
77
|
|
78
78
|
end
|
@@ -11,7 +11,15 @@ describe Enrico::VacationDay do
|
|
11
11
|
Enrico::VacationDay.new(Date.today.beginning_of_year, "Neujahrstag", "New Year's Day")
|
12
12
|
}
|
13
13
|
|
14
|
-
it "test
|
14
|
+
it "test initializer methods" do
|
15
|
+
rsp = {"date"=>{"day"=>1, "month"=>1, "year"=>"2012", "dayOfWeek"=>7}, "localName"=>"Neujahrstag", "englishName"=>"New Year's Day"}
|
16
|
+
day = Enrico::VacationDay.new(rsp)
|
17
|
+
day.date.must_equal Date.today.beginning_of_year
|
18
|
+
day.local_name.must_equal "Neujahrstag"
|
19
|
+
day.english_name.must_equal "New Year's Day"
|
20
|
+
end
|
21
|
+
|
22
|
+
it "test initializer methods" do
|
15
23
|
rsp = {"date"=>{"day"=>1, "month"=>1, "year"=>"2012", "dayOfWeek"=>7}, "localName"=>"Neujahrstag", "englishName"=>"New Year's Day"}
|
16
24
|
day = Enrico::VacationDay.new(rsp)
|
17
25
|
day.date.must_equal Date.today.beginning_of_year
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enrico
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -169,7 +169,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
169
169
|
version: '0'
|
170
170
|
segments:
|
171
171
|
- 0
|
172
|
-
hash:
|
172
|
+
hash: -3664893538224163374
|
173
173
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
174
|
none: false
|
175
175
|
requirements:
|