rock_rms 4.18.0 → 5.0.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
  SHA1:
3
- metadata.gz: bbec7172912560350ad0b904c64b53377a7e8883
4
- data.tar.gz: 57177339a032d15b9746f1407cb24e16ab5efc5a
3
+ metadata.gz: 2cdc3ac5eda8e89243df3cdf319e1ea4d0a2db7a
4
+ data.tar.gz: b3ba9b0089c70ed7cd709e3857b2a16e2ade5e45
5
5
  SHA512:
6
- metadata.gz: 8bdaa550a2b312b28aee6e9569200bf5109ecd1683d4c86051d8000d345976c3632f3c39d4892f21e9866e2e47bf240cbf2ec473cc975cafb1adf261f2127033
7
- data.tar.gz: 39dab6b92d6075c8e72efc2c566cae5087d6b59434ec0250c06554ff55053a593756bb1120085ed5d83ba5fd3573f8af24834b2e726603e1c919073fec9f745d
6
+ metadata.gz: 673884c975f563c2945dafdc321611b989c8d5e6a87914c2fa26c6806b245107c932cd84ae29e2376b8b3e2d3f807501c39dd36161436ff0efc31e6b7001ea96
7
+ data.tar.gz: a4eb7aa401b7c6fa52aa651cb4953ddedcd9969ba445b72609500253d9d4d4c0982828cf82c46d298c49a9f5b3eb9789671938f57d0495c3cd7688e05b1e23a5
@@ -1,5 +1,11 @@
1
1
  module RockRMS
2
2
  class Error < StandardError; end
3
+ class BadRequest < Error; end
4
+ class Forbidden < Error; end
5
+ class GatewayTimeout < Error; end
6
+ class InternalServerError < Error; end
7
+ class NotFound < Error; end
8
+ class Unauthorized < Error; end
3
9
  end
4
10
 
5
11
  require 'faraday'
@@ -9,6 +15,18 @@ module FaradayMiddleware
9
15
 
10
16
  def on_complete(env)
11
17
  case env[:status]
18
+ when 400
19
+ raise RockRMS::BadRequest, "#{env[:status]}: #{env[:body]} #{env[:url]}"
20
+ when 401
21
+ raise RockRMS::Unauthorized, "#{env[:status]}: #{env[:body]} #{env[:url]}"
22
+ when 403
23
+ raise RockRMS::Forbidden, "#{env[:status]}: #{env[:body]} #{env[:url]}"
24
+ when 404
25
+ raise RockRMS::NotFound, "#{env[:status]}: #{env[:body]} #{env[:url]}"
26
+ when 500
27
+ raise RockRMS::InternalServerError, "#{env[:status]}: #{env[:body]} #{env[:url]}"
28
+ when 504
29
+ raise RockRMS::GatewayTimeout, "#{env[:status]}: #{env[:body]} #{env[:url]}"
12
30
  when ERROR_STATUSES
13
31
  raise RockRMS::Error, "#{env[:status]}: #{env[:body]} #{env[:url]}"
14
32
  end
@@ -1,3 +1,3 @@
1
1
  module RockRMS
2
- VERSION = '4.18.0'.freeze
2
+ VERSION = '5.0.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rock_rms
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.18.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Brooks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-06 00:00:00.000000000 Z
11
+ date: 2020-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday