flexirest 1.9.17 → 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: 50fe9393bbb548c2052ca5f971b7c406a9daf742d398fcd0681a917e03dd6247
4
- data.tar.gz: b1dc3e1b1c97626ed7956f7a7ba31f4bd424d9a1a539645de8bbd456348eb814
3
+ metadata.gz: 9f713d7d9f8f37de42e54bd20623b4477b9893b6cd40f0d2d5e8c5a06079a821
4
+ data.tar.gz: b5fc1fe7bffbe57a6adf9443aab86d91313fddd90b2fcc2ef35f50f2b41ec942
5
5
  SHA512:
6
- metadata.gz: 23ca59d17ad6df1bf15f8dc40bf4fd826132016d82de50a40824ac9d7d98858e92ab621bc8d0681bb61db950ae50853b3017bae86b8ae96ecccc1270a757c018
7
- data.tar.gz: 60bae684f60df01e8419f97d870bb3412192c6e7c85ecff1abf578d6210bc8d336781e1f1bd1d4f05753b1cccd3a44923049dd43a76f55f5b3ee233807b75fbb
6
+ metadata.gz: eedfb75a0ecacbb1114d62fad201cf5e478242dd74126b87b29f1081e9c56b4194b600c6d729ac8afa70a7dd4ee8d66a03057974a2e52ee76f575e848027bfca
7
+ data.tar.gz: 955f229836e2e6fbc6273b1505294619ab0a614af05e79d0e5113b956959dbf22bb76ed23b2a169a9dafe207b6ab48b3559f7adeb84f22e3fcff01fbc223b28f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
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
+
9
+ ## 1.9.18
10
+
11
+ Security:
12
+
13
+ - Upgrade rest-client development dependency to a CVE-fixed version.
14
+
3
15
  ## 1.9.17
4
16
 
5
17
  Feature:
data/flexirest.gemspec CHANGED
@@ -39,6 +39,7 @@ Gem::Specification.new do |spec|
39
39
  spec.add_development_dependency "api-auth", ">= 1.3.1", "< 2.4"
40
40
  spec.add_development_dependency 'typhoeus'
41
41
  spec.add_development_dependency 'activemodel'
42
+ spec.add_development_dependency 'rest-client', ">= 1.8.0"
42
43
 
43
44
  spec.add_runtime_dependency "mime-types"
44
45
  spec.add_runtime_dependency "multi_json"
@@ -52,12 +53,4 @@ Gem::Specification.new do |spec|
52
53
  else
53
54
  spec.add_runtime_dependency "activesupport", "< 5.0.0"
54
55
  end
55
- # JSON is an implicit dependency of something, but JSON v2+ requires Ruby 2+
56
- # Same with "tins" which is a dependency of coveralls
57
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0.0')
58
- spec.add_runtime_dependency "json", "< 2.0.0"
59
- spec.add_runtime_dependency "tins", "~> 1.6.0"
60
- spec.add_runtime_dependency "term-ansicolor", "~> 1.3.2"
61
- spec.add_runtime_dependency "public_suffix", "~> 1.4.6"
62
- end
63
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
@@ -66,8 +66,8 @@ module Flexirest
66
66
  self
67
67
  end
68
68
 
69
- def delete_if
70
- @items = @items.delete_if &Proc.new
69
+ def delete_if(&block)
70
+ @items = @items.delete_if &block
71
71
  self
72
72
  end
73
73
 
@@ -1,3 +1,3 @@
1
1
  module Flexirest
2
- VERSION = "1.9.17"
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.17
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
@@ -170,6 +170,20 @@ dependencies:
170
170
  - - ">="
171
171
  - !ruby/object:Gem::Version
172
172
  version: '0'
173
+ - !ruby/object:Gem::Dependency
174
+ name: rest-client
175
+ requirement: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: 1.8.0
180
+ type: :development
181
+ prerelease: false
182
+ version_requirements: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: 1.8.0
173
187
  - !ruby/object:Gem::Dependency
174
188
  name: mime-types
175
189
  requirement: !ruby/object:Gem::Requirement