skiplan_client 0.2.3 → 0.2.4
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 +4 -4
- data/lib/skiplan_client.rb +13 -4
- data/lib/skiplan_client/version.rb +1 -1
- data/test/skiplan_client/skiplan_client_test.rb +12 -6
- data/test/skiplan_client/zone_test.rb +8 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3b5e3eb3aee4a977eee4cbbc1a8fbeb96ca2717
|
4
|
+
data.tar.gz: 93e01c7036deecd5bb1dd5faa1c5580723b4b471
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2902eb1ddab5f7849a023ed8ea87ea4521f5dcfc3cf6aa19bd1b84192efb89c4ca04e8bf8a65b704870f9d62cee636937e31fbb3a83730ca4837c1a3136e8167
|
7
|
+
data.tar.gz: 1590c29da44bebe320760f0cb985e4f9d0b48bd79c103872918404413ecbcfa454c9e857eafd64a45b39ce2884807243f9725fa33b48691dfbd9987cc497e625
|
data/lib/skiplan_client.rb
CHANGED
@@ -49,18 +49,27 @@ module SkiplanClient
|
|
49
49
|
|
50
50
|
def self.texts
|
51
51
|
xml = Nokogiri::XML(open(@config[:base_url]))
|
52
|
+
{
|
53
|
+
fr: SkiplanClient.localized_texts(xml, 'fr'),
|
54
|
+
en: SkiplanClient.localized_texts(xml, 'en')
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def self.localized_texts(xml, locale)
|
52
61
|
text_messages = {}
|
53
62
|
|
54
|
-
today_forecast = xml.xpath('//BULLETINS//JOUR//LANGUE[@val="
|
63
|
+
today_forecast = xml.xpath('//BULLETINS//JOUR//LANGUE[@val="' + locale + '"]')
|
55
64
|
text_messages['today_forecast'] = Hash.from_xml(today_forecast.to_s)['LANGUE']
|
56
65
|
|
57
|
-
tomorrow_forecast = xml.xpath('//BULLETINS//LENDEMAIN//LANGUE[@val="
|
66
|
+
tomorrow_forecast = xml.xpath('//BULLETINS//LENDEMAIN//LANGUE[@val="' + locale + '"]')
|
58
67
|
text_messages['tomorrow_forecast'] = Hash.from_xml(tomorrow_forecast.to_s)['LANGUE']
|
59
68
|
|
60
|
-
forecasts_comment = xml.xpath('//BULLETINS//COMMENTAIRES//LANGUE[@val="
|
69
|
+
forecasts_comment = xml.xpath('//BULLETINS//COMMENTAIRES//LANGUE[@val="' + locale + '"]')
|
61
70
|
text_messages['forecasts_comment'] = Hash.from_xml(forecasts_comment.to_s)['LANGUE']
|
62
71
|
|
63
|
-
ski_area_comment = xml.xpath('//INDICES//COMMENTAIRES//LANGUE[@val="
|
72
|
+
ski_area_comment = xml.xpath('//INDICES//COMMENTAIRES//LANGUE[@val="' + locale + '"]')
|
64
73
|
text_messages['ski_area'] = Hash.from_xml(ski_area_comment.to_s)['LANGUE']
|
65
74
|
|
66
75
|
conditions_comment = xml.xpath('//INDICES//ETAT_ROUTE')
|
@@ -85,11 +85,17 @@ class SkiplanClientTest < Test::Unit::TestCase
|
|
85
85
|
should 'retrieve forecasts text messages' do
|
86
86
|
texts = SkiplanClient.texts
|
87
87
|
|
88
|
-
assert_equal 'Pluie. Vent faible variable.', texts['today_forecast']
|
89
|
-
assert_equal 'Beau temps sec et ensoleillé. Vent faible variable.', texts['tomorrow_forecast']
|
90
|
-
assert_equal 'Col de la Colombière ouvert.', texts['forecasts_comment']
|
91
|
-
assert_equal 'LE DOMAINE SKIABLE EST FERME POUR LA SAISON 2013/2014.', texts['ski_area']
|
92
|
-
assert_equal 'Routes degagees, circulation normale', texts['conditions']
|
93
|
-
assert_equal 'Non defini', texts['roads']
|
88
|
+
assert_equal 'Pluie. Vent faible variable.', texts[:fr]['today_forecast']
|
89
|
+
assert_equal 'Beau temps sec et ensoleillé. Vent faible variable.', texts[:fr]['tomorrow_forecast']
|
90
|
+
assert_equal 'Col de la Colombière ouvert.', texts[:fr]['forecasts_comment']
|
91
|
+
assert_equal 'LE DOMAINE SKIABLE EST FERME POUR LA SAISON 2013/2014.', texts[:fr]['ski_area']
|
92
|
+
assert_equal 'Routes degagees, circulation normale', texts[:fr]['conditions']
|
93
|
+
assert_equal 'Non defini', texts[:fr]['roads']
|
94
|
+
assert_equal 'Rain and snow. Variable winds, light at most places.', texts[:en]['today_forecast']
|
95
|
+
assert_equal 'Dry and mostly sunny. Variable winds, light at most places.', texts[:en]['tomorrow_forecast']
|
96
|
+
assert_equal 'Col de la Colombière open.', texts[:en]['forecasts_comment']
|
97
|
+
assert_equal 'SKI AREA IS CLOSED FOR THE SEASON 2013/2014.', texts[:en]['ski_area']
|
98
|
+
assert_equal 'Routes degagees, circulation normale', texts[:en]['conditions']
|
99
|
+
assert_equal 'Non defini', texts[:en]['roads']
|
94
100
|
end
|
95
101
|
end
|
@@ -8,7 +8,10 @@ class ZoneTest < Test::Unit::TestCase
|
|
8
8
|
|
9
9
|
setup do
|
10
10
|
attributes = {'nom' => 'ALPIN CHINAILLON',
|
11
|
-
'REMONTEE' => [{
|
11
|
+
'REMONTEE' => [{
|
12
|
+
'nom' => 'TS LA FLORIA', 'etat' => 'O', 'type' => 'TS', 'msg' => 'Fermee pour la saison', 'heuredeb' => '09:00', 'heurefin' => '16:45',
|
13
|
+
'MSG_ASSOCIE' => ['message fr', 'message en']
|
14
|
+
},
|
12
15
|
{'nom' => 'TK LE STADE', 'etat' => 'F', 'type' => 'TK', 'msg' => 'Fermee pour la saison', 'heuredeb' => '09:00', 'heurefin' => '16:00'}],
|
13
16
|
'PISTE' => [{'nom' => 'LA SERPENTINE', 'etat' => 'F', 'type' => 'A', 'msg' => 'Piste de retour au Village', 'niveau' => 'V', 'entretien_num' => '1'},
|
14
17
|
{'nom' => 'LE VENAY', 'etat' => 'O', 'type' => 'A', 'msg' => '', 'niveau' => 'V', 'entretien_num' => '0'}],
|
@@ -20,7 +23,10 @@ class ZoneTest < Test::Unit::TestCase
|
|
20
23
|
|
21
24
|
should 'retrieve the data for a given zone' do
|
22
25
|
assert_equal 'ALPIN CHINAILLON', @zone.name
|
23
|
-
assert_equal [{
|
26
|
+
assert_equal [{
|
27
|
+
'nom' => 'TS LA FLORIA', 'etat' => 'O', 'type' => 'TS', 'msg' => 'Fermee pour la saison', 'heuredeb' => '09:00', 'heurefin' => '16:45',
|
28
|
+
'MSG_ASSOCIE' => ['message fr', 'message en']
|
29
|
+
},
|
24
30
|
{'nom' => 'TK LE STADE', 'etat' => 'F', 'type' => 'TK', 'msg' => 'Fermee pour la saison', 'heuredeb' => '09:00', 'heurefin' => '16:00'}], @zone.skilifts
|
25
31
|
assert_equal [{'nom' => 'LA SERPENTINE', 'etat' => 'F', 'type' => 'A', 'msg' => 'Piste de retour au Village', 'niveau' => 'V', 'entretien_num' => '1'},
|
26
32
|
{'nom' => 'LE VENAY', 'etat' => 'O', 'type' => 'A', 'msg' => '', 'niveau' => 'V', 'entretien_num' => '0'}], @zone.slopes
|
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.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SimonRonzani
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-12-
|
12
|
+
date: 2015-12-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|