enrico 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/enrico.gemspec +1 -1
- data/lib/enrico.rb +1 -0
- data/lib/enrico/country.rb +14 -4
- data/spec/fixtures/vcr_cassettes/public_holidays_in_date_range.yml +29 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/enrico.gemspec
CHANGED
data/lib/enrico.rb
CHANGED
data/lib/enrico/country.rb
CHANGED
@@ -59,20 +59,30 @@ 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
|
66
|
+
end
|
67
|
+
|
62
68
|
def is_public_holiday(date)
|
63
|
-
|
69
|
+
params = country_parameters({date: date.strftime("%d-%m-%Y")})
|
70
|
+
JSON.parse(self.class.get("/?action=isPublicHoliday&#{params}"))
|
64
71
|
end
|
65
72
|
|
66
73
|
def get_public_holidays_for_month(date)
|
67
|
-
|
74
|
+
params = country_parameters({month: date.month, year: date.year})
|
75
|
+
JSON.parse(self.class.get("/?action=getPublicHolidaysForMonth&#{params}"))
|
68
76
|
end
|
69
77
|
|
70
78
|
def get_public_holidays_for_year(date)
|
71
|
-
|
79
|
+
params = country_parameters({year: date.year})
|
80
|
+
JSON.parse(self.class.get("/?action=getPublicHolidaysForYear&#{params}"))
|
72
81
|
end
|
73
82
|
|
74
83
|
def get_public_holidays_for_date_range(from_date, to_date)
|
75
|
-
|
84
|
+
params = country_parameters({fromDate: from_date.strftime("%d-%m-%Y"), toDate: to_date.strftime("%d-%m-%Y")})
|
85
|
+
JSON.parse(self.class.get("/?action=getPublicHolidaysForDateRange&#{params}"))
|
76
86
|
end
|
77
87
|
|
78
88
|
end
|
@@ -100,4 +100,33 @@ http_interactions:
|
|
100
100
|
Year''s Day"}]'
|
101
101
|
http_version:
|
102
102
|
recorded_at: Thu, 29 Nov 2012 16:56:36 GMT
|
103
|
+
- request:
|
104
|
+
method: get
|
105
|
+
uri: http://kayaposoft.com/enrico/json/v1.0/?action=getPublicHolidaysForDateRange&country=ger&from_date=01-01-2012®ion=&to_date=01-03-2012
|
106
|
+
body:
|
107
|
+
encoding: US-ASCII
|
108
|
+
string: ''
|
109
|
+
headers: {}
|
110
|
+
response:
|
111
|
+
status:
|
112
|
+
code: 200
|
113
|
+
message: OK
|
114
|
+
headers:
|
115
|
+
Server:
|
116
|
+
- nginx
|
117
|
+
Date:
|
118
|
+
- Fri, 30 Nov 2012 12:32:31 GMT
|
119
|
+
Content-Type:
|
120
|
+
- text/html
|
121
|
+
Content-Length:
|
122
|
+
- '50'
|
123
|
+
Connection:
|
124
|
+
- keep-alive
|
125
|
+
Vary:
|
126
|
+
- User-Agent,Accept-Encoding
|
127
|
+
body:
|
128
|
+
encoding: US-ASCII
|
129
|
+
string: ! '{"error":"Query parameter ''fromDate'' is not set!"}'
|
130
|
+
http_version:
|
131
|
+
recorded_at: Fri, 30 Nov 2012 12:28:58 GMT
|
103
132
|
recorded_with: VCR 2.3.0
|
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.5
|
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: -4538822451665088345
|
173
173
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
174
|
none: false
|
175
175
|
requirements:
|