skiplan_client 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.
@@ -248,20 +248,16 @@
248
248
  </PARAMETRES>
249
249
  <BULLETINS>
250
250
  <COMMENTAIRES>
251
- <LANGUE val="en"><![CDATA[Col de la Colombi??re open.
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[The sun will shine. Variable winds, light at most places.]]></LANGUE>
260
- <LANGUE val="fr"><![CDATA[Soleil et ciel bleu pr??dominent. Vent variable faible. Cette nuit : Nuit ??toil??e, puis d??gradation nuageuse en fin de nuit.En fin de nuit vent de sud-est mod??r?? dans le Pays du Mont Blanc. Sur les autres r??gions, vent plus faible.]]></LANGUE>
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[Rain and thunderstorm. Early in the day, moderate southeasterly wind Mont-Blanc region with gusts reaching 55 km/h ; decreasing later. Elsewhere lighter winds.]]></LANGUE>
264
- <LANGUE val="fr"><![CDATA[Temps nuageux ?? tr??s nuageux, averses parfois orageuses en journ??e. En d??but de matin??e, vent de sud-est soufflant mod??r??ment dans le Pays du Mont Blanc, avec des rafales atteignant 55 km/h; puis att??nuation. Ailleurs, vent plus faible.]]></LANGUE>
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)
@@ -1,9 +1,10 @@
1
1
  class Skiplan
2
2
 
3
- attr_accessor :forecasts, :metrics, :zones
3
+ attr_accessor :forecasts, :text_forecasts, :metrics, :zones
4
4
 
5
5
  def initialize
6
6
  @forecasts = {}
7
7
  @zones = {}
8
+ @text_forecasts = {}
8
9
  end
9
10
  end
@@ -1,3 +1,3 @@
1
1
  module SkiplanClient
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -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 = {'SKI_NUIT' => {'etat' => '1'},
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
- # assert_equal
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.2
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 00:00:00.000000000 Z
12
+ date: 2014-11-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler