squash_matrix 1.0.7 → 1.0.8

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: eed138cf3aa885351dd0e42f62a5501cfc3f355a4611ea619bc53abd0a138fdc
4
- data.tar.gz: 6d4e62d6191d730691a5ab312f844da7ddfceadc8619da8c96bb41d51122bd64
3
+ metadata.gz: e39c810538e0cccb7d8418eae458e164cda33854d1f2fc56e841aeaf13078e8f
4
+ data.tar.gz: e76295af2406401e89a43c32e8bde72e20e2ebe315c9ead1eaa7a95b34551104
5
5
  SHA512:
6
- metadata.gz: 9ed1f044b29eca1efc4d10a3ed4d9b2c3c006ad8df85fc26444e2aa793808cd1a467c52e7ddb37c5269b79131b75a38035ef1fc95190fc04a18843a4add09747
7
- data.tar.gz: 6e9cfa37594ad1633b75b3ab72df5b5dffb461e4e4847431d335715a9189a3afa440a0d950e0d5ee060543fa9fe51aa5ae55a5c025f6654df81f40fd9d317f2f
6
+ metadata.gz: f472a5010c4a1d3d061e179dd6a7385038ff13b7cfa8b42e8ed1f872a22a7083eee3507e4401024a7dfdd03313d4d0cf0f2eb4b6dee23369e1408d65bfeae531
7
+ data.tar.gz: 1690abc95e59085ad37b50a8ed2f5d44dcd0cebf20fc153728de9f47acea7dc312d0afc1897c2ba20dea426f74ca4ce17eb2b086244eee6edfd16230eb1c2d52
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- squash_matrix (1.0.6)
4
+ squash_matrix (1.0.7)
5
5
  http-cookie (~> 1.0, >= 1.0.3)
6
6
  nokogiri (~> 1.8, >= 1.8.4)
7
7
  user-agent-randomizer (~> 0.2)
@@ -186,12 +186,18 @@ module SquashMatrix
186
186
  res = @request_client.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') { |http| http.request(req) }
187
187
  case res
188
188
  when Net::HTTPSuccess, Net::HTTPFound
189
- return success_proc&.call(res) || res
189
+ rtn = success_proc&.call(res) || res
190
+ raise SquashMatrix::Errors::EntityNotFoundError if rtn.is_a?(Array) &&
191
+ rtn.length == 0 &&
192
+ SquashMatrix::Constants::NOT_FOUND_REGEX.match(res.body)
193
+ return rtn
190
194
  when Net::HTTPConflict
191
195
  unless @suppress_errors
192
196
  raise SquashMatrix::Errors::ForbiddenError, res.body if SquashMatrix::Constants::FORBIDDEN_ERROR_REGEX.match(res.body)
193
197
  raise SquashMatrix::Errors::TooManyRequestsError, res.body if SquashMatrix::Constants::TOO_MANY_REQUESTS_ERROR_REGEX.match(res.body)
194
198
  end
199
+ when Net::HTTPNotFound
200
+ raise SquashMatrix::Errors::EntityNotFoundError
195
201
  else
196
202
  raise SquashMatrix::Errors::UnknownError, res unless @suppress_errors
197
203
  end
@@ -36,5 +36,6 @@ module SquashMatrix
36
36
 
37
37
  TOO_MANY_REQUESTS_ERROR_REGEX = /Request made too soon. This is to prevent abuse to the site. We apologise for the inconvenience/
38
38
  FORBIDDEN_ERROR_REGEX = /Forbidden/
39
+ NOT_FOUND_REGEX = /No information/
39
40
  end
40
41
  end
@@ -6,5 +6,6 @@ module SquashMatrix
6
6
  class AuthorizationError < StandardError; end
7
7
  class ForbiddenError < StandardError; end
8
8
  class UnknownError < StandardError; end
9
+ class EntityNotFoundError < StandardError; end
9
10
  end
10
11
  end
@@ -1,3 +1,3 @@
1
1
  module SquashMatrix
2
- VERSION = "1.0.7"
2
+ VERSION = "1.0.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squash_matrix
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Wilkosz