taxjar-ruby 2.6.1 → 3.0.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/.travis.yml +1 -7
- data/CHANGELOG.md +8 -1
- data/README.md +1 -1
- data/lib/taxjar/client.rb +8 -1
- data/lib/taxjar/version.rb +3 -3
- data/spec/taxjar/api/request_spec.rb +7 -12
- data/spec/taxjar/client_spec.rb +4 -4
- data/taxjar-ruby.gemspec +3 -3
- metadata +14 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47a7bd26490bf919e6339a26097c87d7d9dd0b09ea6214b87070243da422d03c
|
4
|
+
data.tar.gz: ba4de289c2768c0e52effab858cd0569c3a43f524c34698bafc3cbea8e0eab4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dbea4df68a8bd664c86507f8b266aa1a5901aad30f9b558d8d0e4fa999d36c887a0b6b5acebf511f0a67d8a812d98c60f0693fa4a54057e201765ea67db7ab3
|
7
|
+
data.tar.gz: d152b6c9d34c19fbae78386346d63aa6bab0ac8d95197a7fa700bb7f2c4ea5da5fede05c6f7458f138febeb7a4065c542cf4c86c7bb320474856352858c67d56
|
data/.travis.yml
CHANGED
@@ -1,16 +1,10 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
3
|
rvm:
|
4
|
-
- "2.0"
|
5
|
-
- "2.1"
|
6
|
-
- "2.2"
|
7
4
|
- "2.3"
|
8
5
|
- "2.4"
|
9
6
|
- "2.5"
|
10
7
|
- "2.6"
|
8
|
+
- "2.7"
|
11
9
|
|
12
10
|
script: bundle exec rspec
|
13
|
-
|
14
|
-
before_install:
|
15
|
-
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
|
16
|
-
- gem install bundler -v '< 2'
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [3.0.0] - 2020-04-03
|
11
|
+
- Add information to custom user agent for debugging and informational purposes
|
12
|
+
- Update required Ruby version from 2.0 to 2.3 or higher
|
13
|
+
- Update HTTP (The Gem) to version 4.3
|
14
|
+
- Relax bundler (development dependency) version requirements
|
15
|
+
|
10
16
|
## [2.6.1] - 2019-10-23
|
11
17
|
- Parse all responses as JSON and improve error handling for non-JSON [#51](https://github.com/taxjar/taxjar-ruby/pull/51)
|
12
18
|
|
@@ -37,7 +43,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
37
43
|
- Update minimum required Ruby version to 2.0
|
38
44
|
- Update HTTP (The Gem) to 2.2
|
39
45
|
|
40
|
-
[Unreleased]: https://github.com/taxjar/taxjar-ruby/compare/
|
46
|
+
[Unreleased]: https://github.com/taxjar/taxjar-ruby/compare/v3.0.0...HEAD
|
47
|
+
[3.0.0]: https://github.com/taxjar/taxjar-ruby/compare/v2.6.1...v3.0.0
|
41
48
|
[2.6.1]: https://github.com/taxjar/taxjar-ruby/compare/v2.6.0...v2.6.1
|
42
49
|
[2.6.0]: https://github.com/taxjar/taxjar-ruby/compare/v2.5.0...v2.6.0
|
43
50
|
[2.5.0]: https://github.com/taxjar/taxjar-ruby/compare/v2.4.1...v2.5.0
|
data/README.md
CHANGED
data/lib/taxjar/client.rb
CHANGED
@@ -38,7 +38,14 @@ module Taxjar
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def user_agent
|
41
|
-
|
41
|
+
def platform
|
42
|
+
(`uname -a` || '').strip
|
43
|
+
rescue Errno::ENOENT, Errno::ENOMEM
|
44
|
+
''
|
45
|
+
end
|
46
|
+
ruby_version = "ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
|
47
|
+
openSSL_version = OpenSSL::OPENSSL_LIBRARY_VERSION
|
48
|
+
"TaxJar/Ruby (#{platform}; #{ruby_version}; #{openSSL_version}) taxjar-ruby/#{Taxjar::Version}"
|
42
49
|
end
|
43
50
|
end
|
44
51
|
end
|
data/lib/taxjar/version.rb
CHANGED
@@ -41,7 +41,7 @@ describe Taxjar::API::Request do
|
|
41
41
|
it 'should return headers' do
|
42
42
|
expect(subject).to respond_to(:headers)
|
43
43
|
expect(subject.headers).to be_instance_of(Hash)
|
44
|
-
expect(subject.headers[:user_agent]).to match(
|
44
|
+
expect(subject.headers[:user_agent]).to match(/^TaxJar\/Ruby \(.+\) taxjar-ruby\/\d+\.\d+\.\d+$/)
|
45
45
|
expect(subject.headers[:authorization]).to eq('Bearer AK')
|
46
46
|
end
|
47
47
|
|
@@ -52,7 +52,7 @@ describe Taxjar::API::Request do
|
|
52
52
|
subject = Taxjar::API::Request.new(client, :get, '/api_path', 'object')
|
53
53
|
expect(subject).to respond_to(:headers)
|
54
54
|
expect(subject.headers).to be_instance_of(Hash)
|
55
|
-
expect(subject.headers[:user_agent]).to match(
|
55
|
+
expect(subject.headers[:user_agent]).to match(/^TaxJar\/Ruby \(.+\) taxjar-ruby\/\d+\.\d+\.\d+$/)
|
56
56
|
expect(subject.headers[:authorization]).to eq('Bearer AK')
|
57
57
|
expect(subject.headers['X-TJ-Expected-Response']).to eq(422)
|
58
58
|
end
|
@@ -124,8 +124,7 @@ describe Taxjar::API::Request do
|
|
124
124
|
it "runs through the proxy" do
|
125
125
|
stub_request(:get, "https://api.taxjar.com/api_path").
|
126
126
|
with(:headers => {'Authorization'=>'Bearer AK', 'Connection'=>'close',
|
127
|
-
'Host'=>'api.taxjar.com'
|
128
|
-
'User-Agent'=>"TaxjarRubyGem/#{Taxjar::Version.to_s}"}).
|
127
|
+
'Host'=>'api.taxjar.com'}).
|
129
128
|
to_return(:status => 200, :body => '{"object": {"id": "3"}}',
|
130
129
|
:headers => {content_type: 'application/json; charset=UTF-8'})
|
131
130
|
|
@@ -138,8 +137,7 @@ describe Taxjar::API::Request do
|
|
138
137
|
it 'should return a body if no errors' do
|
139
138
|
stub_request(:get, "https://api.taxjar.com/api_path").
|
140
139
|
with(:headers => {'Authorization'=>'Bearer AK', 'Connection'=>'close',
|
141
|
-
'Host'=>'api.taxjar.com'
|
142
|
-
'User-Agent'=>"TaxjarRubyGem/#{Taxjar::Version.to_s}"}).
|
140
|
+
'Host'=>'api.taxjar.com'}).
|
143
141
|
to_return(:status => 200, :body => '{"object": {"id": "3"}}',
|
144
142
|
:headers => {content_type: 'application/json; charset=UTF-8'})
|
145
143
|
|
@@ -159,8 +157,7 @@ describe Taxjar::API::Request do
|
|
159
157
|
with(:body => "{\"city\":\"New York\"}",
|
160
158
|
:headers => {'Authorization'=>'Bearer AK', 'Connection'=>'close',
|
161
159
|
'Content-Type'=>'application/json; charset=UTF-8',
|
162
|
-
'Host'=>'api.taxjar.com'
|
163
|
-
'User-Agent'=>"TaxjarRubyGem/#{Taxjar::Version.to_s}"}).
|
160
|
+
'Host'=>'api.taxjar.com'}).
|
164
161
|
to_return(:status => 200, :body => '{"object": {"id": "3"}}',
|
165
162
|
:headers => {content_type: 'application/json; charset=UTF-8'})
|
166
163
|
|
@@ -171,8 +168,7 @@ describe Taxjar::API::Request do
|
|
171
168
|
it 'handles unexpected Content-Type responses' do
|
172
169
|
stub_request(:get, "https://api.taxjar.com/api_path").
|
173
170
|
with(:headers => {'Authorization'=>'Bearer AK', 'Connection'=>'close',
|
174
|
-
'Host'=>'api.taxjar.com'
|
175
|
-
'User-Agent'=>"TaxjarRubyGem/#{Taxjar::Version.to_s}"}).
|
171
|
+
'Host'=>'api.taxjar.com'}).
|
176
172
|
to_return(:status => 200, :body => 'Something unexpected',
|
177
173
|
:headers => {content_type: 'text/html; charset=UTF-8'})
|
178
174
|
|
@@ -184,8 +180,7 @@ describe Taxjar::API::Request do
|
|
184
180
|
it "raises #{exception}" do
|
185
181
|
stub_request(:get, "https://api.taxjar.com/api_path").
|
186
182
|
with(:headers => {'Authorization'=>'Bearer AK', 'Connection'=>'close',
|
187
|
-
'Host'=>'api.taxjar.com'
|
188
|
-
'User-Agent'=>"TaxjarRubyGem/#{Taxjar::Version.to_s}"}).
|
183
|
+
'Host'=>'api.taxjar.com'}).
|
189
184
|
to_return(:status => status,
|
190
185
|
:body => '{"error": "Not Acceptable",
|
191
186
|
"detail": "error explanation",
|
data/spec/taxjar/client_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
describe Taxjar::Client do
|
4
|
-
describe '#api_key?' do
|
4
|
+
describe '#api_key?' do
|
5
5
|
it 'returns true if api_key is present' do
|
6
6
|
client = Taxjar::Client.new(api_key: 'AK')
|
7
7
|
expect(client.api_key?).to be true
|
@@ -25,14 +25,14 @@ describe Taxjar::Client do
|
|
25
25
|
client.set_api_config('api_url', 'https://api.sandbox.taxjar.com')
|
26
26
|
expect(client.api_url).to eq('https://api.sandbox.taxjar.com')
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
it 'sets new custom headers' do
|
30
30
|
client = Taxjar::Client.new(api_key: 'AK')
|
31
31
|
client.set_api_config('headers', { 'X-TJ-Expected-Response' => 422 })
|
32
32
|
expect(client.headers).to eq({ 'X-TJ-Expected-Response' => 422 })
|
33
33
|
end
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
describe "#get_api_config" do
|
37
37
|
it 'gets a config value' do
|
38
38
|
client = Taxjar::Client.new(api_key: 'AK')
|
@@ -44,7 +44,7 @@ describe Taxjar::Client do
|
|
44
44
|
describe '#user_agent' do
|
45
45
|
it 'returns string with version' do
|
46
46
|
client = Taxjar::Client.new(api_key: 'AK')
|
47
|
-
expect(client.user_agent).to
|
47
|
+
expect(client.user_agent).to match(/^TaxJar\/Ruby \(.+\) taxjar-ruby\/\d+\.\d+\.\d+$/)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
data/taxjar-ruby.gemspec
CHANGED
@@ -18,13 +18,13 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.required_ruby_version = '>= 2.
|
21
|
+
spec.required_ruby_version = '>= 2.3'
|
22
22
|
|
23
23
|
spec.add_dependency 'addressable', '~> 2.3'
|
24
|
-
spec.add_dependency 'http', '>=
|
24
|
+
spec.add_dependency 'http', '>= 4.3', '< 5.0'
|
25
25
|
spec.add_dependency 'memoizable', '~> 0.4.0'
|
26
26
|
spec.add_dependency 'model_attribute', '~> 3.2'
|
27
|
-
spec.add_development_dependency "bundler", "
|
27
|
+
spec.add_development_dependency "bundler", ">= 1.7", "< 3.0"
|
28
28
|
spec.add_development_dependency "rake", "~> 12.0"
|
29
29
|
|
30
30
|
if spec.respond_to?(:metadata)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taxjar-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TaxJar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '4.3'
|
34
34
|
- - "<"
|
35
35
|
- !ruby/object:Gem::Version
|
36
36
|
version: '5.0'
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
43
|
+
version: '4.3'
|
44
44
|
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '5.0'
|
@@ -76,16 +76,22 @@ dependencies:
|
|
76
76
|
name: bundler
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- - "
|
79
|
+
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '1.7'
|
82
|
+
- - "<"
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '3.0'
|
82
85
|
type: :development
|
83
86
|
prerelease: false
|
84
87
|
version_requirements: !ruby/object:Gem::Requirement
|
85
88
|
requirements:
|
86
|
-
- - "
|
89
|
+
- - ">="
|
87
90
|
- !ruby/object:Gem::Version
|
88
91
|
version: '1.7'
|
92
|
+
- - "<"
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '3.0'
|
89
95
|
- !ruby/object:Gem::Dependency
|
90
96
|
name: rake
|
91
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -189,14 +195,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
189
195
|
requirements:
|
190
196
|
- - ">="
|
191
197
|
- !ruby/object:Gem::Version
|
192
|
-
version: '2.
|
198
|
+
version: '2.3'
|
193
199
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
194
200
|
requirements:
|
195
201
|
- - ">="
|
196
202
|
- !ruby/object:Gem::Version
|
197
203
|
version: '0'
|
198
204
|
requirements: []
|
199
|
-
rubygems_version: 3.
|
205
|
+
rubygems_version: 3.1.2
|
200
206
|
signing_key:
|
201
207
|
specification_version: 4
|
202
208
|
summary: Ruby wrapper for Taxjar API
|