better-faraday 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/better-faraday.gemspec +1 -1
- data/lib/better-faraday.rb +16 -11
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 96306102b54a000666f1b5c816c5a3999c1bbcce3dfd0f9fddb8c98175613dd2
|
|
4
|
+
data.tar.gz: 5925c4b2c42be901662b5d6927289825d26551cf5b8255d32243bbf6092cd2e4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8b681f0b3a10e172a41d30d95da3a33d11fdeb2a207706c97f18eb7cf1dbc10d1108f3f83b80fea89b35da9e536815d8522f4cac9170bb41bb0ce0800a2af2a4
|
|
7
|
+
data.tar.gz: 1ba125b9751c87a2ea3a83cbe8628ccb63ad7f9d662e783ca4308eca742c04b76b1f280e7766562cd3b7ce8e68d565cc30ddd88439e553429ed24e7ac758587c
|
data/better-faraday.gemspec
CHANGED
data/lib/better-faraday.rb
CHANGED
|
@@ -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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
|
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
|
+
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-
|
|
11
|
+
date: 2019-05-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|