flexirest 1.9.18 → 1.10.0

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: 4a602c593b7748bb16605a196b249920ad733152fee9c7969fa56445b8c07003
4
- data.tar.gz: 1e75b70398bcc73ee2fbd68a169c9f30ed1cbdd968e2f0d74272a1ed1b254737
3
+ metadata.gz: 9f713d7d9f8f37de42e54bd20623b4477b9893b6cd40f0d2d5e8c5a06079a821
4
+ data.tar.gz: b5fc1fe7bffbe57a6adf9443aab86d91313fddd90b2fcc2ef35f50f2b41ec942
5
5
  SHA512:
6
- metadata.gz: 1d868df5a25277b88e0482e5cae4ba4398aa0ae4082766321988172365d7e1d955f6254f4a29eccd927f6d95d3734e81333f55760c1fbc0847f1ba6a249ae922
7
- data.tar.gz: 2710c351b4f5770a4cc177d5ca7509aff9e988ff7b89a892bf4f57c35bb5834c5f41ca193ae22023b15de71118b19799c52491682dad86d041fd21dad9773a32
6
+ metadata.gz: eedfb75a0ecacbb1114d62fad201cf5e478242dd74126b87b29f1081e9c56b4194b600c6d729ac8afa70a7dd4ee8d66a03057974a2e52ee76f575e848027bfca
7
+ data.tar.gz: 955f229836e2e6fbc6273b1505294619ab0a614af05e79d0e5113b956959dbf22bb76ed23b2a169a9dafe207b6ab48b3559f7adeb84f22e3fcff01fbc223b28f
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.10.0
4
+
5
+ Enhancement:
6
+
7
+ - Add specific exceptions for the most common 5xx server-side errors
8
+
3
9
  ## 1.9.18
4
10
 
5
11
  Security:
@@ -53,12 +53,4 @@ Gem::Specification.new do |spec|
53
53
  else
54
54
  spec.add_runtime_dependency "activesupport", "< 5.0.0"
55
55
  end
56
- # JSON is an implicit dependency of something, but JSON v2+ requires Ruby 2+
57
- # Same with "tins" which is a dependency of coveralls
58
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0.0')
59
- spec.add_runtime_dependency "json", "< 2.0.0"
60
- spec.add_runtime_dependency "tins", "~> 1.6.0"
61
- spec.add_runtime_dependency "term-ansicolor", "~> 1.3.2"
62
- spec.add_runtime_dependency "public_suffix", "~> 1.4.6"
63
- end
64
56
  end
@@ -630,6 +630,16 @@ module Flexirest
630
630
  raise HTTPConflictClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
631
631
  elsif status == 429
632
632
  raise HTTPTooManyRequestsClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
633
+ elsif status == 500
634
+ raise HTTPInternalServerException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
635
+ elsif status == 501
636
+ raise HTTPNotImplementedServerException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
637
+ elsif status == 502
638
+ raise HTTPBadGatewayServerException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
639
+ elsif status == 503
640
+ raise HTTPServiceUnavailableServerException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
641
+ elsif status == 504
642
+ raise HTTPGatewayTimeoutServerException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
633
643
  elsif (400..499).include? status
634
644
  raise HTTPClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
635
645
  elsif (500..599).include? status
@@ -901,5 +911,9 @@ module Flexirest
901
911
  class HTTPNotFoundClientException < HTTPClientException ; end
902
912
  class HTTPTooManyRequestsClientException < HTTPClientException ; end
903
913
  class HTTPServerException < HTTPException ; end
904
-
914
+ class HTTPInternalServerException < HTTPServerException ; end
915
+ class HTTPNotImplementedServerException < HTTPServerException ; end
916
+ class HTTPBadGatewayServerException < HTTPServerException ; end
917
+ class HTTPServiceUnavailableServerException < HTTPServerException ; end
918
+ class HTTPGatewayTimeoutServerException < HTTPServerException ; end
905
919
  end
@@ -1,3 +1,3 @@
1
1
  module Flexirest
2
- VERSION = "1.9.18"
2
+ VERSION = "1.10.0"
3
3
  end
@@ -1005,7 +1005,7 @@ describe Flexirest::Request do
1005
1005
  rescue Flexirest::HTTPServerException => e
1006
1006
  e
1007
1007
  end
1008
- expect(e).to be_instance_of(Flexirest::HTTPServerException)
1008
+ expect(e).to be_instance_of(Flexirest::HTTPInternalServerException)
1009
1009
  expect(e.status).to eq(500)
1010
1010
  expect(e.result.first_name).to eq("John")
1011
1011
  end
@@ -1021,7 +1021,7 @@ describe Flexirest::Request do
1021
1021
  rescue Flexirest::HTTPServerException => e
1022
1022
  e
1023
1023
  end
1024
- expect(e.message).to eq(%q{The POST to '/create' returned a 500 status, which raised a Flexirest::HTTPServerException with a body of: \{"first_name":"John", "id":1234\}})
1024
+ expect(e.message).to eq(%q{The POST to '/create' returned a 500 status, which raised a Flexirest::HTTPInternalServerException with a body of: \{"first_name":"John", "id":1234\}})
1025
1025
  end
1026
1026
 
1027
1027
  it "should raise a parse exception for invalid JSON returns" do
@@ -1036,7 +1036,7 @@ describe Flexirest::Request do
1036
1036
  rescue => e
1037
1037
  e
1038
1038
  end
1039
- expect(e).to be_instance_of(Flexirest::HTTPServerException)
1039
+ expect(e).to be_instance_of(Flexirest::HTTPInternalServerException)
1040
1040
  expect(e.status).to eq(500)
1041
1041
  expect(e.result).to eq(error_content)
1042
1042
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flexirest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.18
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-24 00:00:00.000000000 Z
11
+ date: 2020-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler