faraday 0.16.0 → 0.16.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 010e4dd27187eb834e8a0c185cab419a1b69c6e3f8a5728f6681109b7848091d
4
- data.tar.gz: ccd678f8acf84929c15a19b7a6ca1b22b2d634eabfae21c84c4a0f0ba97fb8b6
3
+ metadata.gz: 23562bbe34d7ac60c8cc99bbebd129ef82a007fd58427e9f55150d7dd0bc62d4
4
+ data.tar.gz: ec487ada8a75259f37a33615826112abe255186ee313467145361f3d42c65fb1
5
5
  SHA512:
6
- metadata.gz: 150271b18c60bf5b55cc7e74f39fb01d6c83eecc39119d425fe8d399829ba728183900a5a948dbb874f432fc95996b88c367e87b5274b45addbd15d6175d7bc0
7
- data.tar.gz: 3f4ef0b5d787aeffef29d79af04297a62a6b1ae77f034858b7d68ac4bdcfc00734c976cb8dff8b76b0af007590c6f4a5376797c14d3798cc13193aed96689d0c
6
+ metadata.gz: 37fe1268b37bb7841a0cf46175ff819fadcdb88d776ccb0ce67d1fa7c9527c29e3896d30960ed75da02df73a5ec6f93af32aaf2d959fe9546f37110988a03cb8
7
+ data.tar.gz: 200da4c8d47cbbd9635e326d062d3be7c25f68451bc8fb82463f0b5803a42682d08cec4891c5910013723a3b57c2dc517103d2b6424706cf7f5bcf73810706b7
@@ -19,7 +19,7 @@ require 'faraday/dependency_loader'
19
19
  # conn.get '/'
20
20
  #
21
21
  module Faraday
22
- VERSION = '0.16.0'
22
+ VERSION = '0.16.1'
23
23
  METHODS_WITH_QUERY = %w[get head delete connect trace].freeze
24
24
  METHODS_WITH_BODY = %w[post put patch].freeze
25
25
 
@@ -0,0 +1,53 @@
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
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'faraday/deprecated_constant'
4
+
5
+ # Faraday namespace.
3
6
  module Faraday
4
7
  # Faraday error base class.
5
8
  class Error < StandardError
@@ -97,4 +100,15 @@ module Faraday
97
100
  # @see Faraday::Request::Retry
98
101
  class RetriableResponse < Error
99
102
  end
103
+
104
+ %i[ClientError ConnectionFailed ResourceNotFound
105
+ ParsingError TimeoutError SSLError RetriableResponse].each do |const|
106
+ Error.const_set(
107
+ const,
108
+ Faraday::DeprecatedConstant.new(
109
+ "Faraday::Error::#{const}",
110
+ Faraday.const_get(const)
111
+ )
112
+ )
113
+ end
100
114
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Olson
@@ -56,6 +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/deprecated_constant.rb
59
60
  - lib/faraday/encoders/flat_params_encoder.rb
60
61
  - lib/faraday/encoders/nested_params_encoder.rb
61
62
  - lib/faraday/error.rb