tax_cloud 0.6.0 → 0.7.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 +4 -4
- data/.github/workflows/danger-comment.yml +18 -0
- data/.github/workflows/danger.yml +15 -0
- data/.github/workflows/lint.yml +29 -0
- data/.github/workflows/release.yml +27 -0
- data/.github/workflows/test.yml +29 -23
- data/.gitignore +1 -0
- data/.rubocop.yml +82 -6
- data/.rubocop_todo.yml +176 -23
- data/.spellcheck.txt +90 -0
- data/CHANGELOG.md +50 -65
- data/CONTRIBUTING.md +88 -0
- data/CONTRIBUTORS.txt +6 -6
- data/Dangerfile +7 -0
- data/Gemfile +16 -2
- data/LICENSE.md +3 -15
- data/README.md +48 -77
- data/RELEASING.md +39 -0
- data/Rakefile +22 -3
- data/lib/config/locales/en.yml +4 -0
- data/lib/tax_cloud/errors/missing_cart_items_error.rb +13 -0
- data/lib/tax_cloud/errors/soap_error.rb +1 -1
- data/lib/tax_cloud/errors.rb +1 -0
- data/lib/tax_cloud/transaction.rb +4 -1
- data/lib/tax_cloud/version.rb +1 -1
- data/script/release.rb +15 -0
- data/tax_cloud.gemspec +1 -2
- data/test/test_release.rb +82 -0
- data/test/test_transaction.rb +8 -0
- metadata +14 -3
data/lib/tax_cloud/errors.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require 'tax_cloud/errors/tax_cloud_error'
|
|
4
4
|
require 'tax_cloud/errors/missing_config_error'
|
|
5
5
|
require 'tax_cloud/errors/missing_config_option_error'
|
|
6
|
+
require 'tax_cloud/errors/missing_cart_items_error'
|
|
6
7
|
require 'tax_cloud/errors/soap_error'
|
|
7
8
|
require 'tax_cloud/errors/unexpected_soap_response_error'
|
|
8
9
|
require 'tax_cloud/errors/api_error'
|
|
@@ -28,7 +28,10 @@ module TaxCloud #:nodoc:
|
|
|
28
28
|
|
|
29
29
|
# Lookup the tax rate for the transaction.
|
|
30
30
|
# The returned information is based on the originating address, destination address, and cart items.
|
|
31
|
+
# Raises <tt>TaxCloud::Errors::MissingCartItems</tt> without calling TaxCloud when there are no cart items.
|
|
31
32
|
def lookup
|
|
33
|
+
raise TaxCloud::Errors::MissingCartItems if cart_items.nil? || cart_items.empty?
|
|
34
|
+
|
|
32
35
|
request_params = {
|
|
33
36
|
'customerID' => customer_id,
|
|
34
37
|
'cartID' => cart_id,
|
|
@@ -98,7 +101,7 @@ module TaxCloud #:nodoc:
|
|
|
98
101
|
# Marks any included cart items as returned.
|
|
99
102
|
#
|
|
100
103
|
# === Options
|
|
101
|
-
# [returned_date] The date the return
|
|
104
|
+
# [returned_date] The date the return occurred. Default is today.
|
|
102
105
|
def returned(options = {})
|
|
103
106
|
options = { returned_date: Date.today }.merge(options)
|
|
104
107
|
request_params = {
|
data/lib/tax_cloud/version.rb
CHANGED
data/script/release.rb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'ruby-gem-release/changelog'
|
|
4
|
+
require 'ruby-gem-release/workflow/ruby_gem'
|
|
5
|
+
|
|
6
|
+
# Builds the ruby-gem-release workflow used by the Rakefile, the Release GitHub Actions workflow, and test/test_release.rb.
|
|
7
|
+
module TaxCloudRelease
|
|
8
|
+
def self.workflow(**options)
|
|
9
|
+
RubyGemRelease::Workflow::RubyGem.new(
|
|
10
|
+
version: RubyGemRelease::Version::RubyConstant.new(path: 'lib/tax_cloud/version.rb', constant: 'VERSION'),
|
|
11
|
+
changelog: RubyGemRelease::Changelog::Intridea.new(placeholder: '* Your contribution here.'),
|
|
12
|
+
**options
|
|
13
|
+
)
|
|
14
|
+
end
|
|
15
|
+
end
|
data/tax_cloud.gemspec
CHANGED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'minitest/autorun'
|
|
4
|
+
|
|
5
|
+
if RUBY_ENGINE == 'ruby' && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.3') &&
|
|
6
|
+
Gem.loaded_specs.key?('ruby-gem-release')
|
|
7
|
+
require_relative '../script/release'
|
|
8
|
+
require 'ruby-gem-release/rspec'
|
|
9
|
+
|
|
10
|
+
# Runs the real release tasks against a local fixture, without contacting RubyGems or GitHub.
|
|
11
|
+
class TestRelease < Minitest::Test
|
|
12
|
+
include RubyGemRelease::RSpec
|
|
13
|
+
|
|
14
|
+
ROOT = File.expand_path('..', __dir__)
|
|
15
|
+
VERSION_PATH = 'lib/tax_cloud/version.rb'
|
|
16
|
+
FIXTURE_FILES = %w[
|
|
17
|
+
tax_cloud.gemspec script/release.rb lib/**/*.rb CHANGELOG.md LICENSE.md README.md RELEASING.md
|
|
18
|
+
].freeze
|
|
19
|
+
PLACEHOLDER = '* Your contribution here.'
|
|
20
|
+
NOTE = '* [#1](https://github.com/txcrb/tax_cloud/pull/1): Added a feature - [@dblock](https://github.com/dblock).'
|
|
21
|
+
|
|
22
|
+
def test_builds_the_standard_ruby_gem_release_workflow
|
|
23
|
+
assert_kind_of RubyGemRelease::Workflow::RubyGem, TaxCloudRelease.workflow
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def test_dates_the_release_and_prepares_the_next_patch_version
|
|
27
|
+
with_project(NOTE) do |project|
|
|
28
|
+
project.release!
|
|
29
|
+
|
|
30
|
+
released = project.remote_file('v1.2.0', 'CHANGELOG.md')
|
|
31
|
+
assert_match(%r{\A# Changelog\n\n## 1\.2\.0 \(\d{4}/\d{2}/\d{2}\)\n\n}, released)
|
|
32
|
+
assert_includes released, NOTE
|
|
33
|
+
refute_includes released, '(Next)'
|
|
34
|
+
refute_includes released, PLACEHOLDER
|
|
35
|
+
assert_includes project.remote_file('v1.2.0', VERSION_PATH), "VERSION = '1.2.0'"
|
|
36
|
+
|
|
37
|
+
pending = project.remote_file('master', 'CHANGELOG.md')
|
|
38
|
+
assert pending.start_with?("# Changelog\n\n## 1.2.1 (Next)\n\n#{PLACEHOLDER}\n\n## 1.2.0 ("), pending
|
|
39
|
+
assert_includes project.remote_file('master', VERSION_PATH), "VERSION = '1.2.1'"
|
|
40
|
+
assert_empty project.git('status', '--porcelain')
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def test_rejects_placeholder_only_notes_without_changing_files_or_remote_refs
|
|
45
|
+
with_project(nil) do |project|
|
|
46
|
+
original = project.git('rev-parse', 'origin/master')
|
|
47
|
+
project.run_task('release:workflow:capture')
|
|
48
|
+
|
|
49
|
+
error = assert_raises(RuntimeError) { project.run_task('release:validate') }
|
|
50
|
+
assert_match(/no pending changelog notes/, error.message)
|
|
51
|
+
assert_empty project.git('status', '--porcelain')
|
|
52
|
+
assert_equal original, project.git('rev-parse', 'origin/master')
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
private
|
|
57
|
+
|
|
58
|
+
def changelog(notes)
|
|
59
|
+
[
|
|
60
|
+
'# Changelog', '',
|
|
61
|
+
'## 1.2.0 (Next)', '', notes, PLACEHOLDER, '',
|
|
62
|
+
'## 1.1.0 (2026/01/01)', '', '* Previous release.', ''
|
|
63
|
+
].compact.join("\n")
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def write_version(project, version)
|
|
67
|
+
source = File.read(File.join(ROOT, VERSION_PATH))
|
|
68
|
+
project.write(VERSION_PATH, source.sub(/VERSION = (['"])[^'"]+\1/, "VERSION = '#{version}'"))
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def with_project(notes)
|
|
72
|
+
with_release_project do |project|
|
|
73
|
+
project.copy_files(path: ROOT, files: FIXTURE_FILES)
|
|
74
|
+
project.configure_workflow(require: 'script/release', builder: 'TaxCloudRelease.workflow')
|
|
75
|
+
project.write('CHANGELOG.md', changelog(notes))
|
|
76
|
+
write_version(project, '1.2.0')
|
|
77
|
+
project.commit!
|
|
78
|
+
yield project
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
data/test/test_transaction.rb
CHANGED
|
@@ -30,6 +30,14 @@ class TestTransaction < TestSetup
|
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
def test_lookup_without_cart_items
|
|
34
|
+
@transaction.cart_items = []
|
|
35
|
+
e = assert_raises TaxCloud::Errors::MissingCartItems do
|
|
36
|
+
@transaction.lookup
|
|
37
|
+
end
|
|
38
|
+
assert_equal 'Missing cart items.', e.problem
|
|
39
|
+
end
|
|
40
|
+
|
|
33
41
|
def test_authorized
|
|
34
42
|
VCR.use_cassette('authorized') do
|
|
35
43
|
@transaction.lookup
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tax_cloud
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Drew Tempelmeyer
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-11-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -73,15 +73,23 @@ executables: []
|
|
|
73
73
|
extensions: []
|
|
74
74
|
extra_rdoc_files: []
|
|
75
75
|
files:
|
|
76
|
+
- ".github/workflows/danger-comment.yml"
|
|
77
|
+
- ".github/workflows/danger.yml"
|
|
78
|
+
- ".github/workflows/lint.yml"
|
|
79
|
+
- ".github/workflows/release.yml"
|
|
76
80
|
- ".github/workflows/test.yml"
|
|
77
81
|
- ".gitignore"
|
|
78
82
|
- ".rubocop.yml"
|
|
79
83
|
- ".rubocop_todo.yml"
|
|
84
|
+
- ".spellcheck.txt"
|
|
80
85
|
- CHANGELOG.md
|
|
86
|
+
- CONTRIBUTING.md
|
|
81
87
|
- CONTRIBUTORS.txt
|
|
88
|
+
- Dangerfile
|
|
82
89
|
- Gemfile
|
|
83
90
|
- LICENSE.md
|
|
84
91
|
- README.md
|
|
92
|
+
- RELEASING.md
|
|
85
93
|
- Rakefile
|
|
86
94
|
- lib/config/locales/en.yml
|
|
87
95
|
- lib/hash.rb
|
|
@@ -95,6 +103,7 @@ files:
|
|
|
95
103
|
- lib/tax_cloud/configuration.rb
|
|
96
104
|
- lib/tax_cloud/errors.rb
|
|
97
105
|
- lib/tax_cloud/errors/api_error.rb
|
|
106
|
+
- lib/tax_cloud/errors/missing_cart_items_error.rb
|
|
98
107
|
- lib/tax_cloud/errors/missing_config_error.rb
|
|
99
108
|
- lib/tax_cloud/errors/missing_config_option_error.rb
|
|
100
109
|
- lib/tax_cloud/errors/soap_error.rb
|
|
@@ -123,6 +132,7 @@ files:
|
|
|
123
132
|
- lib/tax_cloud/tax_codes.rb
|
|
124
133
|
- lib/tax_cloud/transaction.rb
|
|
125
134
|
- lib/tax_cloud/version.rb
|
|
135
|
+
- script/release.rb
|
|
126
136
|
- tax_cloud.gemspec
|
|
127
137
|
- test/cassettes/authorized.yml
|
|
128
138
|
- test/cassettes/authorized_with_capture.yml
|
|
@@ -148,6 +158,7 @@ files:
|
|
|
148
158
|
- test/test_configuration_optional_keys.rb
|
|
149
159
|
- test/test_configuration_required_keys.rb
|
|
150
160
|
- test/test_lookup_response.rb
|
|
161
|
+
- test/test_release.rb
|
|
151
162
|
- test/test_setup.rb
|
|
152
163
|
- test/test_soap.rb
|
|
153
164
|
- test/test_tax_code_groups.rb
|
|
@@ -174,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
174
185
|
- !ruby/object:Gem::Version
|
|
175
186
|
version: 1.3.6
|
|
176
187
|
requirements: []
|
|
177
|
-
rubygems_version: 3.
|
|
188
|
+
rubygems_version: 3.5.22
|
|
178
189
|
signing_key:
|
|
179
190
|
specification_version: 4
|
|
180
191
|
summary: Calculate sales tax using TaxCloud
|