skiplan_client 0.1.5 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 56fb88b43862ee4f6f162950a21d7c84cbdf7b8e
4
+ data.tar.gz: 25733b6599e5c04f52e1501ce3dc276255f96c6d
5
+ SHA512:
6
+ metadata.gz: 111959f9f98523ced19818eae7859268e0b3d9d57a58da4ce488f5637161ee1459db2f3ed3e8a638d23dd4413e84fed3890c9e907adb5bac3030272467bb9669
7
+ data.tar.gz: 96d5af1b97db6a4e02fad472d39143ccd301ef509c44cc490c303721dab7daa8dae364b0949629765627b8a78fd31061488c78056d37f98f24a179008c3065c4
@@ -1165,94 +1165,6 @@
1165
1165
  <PLAGE prd_id="4" pgh_id="" heuredeb="" heurefin=""/>
1166
1166
  </PLAGES>
1167
1167
  </PISTE>
1168
- <PISTE nom="LA MOTTAZ-L'ARBELAY 1 KM" etat="O" type="PE" msg=" " niveau="" entretien_txt="" entretien_num="0" longueur="1000" heuredeb="00:00" heurefin="23:59" heuredebmod="00:00" heurefinmod="23:59">
1169
- <PLAGES>
1170
- <PLAGE prd_id="1" pgh_id="" heuredeb="" heurefin=""/>
1171
- <PLAGE prd_id="2" pgh_id="" heuredeb="" heurefin=""/>
1172
- <PLAGE prd_id="3" pgh_id="" heuredeb="" heurefin=""/>
1173
- <PLAGE prd_id="4" pgh_id="" heuredeb="" heurefin=""/>
1174
- </PLAGES>
1175
- </PISTE>
1176
- <PISTE nom="LA VALLEE DU BOUCHET 7,5 KM." etat="F" type="PE" msg=" " niveau="" entretien_txt="" entretien_num="0" longueur="7500" heuredeb="00:00" heurefin="23:59" heuredebmod="00:00" heurefinmod="23:59">
1177
- <PLAGES>
1178
- <PLAGE prd_id="1" pgh_id="" heuredeb="" heurefin=""/>
1179
- <PLAGE prd_id="2" pgh_id="" heuredeb="" heurefin=""/>
1180
- <PLAGE prd_id="3" pgh_id="" heuredeb="" heurefin=""/>
1181
- <PLAGE prd_id="4" pgh_id="" heuredeb="" heurefin=""/>
1182
- </PLAGES>
1183
- </PISTE>
1184
- <PISTE nom="LE BORNE 2 KM." etat="O" type="PE" msg=" " niveau="" entretien_txt="" entretien_num="0" longueur="2000" heuredeb="00:00" heurefin="23:59" heuredebmod="00:00" heurefinmod="23:59">
1185
- <PLAGES>
1186
- <PLAGE prd_id="1" pgh_id="" heuredeb="" heurefin=""/>
1187
- <PLAGE prd_id="2" pgh_id="" heuredeb="" heurefin=""/>
1188
- <PLAGE prd_id="3" pgh_id="" heuredeb="" heurefin=""/>
1189
- <PLAGE prd_id="4" pgh_id="" heuredeb="" heurefin=""/>
1190
- </PLAGES>
1191
- </PISTE>
1192
- <PISTE nom="LE CRET-LE RECHAT 3 KM" etat="O" type="PE" msg=" " niveau="" entretien_txt="" entretien_num="0" longueur="3000" heuredeb="00:00" heurefin="23:59" heuredebmod="00:00" heurefinmod="23:59">
1193
- <PLAGES>
1194
- <PLAGE prd_id="1" pgh_id="" heuredeb="" heurefin=""/>
1195
- <PLAGE prd_id="2" pgh_id="" heuredeb="" heurefin=""/>
1196
- <PLAGE prd_id="3" pgh_id="" heuredeb="" heurefin=""/>
1197
- <PLAGE prd_id="4" pgh_id="" heuredeb="" heurefin=""/>
1198
- </PLAGES>
1199
- </PISTE>
1200
- <PISTE nom="LE ROSAY-CHINAILLON 1,5 KM" etat="F" type="PE" msg=" " niveau="" entretien_txt="" entretien_num="0" longueur="1500" heuredeb="00:00" heurefin="23:59" heuredebmod="00:00" heurefinmod="23:59">
1201
- <PLAGES>
1202
- <PLAGE prd_id="1" pgh_id="" heuredeb="" heurefin=""/>
1203
- <PLAGE prd_id="2" pgh_id="" heuredeb="" heurefin=""/>
1204
- <PLAGE prd_id="3" pgh_id="" heuredeb="" heurefin=""/>
1205
- <PLAGE prd_id="4" pgh_id="" heuredeb="" heurefin=""/>
1206
- </PLAGES>
1207
- </PISTE>
1208
- <PISTE nom="LE TERRET 3 KM" etat="O" type="PE" msg=" " niveau="" entretien_txt="" entretien_num="0" longueur="3000" heuredeb="00:00" heurefin="23:59" heuredebmod="00:00" heurefinmod="23:59">
1209
- <PLAGES>
1210
- <PLAGE prd_id="1" pgh_id="" heuredeb="" heurefin=""/>
1211
- <PLAGE prd_id="2" pgh_id="" heuredeb="" heurefin=""/>
1212
- <PLAGE prd_id="3" pgh_id="" heuredeb="" heurefin=""/>
1213
- <PLAGE prd_id="4" pgh_id="" heuredeb="" heurefin=""/>
1214
- </PLAGES>
1215
- </PISTE>
1216
- <PISTE nom="LE VIEUX VILLAGE-LA MAZERIE 3 KM" etat="O" type="PE" msg=" " niveau="" entretien_txt="" entretien_num="0" longueur="3000" heuredeb="00:00" heurefin="23:59" heuredebmod="00:00" heurefinmod="23:59">
1217
- <PLAGES>
1218
- <PLAGE prd_id="1" pgh_id="" heuredeb="" heurefin=""/>
1219
- <PLAGE prd_id="2" pgh_id="" heuredeb="" heurefin=""/>
1220
- <PLAGE prd_id="3" pgh_id="" heuredeb="" heurefin=""/>
1221
- <PLAGE prd_id="4" pgh_id="" heuredeb="" heurefin=""/>
1222
- </PLAGES>
1223
- </PISTE>
1224
- <PISTE nom="LE VILLAGE-LE CROIX 3,5 KM" etat="O" type="PE" msg=" " niveau="" entretien_txt="" entretien_num="0" longueur="3500" heuredeb="00:00" heurefin="23:59" heuredebmod="00:00" heurefinmod="23:59">
1225
- <PLAGES>
1226
- <PLAGE prd_id="1" pgh_id="" heuredeb="" heurefin=""/>
1227
- <PLAGE prd_id="2" pgh_id="" heuredeb="" heurefin=""/>
1228
- <PLAGE prd_id="3" pgh_id="" heuredeb="" heurefin=""/>
1229
- <PLAGE prd_id="4" pgh_id="" heuredeb="" heurefin=""/>
1230
- </PLAGES>
1231
- </PISTE>
1232
- <PISTE nom="LE VILLAGE-LES POTAIS 3 KM" etat="O" type="PE" msg=" " niveau="" entretien_txt="" entretien_num="0" longueur="3000" heuredeb="00:00" heurefin="23:59" heuredebmod="00:00" heurefinmod="23:59">
1233
- <PLAGES>
1234
- <PLAGE prd_id="1" pgh_id="" heuredeb="" heurefin=""/>
1235
- <PLAGE prd_id="2" pgh_id="" heuredeb="" heurefin=""/>
1236
- <PLAGE prd_id="3" pgh_id="" heuredeb="" heurefin=""/>
1237
- <PLAGE prd_id="4" pgh_id="" heuredeb="" heurefin=""/>
1238
- </PLAGES>
1239
- </PISTE>
1240
- <PISTE nom="LES NANTS-LE MONT 2,5 KM" etat="O" type="PE" msg=" " niveau="" entretien_txt="" entretien_num="0" longueur="2500" heuredeb="00:00" heurefin="23:59" heuredebmod="00:00" heurefinmod="23:59">
1241
- <PLAGES>
1242
- <PLAGE prd_id="1" pgh_id="" heuredeb="" heurefin=""/>
1243
- <PLAGE prd_id="2" pgh_id="" heuredeb="" heurefin=""/>
1244
- <PLAGE prd_id="3" pgh_id="" heuredeb="" heurefin=""/>
1245
- <PLAGE prd_id="4" pgh_id="" heuredeb="" heurefin=""/>
1246
- </PLAGES>
1247
- </PISTE>
1248
- <PISTE nom="ROUTE DE LA DUCHE 14 KM" etat="O" type="PE" msg=" " niveau="" entretien_txt="" entretien_num="0" longueur="14000" heuredeb="00:00" heurefin="23:59" heuredebmod="00:00" heurefinmod="23:59">
1249
- <PLAGES>
1250
- <PLAGE prd_id="1" pgh_id="" heuredeb="" heurefin=""/>
1251
- <PLAGE prd_id="2" pgh_id="" heuredeb="" heurefin=""/>
1252
- <PLAGE prd_id="3" pgh_id="" heuredeb="" heurefin=""/>
1253
- <PLAGE prd_id="4" pgh_id="" heuredeb="" heurefin=""/>
1254
- </PLAGES>
1255
- </PISTE>
1256
1168
  </SECTEUR>
1257
1169
  <SECTEUR nom="PISTE DE LUGE">
1258
1170
  <PISTE nom="LE BORNE (VILLAGE)" etat="F" type="L" msg=" " niveau="V" entretien_txt="" entretien_num="0" longueur="0" heuredeb="00:00" heurefin="23:59" heuredebmod="00:00" heurefinmod="23:59">
@@ -4,6 +4,7 @@ class Skiplan
4
4
 
5
5
  def initialize
6
6
  @forecasts = {}
7
+ @metrics = {}
7
8
  @zones = {}
8
9
  @text_messages = {}
9
10
  end
@@ -1,3 +1,3 @@
1
1
  module SkiplanClient
2
- VERSION = '0.1.5'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -5,7 +5,10 @@ class Zone
5
5
  include AttributeHelper
6
6
 
7
7
  def initialize(attributes)
8
- self.attributes = attributes
8
+ normalized_attrs = attributes.dup
9
+ normalized_attrs['REMONTEE'] = [normalized_attrs['REMONTEE']] if normalized_attrs['REMONTEE'].is_a?(Hash)
10
+ normalized_attrs['PISTE'] = [normalized_attrs['PISTE']] if normalized_attrs['PISTE'].is_a?(Hash)
11
+ self.attributes = normalized_attrs
9
12
  end
10
13
 
11
14
  def name
@@ -2,6 +2,7 @@ require 'skiplan_client/version'
2
2
  require 'skiplan_client/forecast'
3
3
  require 'skiplan_client/metrics'
4
4
  require 'skiplan_client/zone'
5
+ require 'skiplan_client/skiplan'
5
6
  require 'open-uri'
6
7
  require 'nokogiri'
7
8
  require 'active_support/core_ext/hash/conversions'
@@ -10,46 +11,48 @@ module SkiplanClient
10
11
 
11
12
  # Configuration defaults
12
13
  @config = {
13
- :base_url => 'http://www.skiplan.com/php/genererXml.php?pays=france&region=alpes&station=legrandbornand&v=1'
14
+ :base_url => ''
14
15
  }
15
16
 
16
17
  def self.configure(url)
17
18
  @config[:base_url] = url
18
19
  end
19
20
 
20
- def self.get_weather(zone)
21
+ def self.weather(zone)
21
22
  xml = Nokogiri::XML(open(@config[:base_url]))
22
- weather = Skiplan.new
23
+ skiplan = Skiplan.new
23
24
 
24
- today_element = xml.xpath('//ZONE[@nom="' + zone + '"]')
25
- weather.forecasts['j'] = Forecast.new(Hash.from_xml(today_element.to_s)['ZONE'])
25
+ zone_nodes = xml.xpath('//ZONE[@reference="' + zone + '"]')
26
+ zone_nodes.each do |n|
27
+ skiplan.forecasts[n['nom']] = Forecast.new(Hash.from_xml(n.to_s)['ZONE'])
28
+ end
26
29
 
27
- tomorrow_element = xml.xpath('//ZONE[starts-with(@nom,"J+1") and @reference="' + zone + '"]')
28
- weather.forecasts['j+1'] = Forecast.new(Hash.from_xml(tomorrow_element.to_s)['ZONE'])
30
+ today_forecast = xml.xpath('//BULLETINS//JOUR//LANGUE[@val="fr"]')
31
+ skiplan.text_messages['today_forecast'] = Hash.from_xml(today_forecast.to_s)['LANGUE']
29
32
 
30
- j2_element = xml.xpath('//ZONE[starts-with(@nom,"J+2") and @reference="' + zone + '"]')
31
- weather.forecasts['j+2'] = Forecast.new(Hash.from_xml(j2_element.to_s)['ZONE'])
33
+ forecasts_comment = xml.xpath('//BULLETINS//COMMENTAIRES//LANGUE[@val="fr"]')
34
+ skiplan.text_messages['forecasts_comment'] = Hash.from_xml(forecasts_comment.to_s)['LANGUE']
32
35
 
33
- j3_element = xml.xpath('//ZONE[starts-with(@nom,"J+3") and @reference="' + zone + '"]')
34
- weather.forecasts['j+3'] = Forecast.new(Hash.from_xml(j3_element.to_s)['ZONE'])
36
+ skiplan
37
+ end
35
38
 
36
- metrics = xml.xpath('//INDICES')
37
- weather.metrics = Metrics.new(Hash.from_xml(metrics.to_s)['INDICES'])
39
+ def self.ski_area
40
+ xml = Nokogiri::XML(open(@config[:base_url]))
41
+ skiplan = Skiplan.new
42
+
43
+ area_metrics = xml.xpath('//INDICES')
44
+ area_metrics.each do |area|
45
+ skiplan.metrics[area['nom']] = Metrics.new(Hash.from_xml(area.to_s)['INDICES'])
46
+ slopes_comment = area.xpath('.//COMMENTAIRES//LANGUE[@val="fr"]')
47
+ skiplan.text_messages[area['nom']] ||= {}
48
+ skiplan.text_messages[area['nom']]['slopes_comment'] = Hash.from_xml(slopes_comment.to_s)['LANGUE']
49
+ end
38
50
 
39
51
  zones = xml.xpath('//SECTEUR')
40
52
  zones.each do |z|
41
- weather.zones[z['nom']] = Zone.new(Hash.from_xml(z.to_s)['SECTEUR'])
53
+ skiplan.zones[z['nom']] = Zone.new(Hash.from_xml(z.to_s)['SECTEUR'])
42
54
  end
43
55
 
44
- today_forecast = xml.xpath('//BULLETINS//JOUR//LANGUE[@val="fr"]')
45
- weather.text_messages['today_forecast'] = Hash.from_xml(today_forecast.to_s)['LANGUE']
46
-
47
- forecasts_comment = xml.xpath('//BULLETINS//COMMENTAIRES//LANGUE[@val="fr"]')
48
- weather.text_messages['forecasts_comment'] = Hash.from_xml(forecasts_comment.to_s)['LANGUE']
49
-
50
- slopes_comment = xml.xpath('//INDICES//COMMENTAIRES//LANGUE[@val="fr"]')
51
- weather.text_messages['slopes_comment'] = Hash.from_xml(slopes_comment.to_s)['LANGUE']
52
-
53
- weather
56
+ skiplan
54
57
  end
55
58
  end
@@ -6,7 +6,7 @@ require 'skiplan_client/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "skiplan_client"
8
8
  spec.version = SkiplanClient::VERSION
9
- spec.authors = ["SimonRonzani"]
9
+ spec.authors = ["SimonRonzani", "jeanbaptistevilain"]
10
10
  spec.email = ["ronzani.simon@gmail.com"]
11
11
  spec.description = "SkiPlan API client gem"
12
12
  spec.summary = "A simple Ruby wrapper for the SkiPlan XML api"
@@ -18,10 +18,10 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.0"
21
+ spec.add_development_dependency "bundler"
22
22
  spec.add_development_dependency "rake"
23
23
  spec.add_development_dependency "test-unit"
24
- spec.add_development_dependency "shoulda"
25
- spec.add_runtime_dependency "rails", "~> 3.2.14"
24
+ spec.add_development_dependency "shoulda-context"
25
+ spec.add_runtime_dependency "rails"
26
26
  spec.add_runtime_dependency "nokogiri"
27
27
  end
@@ -1,8 +1,7 @@
1
1
  # encoding : UTF-8
2
2
  require 'rubygems'
3
- gem 'shoulda'
4
3
  require 'test/unit'
5
- require 'shoulda'
4
+ require 'shoulda-context'
6
5
  require 'skiplan_client/forecast'
7
6
 
8
7
  class ForecastTest < Test::Unit::TestCase
@@ -1,8 +1,7 @@
1
1
  # encoding : UTF-8
2
2
  require 'rubygems'
3
- gem 'shoulda'
4
3
  require 'test/unit'
5
- require 'shoulda'
4
+ require 'shoulda-context'
6
5
  require 'skiplan_client/metrics'
7
6
 
8
7
  class MetricsTest < Test::Unit::TestCase
@@ -1,8 +1,6 @@
1
1
  # encoding : UTF-8
2
- require 'rubygems'
3
- gem 'shoulda'
4
2
  require 'test/unit'
5
- require 'shoulda'
3
+ require 'shoulda-context'
6
4
  require 'skiplan_client'
7
5
  require 'skiplan_client/skiplan'
8
6
 
@@ -17,9 +15,9 @@ class SkiplanClientTest < Test::Unit::TestCase
17
15
  end
18
16
 
19
17
  should 'retrieve weather data' do
20
- weather = SkiplanClient.get_weather('CHINAILLON')
18
+ weather = SkiplanClient.weather('CHINAILLON')
21
19
 
22
- today_forecast = weather.forecasts['j']
20
+ today_forecast = weather.forecasts['CHINAILLON']
23
21
  assert_equal '101' , today_forecast.weather_am
24
22
  assert_equal '101' , today_forecast.weather_pm
25
23
  assert_equal '+12' , today_forecast.temp_am
@@ -28,7 +26,7 @@ class SkiplanClientTest < Test::Unit::TestCase
28
26
  assert_equal '4' , today_forecast.wind_speed
29
27
  assert_equal 'SE' , today_forecast.wind_dir
30
28
 
31
- tomorrow_forecast = weather.forecasts['j+1']
29
+ tomorrow_forecast = weather.forecasts['J+1']
32
30
  assert_equal '104' , tomorrow_forecast.weather_am
33
31
  assert_equal '106' , tomorrow_forecast.weather_pm
34
32
  assert_equal '+17' , tomorrow_forecast.temp_am
@@ -36,7 +34,7 @@ class SkiplanClientTest < Test::Unit::TestCase
36
34
  assert_equal '7' , tomorrow_forecast.wind_speed
37
35
  assert_equal 'SO' , tomorrow_forecast.wind_dir
38
36
 
39
- j2_forecast = weather.forecasts['j+2']
37
+ j2_forecast = weather.forecasts['J+2']
40
38
  assert_equal '106' , j2_forecast.weather_am
41
39
  assert_equal '104' , j2_forecast.weather_pm
42
40
  assert_equal '+12' , j2_forecast.temp_am
@@ -44,7 +42,7 @@ class SkiplanClientTest < Test::Unit::TestCase
44
42
  assert_equal '7' , j2_forecast.wind_speed
45
43
  assert_equal 'O' , j2_forecast.wind_dir
46
44
 
47
- j3_forecast = weather.forecasts['j+3']
45
+ j3_forecast = weather.forecasts['J+3']
48
46
  assert_equal '101' , j3_forecast.weather_am
49
47
  assert_equal '103' , j3_forecast.weather_pm
50
48
  assert_equal '+16' , j3_forecast.temp_am
@@ -54,7 +52,7 @@ class SkiplanClientTest < Test::Unit::TestCase
54
52
  end
55
53
 
56
54
  should 'retrieve metrics data' do
57
- metrics = SkiplanClient.get_weather('CHINAILLON').metrics
55
+ metrics = SkiplanClient.ski_area.metrics['GRAND BORNAND']
58
56
 
59
57
  assert_equal '0/44', metrics.alpine[:total]
60
58
  assert_equal '0/17', metrics.nordic[:total]
@@ -65,7 +63,7 @@ class SkiplanClientTest < Test::Unit::TestCase
65
63
  end
66
64
 
67
65
  should 'retrieve zones data' do
68
- zones = SkiplanClient.get_weather('CHINAILLON').zones
66
+ zones = SkiplanClient.ski_area.zones
69
67
 
70
68
  assert_equal 10, zones.length
71
69
  assert_equal 'ALPIN CHINAILLON', zones.keys[0]
@@ -73,6 +71,9 @@ class SkiplanClientTest < Test::Unit::TestCase
73
71
  ac_zone = zones['ALPIN CHINAILLON']
74
72
  assert_equal 10, ac_zone.skilifts.count
75
73
  assert_equal 16, ac_zone.slopes.count
74
+
75
+ single_entry_zone = zones['PIETONS']
76
+ assert_equal 1, single_entry_zone.slopes.count
76
77
  end
77
78
 
78
79
  should 'change config url' do
@@ -80,11 +81,16 @@ class SkiplanClientTest < Test::Unit::TestCase
80
81
  assert_equal 'my_new_url', config
81
82
  end
82
83
 
83
- should 'retrieve text messages' do
84
- text_forecasts = SkiplanClient.get_weather('CHINAILLON').text_messages
84
+ should 'retrieve forecasts text messages' do
85
+ text_forecasts = SkiplanClient.weather('CHINAILLON').text_messages
85
86
 
86
87
  assert_equal 'Pluie. Vent faible variable.', text_forecasts['today_forecast']
87
88
  assert_equal 'Col de la Colombière ouvert.', text_forecasts['forecasts_comment']
89
+ end
90
+
91
+ should 'retrieve ski area text messages' do
92
+ text_forecasts = SkiplanClient.ski_area.text_messages['GRAND BORNAND']
93
+
88
94
  assert_equal 'LE DOMAINE SKIABLE EST FERME POUR LA SAISON 2013/2014.', text_forecasts['slopes_comment']
89
95
  end
90
96
  end
@@ -1,8 +1,7 @@
1
1
  # encoding : UTF-8
2
2
  require 'rubygems'
3
- gem 'shoulda'
4
3
  require 'test/unit'
5
- require 'shoulda'
4
+ require 'shoulda-context'
6
5
  require 'skiplan_client/zone'
7
6
 
8
7
  class ZoneTest < Test::Unit::TestCase
@@ -11,8 +10,8 @@ class ZoneTest < Test::Unit::TestCase
11
10
  attributes = {'nom' => 'ALPIN CHINAILLON',
12
11
  'REMONTEE' => [{'nom' => 'TS LA FLORIA', 'etat' => 'O', 'type' => 'TS', 'msg' => 'Fermee pour la saison', 'heuredeb' => '09:00', 'heurefin' => '16:45'},
13
12
  {'nom' => 'TK LE STADE', 'etat' => 'F', 'type' => 'TK', 'msg' => 'Fermee pour la saison', 'heuredeb' => '09:00', 'heurefin' => '16:00'}],
14
- 'PISTE' => [{'nom' => 'LA SERPENTINE', 'etat' => 'F', 'type' => 'A', 'msg' => 'Piste de retour au Village', 'niveau' => 'V'},
15
- {'nom' => 'LE VENAY', 'etat' => 'O', 'type' => 'A', 'msg' => '', 'niveau' => 'V'}]
13
+ 'PISTE' => [{'nom' => 'LA SERPENTINE', 'etat' => 'F', 'type' => 'A', 'msg' => 'Piste de retour au Village', 'niveau' => 'V', 'entretien_num' => '1'},
14
+ {'nom' => 'LE VENAY', 'etat' => 'O', 'type' => 'A', 'msg' => '', 'niveau' => 'V', 'entretien_num' => '0'}]
16
15
  }
17
16
  @zone = Zone.new(attributes)
18
17
  end
@@ -21,8 +20,16 @@ class ZoneTest < Test::Unit::TestCase
21
20
  assert_equal 'ALPIN CHINAILLON', @zone.name
22
21
  assert_equal [{'nom' => 'TS LA FLORIA', 'etat' => 'O', 'type' => 'TS', 'msg' => 'Fermee pour la saison', 'heuredeb' => '09:00', 'heurefin' => '16:45'},
23
22
  {'nom' => 'TK LE STADE', 'etat' => 'F', 'type' => 'TK', 'msg' => 'Fermee pour la saison', 'heuredeb' => '09:00', 'heurefin' => '16:00'}], @zone.skilifts
24
- assert_equal [{'nom' => 'LA SERPENTINE', 'etat' => 'F', 'type' => 'A', 'msg' => 'Piste de retour au Village', 'niveau' => 'V'},
25
- {'nom' => 'LE VENAY', 'etat' => 'O', 'type' => 'A', 'msg' => '', 'niveau' => 'V'}], @zone.slopes
23
+ assert_equal [{'nom' => 'LA SERPENTINE', 'etat' => 'F', 'type' => 'A', 'msg' => 'Piste de retour au Village', 'niveau' => 'V', 'entretien_num' => '1'},
24
+ {'nom' => 'LE VENAY', 'etat' => 'O', 'type' => 'A', 'msg' => '', 'niveau' => 'V', 'entretien_num' => '0'}], @zone.slopes
25
+ end
26
+
27
+ should 'store an array of slopes even when only one slope is present' do
28
+ attributes = {'nom' => 'PIETONS',
29
+ 'PISTE' => {'nom' => 'Chemin pieton', 'etat' => 'F', 'type' => 'PE', 'msg' => 'Chemin', 'entretien_num' => '0'}
30
+ }
31
+ @zone = Zone.new(attributes)
32
+ assert_equal [{'nom' => 'Chemin pieton', 'etat' => 'F', 'type' => 'PE', 'msg' => 'Chemin', 'entretien_num' => '0'}], @zone.slopes
26
33
  end
27
34
 
28
35
  should 'return the ratio of open skilifts' do
metadata CHANGED
@@ -1,110 +1,98 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skiplan_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - SimonRonzani
8
+ - jeanbaptistevilain
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-08 00:00:00.000000000 Z
12
+ date: 2015-10-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
17
  requirements:
19
- - - ~>
18
+ - - ">="
20
19
  - !ruby/object:Gem::Version
21
- version: '1.0'
20
+ version: '0'
22
21
  type: :development
23
22
  prerelease: false
24
23
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
- - - ~>
25
+ - - ">="
28
26
  - !ruby/object:Gem::Version
29
- version: '1.0'
27
+ version: '0'
30
28
  - !ruby/object:Gem::Dependency
31
29
  name: rake
32
30
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
31
  requirements:
35
- - - ! '>='
32
+ - - ">="
36
33
  - !ruby/object:Gem::Version
37
34
  version: '0'
38
35
  type: :development
39
36
  prerelease: false
40
37
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
38
  requirements:
43
- - - ! '>='
39
+ - - ">="
44
40
  - !ruby/object:Gem::Version
45
41
  version: '0'
46
42
  - !ruby/object:Gem::Dependency
47
43
  name: test-unit
48
44
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
45
  requirements:
51
- - - ! '>='
46
+ - - ">="
52
47
  - !ruby/object:Gem::Version
53
48
  version: '0'
54
49
  type: :development
55
50
  prerelease: false
56
51
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
52
  requirements:
59
- - - ! '>='
53
+ - - ">="
60
54
  - !ruby/object:Gem::Version
61
55
  version: '0'
62
56
  - !ruby/object:Gem::Dependency
63
- name: shoulda
57
+ name: shoulda-context
64
58
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
59
  requirements:
67
- - - ! '>='
60
+ - - ">="
68
61
  - !ruby/object:Gem::Version
69
62
  version: '0'
70
63
  type: :development
71
64
  prerelease: false
72
65
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
66
  requirements:
75
- - - ! '>='
67
+ - - ">="
76
68
  - !ruby/object:Gem::Version
77
69
  version: '0'
78
70
  - !ruby/object:Gem::Dependency
79
71
  name: rails
80
72
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
73
  requirements:
83
- - - ~>
74
+ - - ">="
84
75
  - !ruby/object:Gem::Version
85
- version: 3.2.14
76
+ version: '0'
86
77
  type: :runtime
87
78
  prerelease: false
88
79
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
80
  requirements:
91
- - - ~>
81
+ - - ">="
92
82
  - !ruby/object:Gem::Version
93
- version: 3.2.14
83
+ version: '0'
94
84
  - !ruby/object:Gem::Dependency
95
85
  name: nokogiri
96
86
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
87
  requirements:
99
- - - ! '>='
88
+ - - ">="
100
89
  - !ruby/object:Gem::Version
101
90
  version: '0'
102
91
  type: :runtime
103
92
  prerelease: false
104
93
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
94
  requirements:
107
- - - ! '>='
95
+ - - ">="
108
96
  - !ruby/object:Gem::Version
109
97
  version: '0'
110
98
  description: SkiPlan API client gem
@@ -114,7 +102,7 @@ executables: []
114
102
  extensions: []
115
103
  extra_rdoc_files: []
116
104
  files:
117
- - .gitignore
105
+ - ".gitignore"
118
106
  - Gemfile
119
107
  - LICENSE.txt
120
108
  - README.md
@@ -131,36 +119,33 @@ files:
131
119
  - test/skiplan_client/forecast_test.rb
132
120
  - test/skiplan_client/metrics_test.rb
133
121
  - test/skiplan_client/skiplan_client_test.rb
134
- - test/skiplan_client/weather_object_test.rb
135
122
  - test/skiplan_client/zone_test.rb
136
123
  homepage: https://github.com/jeanbaptistevilain/skiplan_client
137
124
  licenses:
138
125
  - MIT
126
+ metadata: {}
139
127
  post_install_message:
140
128
  rdoc_options: []
141
129
  require_paths:
142
130
  - lib
143
131
  required_ruby_version: !ruby/object:Gem::Requirement
144
- none: false
145
132
  requirements:
146
- - - ! '>='
133
+ - - ">="
147
134
  - !ruby/object:Gem::Version
148
135
  version: '0'
149
136
  required_rubygems_version: !ruby/object:Gem::Requirement
150
- none: false
151
137
  requirements:
152
- - - ! '>='
138
+ - - ">="
153
139
  - !ruby/object:Gem::Version
154
140
  version: '0'
155
141
  requirements: []
156
142
  rubyforge_project:
157
- rubygems_version: 1.8.24
143
+ rubygems_version: 2.2.5
158
144
  signing_key:
159
- specification_version: 3
145
+ specification_version: 4
160
146
  summary: A simple Ruby wrapper for the SkiPlan XML api
161
147
  test_files:
162
148
  - test/skiplan_client/forecast_test.rb
163
149
  - test/skiplan_client/metrics_test.rb
164
150
  - test/skiplan_client/skiplan_client_test.rb
165
- - test/skiplan_client/weather_object_test.rb
166
151
  - test/skiplan_client/zone_test.rb
@@ -1,10 +0,0 @@
1
- # encoding : UTF-8
2
- require 'rubygems'
3
- gem 'shoulda'
4
- require 'test/unit'
5
- require 'shoulda'
6
- require 'skiplan_client/skiplan'
7
-
8
- class WeatherObjectTest < Test::Unit::TestCase
9
-
10
- end