taxjar-ruby 3.0.1 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0bd370b061b002cddb9e65f2a879beed9e11c82678eccaa4b6e3b4b6ceb4c053
4
- data.tar.gz: b45f569333906938d5f656442549124f06b12c9dc51c47db9af3a0a29e312730
3
+ metadata.gz: 0fd7067e606c95428f248d02ff6b4a69fc9c21a6bd0ddda37eb2d6ceffaa3744
4
+ data.tar.gz: f83a3a44b30d5bccbcb82e9fc7aee45c6b4751c69055f13a4e12671c70803133
5
5
  SHA512:
6
- metadata.gz: 6960458fd1bb6c89eaeb5f817b15c70a5e68b5b23f6232c05be63273fe02be92102797b989eaaacd76ee77ffa97cef67cdf413293d2a351300633a7d1d51f51a
7
- data.tar.gz: fe9903162754fa2c551d1dd4a88fc1bdd270bc92ac5fedeb1489ecc38a817cee5d93bfbf386442f3b3006df082ff8b31e692a24e6a1a95c716cee8d2b5917077
6
+ metadata.gz: ed65462a17a6505b43f9812ee5a66b9067d8308478330f85fbdc8cd76644e982bbe26a0dae7281b3c21d0f88d8fb7e4e0fff5a162377782774d6dff75d69e8a6
7
+ data.tar.gz: a7acb06bf4dfee72a549fa0c579ba5c27e87f299c647e51f13fbbab03b63e2386cc56c735277458fca52fba5a76d662c8e04a8c5131c6ab90111d5aa483fd6ce
data/.travis.yml CHANGED
@@ -7,5 +7,6 @@ rvm:
7
7
  - "2.6"
8
8
  - "2.7"
9
9
  - "3.0"
10
+ - "3.1"
10
11
 
11
12
  script: bundle exec rspec
data/CHANGELOG.md CHANGED
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.0.4] - 2022-08-22
11
+ - Relaxes `http` version to allow >= 5
12
+ - Encodes client user agent using ISO-8859-1 character set
13
+
14
+ ## [3.0.3] - 2022-02-07
15
+ - Throw a `Taxjar::Error::GatewayTimeout` exception when receiving a 504 HTTP status code
16
+
17
+ ## [3.0.2] - 2021-03-18
18
+ - Re-classify `HTTP::ConnectionError` and other `HTTP::Error` types as `Taxjar::Error`
19
+
10
20
  ## [3.0.1] - 2021-03-16
11
21
  - Throw a `Taxjar::Error` exception for any non-successful HTTP response
12
22
 
@@ -46,7 +56,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
46
56
  - Update minimum required Ruby version to 2.0
47
57
  - Update HTTP (The Gem) to 2.2
48
58
 
49
- [Unreleased]: https://github.com/taxjar/taxjar-ruby/compare/v3.0.1...HEAD
59
+ [Unreleased]: https://github.com/taxjar/taxjar-ruby/compare/v3.0.3...HEAD
60
+ [3.0.3]: https://github.com/taxjar/taxjar-ruby/compare/v3.0.2...v3.0.3
61
+ [3.0.2]: https://github.com/taxjar/taxjar-ruby/compare/v3.0.1...v3.0.2
50
62
  [3.0.1]: https://github.com/taxjar/taxjar-ruby/compare/v3.0.0...v3.0.1
51
63
  [3.0.0]: https://github.com/taxjar/taxjar-ruby/compare/v2.6.1...v3.0.0
52
64
  [2.6.1]: https://github.com/taxjar/taxjar-ruby/compare/v2.6.0...v2.6.1
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # TaxJar Sales Tax API for Ruby [![RubyGems](https://img.shields.io/gem/v/taxjar-ruby.svg?style=flat-square)](https://rubygems.org/gems/taxjar-ruby) [![Build Status](https://img.shields.io/travis/taxjar/taxjar-ruby.svg?style=flat-square)](https://travis-ci.org/taxjar/taxjar-ruby)
2
2
 
3
- <a href="https://developers.taxjar.com"><img src="https://www.taxjar.com/img/TJ_logo_color_office_png.png" alt="TaxJar" width="220"></a>
3
+ <a href="https://developers.taxjar.com"><img src="https://www.taxjar.com/wp-content/uploads/TaxJar__Wordmark_Black.svg" alt="TaxJar" width="220"></a>
4
4
 
5
5
  A Ruby interface to the TaxJar [Sales Tax API](https://developers.taxjar.com/api/reference/?ruby). TaxJar makes sales tax filing easier for online sellers and merchants. See local jurisdictional tax reports, get payment reminders, and more. You can use our API to access TaxJar API endpoints, which can get information on sales tax rates, categories or upload transactions.
6
6
 
@@ -1188,7 +1188,7 @@ nexus_regions = client.nexus_regions
1188
1188
 
1189
1189
  ### Validate an address <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#post-validate-an-address))_</small>
1190
1190
 
1191
- > Validates a customer address and returns back a collection of address matches. **Address validation requires a [TaxJar Plus](https://www.taxjar.com/plus/) subscription.**
1191
+ > Validates a customer address and returns back a collection of address matches. **Address validation requires a [TaxJar Professional](https://www.taxjar.com/pricing) subscription.**
1192
1192
 
1193
1193
  #### Definition
1194
1194
 
@@ -35,6 +35,8 @@ module Taxjar
35
35
  nil
36
36
  end
37
37
  fail_or_return_response_body(response, response_body)
38
+ rescue HTTP::Error => e
39
+ raise Taxjar::Error, e
38
40
  end
39
41
 
40
42
  private
data/lib/taxjar/client.rb CHANGED
@@ -45,7 +45,7 @@ module Taxjar
45
45
  end
46
46
  ruby_version = "ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
47
47
  openSSL_version = OpenSSL::OPENSSL_LIBRARY_VERSION
48
- "TaxJar/Ruby (#{platform}; #{ruby_version}; #{openSSL_version}) taxjar-ruby/#{Taxjar::Version}"
48
+ "TaxJar/Ruby (#{platform}; #{ruby_version}; #{openSSL_version}) taxjar-ruby/#{Taxjar::Version}".encode("ISO-8859-1", invalid: :replace, undef: :replace)
49
49
  end
50
50
  end
51
51
  end
data/lib/taxjar/error.rb CHANGED
@@ -39,6 +39,9 @@ module Taxjar
39
39
  # Raised when Taxjar endpoint returns the HTTP status code 503
40
40
  ServiceUnavailable = Class.new(ServerError)
41
41
 
42
+ # Raised when Taxjar endpoint returns the HTTP status code 504
43
+ GatewayTimeout = Class.new(ServerError)
44
+
42
45
  ERRORS = {
43
46
  400 => Taxjar::Error::BadRequest,
44
47
  401 => Taxjar::Error::Unauthorized,
@@ -50,7 +53,8 @@ module Taxjar
50
53
  422 => Taxjar::Error::UnprocessableEntity,
51
54
  429 => Taxjar::Error::TooManyRequests,
52
55
  500 => Taxjar::Error::InternalServerError,
53
- 503 => Taxjar::Error::ServiceUnavailable
56
+ 503 => Taxjar::Error::ServiceUnavailable,
57
+ 504 => Taxjar::Error::GatewayTimeout
54
58
  }
55
59
 
56
60
  class << self
@@ -1,6 +1,7 @@
1
1
  module Taxjar
2
2
  module Version
3
- module_function
3
+ module_function
4
+
4
5
  def major
5
6
  3
6
7
  end
@@ -10,7 +11,7 @@ module Taxjar
10
11
  end
11
12
 
12
13
  def patch
13
- 1
14
+ 4
14
15
  end
15
16
 
16
17
  def pre
@@ -22,7 +23,7 @@ module Taxjar
22
23
  major: major,
23
24
  minor: minor,
24
25
  patch: patch,
25
- pre: pre,
26
+ pre: pre
26
27
  }
27
28
  end
28
29
 
@@ -175,6 +175,24 @@ describe Taxjar::API::Request do
175
175
  expect{subject.perform}.to raise_error(Taxjar::Error::ServerError)
176
176
  end
177
177
 
178
+ [
179
+ HTTP::Error,
180
+ HTTP::ConnectionError,
181
+ HTTP::RequestError,
182
+ HTTP::ResponseError,
183
+ HTTP::StateError,
184
+ HTTP::TimeoutError,
185
+ HTTP::HeaderError
186
+ ].each do |http_error_class|
187
+ context "#{http_error_class}" do
188
+ it "is classified as a Taxjar::Error" do
189
+ stub_request(:get, "https://api.taxjar.com/api_path").to_raise(http_error_class)
190
+
191
+ expect{subject.perform}.to raise_error(Taxjar::Error)
192
+ end
193
+ end
194
+ end
195
+
178
196
  Taxjar::Error::ERRORS.each do |status, exception|
179
197
  context "when HTTP status is #{status}" do
180
198
  it "raises #{exception}" do
@@ -46,5 +46,11 @@ describe Taxjar::Client do
46
46
  client = Taxjar::Client.new(api_key: 'AK')
47
47
  expect(client.user_agent).to match(/^TaxJar\/Ruby \(.+\) taxjar-ruby\/\d+\.\d+\.\d+$/)
48
48
  end
49
+
50
+ it 'encodes using the ISO-8859-1 character set' do
51
+ client = Taxjar::Client.new(api_key: 'AK')
52
+ allow(client).to receive(:platform).and_return("Curly’s MacBook Pro")
53
+ expect(client.user_agent).to match(/Curly\?s MacBook Pro/)
54
+ end
49
55
  end
50
56
  end
data/taxjar-ruby.gemspec CHANGED
@@ -21,11 +21,11 @@ Gem::Specification.new do |spec|
21
21
  spec.required_ruby_version = '>= 2.3'
22
22
 
23
23
  spec.add_dependency 'addressable', '~> 2.3'
24
- spec.add_dependency 'http', '>= 4.3', '< 5.0'
24
+ spec.add_dependency 'http', '>= 4.3'
25
25
  spec.add_dependency 'memoizable', '~> 0.4.0'
26
26
  spec.add_dependency 'model_attribute', '~> 3.2'
27
27
  spec.add_development_dependency "bundler", ">= 1.7", "< 3.0"
28
- spec.add_development_dependency "rake", "~> 12.0"
28
+ spec.add_development_dependency "rake", "~> 13.0"
29
29
 
30
30
  if spec.respond_to?(:metadata)
31
31
  spec.metadata['changelog_uri'] = 'https://github.com/taxjar/taxjar-ruby/blob/master/CHANGELOG.md'
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: 3.0.1
4
+ version: 3.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - TaxJar
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-16 00:00:00.000000000 Z
11
+ date: 2022-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -31,9 +31,6 @@ dependencies:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '4.3'
34
- - - "<"
35
- - !ruby/object:Gem::Version
36
- version: '5.0'
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
@@ -41,9 +38,6 @@ dependencies:
41
38
  - - ">="
42
39
  - !ruby/object:Gem::Version
43
40
  version: '4.3'
44
- - - "<"
45
- - !ruby/object:Gem::Version
46
- version: '5.0'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: memoizable
49
43
  requirement: !ruby/object:Gem::Requirement
@@ -98,14 +92,14 @@ dependencies:
98
92
  requirements:
99
93
  - - "~>"
100
94
  - !ruby/object:Gem::Version
101
- version: '12.0'
95
+ version: '13.0'
102
96
  type: :development
103
97
  prerelease: false
104
98
  version_requirements: !ruby/object:Gem::Requirement
105
99
  requirements:
106
100
  - - "~>"
107
101
  - !ruby/object:Gem::Version
108
- version: '12.0'
102
+ version: '13.0'
109
103
  description: Ruby wrapper for Taxjar API, more info at developers.taxjar.com
110
104
  email:
111
105
  - support@taxjar.com
@@ -116,7 +110,6 @@ files:
116
110
  - ".editorconfig"
117
111
  - ".gitignore"
118
112
  - ".rspec"
119
- - ".ruby-version"
120
113
  - ".travis.yml"
121
114
  - CHANGELOG.md
122
115
  - Gemfile
@@ -187,7 +180,7 @@ metadata:
187
180
  changelog_uri: https://github.com/taxjar/taxjar-ruby/blob/master/CHANGELOG.md
188
181
  source_code_uri: https://github.com/taxjar/taxjar-ruby
189
182
  bug_tracker_uri: https://github.com/taxjar/taxjar-ruby/issues
190
- post_install_message:
183
+ post_install_message:
191
184
  rdoc_options: []
192
185
  require_paths:
193
186
  - lib
@@ -202,9 +195,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
195
  - !ruby/object:Gem::Version
203
196
  version: '0'
204
197
  requirements: []
205
- rubyforge_project:
206
- rubygems_version: 2.7.6.2
207
- signing_key:
198
+ rubygems_version: 3.1.2
199
+ signing_key:
208
200
  specification_version: 4
209
201
  summary: Ruby wrapper for Taxjar API
210
202
  test_files:
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 1.9.3-p0