fuel_surcharge 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7e6925a11089e67824b780894dd1e9c0b0d5d04c1557f2a924bdbd15a7f66abc
4
+ data.tar.gz: 9e8fc90cf801ee0c633bdc09c36d4d15d1de7e243461878d0b110a8460deb085
5
+ SHA512:
6
+ metadata.gz: 2b023f34692ec4944e6ba1ca41cfd6bd9a717158cae69893029cc7d4942029abbe49f1decab3d965b20a475c911d04acbb3b916eb1980610ebfc41e9c67034b7
7
+ data.tar.gz: 0c4bf04e75242132641b57c2c818dc382ecf81630a7e7962b331646c13ab1a6dd4600ea75b44b7472e941dcfadc993c5dfeefc43d5ed5a58241b689286d82dca
checksums.yaml.gz.sig ADDED
Binary file
data.tar.gz.sig ADDED
Binary file
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/.rubocop.yml ADDED
@@ -0,0 +1,36 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.3
3
+
4
+ Style/Documentation:
5
+ Enabled: false
6
+
7
+ Style/StringLiterals:
8
+ Enabled: false
9
+
10
+ Style/FrozenStringLiteralComment:
11
+ Exclude:
12
+ - './bin/*'
13
+ - './exe/*'
14
+ - './Rakefile'
15
+ - './Gemfile'
16
+ - './*.gemspec'
17
+
18
+ Metrics/BlockLength:
19
+ Exclude:
20
+ - './*.gemspec'
21
+
22
+ Metrics/LineLength:
23
+ Exclude:
24
+ - './*.gemspec'
25
+ - 'exe/fuel_surcharge'
26
+
27
+ # Lint/AssignmentInCondition:
28
+ # Enabled: false
29
+
30
+ Metrics/MethodLength:
31
+ Exclude:
32
+ - 'test/**/*.rb'
33
+
34
+ Metrics/AbcSize:
35
+ Exclude:
36
+ - 'test/**/*.rb'
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,10 @@
1
+ # Change Log
2
+
3
+ ## [v0.1.0](https://github.com/levups/fuel_surcharge/tree/v0.1.0) (2018-11-25)
4
+ **Merged pull requests:**
5
+
6
+ - Prepare for initial release [\#1](https://github.com/levups/fuel_surcharge/pull/1) ([bobmaerten](https://github.com/bobmaerten))
7
+
8
+
9
+
10
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in fuel_surcharge.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,42 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ fuel_surcharge (0.1.0)
5
+ http (~> 4.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.5.2)
11
+ public_suffix (>= 2.0.2, < 4.0)
12
+ domain_name (0.5.20180417)
13
+ unf (>= 0.0.5, < 1.0.0)
14
+ http (4.0.0)
15
+ addressable (~> 2.3)
16
+ http-cookie (~> 1.0)
17
+ http-form_data (~> 2.0)
18
+ http_parser.rb (~> 0.6.0)
19
+ http-cookie (1.0.3)
20
+ domain_name (~> 0.5)
21
+ http-form_data (2.1.1)
22
+ http_parser.rb (0.6.0)
23
+ minitest (5.11.3)
24
+ minitest-stub_any_instance (1.0.2)
25
+ public_suffix (3.0.3)
26
+ rake (10.5.0)
27
+ unf (0.1.4)
28
+ unf_ext
29
+ unf_ext (0.0.7.5)
30
+
31
+ PLATFORMS
32
+ ruby
33
+
34
+ DEPENDENCIES
35
+ bundler (~> 1.17)
36
+ fuel_surcharge!
37
+ minitest (~> 5.0)
38
+ minitest-stub_any_instance (~> 1.0)
39
+ rake (~> 10.0)
40
+
41
+ BUNDLED WITH
42
+ 1.17.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Bob Maerten
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,60 @@
1
+ # Transporters Fuel surchage fetcher
2
+
3
+ Retrieve current air and road rates applied to transporters shipping costs and
4
+ convert them to multipliers we can directly use in your app to calculate
5
+ precise shipping costs.
6
+
7
+ ## Implemented transporters
8
+
9
+ - [Colissimo](https://www.colissimo.entreprise.laposte.fr/fr/system/files/imagescontent/docs/indice_gazole.xml)
10
+ - [Chronopost](https://www.chronopost.fr/fr/surcharge-carburant)
11
+ - [Tnt](https://www.tnt.com/express/fr_fr/site/home/comment-expedier/facturation/surcharges/baremes-et-historiques.html)
12
+
13
+ ## Usage
14
+
15
+ Install the gem:
16
+
17
+ $ gem install fuel_surcharge
18
+
19
+ Run the gem:
20
+
21
+ $ fuel_surcharge
22
+
23
+ Get the result:
24
+
25
+ ---------------------------------------------------
26
+ # Fuel surcharges for Colissimo on 12-2018
27
+ # Fetched from https://www.colissimo.entreprise.laposte.fr/fr/system/files/imagescontent/docs/indice_gazole.xml
28
+
29
+ AIR = 3,58% / 1.0358
30
+ ROAD = 2,24% / 1.0224
31
+
32
+ ---------------------------------------------------
33
+ # Fuel surcharges for Chronopost on Novembre 2018
34
+ # Fetched from https://www.chronopost.fr/fr/surcharge-carburant
35
+
36
+ AIR = 20,15% / 1.2015
37
+ ROAD = 14,80% / 1.1480
38
+
39
+ ---------------------------------------------------
40
+ # Fuel surcharges for Tnt on novembre 2018
41
+ # Fetched from https://www.tnt.com/express/fr_fr/site/home/comment-expedier/facturation/surcharges/baremes-et-historiques.html
42
+
43
+ AIR = 18,50% / 1.1850
44
+ ROAD = 12,10% / 1.1210
45
+
46
+ Or use it in your app:
47
+
48
+ require 'fuel_surcharge'
49
+
50
+ colissimo = FuelSurcharge::Colissimo.new
51
+ colissimo.road_multiplier # 0.10224e1
52
+ colissimo.air_multiplier # 0.10358e1
53
+
54
+ chronopost = FuelSurcharge::Chronopost.new
55
+ chronopost.road_multiplier # 0.1148e1
56
+ chronopost.air_multiplier # 0.12015e1
57
+
58
+ tnt = FuelSurcharge::Tnt.new
59
+ tnt.road_multiplier # 0.1121e1
60
+ tnt.air_multiplier # 0.1185e1
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task default: :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "fuel_surcharge"
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,9 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+ IFS=$'\n\t'
5
+ set -vx
6
+
7
+ bundle install
8
+
9
+ # Do any other automated setup that you need to do here
@@ -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,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "fuel_surcharge"
4
+
5
+ colissimo = FuelSurcharge::Colissimo.new
6
+ chronopost = FuelSurcharge::Chronopost.new
7
+ tnt = FuelSurcharge::Tnt.new
8
+
9
+ [colissimo, chronopost, tnt].each do |fuel_surcharge|
10
+ puts "---------------------------------------------------"
11
+ puts "# Fuel surcharges for #{fuel_surcharge.class.name.split('::').last} on #{fuel_surcharge.time_period}"
12
+ puts "# Fetched from #{fuel_surcharge.url}"
13
+ puts
14
+ puts "AIR = #{fuel_surcharge.air_percentage} / #{format '%.4f', fuel_surcharge.air_multiplier}"
15
+ puts "ROAD = #{fuel_surcharge.road_percentage} / #{format '%.4f', fuel_surcharge.road_multiplier}"
16
+ puts
17
+ end
@@ -0,0 +1,46 @@
1
+ lib = File.expand_path("lib", __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ require "fuel_surcharge/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.required_ruby_version = "~> 2.3"
8
+
9
+ spec.name = "fuel_surcharge"
10
+ spec.version = FuelSurcharge::VERSION
11
+ spec.authors = ["Bob Maerten", "Clément Joubert"]
12
+ spec.email = ["bob@levups.com", "clement@levups.com"]
13
+
14
+ spec.summary = "Retrieve current month's Transporters' fuel surcharge"
15
+ spec.description = "A simple gem to fetch transporters data every month."
16
+
17
+ spec.homepage = "https://rubygems.org/gems/fuel_surcharge"
18
+ spec.license = "MIT"
19
+
20
+ spec.metadata = {
21
+ "bug_tracker_uri" => "https://github.com/levups/fuel_surcharge/issues",
22
+ "changelog_uri" => "https://github.com/levups/fuel_surcharge/blob/master/CHANGELOG.md",
23
+ "homepage_uri" => "https://rubygems.org/gems/fuel_surcharge",
24
+ "source_code_uri" => "https://github.com/levups/fuel_surcharge"
25
+ }
26
+
27
+ # Specify which files should be added to the gem when it is released.
28
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
29
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
30
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
31
+ end
32
+ spec.bindir = "exe"
33
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
34
+ spec.require_paths = ["lib"]
35
+
36
+ # Signature config
37
+ spec.cert_chain = ["certs/bob_levups.pem"]
38
+ spec.signing_key = File.expand_path("~/.ssh/bob_levups-gem-private_key.pem") if $PROGRAM_NAME.end_with?("gem")
39
+
40
+ spec.add_dependency "http", "~> 4.0"
41
+
42
+ spec.add_development_dependency "bundler", "~> 1.17"
43
+ spec.add_development_dependency "minitest", "~> 5.0"
44
+ spec.add_development_dependency "minitest-stub_any_instance", "~> 1.0"
45
+ spec.add_development_dependency "rake", "~> 10.0"
46
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "fuel_surcharge/chronopost"
4
+ require "fuel_surcharge/colissimo"
5
+ require "fuel_surcharge/tnt"
6
+ require "fuel_surcharge/version"
@@ -0,0 +1,78 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "fuel_surcharge/http_request"
4
+ require "fuel_surcharge/string_formatter"
5
+
6
+ module FuelSurcharge
7
+ class Chronopost
8
+ using StringFormatter
9
+
10
+ def initialize
11
+ extract_content
12
+ end
13
+
14
+ attr_reader :time_period, :air_percentage, :road_percentage
15
+
16
+ def air_multiplier
17
+ air_percentage&.to_multiplier
18
+ end
19
+
20
+ def road_multiplier
21
+ road_percentage&.to_multiplier
22
+ end
23
+
24
+ def url
25
+ "https://www.chronopost.fr/fr/surcharge-carburant"
26
+ end
27
+
28
+ private
29
+
30
+ def source_html
31
+ HTTPRequest.new(url)
32
+ .response
33
+ .to_s
34
+ .delete("\n")
35
+ .gsub(/\s+/, " ")
36
+ end
37
+
38
+ def tables
39
+ return unless source_html
40
+
41
+ source_html.split("<table ")[1]
42
+ end
43
+
44
+ def table
45
+ return unless tables
46
+
47
+ tables.split("<h2>Principe</h2>").first
48
+ end
49
+
50
+ def head
51
+ return unless table
52
+
53
+ table.scan(%r{<thead>.*</thead>}).first
54
+ end
55
+
56
+ def period
57
+ return unless head
58
+
59
+ head.match(%r{<p>(?<content>.*)</p>})
60
+ end
61
+
62
+ def body
63
+ return unless table
64
+
65
+ table.scan(%r{<tbody><tr>.*</tr></tbody>}).first
66
+ end
67
+
68
+ def extract_content
69
+ return unless period
70
+ return unless body
71
+
72
+ @time_period = period[:content].sub("<br />", "")
73
+ @road_percentage, @air_percentage = body.split("</tr><tr>").map do |line|
74
+ line.to_s.rpartition("</td>").first.rpartition(">").last
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "fuel_surcharge/http_request"
4
+ require "fuel_surcharge/string_formatter"
5
+
6
+ require "rexml/document"
7
+
8
+ # Expected XML is like:
9
+ # <indice_gazole>
10
+ # <cap>
11
+ # <cap_mois>
12
+ # <titre>05-2017</titre>
13
+ # <routier>0,77%</routier>
14
+ # <aerien>0,00%</aerien>
15
+ # </cap_mois>
16
+ # ...
17
+ # </cap>
18
+ # <indice_gazole>
19
+ module FuelSurcharge
20
+ class Colissimo
21
+ using StringFormatter
22
+
23
+ def initialize
24
+ @parsed_values = {}
25
+ return unless xml_root
26
+
27
+ caps = xml_root.elements.first
28
+ month = caps.elements.first
29
+ month.elements.each do |element|
30
+ @parsed_values[element.name] = element.text
31
+ end
32
+ end
33
+
34
+ def url
35
+ "https://www.colissimo.entreprise.laposte.fr/fr/system/files/imagescontent/docs/indice_gazole.xml"
36
+ end
37
+
38
+ def time_period
39
+ @parsed_values["titre"]
40
+ end
41
+
42
+ def air_percentage
43
+ @parsed_values["aerien"]
44
+ end
45
+
46
+ def road_percentage
47
+ @parsed_values["routier"]
48
+ end
49
+
50
+ def air_multiplier
51
+ air_percentage&.to_multiplier
52
+ end
53
+
54
+ def road_multiplier
55
+ road_percentage&.to_multiplier
56
+ end
57
+
58
+ private
59
+
60
+ def xml_root
61
+ doc = ::REXML::Document.new HTTPRequest.new(url).response.to_s
62
+ doc.root
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "http"
4
+
5
+ module FuelSurcharge
6
+ class HTTPRequest
7
+ def initialize(url)
8
+ @url = url
9
+ end
10
+
11
+ def response
12
+ ::HTTP.timeout(10).get(@url)
13
+ rescue HTTP::Error
14
+ ""
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bigdecimal"
4
+
5
+ module FuelSurcharge
6
+ module StringFormatter
7
+ refine String do
8
+ def to_multiplier
9
+ number = BigDecimal tr(",", ".")
10
+
11
+ (number / 100 + 1).round(4)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "fuel_surcharge/http_request"
4
+ require "fuel_surcharge/string_formatter"
5
+
6
+ module FuelSurcharge
7
+ class Tnt
8
+ using StringFormatter
9
+ def initialize
10
+ @road_values = extracted_values.first
11
+ @air_values = extracted_values.last(3).first
12
+ end
13
+
14
+ def url
15
+ "https://www.tnt.com/express/fr_fr/site/home/comment-expedier/facturation/surcharges/baremes-et-historiques.html"
16
+ end
17
+
18
+ def time_period
19
+ return unless @road_values
20
+
21
+ @road_values.first.to_s.strip
22
+ end
23
+
24
+ def road_percentage
25
+ return unless @road_values
26
+
27
+ @road_values.last.to_s
28
+ end
29
+
30
+ def air_percentage
31
+ return unless @air_values
32
+
33
+ @air_values.last.to_s
34
+ end
35
+
36
+ def road_multiplier
37
+ road_percentage&.to_multiplier
38
+ end
39
+
40
+ def air_multiplier
41
+ air_percentage&.to_multiplier
42
+ end
43
+
44
+ private
45
+
46
+ # [
47
+ # [" novembre 2018 ", "12,10%"],
48
+ # ["octobre 2018 ", "11,95%"],
49
+ # [" septembre 2018 ", "11,95%"],
50
+ # [" novembre 2018 ", "18,50%"],
51
+ # ["octobre 2018 ", "17,50%"],
52
+ # [" septembre 2018 ", "17,50%"]
53
+ # ]
54
+ def extracted_values
55
+ @extracted_values ||=
56
+ HTTPRequest.new(url)
57
+ .response
58
+ .to_s
59
+ .scan(/Surcharge d[e']+(.*): (.*)<br>$/)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FuelSurcharge
4
+ VERSION = "0.1.0"
5
+ end
metadata ADDED
@@ -0,0 +1,168 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fuel_surcharge
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
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-25 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: bundler
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.17'
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.17'
68
+ - !ruby/object:Gem::Dependency
69
+ name: minitest
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '5.0'
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '5.0'
82
+ - !ruby/object:Gem::Dependency
83
+ name: minitest-stub_any_instance
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '1.0'
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '1.0'
96
+ - !ruby/object:Gem::Dependency
97
+ name: rake
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '10.0'
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '10.0'
110
+ description: A simple gem to fetch transporters data every month.
111
+ email:
112
+ - bob@levups.com
113
+ - clement@levups.com
114
+ executables:
115
+ - fuel_surcharge
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - ".gitignore"
120
+ - ".rubocop.yml"
121
+ - ".travis.yml"
122
+ - CHANGELOG.md
123
+ - Gemfile
124
+ - Gemfile.lock
125
+ - LICENSE.txt
126
+ - README.md
127
+ - Rakefile
128
+ - bin/console
129
+ - bin/setup
130
+ - certs/bob_levups.pem
131
+ - exe/fuel_surcharge
132
+ - fuel_surcharge.gemspec
133
+ - lib/fuel_surcharge.rb
134
+ - lib/fuel_surcharge/chronopost.rb
135
+ - lib/fuel_surcharge/colissimo.rb
136
+ - lib/fuel_surcharge/http_request.rb
137
+ - lib/fuel_surcharge/string_formatter.rb
138
+ - lib/fuel_surcharge/tnt.rb
139
+ - lib/fuel_surcharge/version.rb
140
+ homepage: https://rubygems.org/gems/fuel_surcharge
141
+ licenses:
142
+ - MIT
143
+ metadata:
144
+ bug_tracker_uri: https://github.com/levups/fuel_surcharge/issues
145
+ changelog_uri: https://github.com/levups/fuel_surcharge/blob/master/CHANGELOG.md
146
+ homepage_uri: https://rubygems.org/gems/fuel_surcharge
147
+ source_code_uri: https://github.com/levups/fuel_surcharge
148
+ post_install_message:
149
+ rdoc_options: []
150
+ require_paths:
151
+ - lib
152
+ required_ruby_version: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - "~>"
155
+ - !ruby/object:Gem::Version
156
+ version: '2.3'
157
+ required_rubygems_version: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - ">="
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
162
+ requirements: []
163
+ rubyforge_project:
164
+ rubygems_version: 2.7.7
165
+ signing_key:
166
+ specification_version: 4
167
+ summary: Retrieve current month's Transporters' fuel surcharge
168
+ test_files: []
metadata.gz.sig ADDED
Binary file