skiplan_client 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,8 +5,8 @@ class Metrics
5
5
 
6
6
  include AttributeHelper
7
7
 
8
- METRICS = ['ETAT_ROUTE', 'SKI_NUIT', 'KM_SKATING', 'SKI_ALPIN', 'SKI_ALPIN_VERTES', 'SKI_ALPIN_BLEUES', 'SKI_ALPIN_ROUGES', 'SKI_ALPIN_NOIRES',
9
- 'SKI_NORDIQUE', 'SKI_NORDIQUE_VERTES', 'SKI_NORDIQUE_BLEUES', 'SKI_NORDIQUE_ROUGES', 'SKI_NORDIQUE_NOIRES',
8
+ METRICS = ['ETAT_CHAUSSEE', 'ETAT_ROUTE', 'SKI_NUIT', 'KM_SKATING', 'SKI_ALPIN', 'SKI_ALPIN_VERTES', 'SKI_ALPIN_BLEUES', 'SKI_ALPIN_ROUGES',
9
+ 'SKI_ALPIN_NOIRES', 'SKI_NORDIQUE', 'SKI_NORDIQUE_VERTES', 'SKI_NORDIQUE_BLEUES', 'SKI_NORDIQUE_ROUGES', 'SKI_NORDIQUE_NOIRES',
10
10
  'REMONTEES', 'PIETONS', 'RAQUETTES', 'LUGE', 'SNOWPARK']
11
11
 
12
12
  def initialize(attributes)
@@ -64,10 +64,14 @@ class Metrics
64
64
  @KM_SKATING['ouvert'] unless @KM_SKATING.nil?
65
65
  end
66
66
 
67
- def roads
67
+ def driving_conditions
68
68
  @ETAT_ROUTE['lib']
69
69
  end
70
70
 
71
+ def roads
72
+ @ETAT_CHAUSSEE['lib'] unless (@ETAT_CHAUSSEE.nil? || @ETAT_CHAUSSEE['val'] == '8')
73
+ end
74
+
71
75
  private
72
76
 
73
77
  def get_ratio(hash)
@@ -1,3 +1,3 @@
1
1
  module SkiplanClient
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -9,6 +9,7 @@ class MetricsTest < Test::Unit::TestCase
9
9
 
10
10
  setup do
11
11
  attributes = {'ETAT_ROUTE' => {'lib' => "Routes dégagées, circulation normale"},
12
+ 'ETAT_CHAUSSEE' => {'val' => '0', 'lib' => "Dégagées et sèches"},
12
13
  'SKI_NUIT' => {'etat' => '1'},
13
14
  'KM_SKATING' => {'ouvert' => '10'},
14
15
  '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'},
@@ -89,7 +90,11 @@ class MetricsTest < Test::Unit::TestCase
89
90
  assert_equal '10', @metrics.skating
90
91
  end
91
92
 
92
- should 'return a detailed status for the local roads' do
93
- assert_equal 'Routes dégagées, circulation normale', @metrics.roads
93
+ should 'return a detailed status for the driving conditions' do
94
+ assert_equal 'Routes dégagées, circulation normale', @metrics.driving_conditions
95
+ end
96
+
97
+ should 'return a detailed status for the roads' do
98
+ assert_equal 'Dégagées et sèches', @metrics.roads
94
99
  end
95
100
  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.3
4
+ version: 0.1.4
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-18 00:00:00.000000000 Z
12
+ date: 2014-11-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler