Class: ChronopostFuelMultiplier
- Inherits:
-
Object
- Object
- ChronopostFuelMultiplier
- Defined in:
- lib/chronopost_fuel_multiplier.rb
Constant Summary collapse
- URL =
'http://www.chronopost.fr/fr/surcharge-carburant'
Instance Method Summary collapse
- #air_multiplier ⇒ Object
-
#initialize ⇒ ChronopostFuelMultiplier
constructor
A new instance of ChronopostFuelMultiplier.
- #road_multiplier ⇒ Object
- #time_period ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize ⇒ ChronopostFuelMultiplier
Returns a new instance of ChronopostFuelMultiplier.
10 11 12 13 |
# File 'lib/chronopost_fuel_multiplier.rb', line 10 def initialize response = PlainHttpClient.get(url, limit: 3, timeout: 10) @page = Nokogiri::HTML response.body end |
Instance Method Details
#air_multiplier ⇒ Object
19 20 21 |
# File 'lib/chronopost_fuel_multiplier.rb', line 19 def air_multiplier "%.4f" % (@page.at_css("table.ch-table tbody tr:last-child td:last-child").text.to_f / 100 + 1) end |
#road_multiplier ⇒ Object
23 24 25 |
# File 'lib/chronopost_fuel_multiplier.rb', line 23 def road_multiplier "%.4f" % (@page.at_css("table.ch-table tbody tr td:last-child").text.to_f / 100 + 1) end |
#time_period ⇒ Object
15 16 17 |
# File 'lib/chronopost_fuel_multiplier.rb', line 15 def time_period @page.at_css("table.ch-table thead tr th:last-child").text end |
#url ⇒ Object
27 28 29 |
# File 'lib/chronopost_fuel_multiplier.rb', line 27 def url URL end |