faraday-patron 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -11
- data/lib/faraday/adapter/patron.rb +6 -10
- data/lib/faraday/patron/version.rb +1 -1
- data/lib/faraday/patron.rb +2 -0
- metadata +8 -134
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 507f74d1eac6f682df3331af26ded117c552fa0b7cae1ed1ce62718ffd1b6a06
|
4
|
+
data.tar.gz: f6c21a13926cf00212e327cb31b13a119b64a7a02c64e886089181d2c2445f28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f3b5cd9f313dd3118e90b1b2ee727b7ed967522fb682b74fda008172e1b846742bb54c61720b7a256c3270aa451b5266904e586e0f428ddfe090bc98bad52a8
|
7
|
+
data.tar.gz: 10520cd6d7a1cf4beeca2d1d3456ffd714cc3f748eecf12ccc25ba0b88bf4d450821f88184fc37d4c541b6756ef32cb6e876fbe20692ccf4d9e1283698a7261e
|
data/README.md
CHANGED
@@ -9,8 +9,6 @@ Every adapter is defined into its own gem. This gem defines the adapter for Patr
|
|
9
9
|
Add these lines to your application's Gemfile:
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem 'patron', '>= 2.2'
|
13
|
-
gem 'faraday'
|
14
12
|
gem 'faraday-patron'
|
15
13
|
```
|
16
14
|
|
@@ -20,21 +18,19 @@ And then execute:
|
|
20
18
|
|
21
19
|
Or install them yourself as:
|
22
20
|
|
23
|
-
$ gem install patron
|
24
|
-
$ gem install faraday faraday-patron
|
21
|
+
$ gem install faraday-patron
|
25
22
|
|
26
23
|
## Usage
|
27
24
|
|
28
|
-
Configure your Faraday connection to use this adapter like this:
|
29
|
-
|
30
25
|
```ruby
|
31
|
-
|
32
|
-
|
26
|
+
conn = Faraday.new(...) do |f|
|
27
|
+
f.adapter :patron do |session|
|
28
|
+
# yields Patron::Session
|
29
|
+
session.max_redirects = 10
|
30
|
+
end
|
33
31
|
end
|
34
32
|
```
|
35
33
|
|
36
|
-
For more information on how to setup your Faraday connection and adapters usage, please refer to the [Faraday Website][faraday-website].
|
37
|
-
|
38
34
|
## Development
|
39
35
|
|
40
36
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -54,7 +50,6 @@ The gem is available as open source under the terms of the [license][license].
|
|
54
50
|
Everyone interacting in the Faraday Patron adapter project's codebase, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct][code-of-conduct].
|
55
51
|
|
56
52
|
[faraday]: https://github.com/lostisland/faraday
|
57
|
-
[faraday-website]: https://lostisland.github.io/faraday
|
58
53
|
[patron]: https://github.com/toland/patron
|
59
54
|
[rubygems]: https://rubygems.org
|
60
55
|
[repo]: https://github.com/lostisland/faraday-patron
|
@@ -4,8 +4,6 @@ module Faraday
|
|
4
4
|
class Adapter
|
5
5
|
# Patron adapter
|
6
6
|
class Patron < Faraday::Adapter
|
7
|
-
dependency 'patron'
|
8
|
-
|
9
7
|
def build_connection(env)
|
10
8
|
session = ::Patron::Session.new
|
11
9
|
@config_block&.call(session)
|
@@ -27,13 +25,11 @@ module Faraday
|
|
27
25
|
env[:body] = env[:body].read if env[:body].respond_to? :read
|
28
26
|
|
29
27
|
response = connection(env) do |session|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
raise Faraday::ConnectionFailed, $ERROR_INFO
|
36
|
-
end
|
28
|
+
data = env[:body] ? env[:body].to_s : nil
|
29
|
+
session.request(env[:method], env[:url].to_s,
|
30
|
+
env[:request_headers], data: data)
|
31
|
+
rescue Errno::ECONNREFUSED, ::Patron::ConnectionFailed
|
32
|
+
raise Faraday::ConnectionFailed, $ERROR_INFO
|
37
33
|
end
|
38
34
|
|
39
35
|
if (req = env[:request]).stream_response?
|
@@ -63,7 +59,7 @@ module Faraday
|
|
63
59
|
raise Faraday::ConnectionFailed, e
|
64
60
|
end
|
65
61
|
|
66
|
-
if
|
62
|
+
if defined?(::Patron::Request::VALID_ACTIONS)
|
67
63
|
# HAX: helps but doesn't work completely
|
68
64
|
# https://github.com/toland/patron/issues/34
|
69
65
|
::Patron::Request::VALID_ACTIONS.tap do |actions|
|
data/lib/faraday/patron.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faraday-patron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "@iMacTia"
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
type: :
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: patron
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -31,139 +31,13 @@ dependencies:
|
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.4.2
|
34
|
-
type: :
|
34
|
+
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.4.2
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: bundler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '2.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '2.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '13.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '13.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rspec
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '3.0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '3.0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: simplecov
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 0.19.0
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 0.19.0
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: multipart-parser
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 0.1.1
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 0.1.1
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: webmock
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '3.4'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '3.4'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: rubocop
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - "~>"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: 1.12.0
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - "~>"
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: 1.12.0
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: rubocop-packaging
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - "~>"
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0.5'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - "~>"
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0.5'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: rubocop-performance
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - "~>"
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '1.0'
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - "~>"
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '1.0'
|
167
41
|
description: Faraday adapter for Patron
|
168
42
|
email:
|
169
43
|
- giuffrida.mattia@gmail.com
|
@@ -182,7 +56,7 @@ licenses:
|
|
182
56
|
metadata:
|
183
57
|
homepage_uri: https://github.com/lostisland/faraday-patron
|
184
58
|
source_code_uri: https://github.com/lostisland/faraday-patron
|
185
|
-
changelog_uri: https://github.com/lostisland/faraday-patron
|
59
|
+
changelog_uri: https://github.com/lostisland/faraday-patron/releases/tag/v2.0.0
|
186
60
|
post_install_message:
|
187
61
|
rdoc_options: []
|
188
62
|
require_paths:
|
@@ -191,7 +65,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
191
65
|
requirements:
|
192
66
|
- - ">="
|
193
67
|
- !ruby/object:Gem::Version
|
194
|
-
version: 2.
|
68
|
+
version: '2.6'
|
195
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
70
|
requirements:
|
197
71
|
- - ">="
|