Class: ColissimoFuelAdjustmentCoefficients
- Inherits:
-
Object
- Object
- ColissimoFuelAdjustmentCoefficients
- Includes:
- REXML
- Defined in:
- lib/colissimo_fuel_adjustment_coefficients.rb
Overview
Excepted XML is like:
<indice_gazole>
<cap>
<cap_mois>
<titre>05-2017</titre>
<routier>0,77%</routier>
<aerien>0,00%</aerien>
</cap_mois>
...
</cap>
<indice_gazole>
Instance Method Summary collapse
- #air_multiplier ⇒ Object
-
#initialize ⇒ ColissimoFuelAdjustmentCoefficients
constructor
A new instance of ColissimoFuelAdjustmentCoefficients.
- #road_multiplier ⇒ Object
- #time_period ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize ⇒ ColissimoFuelAdjustmentCoefficients
Returns a new instance of ColissimoFuelAdjustmentCoefficients.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/colissimo_fuel_adjustment_coefficients.rb', line 21 def initialize @parsed_values = {} return unless xml_root caps = xml_root.elements.first month = caps.elements.first month.elements.each do |element| @parsed_values[element.name] = element.text end end |
Instance Method Details
#air_multiplier ⇒ Object
40 41 42 |
# File 'lib/colissimo_fuel_adjustment_coefficients.rb', line 40 def air_multiplier format_multiplier @parsed_values["aerien"] end |
#road_multiplier ⇒ Object
44 45 46 |
# File 'lib/colissimo_fuel_adjustment_coefficients.rb', line 44 def road_multiplier format_multiplier @parsed_values["routier"] end |
#time_period ⇒ Object
36 37 38 |
# File 'lib/colissimo_fuel_adjustment_coefficients.rb', line 36 def time_period @parsed_values["titre"] end |
#url ⇒ Object
32 33 34 |
# File 'lib/colissimo_fuel_adjustment_coefficients.rb', line 32 def url "https://www.colissimo.entreprise.laposte.fr/fr/system/files/imagescontent/docs/indice_gazole.xml" end |