faraday 0.16.1 → 0.16.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/faraday.rb +1 -1
- data/lib/faraday/deprecated_class.rb +28 -0
- data/lib/faraday/error.rb +2 -2
- metadata +4 -5
- data/lib/faraday/deprecated_constant.rb +0 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 382a791285d8cbe43d29471e437b2ad99e77d0428e53d2de3c0be7562d48b243
|
4
|
+
data.tar.gz: ef5893153bb55c9461389041611176056b26f65f18f288aa76cac795b660de5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98f2ec6c8f92d4ff0493bd655d5d09ce1e09962efb6c9ba6f7eda174363f603f0e2ed068b4fb444ec119cd99b819df3e44f675419e24369c91a1db95a731223a
|
7
|
+
data.tar.gz: d5a8e2febb3d3ca040abad1147d70a41f26e2dc8dc0e72de707ab9b7caf400bc9308af2c6cb5aad92b267c9795daa28c42618e963a2e4cc061a7ece7ac713d10
|
data/lib/faraday.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Faraday
|
4
|
+
# @param old_klass [String] Old Namespaced Class
|
5
|
+
# @param new_klass [Class] New Class that the caller should use instead
|
6
|
+
#
|
7
|
+
# @return [Class] A modified version of new_klass that warns on
|
8
|
+
# usage about deprecation.
|
9
|
+
module DeprecatedClass
|
10
|
+
def self.proxy_class(old_klass, new_klass)
|
11
|
+
Class.new(new_klass).tap do |k|
|
12
|
+
k.send(:define_method, :initialize) do |*args, &block|
|
13
|
+
@old_klass = old_klass
|
14
|
+
@new_klass = new_klass
|
15
|
+
warn
|
16
|
+
super(*args, &block)
|
17
|
+
end
|
18
|
+
|
19
|
+
k.send(:define_method, :warn) do
|
20
|
+
puts(
|
21
|
+
"DEPRECATION WARNING: #{@old_klass} is deprecated! " \
|
22
|
+
"Use #{@new_klass} instead."
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/faraday/error.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'faraday/
|
3
|
+
require 'faraday/deprecated_class'
|
4
4
|
|
5
5
|
# Faraday namespace.
|
6
6
|
module Faraday
|
@@ -105,7 +105,7 @@ module Faraday
|
|
105
105
|
ParsingError TimeoutError SSLError RetriableResponse].each do |const|
|
106
106
|
Error.const_set(
|
107
107
|
const,
|
108
|
-
Faraday::
|
108
|
+
Faraday::DeprecatedClass.proxy_class(
|
109
109
|
"Faraday::Error::#{const}",
|
110
110
|
Faraday.const_get(const)
|
111
111
|
)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faraday
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.
|
4
|
+
version: 0.16.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rick Olson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multipart-post
|
@@ -56,7 +56,7 @@ files:
|
|
56
56
|
- lib/faraday/autoload.rb
|
57
57
|
- lib/faraday/connection.rb
|
58
58
|
- lib/faraday/dependency_loader.rb
|
59
|
-
- lib/faraday/
|
59
|
+
- lib/faraday/deprecated_class.rb
|
60
60
|
- lib/faraday/encoders/flat_params_encoder.rb
|
61
61
|
- lib/faraday/encoders/nested_params_encoder.rb
|
62
62
|
- lib/faraday/error.rb
|
@@ -108,8 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
|
-
|
112
|
-
rubygems_version: 2.7.6.2
|
111
|
+
rubygems_version: 3.0.6
|
113
112
|
signing_key:
|
114
113
|
specification_version: 4
|
115
114
|
summary: HTTP/REST API client library.
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Faraday
|
4
|
-
# Allows for the deprecation of constants between versions of Faraday
|
5
|
-
#
|
6
|
-
# rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
|
7
|
-
class DeprecatedConstant < Module
|
8
|
-
def self.new(*args, &block)
|
9
|
-
object = args.first
|
10
|
-
return object unless object
|
11
|
-
|
12
|
-
super
|
13
|
-
end
|
14
|
-
|
15
|
-
def initialize(old_const, new_const)
|
16
|
-
@old_const = old_const
|
17
|
-
@new_const = new_const
|
18
|
-
end
|
19
|
-
|
20
|
-
# TODO: use match? once Faraday drops Ruby 2.3 support
|
21
|
-
instance_methods.each do |method_name|
|
22
|
-
undef_method method_name if /^__|^object_id$/.match(method_name).nil?
|
23
|
-
end
|
24
|
-
|
25
|
-
def inspect
|
26
|
-
@new_const.inspect
|
27
|
-
end
|
28
|
-
|
29
|
-
def class
|
30
|
-
@new_const.class
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def const_missing(name)
|
36
|
-
warn
|
37
|
-
@new_const.const_get(name)
|
38
|
-
end
|
39
|
-
|
40
|
-
def method_missing(method_name, *args, &block)
|
41
|
-
warn
|
42
|
-
@new_const.__send__(method_name, *args, &block)
|
43
|
-
end
|
44
|
-
|
45
|
-
def warn
|
46
|
-
puts(
|
47
|
-
"DEPRECATION WARNING: #{@old_const} is deprecated! " \
|
48
|
-
"Use #{@new_const} instead."
|
49
|
-
)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
# rubocop:enable Style/MethodMissingSuper, Style/MissingRespondToMissing
|
53
|
-
end
|