skiplan_client 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +37 -39
- data/lib/skiplan_client/version.rb +1 -1
- data/lib/skiplan_client/weather_object.rb +67 -74
- data/lib/skiplan_client.rb +68 -11
- data/test/skiplan_client/skiplan_client_test.rb +35 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Y2RmOTg0YmVjOTY2NmU0ODUwMmY5NGUyZTQ2MzIwNjBjOGFjNGY1MA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTdkMDFkZmYyMGVjZTk5NmNlYjg3NDYyZmZmOTQ2Mjc5N2NlODg1Yw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZGI2NzE3MzgxODJkMzliMTFmM2UzOGY1MDlkYTYyNzk4YjVlOTZkMTJhYTlk
|
10
|
+
OTUzZTY5NzA0Y2EzNWI1ZDQyYWJmYmZiMDg0MGNiYWRlNjA3ODYwZjg2MzI1
|
11
|
+
MmNmODQyNTg5MjMyNTA5ZGU4YzIwYTAzYjJkYWEwZTVjNjQ4YTE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OGZhNmEwN2UxMDEwNzUwOWQwZTg0OTllMDA4YTBiNDI0MTEyMjhhZmY4N2Fi
|
14
|
+
MDBkYWY2Y2Y3YzI2NDhlZDczYWQzM2FhZTIzOGE4MWYwZDhlNmRmMjY4MTNh
|
15
|
+
ZWQ3MzVmOWY4OTdjYzFlMzk4YTRkMjQ5NDM2MmNlNDFlMzJjYzE=
|
data/README.md
CHANGED
@@ -30,45 +30,43 @@ parameter :
|
|
30
30
|
|
31
31
|
Element you can get : (current version)
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
- meteo_lendemain, # Prévision du lendemain
|
71
|
-
- meteo_semaine # Tendances de la semaine
|
33
|
+
:auj_ciel_id_matin,
|
34
|
+
|
35
|
+
- auj_ciel_id_apm,
|
36
|
+
- dem_ciel_id_matin,
|
37
|
+
- dem_ciel_id_apm,
|
38
|
+
- auj_temp_matin,
|
39
|
+
- auj_temp_apm,
|
40
|
+
- dem_temp_matin,
|
41
|
+
- dem_temp_apm,
|
42
|
+
- auj_temp_rst,
|
43
|
+
- auj_vent_kmh,
|
44
|
+
- auj_vent_dir,
|
45
|
+
- auj_vit_rafales,
|
46
|
+
- visibilite,
|
47
|
+
- meteo_jour,
|
48
|
+
- dem_vent_kmh,
|
49
|
+
- dem_vent_dir,
|
50
|
+
- dem_vit_rafales,
|
51
|
+
- dem_visibilite,
|
52
|
+
- meteo_lendemain,
|
53
|
+
- j2_mat_ciel_id,
|
54
|
+
- j2_apm_ciel_id,
|
55
|
+
- j2_temp_matin,
|
56
|
+
- j2_temp_apm,
|
57
|
+
- j2_vent_kmh,
|
58
|
+
- j2_vent_dir,
|
59
|
+
- j2_vit_rafales,
|
60
|
+
- j2_visibilite,
|
61
|
+
- j3_mat_ciel_id,
|
62
|
+
- j3_apm_ciel_id,
|
63
|
+
- j3_temp_matin,
|
64
|
+
- j3_temp_apm,
|
65
|
+
- j3_vent_kmh,
|
66
|
+
- j3_vent_dir,
|
67
|
+
- j3_vit_rafales,
|
68
|
+
- j3_visibilite,
|
69
|
+
- meteo_semaine
|
72
70
|
|
73
71
|
## Contributing
|
74
72
|
|
@@ -1,87 +1,80 @@
|
|
1
1
|
class WeatherObject
|
2
2
|
|
3
|
-
attr_accessor :
|
4
|
-
:langue,
|
5
|
-
:date_heur_maj,
|
6
|
-
:zone_nom,
|
7
|
-
:zone_altitude,
|
8
|
-
:date_maj,
|
9
|
-
:reference_zone,
|
10
|
-
:rsq_reel,
|
11
|
-
:val_risque,
|
12
|
-
:lib_risque,
|
13
|
-
:temperature_mtn,
|
14
|
-
:temperature_apm,
|
15
|
-
:temperature_rst,
|
16
|
-
:neige,
|
17
|
-
:cumul,
|
18
|
-
:neige_horspiste,
|
19
|
-
:lib_qualite,
|
20
|
-
:id_qualite,
|
21
|
-
:id_qualitehorspiste,
|
22
|
-
:date_dern_neige,
|
23
|
-
:vitesse_vent,
|
24
|
-
:direction_vent,
|
25
|
-
:rafales_vent,
|
26
|
-
:visibilite,
|
27
|
-
:id_ciel_mtn,
|
28
|
-
:id_ciel_apm,
|
29
|
-
:indice_uv,
|
30
|
-
:risque_orage,
|
31
|
-
:commentaire,
|
32
|
-
:meteo_jour,
|
33
|
-
:meteo_lendemain,
|
34
|
-
:meteo_semaine,
|
35
|
-
:auj_ciel_id_matin,
|
3
|
+
attr_accessor :auj_ciel_id_matin,
|
36
4
|
:auj_ciel_id_apm,
|
37
5
|
:dem_ciel_id_matin,
|
38
6
|
:dem_ciel_id_apm,
|
39
7
|
:auj_temp_matin,
|
40
8
|
:auj_temp_apm,
|
41
9
|
:dem_temp_matin,
|
42
|
-
:dem_temp_apm
|
10
|
+
:dem_temp_apm,
|
11
|
+
:auj_temp_rst,
|
12
|
+
:auj_vent_kmh,
|
13
|
+
:auj_vent_dir,
|
14
|
+
:auj_vit_rafales,
|
15
|
+
:visibilite,
|
16
|
+
:meteo_jour,
|
17
|
+
:dem_vent_kmh,
|
18
|
+
:dem_vent_dir,
|
19
|
+
:dem_vit_rafales,
|
20
|
+
:dem_visibilite,
|
21
|
+
:meteo_lendemain,
|
22
|
+
:j2_mat_ciel_id,
|
23
|
+
:j2_apm_ciel_id,
|
24
|
+
:j2_temp_matin,
|
25
|
+
:j2_temp_apm,
|
26
|
+
:j2_vent_kmh,
|
27
|
+
:j2_vent_dir,
|
28
|
+
:j2_vit_rafales,
|
29
|
+
:j2_visibilite,
|
30
|
+
:j3_mat_ciel_id,
|
31
|
+
:j3_apm_ciel_id,
|
32
|
+
:j3_temp_matin,
|
33
|
+
:j3_temp_apm,
|
34
|
+
:j3_vent_kmh,
|
35
|
+
:j3_vent_dir,
|
36
|
+
:j3_vit_rafales,
|
37
|
+
:j3_visibilite,
|
38
|
+
:meteo_semaine
|
39
|
+
|
43
40
|
|
44
41
|
def initialize(attributes = {})
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
@auj_temp_matin = attributes[:auj_temp_matin]
|
82
|
-
@auj_temp_apm = attributes[:auj_temp_apm]
|
83
|
-
@dem_temp_matin = attributes[:dem_temp_matin]
|
84
|
-
@dem_temp_apm = attributes[:dem_temp_apm]
|
42
|
+
@auj_ciel_id_matin = attributes[:auj_ciel_id_matin]
|
43
|
+
@auj_ciel_id_apm = attributes[:auj_ciel_id_apm]
|
44
|
+
@dem_ciel_id_matin = attributes[:dem_ciel_id_matin]
|
45
|
+
@dem_ciel_id_apm = attributes[:dem_ciel_id_apm]
|
46
|
+
@auj_temp_matin = attributes[:auj_temp_matin]
|
47
|
+
@auj_temp_apm = attributes[:auj_temp_apm]
|
48
|
+
@dem_temp_matin = attributes[:dem_temp_matin]
|
49
|
+
@dem_temp_apm = attributes[:dem_temp_apm]
|
50
|
+
@auj_temp_rst = attributes[:auj_temp_rst]
|
51
|
+
@auj_vent_kmh = attributes[:auj_vent_kmh]
|
52
|
+
@auj_vent_dir = attributes[:auj_vent_dir]
|
53
|
+
@auj_vit_rafales = attributes[:auj_vit_rafales]
|
54
|
+
@visibilite = attributes[:visibilite]
|
55
|
+
@meteo_jour = attributes[:meteo_jour]
|
56
|
+
@dem_vent_kmh = attributes[:dem_vent_kmh]
|
57
|
+
@dem_vent_dir = attributes[:dem_vent_dir]
|
58
|
+
@dem_vit_rafales = attributes[:dem_vit_rafales]
|
59
|
+
@dem_visibilite = attributes[:dem_visibilite]
|
60
|
+
@meteo_lendemain = attributes[:meteo_lendemain]
|
61
|
+
@j2_mat_ciel_id = attributes[:j2_mat_ciel_id]
|
62
|
+
@j2_apm_ciel_id = attributes[:j2_apm_ciel_id]
|
63
|
+
@j2_temp_matin = attributes[:j2_temp_matin]
|
64
|
+
@j2_temp_apm = attributes[:j2_temp_apm]
|
65
|
+
@j2_vent_kmh = attributes[:j2_vent_kmh]
|
66
|
+
@j2_vent_dir = attributes[:j2_vent_dir]
|
67
|
+
@j2_vit_rafales = attributes[:j2_vit_rafales]
|
68
|
+
@j2_visibilite = attributes[:j2_visibilite]
|
69
|
+
@j3_mat_ciel_id = attributes[:j3_mat_ciel_id]
|
70
|
+
@j3_apm_ciel_id = attributes[:j3_apm_ciel_id]
|
71
|
+
@j3_temp_matin = attributes[:j3_temp_matin]
|
72
|
+
@j3_temp_apm = attributes[:j3_temp_apm]
|
73
|
+
@j3_vent_kmh = attributes[:j3_vent_kmh]
|
74
|
+
@j3_vent_dir = attributes[:j3_vent_dir]
|
75
|
+
@j3_vit_rafales = attributes[:j3_vit_rafales]
|
76
|
+
@j3_visibilite = attributes[:j3_visibilite]
|
77
|
+
@meteo_semaine = attributes[:meteo_semaine]
|
85
78
|
|
86
79
|
end
|
87
80
|
end
|
data/lib/skiplan_client.rb
CHANGED
@@ -20,21 +20,78 @@ module SkiplanClient
|
|
20
20
|
|
21
21
|
ciel_id_auj_mat = xml.xpath('//ZONE[@nom="CHINAILLON"]/CIEL_ID').text
|
22
22
|
ciel_id_auj_apm = xml.xpath('//ZONE[@nom="CHINAILLON"]/CIEL_ID_APM').text
|
23
|
+
auj_temp_matin = xml.xpath('//ZONE[@nom="CHINAILLON"]/TEMPERATURE').text
|
24
|
+
auj_temp_apm = xml.xpath('//ZONE[@nom="CHINAILLON"]/TEMPERATURE_APM').text
|
25
|
+
auj_temp_rst = xml.xpath('//ZONE[@nom="CHINAILLON"]/TEMPERATURE_RESSENTIE').text
|
26
|
+
auj_vent_kmh = xml.xpath('//ZONE[@nom="CHINAILLON"]/VENT').text
|
27
|
+
auj_vent_dir = xml.xpath('//ZONE[@nom="CHINAILLON"]/DIRECTION').text
|
28
|
+
auj_vit_rafales = xml.xpath('//ZONE[@nom="CHINAILLON"]/RAFALES').text
|
29
|
+
auj_visibilite = xml.xpath('//ZONE[@nom="CHINAILLON"]/VISIBILITE').text
|
30
|
+
meteo_jour = xml.xpath('//JOUR/LANGUE[@val="fr"]').text
|
23
31
|
ciel_id_dem_mat = xml.xpath('//ZONE[@nom="J+1"]/CIEL_ID').text
|
24
32
|
ciel_id_dem_apm = xml.xpath('//ZONE[@nom="J+1"]/CIEL_ID_APM').text
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
33
|
+
dem_temp_matin = xml.xpath('//ZONE[@nom="J+1"]/TEMPERATURE').text
|
34
|
+
dem_temp_apm = xml.xpath('//ZONE[@nom="J+1"]/TEMPERATURE_APM').text
|
35
|
+
dem_vent_kmh = xml.xpath('//ZONE[@nom="J+1"]/VENT').text
|
36
|
+
dem_vent_dir = xml.xpath('//ZONE[@nom="J+1"]/DIRECTION').text
|
37
|
+
dem_vit_rafales = xml.xpath('//ZONE[@nom="J+1"]/RAFALES').text
|
38
|
+
dem_visibilite = xml.xpath('//ZONE[@nom="J+1"]/VISIBILITE').text
|
39
|
+
meteo_lendemain = xml.xpath('//LENDEMAIN/LANGUE[@val="fr"]').text
|
40
|
+
j2_mat_ciel_id = xml.xpath('//ZONE[@nom="J+2"]/CIEL_ID').text
|
41
|
+
j2_apm_ciel_id = xml.xpath('//ZONE[@nom="J+2"]/CIEL_ID_APM').text
|
42
|
+
j2_temp_matin = xml.xpath('//ZONE[@nom="J+2"]/TEMPERATURE').text
|
43
|
+
j2_temp_apm = xml.xpath('//ZONE[@nom="J+2"]/TEMPERATURE_APM').text
|
44
|
+
j2_vent_kmh = xml.xpath('//ZONE[@nom="J+2"]/VENT').text
|
45
|
+
j2_vent_dir = xml.xpath('//ZONE[@nom="J+2"]/DIRECTION').text
|
46
|
+
j2_vit_rafales = xml.xpath('//ZONE[@nom="J+2"]/RAFALES').text
|
47
|
+
j2_visibilite = xml.xpath('//ZONE[@nom="J+2"]/VISIBILITE').text
|
48
|
+
j3_mat_ciel_id = xml.xpath('//ZONE[@nom="J+3"]/CIEL_ID').text
|
49
|
+
j3_apm_ciel_id = xml.xpath('//ZONE[@nom="J+3"]/CIEL_ID_APM').text
|
50
|
+
j3_temp_matin = xml.xpath('//ZONE[@nom="J+3"]/TEMPERATURE').text
|
51
|
+
j3_temp_apm = xml.xpath('//ZONE[@nom="J+3"]/TEMPERATURE_APM').text
|
52
|
+
j3_vent_kmh = xml.xpath('//ZONE[@nom="J+3"]/VENT').text
|
53
|
+
j3_vent_dir = xml.xpath('//ZONE[@nom="J+3"]/DIRECTION').text
|
54
|
+
j3_vit_rafales = xml.xpath('//ZONE[@nom="J+3"]/RAFALES').text
|
55
|
+
j3_visibilite = xml.xpath('//ZONE[@nom="J+3"]/VISIBILITE').text
|
56
|
+
meteo_semaine = xml.xpath('//SEMAINE/LANGUE[@val="fr"]').text
|
29
57
|
|
30
|
-
|
31
|
-
|
58
|
+
|
59
|
+
@info = WeatherObject.new( :auj_ciel_id_matin => ciel_id_auj_mat,
|
60
|
+
:auj_ciel_id_apm => ciel_id_auj_apm,
|
32
61
|
:dem_ciel_id_matin => ciel_id_dem_mat,
|
33
|
-
:dem_ciel_id_apm
|
34
|
-
:auj_temp_matin
|
35
|
-
:auj_temp_apm
|
36
|
-
:dem_temp_matin
|
37
|
-
:dem_temp_apm
|
62
|
+
:dem_ciel_id_apm => ciel_id_dem_apm,
|
63
|
+
:auj_temp_matin => auj_temp_matin,
|
64
|
+
:auj_temp_apm => auj_temp_apm,
|
65
|
+
:dem_temp_matin => dem_temp_matin,
|
66
|
+
:dem_temp_apm => dem_temp_apm,
|
67
|
+
:auj_temp_rst => auj_temp_rst,
|
68
|
+
:auj_vent_kmh => auj_vent_kmh,
|
69
|
+
:auj_vent_dir => auj_vent_dir,
|
70
|
+
:auj_vit_rafales => auj_vit_rafales,
|
71
|
+
:visibilite => auj_visibilite,
|
72
|
+
:meteo_jour => meteo_jour,
|
73
|
+
:dem_vent_kmh => dem_vent_kmh,
|
74
|
+
:dem_vent_dir => dem_vent_dir,
|
75
|
+
:dem_vit_rafales => dem_vit_rafales,
|
76
|
+
:dem_visibilite => dem_visibilite,
|
77
|
+
:meteo_lendemain => meteo_lendemain,
|
78
|
+
:j2_mat_ciel_id => j2_mat_ciel_id,
|
79
|
+
:j2_apm_ciel_id => j2_apm_ciel_id,
|
80
|
+
:j2_temp_matin => j2_temp_matin,
|
81
|
+
:j2_temp_apm => j2_temp_apm,
|
82
|
+
:j2_vent_kmh => j2_vent_kmh,
|
83
|
+
:j2_vent_dir => j2_vent_dir,
|
84
|
+
:j2_vit_rafales => j2_vit_rafales,
|
85
|
+
:j2_visibilite => j2_visibilite,
|
86
|
+
:j3_mat_ciel_id => j3_mat_ciel_id,
|
87
|
+
:j3_apm_ciel_id => j3_apm_ciel_id,
|
88
|
+
:j3_temp_matin => j3_temp_matin,
|
89
|
+
:j3_temp_apm => j3_temp_apm,
|
90
|
+
:j3_vent_kmh => j3_vent_kmh,
|
91
|
+
:j3_vent_dir => j3_vent_dir,
|
92
|
+
:j3_vit_rafales => j3_vit_rafales,
|
93
|
+
:j3_visibilite => j3_visibilite,
|
94
|
+
:meteo_semaine => meteo_semaine)
|
38
95
|
@info
|
39
96
|
end
|
40
97
|
end
|
@@ -21,6 +21,10 @@ class SkiplanClientTest < Test::Unit::TestCase
|
|
21
21
|
|
22
22
|
should 'test get_weather founction' do
|
23
23
|
|
24
|
+
jour = '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.'
|
25
|
+
dem = '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.'
|
26
|
+
semaine = ""
|
27
|
+
|
24
28
|
config = SkiplanClient.configure('C:\Users\Simon\Desktop\Stage\GitHub\skiplan_client\data\lumi_response.xml')
|
25
29
|
weather = SkiplanClient.get_weather
|
26
30
|
|
@@ -32,6 +36,37 @@ class SkiplanClientTest < Test::Unit::TestCase
|
|
32
36
|
assert_equal '+20' , weather.auj_temp_apm
|
33
37
|
assert_equal '+17' , weather.dem_temp_matin
|
34
38
|
assert_equal '+21' , weather.dem_temp_apm
|
39
|
+
assert_equal '+4' , weather.auj_temp_rst
|
40
|
+
assert_equal '4' , weather.auj_vent_kmh
|
41
|
+
assert_equal 'SE' , weather.auj_vent_dir
|
42
|
+
assert_equal '0' , weather.auj_vit_rafales
|
43
|
+
assert_equal '100' , weather.visibilite
|
44
|
+
assert_equal jour , weather.meteo_jour
|
45
|
+
assert_equal '+17' , weather.dem_temp_matin
|
46
|
+
assert_equal '+21' , weather.dem_temp_apm
|
47
|
+
assert_equal '7' , weather.dem_vent_kmh
|
48
|
+
assert_equal 'SO' , weather.dem_vent_dir
|
49
|
+
assert_equal '0' , weather.dem_vit_rafales
|
50
|
+
assert_equal '100' , weather.dem_visibilite
|
51
|
+
assert_equal dem , weather.meteo_lendemain
|
52
|
+
assert_equal '106' , weather.j2_mat_ciel_id
|
53
|
+
assert_equal '104' , weather.j2_apm_ciel_id
|
54
|
+
assert_equal '+12' , weather.j2_temp_matin
|
55
|
+
assert_equal '+18' , weather.j2_temp_apm
|
56
|
+
assert_equal '7' , weather.j2_vent_kmh
|
57
|
+
assert_equal 'O' , weather.j2_vent_dir
|
58
|
+
assert_equal '0' , weather.j2_vit_rafales
|
59
|
+
assert_equal '100' , weather.j2_visibilite
|
60
|
+
assert_equal '101' , weather.j3_mat_ciel_id
|
61
|
+
assert_equal '103' , weather.j3_apm_ciel_id
|
62
|
+
assert_equal '+16' , weather.j3_temp_matin
|
63
|
+
assert_equal '+20' , weather.j3_temp_apm
|
64
|
+
assert_equal '7' , weather.j3_vent_kmh
|
65
|
+
assert_equal 'O' , weather.j3_vent_dir
|
66
|
+
assert_equal '0' , weather.j3_vit_rafales
|
67
|
+
assert_equal '100' , weather.j3_visibilite
|
68
|
+
assert_equal '' , weather.meteo_semaine
|
69
|
+
|
35
70
|
end
|
36
71
|
|
37
72
|
should 'change config url' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skiplan_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SimonRonzani
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|