vat_order_calculator 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.rspec +1 -0
- data/.rubocop.yml +101 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +96 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +48 -0
- data/VERSION +1 -0
- data/bin/bundler +17 -0
- data/bin/htmldiff +17 -0
- data/bin/jeweler +17 -0
- data/bin/ldiff +17 -0
- data/bin/nokogiri +17 -0
- data/bin/rackup +17 -0
- data/bin/rake +17 -0
- data/bin/ri +17 -0
- data/bin/rspec +17 -0
- data/bin/rubocop +17 -0
- data/bin/ruby-parse +17 -0
- data/bin/ruby-rewrite +17 -0
- data/bin/semver +17 -0
- data/lib/vat_order_calculator.rb +21 -0
- data/shippable.yml +3 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/vat_order_calculator_spec.rb +25 -0
- data/vat_order_calculator.gemspec +80 -0
- metadata +155 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2fa3d0fe32809366b2ad434eb17dcdb3fe13d80e
|
4
|
+
data.tar.gz: d75d29b09bf0f24220e3dbfabb5d15f751df907c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 14c714ab6c746bf8fcd1743d4dcd0c48b73a1e00d1eb2015f61cf3510250b5ed493c3396b2b83c45ca0984f8bc6aaddecc86bbd228debc8e941c2f8ecd40e4ee
|
7
|
+
data.tar.gz: 0a8ee68bc168dbc7ff83d2466d82d87677acff81b7aa4385b9a23184d2ddfad0d88fe0fb579c6b87b928e2cee2afa2f72029bc8718b88db063b5d7b9a0756b5f
|
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
AllCops:
|
2
|
+
DisplayCopNames: true
|
3
|
+
DisplayStyleGuide: true
|
4
|
+
Exclude:
|
5
|
+
- db/schema.rb
|
6
|
+
- spec/dummy/db/schema.rb
|
7
|
+
|
8
|
+
Lint/AmbiguousBlockAssociation:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
# https://github.com/AtomLinter/linter-rubocop/issues/2
|
12
|
+
Style/FileName:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Metrics/BlockLength:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Metrics/CyclomaticComplexity:
|
19
|
+
Max: 10
|
20
|
+
|
21
|
+
Metrics/LineLength:
|
22
|
+
Max: 160
|
23
|
+
|
24
|
+
Metrics/MethodLength:
|
25
|
+
Max: 50
|
26
|
+
|
27
|
+
Metrics/AbcSize:
|
28
|
+
Max: 25
|
29
|
+
|
30
|
+
Metrics/ClassLength:
|
31
|
+
Max: 250
|
32
|
+
|
33
|
+
# .find_each is not the same as .each
|
34
|
+
Rails/FindEach:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
Style/AccessModifierIndentation:
|
38
|
+
EnforcedStyle: outdent
|
39
|
+
|
40
|
+
Style/AlignParameters:
|
41
|
+
EnforcedStyle: with_fixed_indentation
|
42
|
+
|
43
|
+
Style/ClassAndModuleChildren:
|
44
|
+
EnforcedStyle: compact
|
45
|
+
|
46
|
+
Style/ConditionalAssignment:
|
47
|
+
Enabled: false
|
48
|
+
|
49
|
+
Style/Documentation:
|
50
|
+
Enabled: false
|
51
|
+
|
52
|
+
Style/EmptyLines:
|
53
|
+
Enabled: false
|
54
|
+
|
55
|
+
Style/FrozenStringLiteralComment:
|
56
|
+
Enabled: false
|
57
|
+
|
58
|
+
# Will report offences for many places that are much more readable without using a guard clause
|
59
|
+
Style/GuardClause:
|
60
|
+
Enabled: false
|
61
|
+
|
62
|
+
Style/LambdaCall:
|
63
|
+
Enabled: false
|
64
|
+
|
65
|
+
Style/MultilineMethodCallIndentation:
|
66
|
+
EnforcedStyle: indented
|
67
|
+
|
68
|
+
Style/MultilineOperationIndentation:
|
69
|
+
EnforcedStyle: indented
|
70
|
+
|
71
|
+
Style/StringLiterals:
|
72
|
+
EnforcedStyle: double_quotes
|
73
|
+
|
74
|
+
Style/StringLiteralsInInterpolation:
|
75
|
+
Enabled: false
|
76
|
+
|
77
|
+
Style/SymbolArray:
|
78
|
+
Enabled: false
|
79
|
+
|
80
|
+
Style/NilComparison:
|
81
|
+
Enabled: false
|
82
|
+
|
83
|
+
Style/SignalException:
|
84
|
+
EnforcedStyle: only_raise
|
85
|
+
|
86
|
+
Style/MultilineOperationIndentation:
|
87
|
+
EnforcedStyle: indented
|
88
|
+
|
89
|
+
Style/SpaceInsideHashLiteralBraces:
|
90
|
+
EnforcedStyle: no_space
|
91
|
+
|
92
|
+
Style/TrivialAccessors:
|
93
|
+
ExactNameMatch: true
|
94
|
+
Enabled: true
|
95
|
+
|
96
|
+
# Disabled on purpose: https://github.com/bbatsov/rubocop/issues/1758
|
97
|
+
Style/ClosingParenthesisIndentation:
|
98
|
+
Enabled: false
|
99
|
+
|
100
|
+
Style/WordArray:
|
101
|
+
Enabled: false
|
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
gem "json_vat", ">= 1.1.0"
|
7
|
+
|
8
|
+
# Add dependencies to develop your gem here.
|
9
|
+
# Include everything needed to run rake, tests, features, etc.
|
10
|
+
group :development do
|
11
|
+
gem "bundler", "~> 1.0"
|
12
|
+
gem "jeweler", "~> 2.3.7"
|
13
|
+
gem "rspec", "~> 3.6.0"
|
14
|
+
gem "rubocop", "0.50.0"
|
15
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
addressable (2.4.0)
|
5
|
+
ast (2.3.0)
|
6
|
+
builder (3.2.3)
|
7
|
+
descendants_tracker (0.0.4)
|
8
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
9
|
+
diff-lcs (1.3)
|
10
|
+
faraday (0.9.2)
|
11
|
+
multipart-post (>= 1.2, < 3)
|
12
|
+
git (1.3.0)
|
13
|
+
github_api (0.16.0)
|
14
|
+
addressable (~> 2.4.0)
|
15
|
+
descendants_tracker (~> 0.0.4)
|
16
|
+
faraday (~> 0.8, < 0.10)
|
17
|
+
hashie (>= 3.4)
|
18
|
+
mime-types (>= 1.16, < 3.0)
|
19
|
+
oauth2 (~> 1.0)
|
20
|
+
hashie (3.5.6)
|
21
|
+
highline (1.7.8)
|
22
|
+
jeweler (2.3.7)
|
23
|
+
builder
|
24
|
+
bundler (>= 1)
|
25
|
+
git (>= 1.2.5)
|
26
|
+
github_api (~> 0.16.0)
|
27
|
+
highline (>= 1.6.15)
|
28
|
+
nokogiri (>= 1.5.10)
|
29
|
+
psych (~> 2.2)
|
30
|
+
rake
|
31
|
+
rdoc
|
32
|
+
semver2
|
33
|
+
json (1.8.6)
|
34
|
+
json_vat (1.1.0)
|
35
|
+
json (~> 1.7)
|
36
|
+
jwt (1.5.6)
|
37
|
+
mime-types (2.99.3)
|
38
|
+
mini_portile2 (2.3.0)
|
39
|
+
multi_json (1.12.2)
|
40
|
+
multi_xml (0.6.0)
|
41
|
+
multipart-post (2.0.0)
|
42
|
+
nokogiri (1.8.1)
|
43
|
+
mini_portile2 (~> 2.3.0)
|
44
|
+
oauth2 (1.4.0)
|
45
|
+
faraday (>= 0.8, < 0.13)
|
46
|
+
jwt (~> 1.0)
|
47
|
+
multi_json (~> 1.3)
|
48
|
+
multi_xml (~> 0.5)
|
49
|
+
rack (>= 1.2, < 3)
|
50
|
+
parallel (1.12.0)
|
51
|
+
parser (2.4.0.0)
|
52
|
+
ast (~> 2.2)
|
53
|
+
powerpack (0.1.1)
|
54
|
+
psych (2.2.4)
|
55
|
+
rack (2.0.3)
|
56
|
+
rainbow (2.2.2)
|
57
|
+
rake
|
58
|
+
rake (12.1.0)
|
59
|
+
rdoc (4.3.0)
|
60
|
+
rspec (3.6.0)
|
61
|
+
rspec-core (~> 3.6.0)
|
62
|
+
rspec-expectations (~> 3.6.0)
|
63
|
+
rspec-mocks (~> 3.6.0)
|
64
|
+
rspec-core (3.6.0)
|
65
|
+
rspec-support (~> 3.6.0)
|
66
|
+
rspec-expectations (3.6.0)
|
67
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
68
|
+
rspec-support (~> 3.6.0)
|
69
|
+
rspec-mocks (3.6.0)
|
70
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
71
|
+
rspec-support (~> 3.6.0)
|
72
|
+
rspec-support (3.6.0)
|
73
|
+
rubocop (0.50.0)
|
74
|
+
parallel (~> 1.10)
|
75
|
+
parser (>= 2.3.3.1, < 3.0)
|
76
|
+
powerpack (~> 0.1)
|
77
|
+
rainbow (>= 2.2.2, < 3.0)
|
78
|
+
ruby-progressbar (~> 1.7)
|
79
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
80
|
+
ruby-progressbar (1.9.0)
|
81
|
+
semver2 (3.4.2)
|
82
|
+
thread_safe (0.3.6)
|
83
|
+
unicode-display_width (1.3.0)
|
84
|
+
|
85
|
+
PLATFORMS
|
86
|
+
ruby
|
87
|
+
|
88
|
+
DEPENDENCIES
|
89
|
+
bundler (~> 1.0)
|
90
|
+
jeweler (~> 2.3.7)
|
91
|
+
json_vat (>= 1.1.0)
|
92
|
+
rspec (~> 3.6.0)
|
93
|
+
rubocop (= 0.50.0)
|
94
|
+
|
95
|
+
BUNDLED WITH
|
96
|
+
1.15.3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2017 kaspernj
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= vat_order_calculator
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to vat_order_calculator
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
9
|
+
* Fork the project.
|
10
|
+
* Start a feature/bugfix branch.
|
11
|
+
* Commit and push until you are happy with your contribution.
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2017 kaspernj. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "bundler"
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require "rake"
|
11
|
+
|
12
|
+
require "jeweler"
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
15
|
+
gem.name = "vat_order_calculator"
|
16
|
+
gem.homepage = "https://github.com/kaspernj/vat_order_calculator"
|
17
|
+
gem.license = "MIT"
|
18
|
+
gem.summary = %(A library to calculate vat based on order data)
|
19
|
+
gem.description = %(A library to calculate vat based on order data)
|
20
|
+
gem.email = "kaspernj@gmail.com"
|
21
|
+
gem.authors = ["kaspernj"]
|
22
|
+
# dependencies defined in Gemfile
|
23
|
+
end
|
24
|
+
Jeweler::RubygemsDotOrgTasks.new
|
25
|
+
|
26
|
+
require "rspec/core"
|
27
|
+
require "rspec/core/rake_task"
|
28
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
29
|
+
spec.pattern = FileList["spec/**/*_spec.rb"]
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "Code coverage detail"
|
33
|
+
task :simplecov do
|
34
|
+
ENV["COVERAGE"] = "true"
|
35
|
+
Rake::Task["spec"].execute
|
36
|
+
end
|
37
|
+
|
38
|
+
task default: :spec
|
39
|
+
|
40
|
+
require "rdoc/task"
|
41
|
+
Rake::RDocTask.new do |rdoc|
|
42
|
+
version = File.exist?("VERSION") ? File.read("VERSION") : ""
|
43
|
+
|
44
|
+
rdoc.rdoc_dir = "rdoc"
|
45
|
+
rdoc.title = "vat_order_calculator #{version}"
|
46
|
+
rdoc.rdoc_files.include("README*")
|
47
|
+
rdoc.rdoc_files.include("lib/**/*.rb")
|
48
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.0
|
data/bin/bundler
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'bundler' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("bundler", "bundler")
|
data/bin/htmldiff
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'htmldiff' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("diff-lcs", "htmldiff")
|
data/bin/jeweler
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'jeweler' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("jeweler", "jeweler")
|
data/bin/ldiff
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'ldiff' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("diff-lcs", "ldiff")
|
data/bin/nokogiri
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'nokogiri' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("nokogiri", "nokogiri")
|
data/bin/rackup
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'rackup' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("rack", "rackup")
|
data/bin/rake
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'rake' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("rake", "rake")
|
data/bin/ri
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'ri' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("rdoc", "ri")
|
data/bin/rspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'rspec' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/bin/rubocop
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'rubocop' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("rubocop", "rubocop")
|
data/bin/ruby-parse
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'ruby-parse' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("parser", "ruby-parse")
|
data/bin/ruby-rewrite
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'ruby-rewrite' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("parser", "ruby-rewrite")
|
data/bin/semver
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'semver' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("semver2", "semver")
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "json_vat"
|
2
|
+
|
3
|
+
class VatOrderCalculator
|
4
|
+
attr_reader :base_country, :country, :private_customer
|
5
|
+
|
6
|
+
def initialize(base_country:, country:, private_customer:)
|
7
|
+
@base_country = base_country
|
8
|
+
@country = country
|
9
|
+
@private_customer = private_customer
|
10
|
+
end
|
11
|
+
|
12
|
+
def vat_rate
|
13
|
+
if base_country == country
|
14
|
+
JSONVAT.country(country).rate
|
15
|
+
elsif private_customer
|
16
|
+
JSONVAT.country(country).rate
|
17
|
+
else
|
18
|
+
0.0
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/shippable.yml
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
|
4
|
+
require "rspec"
|
5
|
+
require "vat_order_calculator"
|
6
|
+
|
7
|
+
# Requires supporting files with custom matchers and macros, etc,
|
8
|
+
# in ./support/ and its subdirectories.
|
9
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe VatOrderCalculator do
|
4
|
+
describe "#vat_rate" do
|
5
|
+
it "returns base country vat rate if same country and private" do
|
6
|
+
calculator = VatOrderCalculator.new(base_country: "DK", country: "DK", private_customer: true)
|
7
|
+
expect(calculator.vat_rate).to eq 25.0
|
8
|
+
end
|
9
|
+
|
10
|
+
it "returns base country vat rate if same country and company" do
|
11
|
+
calculator = VatOrderCalculator.new(base_country: "DK", country: "DK", private_customer: false)
|
12
|
+
expect(calculator.vat_rate).to eq 25.0
|
13
|
+
end
|
14
|
+
|
15
|
+
it "returns customer country vat if different country and private" do
|
16
|
+
calculator = VatOrderCalculator.new(base_country: "DK", country: "DE", private_customer: true)
|
17
|
+
expect(calculator.vat_rate).to eq 19.0
|
18
|
+
end
|
19
|
+
|
20
|
+
it "returns zero if different country and company" do
|
21
|
+
calculator = VatOrderCalculator.new(base_country: "DK", country: "DE", private_customer: false)
|
22
|
+
expect(calculator.vat_rate).to eq 0.0
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: vat_order_calculator 0.0.0 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "vat_order_calculator".freeze
|
9
|
+
s.version = "0.0.0"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib".freeze]
|
13
|
+
s.authors = ["kaspernj".freeze]
|
14
|
+
s.date = "2017-10-01"
|
15
|
+
s.description = "A library to calculate vat based on order data".freeze
|
16
|
+
s.email = "kaspernj@gmail.com".freeze
|
17
|
+
s.executables = ["bundler".freeze, "htmldiff".freeze, "jeweler".freeze, "ldiff".freeze, "nokogiri".freeze, "rackup".freeze, "rake".freeze, "ri".freeze, "rspec".freeze, "rubocop".freeze, "ruby-parse".freeze, "ruby-rewrite".freeze, "semver".freeze]
|
18
|
+
s.extra_rdoc_files = [
|
19
|
+
"LICENSE.txt",
|
20
|
+
"README.rdoc"
|
21
|
+
]
|
22
|
+
s.files = [
|
23
|
+
".document",
|
24
|
+
".rspec",
|
25
|
+
".rubocop.yml",
|
26
|
+
"Gemfile",
|
27
|
+
"Gemfile.lock",
|
28
|
+
"LICENSE.txt",
|
29
|
+
"README.rdoc",
|
30
|
+
"Rakefile",
|
31
|
+
"VERSION",
|
32
|
+
"bin/bundler",
|
33
|
+
"bin/htmldiff",
|
34
|
+
"bin/jeweler",
|
35
|
+
"bin/ldiff",
|
36
|
+
"bin/nokogiri",
|
37
|
+
"bin/rackup",
|
38
|
+
"bin/rake",
|
39
|
+
"bin/ri",
|
40
|
+
"bin/rspec",
|
41
|
+
"bin/rubocop",
|
42
|
+
"bin/ruby-parse",
|
43
|
+
"bin/ruby-rewrite",
|
44
|
+
"bin/semver",
|
45
|
+
"lib/vat_order_calculator.rb",
|
46
|
+
"shippable.yml",
|
47
|
+
"spec/spec_helper.rb",
|
48
|
+
"spec/vat_order_calculator_spec.rb",
|
49
|
+
"vat_order_calculator.gemspec"
|
50
|
+
]
|
51
|
+
s.homepage = "https://github.com/kaspernj/vat_order_calculator".freeze
|
52
|
+
s.licenses = ["MIT".freeze]
|
53
|
+
s.rubygems_version = "2.6.8".freeze
|
54
|
+
s.summary = "A library to calculate vat based on order data".freeze
|
55
|
+
|
56
|
+
if s.respond_to? :specification_version then
|
57
|
+
s.specification_version = 4
|
58
|
+
|
59
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
60
|
+
s.add_runtime_dependency(%q<json_vat>.freeze, [">= 1.1.0"])
|
61
|
+
s.add_development_dependency(%q<bundler>.freeze, ["~> 1.0"])
|
62
|
+
s.add_development_dependency(%q<jeweler>.freeze, ["~> 2.3.7"])
|
63
|
+
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.6.0"])
|
64
|
+
s.add_development_dependency(%q<rubocop>.freeze, ["= 0.50.0"])
|
65
|
+
else
|
66
|
+
s.add_dependency(%q<json_vat>.freeze, [">= 1.1.0"])
|
67
|
+
s.add_dependency(%q<bundler>.freeze, ["~> 1.0"])
|
68
|
+
s.add_dependency(%q<jeweler>.freeze, ["~> 2.3.7"])
|
69
|
+
s.add_dependency(%q<rspec>.freeze, ["~> 3.6.0"])
|
70
|
+
s.add_dependency(%q<rubocop>.freeze, ["= 0.50.0"])
|
71
|
+
end
|
72
|
+
else
|
73
|
+
s.add_dependency(%q<json_vat>.freeze, [">= 1.1.0"])
|
74
|
+
s.add_dependency(%q<bundler>.freeze, ["~> 1.0"])
|
75
|
+
s.add_dependency(%q<jeweler>.freeze, ["~> 2.3.7"])
|
76
|
+
s.add_dependency(%q<rspec>.freeze, ["~> 3.6.0"])
|
77
|
+
s.add_dependency(%q<rubocop>.freeze, ["= 0.50.0"])
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
metadata
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vat_order_calculator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- kaspernj
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-10-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json_vat
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.1.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.1.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: jeweler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.3.7
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.3.7
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.6.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.6.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.50.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.50.0
|
83
|
+
description: A library to calculate vat based on order data
|
84
|
+
email: kaspernj@gmail.com
|
85
|
+
executables:
|
86
|
+
- bundler
|
87
|
+
- htmldiff
|
88
|
+
- jeweler
|
89
|
+
- ldiff
|
90
|
+
- nokogiri
|
91
|
+
- rackup
|
92
|
+
- rake
|
93
|
+
- ri
|
94
|
+
- rspec
|
95
|
+
- rubocop
|
96
|
+
- ruby-parse
|
97
|
+
- ruby-rewrite
|
98
|
+
- semver
|
99
|
+
extensions: []
|
100
|
+
extra_rdoc_files:
|
101
|
+
- LICENSE.txt
|
102
|
+
- README.rdoc
|
103
|
+
files:
|
104
|
+
- ".document"
|
105
|
+
- ".rspec"
|
106
|
+
- ".rubocop.yml"
|
107
|
+
- Gemfile
|
108
|
+
- Gemfile.lock
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.rdoc
|
111
|
+
- Rakefile
|
112
|
+
- VERSION
|
113
|
+
- bin/bundler
|
114
|
+
- bin/htmldiff
|
115
|
+
- bin/jeweler
|
116
|
+
- bin/ldiff
|
117
|
+
- bin/nokogiri
|
118
|
+
- bin/rackup
|
119
|
+
- bin/rake
|
120
|
+
- bin/ri
|
121
|
+
- bin/rspec
|
122
|
+
- bin/rubocop
|
123
|
+
- bin/ruby-parse
|
124
|
+
- bin/ruby-rewrite
|
125
|
+
- bin/semver
|
126
|
+
- lib/vat_order_calculator.rb
|
127
|
+
- shippable.yml
|
128
|
+
- spec/spec_helper.rb
|
129
|
+
- spec/vat_order_calculator_spec.rb
|
130
|
+
- vat_order_calculator.gemspec
|
131
|
+
homepage: https://github.com/kaspernj/vat_order_calculator
|
132
|
+
licenses:
|
133
|
+
- MIT
|
134
|
+
metadata: {}
|
135
|
+
post_install_message:
|
136
|
+
rdoc_options: []
|
137
|
+
require_paths:
|
138
|
+
- lib
|
139
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
requirements: []
|
150
|
+
rubyforge_project:
|
151
|
+
rubygems_version: 2.6.8
|
152
|
+
signing_key:
|
153
|
+
specification_version: 4
|
154
|
+
summary: A library to calculate vat based on order data
|
155
|
+
test_files: []
|