faraday-decode_xml 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -1
- data/lib/faraday/decode_xml/middleware.rb +8 -1
- data/lib/faraday/decode_xml/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bdc97af12131dc407e82f530448e9445f5e45664df4f9775c67160850d8265b
|
4
|
+
data.tar.gz: 9dec632278e082e185b81033a1eba5164ce1776c6ae7d048ea0917dcf3c7cc71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d94975a292401e7e66ae6f08d16ff79628a51ebb37f0c69f370aa1b85fb4857a11fdea9da08a35fb76d84e73b5bdaef39d8582493495a4b1cc1ed33ae360fb08
|
7
|
+
data.tar.gz: d5798b5564f3bbfa9956953ac17eadfc138809a8f400c1909e9b904f03ed84a2dfd7a3c56480152693e52554fb7cdbef96ffc19ee6e5480ff372c2e1a9f28ffb
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,11 @@ module Faraday
|
|
6
6
|
module DecodeXML
|
7
7
|
# Faraday middleware for decoding XML requests.
|
8
8
|
class Middleware < Faraday::Middleware
|
9
|
+
def initialize(app = nil, content_type: /\bxml$/)
|
10
|
+
super(app)
|
11
|
+
@content_types = Array(content_type)
|
12
|
+
end
|
13
|
+
|
9
14
|
# @param env [Faraday::Env] the environment of the response being processed.
|
10
15
|
def on_complete(env)
|
11
16
|
process_response(env) if process_response_type?(response_type(env)) && parse_response?(env)
|
@@ -32,7 +37,9 @@ module Faraday
|
|
32
37
|
end
|
33
38
|
|
34
39
|
def process_response_type?(type)
|
35
|
-
|
40
|
+
@content_types.empty? || @content_types.any? do |pattern|
|
41
|
+
pattern.is_a?(Regexp) ? type.match?(pattern) : type == pattern
|
42
|
+
end
|
36
43
|
end
|
37
44
|
|
38
45
|
def parse_response?(env)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faraday-decode_xml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Spencer Oberstadt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -170,8 +170,8 @@ licenses:
|
|
170
170
|
- MIT
|
171
171
|
metadata:
|
172
172
|
bug_tracker_uri: https://github.com/soberstadt/faraday-decode_xml/issues
|
173
|
-
changelog_uri: https://github.com/soberstadt/faraday-decode_xml/blob/v0.
|
174
|
-
documentation_uri: http://www.rubydoc.info/gems/faraday-decode_xml/0.
|
173
|
+
changelog_uri: https://github.com/soberstadt/faraday-decode_xml/blob/v0.2.0/CHANGELOG.md
|
174
|
+
documentation_uri: http://www.rubydoc.info/gems/faraday-decode_xml/0.2.0
|
175
175
|
homepage_uri: https://github.com/soberstadt/faraday-decode_xml
|
176
176
|
rubygems_mfa_required: 'true'
|
177
177
|
source_code_uri: https://github.com/soberstadt/faraday-decode_xml
|