better-faraday 1.0.4 → 1.0.5

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: 99c10f80bd720f60bad4cef31fa82b7eb35eff291c7375c6b16afecaeeea768b
4
- data.tar.gz: f22d48fb3b8f72bce97751e66562e7bc5afe16ccc4236a4d1ac2b02dce214bc1
3
+ metadata.gz: 96306102b54a000666f1b5c816c5a3999c1bbcce3dfd0f9fddb8c98175613dd2
4
+ data.tar.gz: 5925c4b2c42be901662b5d6927289825d26551cf5b8255d32243bbf6092cd2e4
5
5
  SHA512:
6
- metadata.gz: 4ced29c94068d38cc9e648639af9e1f41522527fdae7374042b6e61316b935410d0d5231e720957f260fd53f07e92d0c99575e330a9888438ace0e8c15960051
7
- data.tar.gz: dc784bf72977b0e0e5591e5b01f33833235619c261a2d12a5424b37e81180355f215bb354e0a0a897b6b904f94cd476649eb578ca9f00d0e83d31472dc89b929
6
+ metadata.gz: 8b681f0b3a10e172a41d30d95da3a33d11fdeb2a207706c97f18eb7cf1dbc10d1108f3f83b80fea89b35da9e536815d8522f4cac9170bb41bb0ce0800a2af2a4
7
+ data.tar.gz: 1ba125b9751c87a2ea3a83cbe8628ccb63ad7f9d662e783ca4308eca742c04b76b1f280e7766562cd3b7ce8e68d565cc30ddd88439e553429ed24e7ac758587c
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "better-faraday"
6
- s.version = "1.0.4"
6
+ s.version = "1.0.5"
7
7
  s.author = "Yaroslav Konoplov"
8
8
  s.email = "eahome00@gmail.com"
9
9
  s.summary = "Extends Faraday with useful features."
@@ -8,6 +8,7 @@ require "faraday/options"
8
8
  require "faraday/response"
9
9
  require "active_support/core_ext/object/deep_dup"
10
10
  require "active_support/core_ext/string/filters"
11
+ require "active_support/core_ext/string/inflections"
11
12
 
12
13
  Module.new do
13
14
  def run_request(method, url, body, headers, &block)
@@ -22,18 +23,22 @@ module Faraday
22
23
 
23
24
  class Error
24
25
  attr_reader :response
26
+
27
+ def inspect
28
+ super.gsub(/\s*\(\s*\)\z/)
29
+ end
25
30
  end
26
31
 
27
32
  class Response
28
33
  def assert_2xx!
29
34
  return self if status >= 200 && status <= 299
30
- klass = if status == 422
31
- Faraday::HTTP422
32
- elsif status >= 400 && status <= 499
33
- Faraday::HTTP4xx
35
+
36
+ klass = if status >= 400 && status <= 499
37
+ "Faraday::HTTP#{status}".safe_constantize || Faraday::HTTP4xx
34
38
  else
35
39
  Faraday::Error
36
40
  end
41
+
37
42
  error = klass.new(describe)
38
43
  error.instance_variable_set(:@response, self)
39
44
  raise error
@@ -91,13 +96,13 @@ module Faraday
91
96
  end
92
97
  end
93
98
 
94
- class HTTP4xx < Error
95
-
96
- end
97
-
98
- class HTTP422 < HTTP4xx
99
-
100
- end
99
+ class HTTP4xx < Error; end
100
+ class HTTP400 < HTTP4xx; end
101
+ class HTTP401 < HTTP4xx; end
102
+ class HTTP403 < HTTP4xx; end
103
+ class HTTP404 < HTTP4xx; end
104
+ class HTTP422 < HTTP4xx; end
105
+ class HTTP429 < HTTP4xx; end
101
106
 
102
107
  class << self
103
108
  attr_accessor :secrets
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: better-faraday
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaroslav Konoplov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-17 00:00:00.000000000 Z
11
+ date: 2019-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday