faraday-patron 1.0.0 → 2.0.1
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 +1 -0
- metadata +5 -145
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 413309f432c2f8646a3fe359e658e21b3cc1f47b71b1d41567ab954b20f69617
|
4
|
+
data.tar.gz: 3adc206db6a181ebe53aac74ab5334b4024309b00493b08f23f0539c443b0f73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11253b17ba2d4575566cd3ae2a75fc6d535eff7132613ff58d012b496090f9f29ca29f7d73551ce3b38f7941ed1c4a58d65b417e4a5ac7ff51ce4e9e284ba256
|
7
|
+
data.tar.gz: b449e91de75b0ed6d220037fbc661d974fc7e4bca19cbc113204ae28b1429845f332aac476bb967d8e7626c24c4dc13b3e9773802cdf855d964ceb33633455fd
|
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,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faraday-patron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.1
|
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-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: faraday
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: patron
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -31,139 +17,13 @@ dependencies:
|
|
31
17
|
- - ">="
|
32
18
|
- !ruby/object:Gem::Version
|
33
19
|
version: 0.4.2
|
34
|
-
type: :
|
20
|
+
type: :runtime
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
24
|
- - ">="
|
39
25
|
- !ruby/object:Gem::Version
|
40
26
|
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
27
|
description: Faraday adapter for Patron
|
168
28
|
email:
|
169
29
|
- giuffrida.mattia@gmail.com
|
@@ -182,7 +42,7 @@ licenses:
|
|
182
42
|
metadata:
|
183
43
|
homepage_uri: https://github.com/lostisland/faraday-patron
|
184
44
|
source_code_uri: https://github.com/lostisland/faraday-patron
|
185
|
-
changelog_uri: https://github.com/lostisland/faraday-patron
|
45
|
+
changelog_uri: https://github.com/lostisland/faraday-patron/releases/tag/v2.0.1
|
186
46
|
post_install_message:
|
187
47
|
rdoc_options: []
|
188
48
|
require_paths:
|
@@ -191,7 +51,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
191
51
|
requirements:
|
192
52
|
- - ">="
|
193
53
|
- !ruby/object:Gem::Version
|
194
|
-
version: 2.
|
54
|
+
version: '2.6'
|
195
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
56
|
requirements:
|
197
57
|
- - ">="
|