Class: FuelSurcharge::Colissimo
- Inherits:
-
Object
- Object
- FuelSurcharge::Colissimo
- Defined in:
- lib/fuel_surcharge/colissimo.rb
Instance Method Summary collapse
- #air_multiplier ⇒ Object
- #air_percentage ⇒ Object
-
#initialize ⇒ Colissimo
constructor
A new instance of Colissimo.
- #road_multiplier ⇒ Object
- #road_percentage ⇒ Object
- #time_period ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize ⇒ Colissimo
Returns a new instance of Colissimo.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fuel_surcharge/colissimo.rb', line 23 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
50 51 52 |
# File 'lib/fuel_surcharge/colissimo.rb', line 50 def air_multiplier air_percentage&.to_multiplier end |
#air_percentage ⇒ Object
42 43 44 |
# File 'lib/fuel_surcharge/colissimo.rb', line 42 def air_percentage @parsed_values["aerien"] end |
#road_multiplier ⇒ Object
54 55 56 |
# File 'lib/fuel_surcharge/colissimo.rb', line 54 def road_multiplier road_percentage&.to_multiplier end |
#road_percentage ⇒ Object
46 47 48 |
# File 'lib/fuel_surcharge/colissimo.rb', line 46 def road_percentage @parsed_values["routier"] end |
#time_period ⇒ Object
38 39 40 |
# File 'lib/fuel_surcharge/colissimo.rb', line 38 def time_period @parsed_values["titre"] end |
#url ⇒ Object
34 35 36 |
# File 'lib/fuel_surcharge/colissimo.rb', line 34 def url "https://www.colissimo.entreprise.laposte.fr/fr/system/files/imagescontent/docs/indice_gazole.xml" end |