faraday_middleware 0.10.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +16 -22
- data/lib/faraday_middleware/backwards_compatibility.rb +16 -12
- data/lib/faraday_middleware/gzip.rb +51 -15
- data/lib/faraday_middleware/instrumentation.rb +8 -2
- data/lib/faraday_middleware/rack_compatible.rb +18 -11
- data/lib/faraday_middleware/redirect_limit_reached.rb +16 -0
- data/lib/faraday_middleware/request/encode_json.rb +12 -9
- data/lib/faraday_middleware/request/method_override.rb +7 -6
- data/lib/faraday_middleware/request/oauth.rb +13 -10
- data/lib/faraday_middleware/request/oauth2.rb +37 -12
- data/lib/faraday_middleware/response/caching.rb +55 -21
- data/lib/faraday_middleware/response/chunked.rb +10 -6
- data/lib/faraday_middleware/response/follow_redirects.rb +57 -26
- data/lib/faraday_middleware/response/mashify.rb +2 -0
- data/lib/faraday_middleware/response/parse_dates.rb +6 -3
- data/lib/faraday_middleware/response/parse_json.rb +10 -10
- data/lib/faraday_middleware/response/parse_marshal.rb +3 -1
- data/lib/faraday_middleware/response/parse_xml.rb +4 -2
- data/lib/faraday_middleware/response/parse_yaml.rb +18 -11
- data/lib/faraday_middleware/response/rashify.rb +3 -1
- data/lib/faraday_middleware/response_middleware.rb +27 -18
- data/lib/faraday_middleware/version.rb +4 -1
- data/lib/faraday_middleware.rb +21 -17
- metadata +8 -32
- data/CHANGELOG.md +0 -10
- data/CONTRIBUTING.md +0 -46
- data/faraday_middleware.gemspec +0 -20
- data/lib/faraday_middleware/addressable_patch.rb +0 -20
data/lib/faraday_middleware.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'faraday'
|
2
4
|
|
5
|
+
# Main FaradayMiddleware module.
|
3
6
|
module FaradayMiddleware
|
4
7
|
autoload :OAuth, 'faraday_middleware/request/oauth'
|
5
8
|
autoload :OAuth2, 'faraday_middleware/request/oauth2'
|
@@ -15,33 +18,34 @@ module FaradayMiddleware
|
|
15
18
|
autoload :Caching, 'faraday_middleware/response/caching'
|
16
19
|
autoload :Chunked, 'faraday_middleware/response/chunked'
|
17
20
|
autoload :RackCompatible, 'faraday_middleware/rack_compatible'
|
21
|
+
autoload :RedirectLimitReached, 'faraday_middleware/redirect_limit_reached'
|
18
22
|
autoload :FollowRedirects, 'faraday_middleware/response/follow_redirects'
|
19
23
|
autoload :Instrumentation, 'faraday_middleware/instrumentation'
|
20
24
|
autoload :Gzip, 'faraday_middleware/gzip'
|
21
25
|
|
22
26
|
if Faraday::Middleware.respond_to? :register_middleware
|
23
27
|
Faraday::Request.register_middleware \
|
24
|
-
:
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:
|
28
|
+
oauth: -> { OAuth },
|
29
|
+
oauth2: -> { OAuth2 },
|
30
|
+
json: -> { EncodeJson },
|
31
|
+
method_override: -> { MethodOverride }
|
28
32
|
|
29
33
|
Faraday::Response.register_middleware \
|
30
|
-
:
|
31
|
-
:
|
32
|
-
:
|
33
|
-
:
|
34
|
-
:
|
35
|
-
:
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
34
|
+
mashify: -> { Mashify },
|
35
|
+
rashify: -> { Rashify },
|
36
|
+
json: -> { ParseJson },
|
37
|
+
json_fix: -> { ParseJson::MimeTypeFix },
|
38
|
+
xml: -> { ParseXml },
|
39
|
+
marshal: -> { ParseMarshal },
|
40
|
+
yaml: -> { ParseYaml },
|
41
|
+
dates: -> { ParseDates },
|
42
|
+
caching: -> { Caching },
|
43
|
+
follow_redirects: -> { FollowRedirects },
|
44
|
+
chunked: -> { Chunked }
|
41
45
|
|
42
46
|
Faraday::Middleware.register_middleware \
|
43
|
-
:
|
44
|
-
:
|
47
|
+
instrumentation: -> { Instrumentation },
|
48
|
+
gzip: -> { Gzip }
|
45
49
|
end
|
46
50
|
end
|
47
51
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faraday_middleware
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Michaels-Ober
|
@@ -9,43 +9,23 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-10-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ">="
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: 0.7.4
|
21
|
-
- - "<"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: '0.10'
|
24
|
-
type: :runtime
|
25
|
-
prerelease: false
|
26
|
-
version_requirements: !ruby/object:Gem::Requirement
|
27
|
-
requirements:
|
28
|
-
- - ">="
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: 0.7.4
|
31
|
-
- - "<"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0.10'
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: bundler
|
36
16
|
requirement: !ruby/object:Gem::Requirement
|
37
17
|
requirements:
|
38
18
|
- - "~>"
|
39
19
|
- !ruby/object:Gem::Version
|
40
20
|
version: '1.0'
|
41
|
-
type: :
|
21
|
+
type: :runtime
|
42
22
|
prerelease: false
|
43
23
|
version_requirements: !ruby/object:Gem::Requirement
|
44
24
|
requirements:
|
45
25
|
- - "~>"
|
46
26
|
- !ruby/object:Gem::Version
|
47
27
|
version: '1.0'
|
48
|
-
description:
|
28
|
+
description:
|
49
29
|
email:
|
50
30
|
- sferik@gmail.com
|
51
31
|
- wynn.netherland@gmail.com
|
@@ -53,17 +33,14 @@ executables: []
|
|
53
33
|
extensions: []
|
54
34
|
extra_rdoc_files: []
|
55
35
|
files:
|
56
|
-
- CHANGELOG.md
|
57
|
-
- CONTRIBUTING.md
|
58
36
|
- LICENSE.md
|
59
37
|
- README.md
|
60
|
-
- faraday_middleware.gemspec
|
61
38
|
- lib/faraday_middleware.rb
|
62
|
-
- lib/faraday_middleware/addressable_patch.rb
|
63
39
|
- lib/faraday_middleware/backwards_compatibility.rb
|
64
40
|
- lib/faraday_middleware/gzip.rb
|
65
41
|
- lib/faraday_middleware/instrumentation.rb
|
66
42
|
- lib/faraday_middleware/rack_compatible.rb
|
43
|
+
- lib/faraday_middleware/redirect_limit_reached.rb
|
67
44
|
- lib/faraday_middleware/request/encode_json.rb
|
68
45
|
- lib/faraday_middleware/request/method_override.rb
|
69
46
|
- lib/faraday_middleware/request/oauth.rb
|
@@ -92,15 +69,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
92
69
|
requirements:
|
93
70
|
- - ">="
|
94
71
|
- !ruby/object:Gem::Version
|
95
|
-
version: '
|
72
|
+
version: '2.3'
|
96
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
74
|
requirements:
|
98
75
|
- - ">="
|
99
76
|
- !ruby/object:Gem::Version
|
100
|
-
version:
|
77
|
+
version: '0'
|
101
78
|
requirements: []
|
102
|
-
|
103
|
-
rubygems_version: 2.2.2
|
79
|
+
rubygems_version: 3.0.3.1
|
104
80
|
signing_key:
|
105
81
|
specification_version: 4
|
106
82
|
summary: Various middleware for Faraday
|
data/CHANGELOG.md
DELETED
data/CONTRIBUTING.md
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
## Contributing
|
2
|
-
In the spirit of [free software][free-sw], **everyone** is encouraged to help
|
3
|
-
improve this project.
|
4
|
-
|
5
|
-
[free-sw]: http://www.fsf.org/licensing/essays/free-sw.html
|
6
|
-
|
7
|
-
Here are some ways *you* can contribute:
|
8
|
-
|
9
|
-
* by using alpha, beta, and prerelease versions
|
10
|
-
* by reporting bugs
|
11
|
-
* by suggesting new features
|
12
|
-
* by writing or editing documentation
|
13
|
-
* by writing specifications
|
14
|
-
* by writing code (**no patch is too small**: fix typos, add comments, clean up
|
15
|
-
inconsistent whitespace)
|
16
|
-
* by refactoring code
|
17
|
-
* by fixing [issues][]
|
18
|
-
* by reviewing patches
|
19
|
-
|
20
|
-
[issues]: https://github.com/lostisland/faraday_middleware/issues
|
21
|
-
|
22
|
-
## Submitting an Issue
|
23
|
-
We use the [GitHub issue tracker][issues] to track bugs and features. Before
|
24
|
-
submitting a bug report or feature request, check to make sure it hasn't
|
25
|
-
already been submitted. When submitting a bug report, please include a [Gist][]
|
26
|
-
that includes a stack trace and any details that may be necessary to reproduce
|
27
|
-
the bug, including your gem version, Ruby version, and operating system.
|
28
|
-
Ideally, a bug report should include a pull request with failing specs.
|
29
|
-
|
30
|
-
[gist]: https://gist.github.com/
|
31
|
-
|
32
|
-
## Submitting a Pull Request
|
33
|
-
1. [Fork the repository.][fork]
|
34
|
-
2. [Create a topic branch.][branch]
|
35
|
-
3. Add specs for your unimplemented feature or bug fix.
|
36
|
-
4. Run `bundle exec rake spec`. If your specs pass, return to step 3.
|
37
|
-
5. Implement your feature or bug fix.
|
38
|
-
6. Run `COVERAGE=true bundle exec rake spec`. If your specs fail, return to step 5.
|
39
|
-
7. Run `open coverage/index.html`. If your changes are not completely covered
|
40
|
-
by your tests, return to step 3.
|
41
|
-
8. Add, commit, and push your changes.
|
42
|
-
9. [Submit a pull request.][pr]
|
43
|
-
|
44
|
-
[fork]: http://help.github.com/fork-a-repo/
|
45
|
-
[branch]: http://learn.github.com/p/branching.html
|
46
|
-
[pr]: http://help.github.com/send-pull-requests/
|
data/faraday_middleware.gemspec
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'faraday_middleware/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.add_dependency 'faraday', ['>= 0.7.4', '< 0.10']
|
8
|
-
spec.add_development_dependency 'bundler', '~> 1.0'
|
9
|
-
spec.authors = ["Erik Michaels-Ober", "Wynn Netherland"]
|
10
|
-
spec.description = %q{Various middleware for Faraday}
|
11
|
-
spec.email = ['sferik@gmail.com', 'wynn.netherland@gmail.com']
|
12
|
-
spec.files = %w(CHANGELOG.md CONTRIBUTING.md LICENSE.md README.md faraday_middleware.gemspec) + Dir['lib/**/*.rb']
|
13
|
-
spec.homepage = 'https://github.com/lostisland/faraday_middleware'
|
14
|
-
spec.licenses = ['MIT']
|
15
|
-
spec.name = 'faraday_middleware'
|
16
|
-
spec.require_paths = ['lib']
|
17
|
-
spec.required_rubygems_version = '>= 1.3.5'
|
18
|
-
spec.summary = spec.description
|
19
|
-
spec.version = FaradayMiddleware::VERSION
|
20
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'addressable/uri'
|
2
|
-
|
3
|
-
# feature-detect the bug
|
4
|
-
unless Addressable::URI.parse('/?a=1&b=2') === '/?b=2&a=1'
|
5
|
-
# fix `normalized_query` by sorting query key-value pairs
|
6
|
-
# (rejected: https://github.com/sporkmonger/addressable/issues/28)
|
7
|
-
class Addressable::URI
|
8
|
-
alias normalized_query_without_ordering_fix normalized_query
|
9
|
-
|
10
|
-
def normalized_query
|
11
|
-
fresh = @normalized_query.nil?
|
12
|
-
query = normalized_query_without_ordering_fix
|
13
|
-
if query && fresh
|
14
|
-
@normalized_query = query.split('&', -1).sort_by {|q| q[0..(q.index('=')||-1)] }.join('&')
|
15
|
-
else
|
16
|
-
query
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|