colissimo_fuel_adjustment_coefficients 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +3 -0
- data.tar.gz.sig +0 -0
- data/.gitignore +9 -0
- data/.rubocop.yml +21 -0
- data/.ruby-version +1 -0
- data/.travis.yml +24 -0
- data/CHANGELOG.md +36 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +51 -0
- data/LICENSE +21 -0
- data/README.md +31 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/certs/bob_levups.pem +25 -0
- data/colissimo_fuel_adjustment_coefficients.gemspec +45 -0
- data/exe/colissimo_fuel_adjustment_coefficients +11 -0
- data/lib/colissimo_fuel_adjustment_coefficients.rb +63 -0
- metadata +177 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 7b7caf64ae920e2477e23e0ea4f7a29cf4c2de9fb67a4ca835c8c2a73f4f5a16
|
|
4
|
+
data.tar.gz: e32bb9b600316d41b785561f05d18ff46a41e6edcd5ff0311a6db91e335983d3
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 9a5cd20fa570ffae47cd0a7f1cb1ea78fd0ffcc3ffc1b067fbfd3449c845dd3fb63a3ffacd42f98c7d94e2986f9c7eb911e03664af72b8bdda8ac35ecab26833
|
|
7
|
+
data.tar.gz: 5292fe3f37738a0cb8eba459691bdb4bfaf7487ad0af28ec71206f93975d65c6326fe425785b29339799452c0f1a6d59c6d27a4f6ef523a679b019f55e5cbd77
|
checksums.yaml.gz.sig
ADDED
data.tar.gz.sig
ADDED
|
Binary file
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Style/Documentation:
|
|
2
|
+
Enabled: false
|
|
3
|
+
|
|
4
|
+
Style/FrozenStringLiteralComment:
|
|
5
|
+
Enabled: false
|
|
6
|
+
|
|
7
|
+
Style/StringLiterals:
|
|
8
|
+
Enabled: false
|
|
9
|
+
|
|
10
|
+
Style/GuardClause:
|
|
11
|
+
Exclude:
|
|
12
|
+
- './*.gemspec'
|
|
13
|
+
|
|
14
|
+
Metrics/BlockLength:
|
|
15
|
+
Exclude:
|
|
16
|
+
- './*.gemspec'
|
|
17
|
+
|
|
18
|
+
Metrics/LineLength:
|
|
19
|
+
Exclude:
|
|
20
|
+
- './*.gemspec'
|
|
21
|
+
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.5.3
|
data/.travis.yml
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
sudo: false
|
|
3
|
+
|
|
4
|
+
language: ruby
|
|
5
|
+
|
|
6
|
+
rvm:
|
|
7
|
+
- 2.3
|
|
8
|
+
- 2.4
|
|
9
|
+
- 2.5
|
|
10
|
+
- 2.6
|
|
11
|
+
|
|
12
|
+
os:
|
|
13
|
+
- linux
|
|
14
|
+
- osx
|
|
15
|
+
|
|
16
|
+
cache:
|
|
17
|
+
bundler: true
|
|
18
|
+
|
|
19
|
+
before_install:
|
|
20
|
+
- gem install bundler -v 1.17.1
|
|
21
|
+
|
|
22
|
+
script:
|
|
23
|
+
- bundle install
|
|
24
|
+
- bundle exec rake test
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
## [v0.2.1](https://github.com/levups/colissimo_fuel_adjustment_coefficients/tree/v0.2.1) (2018-11-16)
|
|
4
|
+
[Full Changelog](https://github.com/levups/colissimo_fuel_adjustment_coefficients/compare/v0.2.0...v0.2.1)
|
|
5
|
+
|
|
6
|
+
**Closed issues:**
|
|
7
|
+
|
|
8
|
+
- Sign gem before publishing it [\#11](https://github.com/levups/colissimo_fuel_adjustment_coefficients/issues/11)
|
|
9
|
+
- Comply to `bundle gem` defaults [\#10](https://github.com/levups/colissimo_fuel_adjustment_coefficients/issues/10)
|
|
10
|
+
|
|
11
|
+
**Merged pull requests:**
|
|
12
|
+
|
|
13
|
+
- Prepare for official gem release [\#12](https://github.com/levups/colissimo_fuel_adjustment_coefficients/pull/12) ([bobmaerten](https://github.com/bobmaerten))
|
|
14
|
+
|
|
15
|
+
## [v0.2.0](https://github.com/levups/colissimo_fuel_adjustment_coefficients/tree/v0.2.0) (2018-11-14)
|
|
16
|
+
[Full Changelog](https://github.com/levups/colissimo_fuel_adjustment_coefficients/compare/v0.1.0...v0.2.0)
|
|
17
|
+
|
|
18
|
+
**Closed issues:**
|
|
19
|
+
|
|
20
|
+
- Make coefficients results usable as a BigDecimal value [\#8](https://github.com/levups/colissimo_fuel_adjustment_coefficients/issues/8)
|
|
21
|
+
- Add tests to the gem [\#7](https://github.com/levups/colissimo_fuel_adjustment_coefficients/issues/7)
|
|
22
|
+
- Move from httparty to HTTPrb for HTTP requests [\#6](https://github.com/levups/colissimo_fuel_adjustment_coefficients/issues/6)
|
|
23
|
+
|
|
24
|
+
**Merged pull requests:**
|
|
25
|
+
|
|
26
|
+
- Replace httparty with HTTP.rb, unify code and add tests [\#9](https://github.com/levups/colissimo_fuel_adjustment_coefficients/pull/9) ([bobmaerten](https://github.com/bobmaerten))
|
|
27
|
+
- Bump httparty from 0.16.2 to 0.16.3 [\#5](https://github.com/levups/colissimo_fuel_adjustment_coefficients/pull/5) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
28
|
+
- Bump ast from 2.3.0 to 2.4.0 [\#4](https://github.com/levups/colissimo_fuel_adjustment_coefficients/pull/4) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
29
|
+
- Bump addressable from 2.5.1 to 2.5.2 [\#3](https://github.com/levups/colissimo_fuel_adjustment_coefficients/pull/3) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
30
|
+
- Bump oga from 2.10 to 2.15 [\#2](https://github.com/levups/colissimo_fuel_adjustment_coefficients/pull/2) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
31
|
+
- Bump httparty from 0.15.5 to 0.16.2 [\#1](https://github.com/levups/colissimo_fuel_adjustment_coefficients/pull/1) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
32
|
+
|
|
33
|
+
## [v0.1.0](https://github.com/levups/colissimo_fuel_adjustment_coefficients/tree/v0.1.0) (2017-05-23)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
colissimo_fuel_adjustment_coefficients (0.2.1)
|
|
5
|
+
http (~> 4.0)
|
|
6
|
+
oga (~> 2.10)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
addressable (2.5.2)
|
|
12
|
+
public_suffix (>= 2.0.2, < 4.0)
|
|
13
|
+
ansi (1.5.0)
|
|
14
|
+
ast (2.4.0)
|
|
15
|
+
domain_name (0.5.20180417)
|
|
16
|
+
unf (>= 0.0.5, < 1.0.0)
|
|
17
|
+
http (4.0.0)
|
|
18
|
+
addressable (~> 2.3)
|
|
19
|
+
http-cookie (~> 1.0)
|
|
20
|
+
http-form_data (~> 2.0)
|
|
21
|
+
http_parser.rb (~> 0.6.0)
|
|
22
|
+
http-cookie (1.0.3)
|
|
23
|
+
domain_name (~> 0.5)
|
|
24
|
+
http-form_data (2.1.1)
|
|
25
|
+
http_parser.rb (0.6.0)
|
|
26
|
+
minitest (5.11.3)
|
|
27
|
+
minitest-stub_any_instance (1.0.2)
|
|
28
|
+
oga (2.15)
|
|
29
|
+
ast
|
|
30
|
+
ruby-ll (~> 2.1)
|
|
31
|
+
public_suffix (3.0.3)
|
|
32
|
+
rake (12.3.1)
|
|
33
|
+
ruby-ll (2.1.2)
|
|
34
|
+
ansi
|
|
35
|
+
ast
|
|
36
|
+
unf (0.1.4)
|
|
37
|
+
unf_ext
|
|
38
|
+
unf_ext (0.0.7.5)
|
|
39
|
+
|
|
40
|
+
PLATFORMS
|
|
41
|
+
ruby
|
|
42
|
+
|
|
43
|
+
DEPENDENCIES
|
|
44
|
+
bundler (~> 1.17)
|
|
45
|
+
colissimo_fuel_adjustment_coefficients!
|
|
46
|
+
minitest (~> 5.1)
|
|
47
|
+
minitest-stub_any_instance (~> 1.0)
|
|
48
|
+
rake (~> 12.3)
|
|
49
|
+
|
|
50
|
+
BUNDLED WITH
|
|
51
|
+
1.17.1
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2010-2017 Google, Inc. http://angularjs.org
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Colissimo Fuel Adjustment Coefficients fetcher
|
|
2
|
+
|
|
3
|
+
Retrieve current air and road rates applied to Colissimo shipping costs and
|
|
4
|
+
convert them to multipliers we can directly use in your app to calculate
|
|
5
|
+
precise shipping costs?
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
Install the gem:
|
|
10
|
+
|
|
11
|
+
$ gem install colissimo_fuel_adjustment_coefficients
|
|
12
|
+
|
|
13
|
+
Run the gem:
|
|
14
|
+
|
|
15
|
+
$ colissimo_fuel_adjustment_coefficients
|
|
16
|
+
|
|
17
|
+
Get the result:
|
|
18
|
+
|
|
19
|
+
# Fuel multipliers for 05-2017
|
|
20
|
+
# Fetched from https://www.colissimo.entreprise.laposte.fr/fr/system/files/imagescontent/docs/indice_gazole.xml
|
|
21
|
+
|
|
22
|
+
AIR_FUEL_MULTIPLIER = 1.0000
|
|
23
|
+
ROAD_FUEL_MULTIPLIER = 1.0077
|
|
24
|
+
|
|
25
|
+
Or use it in your app:
|
|
26
|
+
|
|
27
|
+
require 'colissimo_fuel_adjustment_coefficients'
|
|
28
|
+
|
|
29
|
+
ch = ColissimoFuelAdjustmentCoefficients.new
|
|
30
|
+
ch.road_multiplier # 0.10077e1
|
|
31
|
+
ch.air_multiplier # 0.1e1
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "colissimo_fuel_adjustment_coefficients"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
|
2
|
+
MIIEKDCCApCgAwIBAgIBATANBgkqhkiG9w0BAQsFADAfMR0wGwYDVQQDDBRib2Iv
|
|
3
|
+
REM9bGV2dXBzL0RDPWNvbTAeFw0xODExMTYwODU2MjNaFw0xOTExMTYwODU2MjNa
|
|
4
|
+
MB8xHTAbBgNVBAMMFGJvYi9EQz1sZXZ1cHMvREM9Y29tMIIBojANBgkqhkiG9w0B
|
|
5
|
+
AQEFAAOCAY8AMIIBigKCAYEA7XI0+NhEI2y0RnOR6b1sTMXGldA57XhzTorPtk7l
|
|
6
|
+
CkOeiMBZzzK+femZhA4Y81TyUFSlg3TO/ggqEv2M0poXkz0xAXlzEqPF2P24UBs8
|
|
7
|
+
yYWzO5RxrVHlm2Y6qS/tT8BtD0onXQQEsRH3q0dMHqGLVXTgLDeZ66Rx6+M8GZ1H
|
|
8
|
+
PvwqINOgFEhdnWQPhFPZILBRrGo/BrToZFYBRGy4LO4+M1wFxlh4CbVNGK2tnwIM
|
|
9
|
+
XkmVCzxTq+e+UoWgUrJYTSAvOxXqe8DlwDTeexaBdCVRG6aRIW1EAgctJDunRCTD
|
|
10
|
+
r/mYiPuZcfkjKZwGpw6oz5+68FpgHzY7G41778A1yClN/5cLN/lNFsMoOu6LEiDV
|
|
11
|
+
8IKiSdZ3D9p8mjesqT/vOe7kUrWohQDSi3QJ60+cLiFD+Ft9DBuAO0TDRN6/tGL9
|
|
12
|
+
VjvGbuJF+4FTrfiqljfWWk9bWu9OXxzg227SEygsjxVl7sYFF51qMRUAO9wvRy2O
|
|
13
|
+
K2jiGEWzepWwuQH2sgD1mFQPAgMBAAGjbzBtMAkGA1UdEwQCMAAwCwYDVR0PBAQD
|
|
14
|
+
AgSwMB0GA1UdDgQWBBSZs9qHyqcihqhWFJ59uiPXX3V+zTAZBgNVHREEEjAQgQ5i
|
|
15
|
+
b2JAbGV2dXBzLmNvbTAZBgNVHRIEEjAQgQ5ib2JAbGV2dXBzLmNvbTANBgkqhkiG
|
|
16
|
+
9w0BAQsFAAOCAYEAp/4YIwioG2eVCJ/rGuQXhkK4Q1m7yQK3wmm8SzHbn4hRl0TG
|
|
17
|
+
Bt3Q9/UB/N5w8HLOeYPR0wmfJ7ngrazqAnWPd/2tPFJ5ovy+zy5777ff2KNadCnI
|
|
18
|
+
PnNYEldJQinX2PFQrLQu6+ia9TFCS+xSGBLNuF6tdxLNj6wwXV4GbmpKCn+roEbw
|
|
19
|
+
x2KtEWqghlLMLa/NLl80bF4QOiT4hB5bCv3nP5NEJcyaaFPFtXQL5TConaMTZg3S
|
|
20
|
+
lGv70G/cGpn1QQjBeIJfxi1pSuJ1wKsQ3/kEJZ+qg8wuD1xHAQ03Rjteavbv/isW
|
|
21
|
+
2Ds/y1oZIwGFXS0eSJGGRAl6RDjg5ODbw1l1qp2EY0rMJjr6khCmfemTj1CHfaPr
|
|
22
|
+
1r0R3b6fBvWXGHOWc+LYj2Myd3ISW3d3d1GkcvdT6eka4r+3RrQzlC9zxTwcCuJw
|
|
23
|
+
jT8ozif/0OTSDY7+8Js1LxoE1c1miwLixh66/avBqoFcnMzfSkTmEv2xVoYiCk0M
|
|
24
|
+
CrJThrTFQhqQDaVx
|
|
25
|
+
-----END CERTIFICATE-----
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = "colissimo_fuel_adjustment_coefficients"
|
|
3
|
+
s.version = "0.2.1"
|
|
4
|
+
s.authors = ["Bob Maerten", "Clément Joubert"]
|
|
5
|
+
s.email = ["bob@levups.com", "clement@levups.com"]
|
|
6
|
+
|
|
7
|
+
s.date = "2018-11-16"
|
|
8
|
+
s.summary = "Retrieve current month's Colissimo's fuel surcharges"
|
|
9
|
+
s.description = "A simple gem to ease/automate getting this data every month."
|
|
10
|
+
s.homepage = "https://rubygems.org/gems/chronopost_fuel_adjustment_coefficients"
|
|
11
|
+
s.license = "MIT"
|
|
12
|
+
|
|
13
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
14
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
15
|
+
if s.respond_to?(:metadata)
|
|
16
|
+
s.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
17
|
+
|
|
18
|
+
s.metadata["homepage_uri"] = s.homepage
|
|
19
|
+
s.metadata["source_code_uri"] = "https://github.com/levups/colissimo_fuel_adjustment_coefficients"
|
|
20
|
+
s.metadata["changelog_uri"] = "https://github.com/levups/colissimo_fuel_adjustment_coefficients/blob/master/CHANGELOG.md"
|
|
21
|
+
else
|
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
s.bindir = "exe"
|
|
26
|
+
s.executables = "colissimo_fuel_adjustment_coefficients"
|
|
27
|
+
s.require_paths = ["lib"]
|
|
28
|
+
# Specify which files should be added to the gem when it is released.
|
|
29
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
30
|
+
s.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
31
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Signature config
|
|
35
|
+
s.cert_chain = ["certs/bob_levups.pem"]
|
|
36
|
+
s.signing_key = File.expand_path("~/.ssh/bob_levups-gem-private_key.pem") if $PROGRAM_NAME.end_with?("gem")
|
|
37
|
+
|
|
38
|
+
s.add_dependency "http", "~> 4.0"
|
|
39
|
+
s.add_dependency "oga", "~> 2.10"
|
|
40
|
+
|
|
41
|
+
s.add_development_dependency "bundler", "~> 1.17"
|
|
42
|
+
s.add_development_dependency "minitest", "~> 5.1"
|
|
43
|
+
s.add_development_dependency "minitest-stub_any_instance", "~> 1.0"
|
|
44
|
+
s.add_development_dependency "rake", "~> 12.3"
|
|
45
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require 'colissimo_fuel_adjustment_coefficients'
|
|
5
|
+
|
|
6
|
+
ch = ColissimoFuelAdjustmentCoefficients.new
|
|
7
|
+
puts "# Fuel multipliers for #{ch.time_period}"
|
|
8
|
+
puts "# Fetched from #{ch.url}"
|
|
9
|
+
puts
|
|
10
|
+
puts "AIR_FUEL_MULTIPLIER = #{format '%.4f', ch.air_multiplier}"
|
|
11
|
+
puts "ROAD_FUEL_MULTIPLIER = #{format '%.4f', ch.road_multiplier}"
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'bigdecimal'
|
|
4
|
+
require 'http'
|
|
5
|
+
require 'oga'
|
|
6
|
+
|
|
7
|
+
# Excepted XML is like:
|
|
8
|
+
# <indice_gazole>
|
|
9
|
+
# <cap>
|
|
10
|
+
# <cap_mois>
|
|
11
|
+
# <titre>05-2017</titre>
|
|
12
|
+
# <routier>0,77%</routier>
|
|
13
|
+
# <aerien>0,00%</aerien>
|
|
14
|
+
# </cap_mois>
|
|
15
|
+
# ...
|
|
16
|
+
# </cap>
|
|
17
|
+
# <indice_gazole>
|
|
18
|
+
class ColissimoFuelAdjustmentCoefficients
|
|
19
|
+
def initialize
|
|
20
|
+
@document = ::Oga.parse_xml response.to_s
|
|
21
|
+
@cap = @document.at_xpath('indice_gazole/cap/cap_mois') ||
|
|
22
|
+
Oga::XML::Element.new
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def url
|
|
26
|
+
'https://www.colissimo.entreprise.laposte.fr/fr/system/files/imagescontent/docs/indice_gazole.xml'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def time_period
|
|
30
|
+
el = @cap.at_xpath('titre')
|
|
31
|
+
return unless el
|
|
32
|
+
|
|
33
|
+
el.text
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def air_multiplier
|
|
37
|
+
format_multiplier 'aerien'
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def road_multiplier
|
|
41
|
+
format_multiplier 'routier'
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
def response
|
|
47
|
+
::HTTP.timeout(10).get(url)
|
|
48
|
+
rescue HTTP::Error
|
|
49
|
+
''
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def format_multiplier(kind)
|
|
53
|
+
el = @cap.at_css(kind)
|
|
54
|
+
return unless el
|
|
55
|
+
|
|
56
|
+
multiplier = el.text
|
|
57
|
+
multiplier.tr!('%', '')
|
|
58
|
+
multiplier.tr!(',', '.')
|
|
59
|
+
|
|
60
|
+
number = (multiplier.to_f / 100 + 1).round(4)
|
|
61
|
+
BigDecimal(number.to_s)
|
|
62
|
+
end
|
|
63
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: colissimo_fuel_adjustment_coefficients
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.2.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Bob Maerten
|
|
8
|
+
- Clément Joubert
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: exe
|
|
11
|
+
cert_chain:
|
|
12
|
+
- |
|
|
13
|
+
-----BEGIN CERTIFICATE-----
|
|
14
|
+
MIIEKDCCApCgAwIBAgIBATANBgkqhkiG9w0BAQsFADAfMR0wGwYDVQQDDBRib2Iv
|
|
15
|
+
REM9bGV2dXBzL0RDPWNvbTAeFw0xODExMTYwODU2MjNaFw0xOTExMTYwODU2MjNa
|
|
16
|
+
MB8xHTAbBgNVBAMMFGJvYi9EQz1sZXZ1cHMvREM9Y29tMIIBojANBgkqhkiG9w0B
|
|
17
|
+
AQEFAAOCAY8AMIIBigKCAYEA7XI0+NhEI2y0RnOR6b1sTMXGldA57XhzTorPtk7l
|
|
18
|
+
CkOeiMBZzzK+femZhA4Y81TyUFSlg3TO/ggqEv2M0poXkz0xAXlzEqPF2P24UBs8
|
|
19
|
+
yYWzO5RxrVHlm2Y6qS/tT8BtD0onXQQEsRH3q0dMHqGLVXTgLDeZ66Rx6+M8GZ1H
|
|
20
|
+
PvwqINOgFEhdnWQPhFPZILBRrGo/BrToZFYBRGy4LO4+M1wFxlh4CbVNGK2tnwIM
|
|
21
|
+
XkmVCzxTq+e+UoWgUrJYTSAvOxXqe8DlwDTeexaBdCVRG6aRIW1EAgctJDunRCTD
|
|
22
|
+
r/mYiPuZcfkjKZwGpw6oz5+68FpgHzY7G41778A1yClN/5cLN/lNFsMoOu6LEiDV
|
|
23
|
+
8IKiSdZ3D9p8mjesqT/vOe7kUrWohQDSi3QJ60+cLiFD+Ft9DBuAO0TDRN6/tGL9
|
|
24
|
+
VjvGbuJF+4FTrfiqljfWWk9bWu9OXxzg227SEygsjxVl7sYFF51qMRUAO9wvRy2O
|
|
25
|
+
K2jiGEWzepWwuQH2sgD1mFQPAgMBAAGjbzBtMAkGA1UdEwQCMAAwCwYDVR0PBAQD
|
|
26
|
+
AgSwMB0GA1UdDgQWBBSZs9qHyqcihqhWFJ59uiPXX3V+zTAZBgNVHREEEjAQgQ5i
|
|
27
|
+
b2JAbGV2dXBzLmNvbTAZBgNVHRIEEjAQgQ5ib2JAbGV2dXBzLmNvbTANBgkqhkiG
|
|
28
|
+
9w0BAQsFAAOCAYEAp/4YIwioG2eVCJ/rGuQXhkK4Q1m7yQK3wmm8SzHbn4hRl0TG
|
|
29
|
+
Bt3Q9/UB/N5w8HLOeYPR0wmfJ7ngrazqAnWPd/2tPFJ5ovy+zy5777ff2KNadCnI
|
|
30
|
+
PnNYEldJQinX2PFQrLQu6+ia9TFCS+xSGBLNuF6tdxLNj6wwXV4GbmpKCn+roEbw
|
|
31
|
+
x2KtEWqghlLMLa/NLl80bF4QOiT4hB5bCv3nP5NEJcyaaFPFtXQL5TConaMTZg3S
|
|
32
|
+
lGv70G/cGpn1QQjBeIJfxi1pSuJ1wKsQ3/kEJZ+qg8wuD1xHAQ03Rjteavbv/isW
|
|
33
|
+
2Ds/y1oZIwGFXS0eSJGGRAl6RDjg5ODbw1l1qp2EY0rMJjr6khCmfemTj1CHfaPr
|
|
34
|
+
1r0R3b6fBvWXGHOWc+LYj2Myd3ISW3d3d1GkcvdT6eka4r+3RrQzlC9zxTwcCuJw
|
|
35
|
+
jT8ozif/0OTSDY7+8Js1LxoE1c1miwLixh66/avBqoFcnMzfSkTmEv2xVoYiCk0M
|
|
36
|
+
CrJThrTFQhqQDaVx
|
|
37
|
+
-----END CERTIFICATE-----
|
|
38
|
+
date: 2018-11-16 00:00:00.000000000 Z
|
|
39
|
+
dependencies:
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: http
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - "~>"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '4.0'
|
|
47
|
+
type: :runtime
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '4.0'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: oga
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - "~>"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '2.10'
|
|
61
|
+
type: :runtime
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '2.10'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: bundler
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '1.17'
|
|
75
|
+
type: :development
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - "~>"
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '1.17'
|
|
82
|
+
- !ruby/object:Gem::Dependency
|
|
83
|
+
name: minitest
|
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - "~>"
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '5.1'
|
|
89
|
+
type: :development
|
|
90
|
+
prerelease: false
|
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - "~>"
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '5.1'
|
|
96
|
+
- !ruby/object:Gem::Dependency
|
|
97
|
+
name: minitest-stub_any_instance
|
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - "~>"
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '1.0'
|
|
103
|
+
type: :development
|
|
104
|
+
prerelease: false
|
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - "~>"
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: '1.0'
|
|
110
|
+
- !ruby/object:Gem::Dependency
|
|
111
|
+
name: rake
|
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - "~>"
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '12.3'
|
|
117
|
+
type: :development
|
|
118
|
+
prerelease: false
|
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
120
|
+
requirements:
|
|
121
|
+
- - "~>"
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: '12.3'
|
|
124
|
+
description: A simple gem to ease/automate getting this data every month.
|
|
125
|
+
email:
|
|
126
|
+
- bob@levups.com
|
|
127
|
+
- clement@levups.com
|
|
128
|
+
executables:
|
|
129
|
+
- colissimo_fuel_adjustment_coefficients
|
|
130
|
+
extensions: []
|
|
131
|
+
extra_rdoc_files: []
|
|
132
|
+
files:
|
|
133
|
+
- ".gitignore"
|
|
134
|
+
- ".rubocop.yml"
|
|
135
|
+
- ".ruby-version"
|
|
136
|
+
- ".travis.yml"
|
|
137
|
+
- CHANGELOG.md
|
|
138
|
+
- Gemfile
|
|
139
|
+
- Gemfile.lock
|
|
140
|
+
- LICENSE
|
|
141
|
+
- README.md
|
|
142
|
+
- Rakefile
|
|
143
|
+
- bin/console
|
|
144
|
+
- bin/setup
|
|
145
|
+
- certs/bob_levups.pem
|
|
146
|
+
- colissimo_fuel_adjustment_coefficients.gemspec
|
|
147
|
+
- exe/colissimo_fuel_adjustment_coefficients
|
|
148
|
+
- lib/colissimo_fuel_adjustment_coefficients.rb
|
|
149
|
+
homepage: https://rubygems.org/gems/chronopost_fuel_adjustment_coefficients
|
|
150
|
+
licenses:
|
|
151
|
+
- MIT
|
|
152
|
+
metadata:
|
|
153
|
+
allowed_push_host: https://rubygems.org
|
|
154
|
+
homepage_uri: https://rubygems.org/gems/chronopost_fuel_adjustment_coefficients
|
|
155
|
+
source_code_uri: https://github.com/levups/colissimo_fuel_adjustment_coefficients
|
|
156
|
+
changelog_uri: https://github.com/levups/colissimo_fuel_adjustment_coefficients/blob/master/CHANGELOG.md
|
|
157
|
+
post_install_message:
|
|
158
|
+
rdoc_options: []
|
|
159
|
+
require_paths:
|
|
160
|
+
- lib
|
|
161
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
162
|
+
requirements:
|
|
163
|
+
- - ">="
|
|
164
|
+
- !ruby/object:Gem::Version
|
|
165
|
+
version: '0'
|
|
166
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
|
+
requirements:
|
|
168
|
+
- - ">="
|
|
169
|
+
- !ruby/object:Gem::Version
|
|
170
|
+
version: '0'
|
|
171
|
+
requirements: []
|
|
172
|
+
rubyforge_project:
|
|
173
|
+
rubygems_version: 2.7.7
|
|
174
|
+
signing_key:
|
|
175
|
+
specification_version: 4
|
|
176
|
+
summary: Retrieve current month's Colissimo's fuel surcharges
|
|
177
|
+
test_files: []
|
metadata.gz.sig
ADDED
|
Binary file
|