fuel_surcharge 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +3 -30
- data/.travis.yml +7 -17
- data/CHANGELOG.md +16 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +24 -5
- data/README.md +7 -8
- data/Rakefile +2 -0
- data/bin/console +1 -0
- data/certs/{bob_levups.pem → levups.pem} +0 -0
- data/exe/fuel_surcharge +2 -1
- data/fuel_surcharge.gemspec +9 -4
- data/lib/fuel_surcharge/string_formatter.rb +3 -3
- data/lib/fuel_surcharge/version.rb +1 -1
- metadata +36 -9
- metadata.gz.sig +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e056196172ceee98f1d33ec86ca82157aef2d308c93ee365f84fee89b3cc53b
|
4
|
+
data.tar.gz: b5499c4e3122359aa92c777c46abab4911ba9fa3249e6166395fe153f2bc7371
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c6fa22b6577e30a04b234f7d2f9c2fb8f71850c91bf23a3bfa3050319e76a8382b61b199cfa8c308813c3f1d2c71b9025d5746fb754882656d2939b894d34d9
|
7
|
+
data.tar.gz: e89e7f5337efb2efba9a16b0e2755c2db4f74631225526dd8aa221e8ea9c10f4adab5ea780633edd621079ba8a7b4cc55696b8f2ce4c18585f34939b9693437e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,36 +1,9 @@
|
|
1
1
|
AllCops:
|
2
2
|
TargetRubyVersion: 2.3
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
Style/StringLiterals:
|
8
|
-
Enabled: false
|
9
|
-
|
10
|
-
Style/FrozenStringLiteralComment:
|
11
|
-
Exclude:
|
12
|
-
- './bin/*'
|
13
|
-
- './exe/*'
|
14
|
-
- './Rakefile'
|
15
|
-
- './Gemfile'
|
16
|
-
- './*.gemspec'
|
4
|
+
inherit_gem:
|
5
|
+
relaxed-rubocop: .rubocop.yml
|
17
6
|
|
18
7
|
Metrics/BlockLength:
|
19
8
|
Exclude:
|
20
|
-
-
|
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'
|
9
|
+
- "*.gemspec"
|
data/.travis.yml
CHANGED
@@ -1,26 +1,16 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
|
2
|
+
language: ruby
|
3
|
+
cache: bundler
|
4
4
|
dist: xenial
|
5
5
|
|
6
|
-
|
6
|
+
before_install:
|
7
|
+
- gem update --system
|
8
|
+
- gem install bundler
|
9
|
+
# This is necessary to run `bundle exec rake` on Travis CI with Ruby 2.6
|
10
|
+
- gem install --user-install executable-hooks
|
7
11
|
|
8
12
|
rvm:
|
9
13
|
- 2.3
|
10
14
|
- 2.4
|
11
15
|
- 2.5
|
12
16
|
- 2.6
|
13
|
-
|
14
|
-
os:
|
15
|
-
- linux
|
16
|
-
- osx
|
17
|
-
|
18
|
-
cache:
|
19
|
-
bundler: true
|
20
|
-
|
21
|
-
before_install:
|
22
|
-
- gem install bundler
|
23
|
-
|
24
|
-
script:
|
25
|
-
- bundle install
|
26
|
-
- bundle exec rake test
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v1.0.0](https://github.com/levups/fuel_surcharge/tree/v1.0.0) (2019-01-04)
|
4
|
+
[Full Changelog](https://github.com/levups/fuel_surcharge/compare/v0.2.0...v1.0.0)
|
5
|
+
|
6
|
+
**Merged pull requests:**
|
7
|
+
|
8
|
+
- Include and comply to relaxed Rubocop style [\#15](https://github.com/levups/fuel_surcharge/pull/15) ([czj](https://github.com/czj))
|
9
|
+
- Add BigDecimal compatibility for ruby 2.6 [\#13](https://github.com/levups/fuel_surcharge/pull/13) ([bobmaerten](https://github.com/bobmaerten))
|
10
|
+
- Bump rake from 12.3.1 to 12.3.2 [\#12](https://github.com/levups/fuel_surcharge/pull/12) ([dependabot[bot]](https://github.com/apps/dependabot))
|
11
|
+
- Update rake requirement from ~\> 10.0 to ~\> 12.3 [\#11](https://github.com/levups/fuel_surcharge/pull/11) ([dependabot[bot]](https://github.com/apps/dependabot))
|
12
|
+
- Fix and unify time period tests [\#9](https://github.com/levups/fuel_surcharge/pull/9) ([bobmaerten](https://github.com/bobmaerten))
|
13
|
+
- Fix fuel surcharge binary [\#8](https://github.com/levups/fuel_surcharge/pull/8) ([bobmaerten](https://github.com/bobmaerten))
|
14
|
+
|
3
15
|
## [v0.2.0](https://github.com/levups/fuel_surcharge/tree/v0.2.0) (2018-11-28)
|
4
16
|
[Full Changelog](https://github.com/levups/fuel_surcharge/compare/v0.1.0...v0.2.0)
|
5
17
|
|
@@ -7,6 +19,10 @@
|
|
7
19
|
|
8
20
|
- Rename Tnt class to TNT [\#5](https://github.com/levups/fuel_surcharge/issues/5)
|
9
21
|
|
22
|
+
**Closed issues:**
|
23
|
+
|
24
|
+
- Bump to v.0.2.0 [\#7](https://github.com/levups/fuel_surcharge/issues/7)
|
25
|
+
|
10
26
|
**Merged pull requests:**
|
11
27
|
|
12
28
|
- Generate changelog with github\_changelog\_generator gem [\#6](https://github.com/levups/fuel_surcharge/pull/6) ([bobmaerten](https://github.com/bobmaerten))
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fuel_surcharge (0.
|
4
|
+
fuel_surcharge (1.0.0)
|
5
5
|
http (~> 4.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -14,6 +14,7 @@ GEM
|
|
14
14
|
tzinfo (~> 1.1)
|
15
15
|
addressable (2.5.2)
|
16
16
|
public_suffix (>= 2.0.2, < 4.0)
|
17
|
+
ast (2.4.0)
|
17
18
|
concurrent-ruby (1.1.3)
|
18
19
|
domain_name (0.5.20180417)
|
19
20
|
unf (>= 0.0.5, < 1.0.0)
|
@@ -40,16 +41,31 @@ GEM
|
|
40
41
|
http_parser.rb (0.6.0)
|
41
42
|
i18n (1.1.1)
|
42
43
|
concurrent-ruby (~> 1.0)
|
44
|
+
jaro_winkler (1.5.1)
|
43
45
|
minitest (5.11.3)
|
44
46
|
minitest-stub_any_instance (1.0.2)
|
45
47
|
multi_json (1.13.1)
|
46
48
|
multipart-post (2.0.0)
|
47
49
|
octokit (4.13.0)
|
48
50
|
sawyer (~> 0.8.0, >= 0.5.3)
|
51
|
+
parallel (1.12.1)
|
52
|
+
parser (2.5.3.0)
|
53
|
+
ast (~> 2.4.0)
|
54
|
+
powerpack (0.1.2)
|
49
55
|
public_suffix (3.0.3)
|
50
56
|
rainbow (3.0.0)
|
51
|
-
rake (
|
57
|
+
rake (12.3.2)
|
58
|
+
relaxed-rubocop (2.3.1)
|
52
59
|
retriable (2.1.0)
|
60
|
+
rubocop (0.62.0)
|
61
|
+
jaro_winkler (~> 1.5.1)
|
62
|
+
parallel (~> 1.10)
|
63
|
+
parser (>= 2.5, != 2.5.1.1)
|
64
|
+
powerpack (~> 0.1)
|
65
|
+
rainbow (>= 2.2.2, < 4.0)
|
66
|
+
ruby-progressbar (~> 1.7)
|
67
|
+
unicode-display_width (~> 1.4.0)
|
68
|
+
ruby-progressbar (1.10.0)
|
53
69
|
sawyer (0.8.1)
|
54
70
|
addressable (>= 2.3.5, < 2.6)
|
55
71
|
faraday (~> 0.8, < 1.0)
|
@@ -59,17 +75,20 @@ GEM
|
|
59
75
|
unf (0.1.4)
|
60
76
|
unf_ext
|
61
77
|
unf_ext (0.0.7.5)
|
78
|
+
unicode-display_width (1.4.1)
|
62
79
|
|
63
80
|
PLATFORMS
|
64
81
|
ruby
|
65
82
|
|
66
83
|
DEPENDENCIES
|
67
|
-
bundler (
|
84
|
+
bundler (>= 1.17)
|
68
85
|
fuel_surcharge!
|
69
86
|
github_changelog_generator (~> 1.14)
|
70
87
|
minitest (~> 5.0)
|
71
88
|
minitest-stub_any_instance (~> 1.0)
|
72
|
-
rake (~>
|
89
|
+
rake (~> 12.3)
|
90
|
+
relaxed-rubocop (~> 2.3.1)
|
91
|
+
rubocop (~> 0.62)
|
73
92
|
|
74
93
|
BUNDLED WITH
|
75
|
-
|
94
|
+
2.0.1
|
data/README.md
CHANGED
@@ -1,14 +1,16 @@
|
|
1
|
-
#
|
1
|
+
# A transporters fuel surcharge fetcher
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.com/levups/fuel_surcharge.svg?branch=master)](https://travis-ci.com/levups/fuel_surcharge)
|
2
4
|
|
3
5
|
Retrieve current air and road rates applied to transporters shipping costs and
|
4
|
-
convert them to multipliers
|
6
|
+
convert them to multipliers you can directly use in your app to calculate
|
5
7
|
precise shipping costs.
|
6
8
|
|
7
9
|
## Implemented transporters
|
8
10
|
|
9
11
|
- [Colissimo](https://www.colissimo.entreprise.laposte.fr/fr/system/files/imagescontent/docs/indice_gazole.xml)
|
10
12
|
- [Chronopost](https://www.chronopost.fr/fr/surcharge-carburant)
|
11
|
-
- [
|
13
|
+
- [TNT](https://www.tnt.com/express/fr_fr/site/home/comment-expedier/facturation/surcharges/baremes-et-historiques.html)
|
12
14
|
|
13
15
|
## Usage
|
14
16
|
|
@@ -16,12 +18,9 @@ Install the gem:
|
|
16
18
|
|
17
19
|
$ gem install fuel_surcharge
|
18
20
|
|
19
|
-
|
21
|
+
Either run the executable to fetch and display the results:
|
20
22
|
|
21
23
|
$ fuel_surcharge
|
22
|
-
|
23
|
-
Get the result:
|
24
|
-
|
25
24
|
---------------------------------------------------
|
26
25
|
# Fuel surcharges for Colissimo on 12-2018
|
27
26
|
# Fetched from https://www.colissimo.entreprise.laposte.fr/fr/system/files/imagescontent/docs/indice_gazole.xml
|
@@ -55,6 +54,6 @@ Or use it in your app:
|
|
55
54
|
chronopost.road_multiplier # 0.1148e1
|
56
55
|
chronopost.air_multiplier # 0.12015e1
|
57
56
|
|
58
|
-
tnt = FuelSurcharge::
|
57
|
+
tnt = FuelSurcharge::TNT.new
|
59
58
|
tnt.road_multiplier # 0.1121e1
|
60
59
|
tnt.air_multiplier # 0.1185e1
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
File without changes
|
data/exe/fuel_surcharge
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require "fuel_surcharge"
|
4
5
|
|
5
6
|
colissimo = FuelSurcharge::Colissimo.new
|
6
7
|
chronopost = FuelSurcharge::Chronopost.new
|
7
|
-
tnt = FuelSurcharge::
|
8
|
+
tnt = FuelSurcharge::TNT.new
|
8
9
|
|
9
10
|
[colissimo, chronopost, tnt].each do |fuel_surcharge|
|
10
11
|
puts "---------------------------------------------------"
|
data/fuel_surcharge.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
lib = File.expand_path("lib", __dir__)
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
5
|
|
@@ -34,14 +36,17 @@ Gem::Specification.new do |spec|
|
|
34
36
|
spec.require_paths = ["lib"]
|
35
37
|
|
36
38
|
# Signature config
|
37
|
-
spec.cert_chain = ["certs/
|
38
|
-
spec.signing_key = File.expand_path("~/.ssh/
|
39
|
+
spec.cert_chain = ["certs/levups.pem"]
|
40
|
+
spec.signing_key = File.expand_path("~/.ssh/levups-gem-private_key.pem") if $PROGRAM_NAME.end_with?("gem")
|
39
41
|
|
40
42
|
spec.add_dependency "http", "~> 4.0"
|
41
43
|
|
42
|
-
spec.add_development_dependency "bundler", "
|
44
|
+
spec.add_development_dependency "bundler", ">= 1.17"
|
43
45
|
spec.add_development_dependency "github_changelog_generator", "~> 1.14"
|
44
46
|
spec.add_development_dependency "minitest", "~> 5.0"
|
45
47
|
spec.add_development_dependency "minitest-stub_any_instance", "~> 1.0"
|
46
|
-
spec.add_development_dependency "rake", "~>
|
48
|
+
spec.add_development_dependency "rake", "~> 12.3"
|
49
|
+
# We it is mature, we'll switch to the "standard" gem
|
50
|
+
spec.add_development_dependency "relaxed-rubocop", "~> 2.3.1"
|
51
|
+
spec.add_development_dependency "rubocop", "~> 0.62"
|
47
52
|
end
|
@@ -6,9 +6,9 @@ module FuelSurcharge
|
|
6
6
|
module StringFormatter
|
7
7
|
refine String do
|
8
8
|
def to_multiplier
|
9
|
-
|
10
|
-
|
11
|
-
(number / 100
|
9
|
+
clean_string = tr(",", ".").gsub(/[^0-9\.]/, "")
|
10
|
+
number = BigDecimal(clean_string)
|
11
|
+
1 + (number / 100).round(4)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fuel_surcharge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Maerten
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
jT8ozif/0OTSDY7+8Js1LxoE1c1miwLixh66/avBqoFcnMzfSkTmEv2xVoYiCk0M
|
36
36
|
CrJThrTFQhqQDaVx
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2019-01-04 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: http
|
@@ -55,14 +55,14 @@ dependencies:
|
|
55
55
|
name: bundler
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- - "
|
58
|
+
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '1.17'
|
61
61
|
type: :development
|
62
62
|
prerelease: false
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- - "
|
65
|
+
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '1.17'
|
68
68
|
- !ruby/object:Gem::Dependency
|
@@ -113,14 +113,42 @@ dependencies:
|
|
113
113
|
requirements:
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
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
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: relaxed-rubocop
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - "~>"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 2.3.1
|
131
|
+
type: :development
|
132
|
+
prerelease: false
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - "~>"
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: 2.3.1
|
138
|
+
- !ruby/object:Gem::Dependency
|
139
|
+
name: rubocop
|
140
|
+
requirement: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - "~>"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0.62'
|
117
145
|
type: :development
|
118
146
|
prerelease: false
|
119
147
|
version_requirements: !ruby/object:Gem::Requirement
|
120
148
|
requirements:
|
121
149
|
- - "~>"
|
122
150
|
- !ruby/object:Gem::Version
|
123
|
-
version: '
|
151
|
+
version: '0.62'
|
124
152
|
description: A simple gem to fetch transporters data every month.
|
125
153
|
email:
|
126
154
|
- bob@levups.com
|
@@ -142,7 +170,7 @@ files:
|
|
142
170
|
- Rakefile
|
143
171
|
- bin/console
|
144
172
|
- bin/setup
|
145
|
-
- certs/
|
173
|
+
- certs/levups.pem
|
146
174
|
- exe/fuel_surcharge
|
147
175
|
- fuel_surcharge.gemspec
|
148
176
|
- lib/fuel_surcharge.rb
|
@@ -175,8 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
203
|
- !ruby/object:Gem::Version
|
176
204
|
version: '0'
|
177
205
|
requirements: []
|
178
|
-
|
179
|
-
rubygems_version: 2.7.7
|
206
|
+
rubygems_version: 3.0.2
|
180
207
|
signing_key:
|
181
208
|
specification_version: 4
|
182
209
|
summary: Retrieve current month's Transporters' fuel surcharge
|
metadata.gz.sig
CHANGED
@@ -1,2 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
��n�.ந��xΜ�J�3�T
|
2
|
+
��T�A4*/��H<�&8�!�+zdh�QJkW�f�Dq�y���f��L\�3v#-�p���R�wt��CXE�O���v[p����K2d���ZQ� 5�����
|
3
|
+
'臠�����@a6��i
|
4
|
+
Q419�ȸWW��"�E�!X3�\Nڍ���wӅ��pwy��3{��#�`��Ɔ5i���ݚ]�.��l3
|
5
|
+
�9��+����c���%p:���%��e#�J�5�� ���ݞ>n�#\YgM�bp���"�%aR�Z���/�=ʆnV)$��H0�E��ڲ�-�
|