faraday 0.17.3 → 0.17.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/faraday/adapter/net_http.rb +1 -0
- data/lib/faraday/deprecate.rb +3 -1
- data/lib/faraday/request.rb +2 -0
- data/lib/faraday/upload_io.rb +16 -6
- data/lib/faraday.rb +1 -1
- data/spec/faraday/deprecate_spec.rb +78 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56d15adebd24ca50e38ac12d74f518927ee757abe32ce2693aac8f6b3b2d5db6
|
4
|
+
data.tar.gz: 72247b6844e16989a3c186a95e226b8254da0dff82854922242add3535707a9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08df648fee5c02b6fd54d70615ee97ccc978d5a16471cbfc4790150189de39799e60bd67d45236645c79785062dc14aef36a0c516e847c7a43615e7147381aad'
|
7
|
+
data.tar.gz: de528b3a2c4a552f68cfb95814729018106146c5bc0861abfcbd45d4202036c9e7347f40dfe1703a27a939e1960e2019bae9293039a1550031a41124c27dfd7c
|
data/lib/faraday/deprecate.rb
CHANGED
@@ -9,11 +9,13 @@ module Faraday
|
|
9
9
|
module DeprecatedClass
|
10
10
|
def self.proxy_class(origclass, ver = '1.0')
|
11
11
|
proxy = Class.new(origclass) do
|
12
|
+
const_set("ORIG_CLASS", origclass)
|
13
|
+
|
12
14
|
class << self
|
13
15
|
extend Faraday::Deprecate
|
14
16
|
|
15
17
|
def ===(other)
|
16
|
-
other.is_a?(superclass) || super
|
18
|
+
(superclass == const_get("ORIG_CLASS") && other.is_a?(superclass)) || super
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
data/lib/faraday/request.rb
CHANGED
@@ -12,6 +12,8 @@ module Faraday
|
|
12
12
|
class Request < Struct.new(:method, :path, :params, :headers, :body, :options)
|
13
13
|
extend MiddlewareRegistry
|
14
14
|
|
15
|
+
alias_method :http_method, :method
|
16
|
+
|
15
17
|
register_middleware File.expand_path('../request', __FILE__),
|
16
18
|
:url_encoded => [:UrlEncoded, 'url_encoded'],
|
17
19
|
:multipart => [:Multipart, 'multipart'],
|
data/lib/faraday/upload_io.rb
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
begin
|
2
|
-
require '
|
3
|
-
require 'parts'
|
2
|
+
require 'multipart/post'
|
4
3
|
require 'stringio'
|
5
4
|
rescue LoadError
|
6
|
-
|
7
|
-
|
5
|
+
begin
|
6
|
+
require 'composite_io'
|
7
|
+
require 'parts'
|
8
|
+
require 'stringio'
|
9
|
+
rescue LoadError
|
10
|
+
$stderr.puts "Install the multipart-post gem."
|
11
|
+
raise
|
12
|
+
end
|
8
13
|
end
|
9
14
|
|
10
15
|
module Faraday
|
@@ -62,6 +67,11 @@ module Faraday
|
|
62
67
|
end
|
63
68
|
end
|
64
69
|
|
65
|
-
|
66
|
-
|
70
|
+
if defined?(::Multipart::Post::UploadIO)
|
71
|
+
UploadIO = ::Multipart::Post::UploadIO
|
72
|
+
Parts = ::Multipart::Post::Parts
|
73
|
+
else
|
74
|
+
UploadIO = ::UploadIO
|
75
|
+
Parts = ::Parts
|
76
|
+
end
|
67
77
|
end
|
data/lib/faraday.rb
CHANGED
@@ -56,6 +56,84 @@ RSpec.describe Faraday::DeprecatedClass do
|
|
56
56
|
expect { raise SampleDeprecatedClass, nil }.to raise_error(SampleClass)
|
57
57
|
end
|
58
58
|
|
59
|
+
describe 'match behavior' do
|
60
|
+
class SampleDeprecatedClassA < SampleDeprecatedClass; end
|
61
|
+
class SampleDeprecatedClassB < SampleDeprecatedClass; end
|
62
|
+
|
63
|
+
class SampleDeprecatedClassAX < SampleDeprecatedClassA; end
|
64
|
+
|
65
|
+
class SampleClassA < SampleClass; end
|
66
|
+
|
67
|
+
describe 'undeprecated class' do
|
68
|
+
it 'is === to instance of deprecated class' do
|
69
|
+
expect(SampleClass === SampleDeprecatedClass.new).to be true
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'is === to instance of subclass of deprecated class' do
|
73
|
+
expect(SampleClass === SampleDeprecatedClassA.new).to be true
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'is === to instance of subclass of subclass of deprecated class' do
|
77
|
+
expect(SampleClass === SampleDeprecatedClassAX.new).to be true
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe 'subclass of undeprecated class' do
|
82
|
+
it 'is not === to instance of undeprecated class' do
|
83
|
+
expect(SampleClassA === SampleClass.new).to be false
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'is not === to instance of deprecated class' do
|
87
|
+
expect(SampleClassA === SampleDeprecatedClass.new).to be false
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe 'deprecated class' do
|
92
|
+
it 'is === to instance of undeprecated class' do
|
93
|
+
expect(SampleDeprecatedClass === SampleClass.new).to be true
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'is === to instance of subclass of undeprecated class' do
|
97
|
+
expect(SampleDeprecatedClass === SampleClassA.new).to be true
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'is === to instance of subclass of deprecated class' do
|
101
|
+
expect(SampleDeprecatedClass === SampleDeprecatedClassA.new).to be true
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'is === to instance of subclass of subclass of deprecated class' do
|
105
|
+
expect(SampleDeprecatedClass === SampleDeprecatedClassAX.new).to be true
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
describe 'subclass of deprecated class' do
|
110
|
+
it 'is not === to instance of subclass of undeprecated class' do
|
111
|
+
expect(SampleDeprecatedClassA === SampleClass.new).to be false
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'is not === to instance of another subclass of deprecated class' do
|
115
|
+
expect(SampleDeprecatedClassA === SampleDeprecatedClassB.new).to be false
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'is === to instance of its subclass' do
|
119
|
+
expect(SampleDeprecatedClassA === SampleDeprecatedClassAX.new).to be true
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'is === to instance of deprecated class' do
|
123
|
+
expect(SampleDeprecatedClass === SampleDeprecatedClassB.new).to be true
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
describe 'subclass of subclass of deprecated class' do
|
128
|
+
it 'is not === to instance of subclass of another subclass of deprecated class' do
|
129
|
+
expect(SampleDeprecatedClassAX === SampleDeprecatedClassB.new).to be false
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'is not === to instance of its superclass' do
|
133
|
+
expect(SampleDeprecatedClassA === SampleDeprecatedClass.new).to be false
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
59
137
|
|
60
138
|
def with_warn_squelching
|
61
139
|
stderr_catcher = StringIO.new
|
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.17.
|
4
|
+
version: 0.17.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "@technoweenie"
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2022-11-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: multipart-post
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
- !ruby/object:Gem::Version
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
|
-
rubygems_version: 3.
|
136
|
+
rubygems_version: 3.3.7
|
137
137
|
signing_key:
|
138
138
|
specification_version: 4
|
139
139
|
summary: HTTP/REST API client library.
|