skiplan_client 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/data/lumi_response.xml +6 -10
- data/lib/skiplan_client/metrics.rb +5 -1
- data/lib/skiplan_client/skiplan.rb +2 -1
- data/lib/skiplan_client/version.rb +1 -1
- data/lib/skiplan_client.rb +3 -0
- data/test/skiplan_client/metrics_test.rb +6 -1
- data/test/skiplan_client/skiplan_client_test.rb +8 -1
- metadata +2 -2
data/data/lumi_response.xml
CHANGED
@@ -248,20 +248,16 @@
|
|
248
248
|
</PARAMETRES>
|
249
249
|
<BULLETINS>
|
250
250
|
<COMMENTAIRES>
|
251
|
-
<LANGUE val="en"><![CDATA[Col de la
|
252
|
-
|
253
|
-
SKI AREA IS CLOSED FOR THE SEASON 2013/2014.]]></LANGUE>
|
254
|
-
<LANGUE val="fr"><![CDATA[Col de la Colombi??re ouvert.
|
255
|
-
|
256
|
-
LE DOMAINE SKIABLE EST FERM?? POUR LA SAISON 2013/2014.]]></LANGUE>
|
251
|
+
<LANGUE val="en"><![CDATA[Col de la Colombière open.]]></LANGUE>
|
252
|
+
<LANGUE val="fr"><![CDATA[Col de la Colombière ouvert.]]></LANGUE>
|
257
253
|
</COMMENTAIRES>
|
258
254
|
<JOUR>
|
259
|
-
<LANGUE val="en"><![CDATA[
|
260
|
-
<LANGUE val="fr"><![CDATA[
|
255
|
+
<LANGUE val="en"><![CDATA[Rain and snow. Variable winds, light at most places.]]></LANGUE>
|
256
|
+
<LANGUE val="fr"><![CDATA[Pluie. Vent faible variable.]]></LANGUE>
|
261
257
|
</JOUR>
|
262
258
|
<LENDEMAIN>
|
263
|
-
<LANGUE val="en"><![CDATA[
|
264
|
-
<LANGUE val="fr"><![CDATA[
|
259
|
+
<LANGUE val="en"><![CDATA[Dry and mostly sunny. Variable winds, light at most places.]]></LANGUE>
|
260
|
+
<LANGUE val="fr"><![CDATA[Beau temps sec et ensoleillé. Vent faible variable.]]></LANGUE>
|
265
261
|
</LENDEMAIN>
|
266
262
|
<SEMAINE>
|
267
263
|
<LANGUE val="en"/>
|
@@ -5,7 +5,7 @@ class Metrics
|
|
5
5
|
|
6
6
|
include AttributeHelper
|
7
7
|
|
8
|
-
METRICS = ['SKI_NUIT', 'KM_SKATING', 'SKI_ALPIN', 'SKI_ALPIN_VERTES', 'SKI_ALPIN_BLEUES', 'SKI_ALPIN_ROUGES', 'SKI_ALPIN_NOIRES',
|
8
|
+
METRICS = ['ETAT_ROUTE', 'SKI_NUIT', 'KM_SKATING', 'SKI_ALPIN', 'SKI_ALPIN_VERTES', 'SKI_ALPIN_BLEUES', 'SKI_ALPIN_ROUGES', 'SKI_ALPIN_NOIRES',
|
9
9
|
'SKI_NORDIQUE', 'SKI_NORDIQUE_VERTES', 'SKI_NORDIQUE_BLEUES', 'SKI_NORDIQUE_ROUGES', 'SKI_NORDIQUE_NOIRES',
|
10
10
|
'REMONTEES', 'PIETONS', 'RAQUETTES', 'LUGE', 'SNOWPARK']
|
11
11
|
|
@@ -64,6 +64,10 @@ class Metrics
|
|
64
64
|
@KM_SKATING['ouvert'] unless @KM_SKATING.nil?
|
65
65
|
end
|
66
66
|
|
67
|
+
def roads
|
68
|
+
@ETAT_ROUTE['lib']
|
69
|
+
end
|
70
|
+
|
67
71
|
private
|
68
72
|
|
69
73
|
def get_ratio(hash)
|
data/lib/skiplan_client.rb
CHANGED
@@ -41,6 +41,9 @@ module SkiplanClient
|
|
41
41
|
weather.zones[z['nom']] = Zone.new(Hash.from_xml(z.to_s)['SECTEUR'])
|
42
42
|
end
|
43
43
|
|
44
|
+
text_forecasts = xml.xpath('//BULLETINS//JOUR//LANGUE[@val="fr"]')
|
45
|
+
weather.text_forecasts = Hash.from_xml(text_forecasts.to_s)['LANGUE']
|
46
|
+
|
44
47
|
weather
|
45
48
|
end
|
46
49
|
end
|
@@ -8,7 +8,8 @@ require 'skiplan_client/metrics'
|
|
8
8
|
class MetricsTest < Test::Unit::TestCase
|
9
9
|
|
10
10
|
setup do
|
11
|
-
attributes = {'
|
11
|
+
attributes = {'ETAT_ROUTE' => {'lib' => "Routes dégagées, circulation normale"},
|
12
|
+
'SKI_NUIT' => {'etat' => '1'},
|
12
13
|
'KM_SKATING' => {'ouvert' => '10'},
|
13
14
|
'SKI_ALPIN'=>{'total'=>'44', 'total_periode'=>'44', 'total_periode_hpf'=>'44', 'ouvertes_previsions'=>'0', 'ouvertes'=>'10', 'previsions'=>'0', 'fermees'=>'44', 'lng_total'=>'0.0', 'lng_ouverts'=>'0.0'},
|
14
15
|
'SKI_ALPIN_VERTES'=>{'total'=>'12', 'total_periode'=>'12', 'total_periode_hpf'=>'12', 'ouvertes_previsions'=>'0', 'ouvertes'=>'2', 'previsions'=>'0', 'fermees'=>'12', 'lng_total'=>'0.0', 'lng_ouverts'=>'0.0'},
|
@@ -87,4 +88,8 @@ class MetricsTest < Test::Unit::TestCase
|
|
87
88
|
should 'return skating km available' do
|
88
89
|
assert_equal '10', @metrics.skating
|
89
90
|
end
|
91
|
+
|
92
|
+
should 'return a detailed status for the local roads' do
|
93
|
+
assert_equal 'Routes dégagées, circulation normale', @metrics.roads
|
94
|
+
end
|
90
95
|
end
|
@@ -67,7 +67,8 @@ class SkiplanClientTest < Test::Unit::TestCase
|
|
67
67
|
assert_equal 'ALPIN CHINAILLON', zones.keys[0]
|
68
68
|
|
69
69
|
ac_zone = zones['ALPIN CHINAILLON']
|
70
|
-
|
70
|
+
assert_equal 10, ac_zone.skilifts.count
|
71
|
+
assert_equal 16, ac_zone.slopes.count
|
71
72
|
end
|
72
73
|
|
73
74
|
should 'change config url' do
|
@@ -75,4 +76,10 @@ class SkiplanClientTest < Test::Unit::TestCase
|
|
75
76
|
assert_equal 'my_new_url', config
|
76
77
|
end
|
77
78
|
|
79
|
+
should 'retrieve text forecasts' do
|
80
|
+
SkiplanClient.configure('../../data/lumi_response.xml')
|
81
|
+
text_forecasts = SkiplanClient.get_weather('CHINAILLON').text_forecasts
|
82
|
+
|
83
|
+
assert_equal 'Pluie. Vent faible variable.', text_forecasts
|
84
|
+
end
|
78
85
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skiplan_client
|
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:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-11-
|
12
|
+
date: 2014-11-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|