wrest 2.1.9 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +6 -0
- data/LICENCE +1 -1
- data/README.md +47 -40
- data/bin/wrest +2 -1
- data/bin/wrest_shell.rb +10 -8
- data/lib/wrest/async_request/event_machine_backend.rb +3 -1
- data/lib/wrest/async_request/thread_backend.rb +5 -2
- data/lib/wrest/async_request/thread_pool.rb +4 -2
- data/lib/wrest/async_request.rb +7 -6
- data/lib/wrest/cache_proxy.rb +39 -28
- data/lib/wrest/caching/memcached.rb +21 -18
- data/lib/wrest/caching/redis.rb +22 -22
- data/lib/wrest/caching.rb +16 -14
- data/lib/wrest/callback.rb +19 -16
- data/lib/wrest/components/container/alias_accessors.rb +51 -47
- data/lib/wrest/components/container/typecaster.rb +146 -95
- data/lib/wrest/components/container.rb +171 -152
- data/lib/wrest/components/mutators/base.rb +43 -34
- data/lib/wrest/components/mutators/camel_to_snake_case.rb +7 -3
- data/lib/wrest/components/mutators/{xml_mini_type_caster.rb → xml_type_caster.rb} +29 -16
- data/lib/wrest/components/mutators.rb +21 -19
- data/lib/wrest/components/translators/content_types.rb +20 -16
- data/lib/wrest/components/translators/json.rb +19 -16
- data/lib/wrest/components/translators/txt.rb +19 -15
- data/lib/wrest/components/translators/xml/conversions.rb +56 -0
- data/lib/wrest/components/translators/xml.rb +60 -18
- data/lib/wrest/components/translators.rb +7 -6
- data/lib/wrest/components.rb +11 -8
- data/lib/wrest/core_ext/hash/conversions.rb +10 -10
- data/lib/wrest/core_ext/hash.rb +4 -2
- data/lib/wrest/core_ext/string/conversions.rb +14 -13
- data/lib/wrest/core_ext/string.rb +5 -3
- data/lib/wrest/exceptions.rb +4 -2
- data/lib/wrest/hash_with_case_insensitive_access.rb +8 -8
- data/lib/wrest/hash_with_indifferent_access.rb +442 -0
- data/lib/wrest/http_codes.rb +20 -19
- data/lib/wrest/http_shared/headers.rb +2 -0
- data/lib/wrest/http_shared/standard_headers.rb +2 -2
- data/lib/wrest/http_shared/standard_tokens.rb +8 -6
- data/lib/wrest/http_shared.rb +5 -3
- data/lib/wrest/multipart.rb +20 -11
- data/lib/wrest/native/connection_factory.rb +15 -11
- data/lib/wrest/native/delete.rb +15 -11
- data/lib/wrest/native/get.rb +60 -55
- data/lib/wrest/native/options.rb +15 -11
- data/lib/wrest/native/patch.rb +27 -0
- data/lib/wrest/native/post.rb +15 -11
- data/lib/wrest/native/post_multipart.rb +22 -18
- data/lib/wrest/native/put.rb +16 -12
- data/lib/wrest/native/put_multipart.rb +22 -18
- data/lib/wrest/native/redirection.rb +13 -12
- data/lib/wrest/native/request.rb +144 -106
- data/lib/wrest/native/response.rb +87 -78
- data/lib/wrest/native/session.rb +49 -40
- data/lib/wrest/native.rb +14 -11
- data/lib/wrest/test/request_patches.rb +10 -3
- data/lib/wrest/test.rb +3 -1
- data/lib/wrest/uri/builders.rb +14 -12
- data/lib/wrest/uri.rb +92 -50
- data/lib/wrest/uri_template.rb +11 -7
- data/lib/wrest/utils.rb +129 -0
- data/lib/wrest/version.rb +3 -1
- data/lib/wrest.rb +31 -33
- data/lib/wrest_no_ext.rb +2 -0
- metadata +91 -56
- data/lib/wrest/components/mutators/xml_simple_type_caster.rb +0 -37
- data/lib/wrest/xml_mini/jdom/xpath_filter.rb +0 -17
- data/lib/wrest/xml_mini/jdom.rb +0 -6
- data/lib/wrest/xml_mini/libxml/xpath_filter.rb +0 -12
- data/lib/wrest/xml_mini/libxml.rb +0 -8
- data/lib/wrest/xml_mini/nokogiri/xpath_filter.rb +0 -15
- data/lib/wrest/xml_mini/nokogiri.rb +0 -7
- data/lib/wrest/xml_mini/rexml/xpath_filter.rb +0 -15
- data/lib/wrest/xml_mini/rexml.rb +0 -8
- data/lib/wrest/xml_mini.rb +0 -8
data/lib/wrest/version.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright 2009-2011 Sidu Ponnappa
|
2
4
|
|
3
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -8,5 +10,5 @@
|
|
8
10
|
# See the License for the specific language governing permissions and limitations under the License.
|
9
11
|
|
10
12
|
module Wrest
|
11
|
-
VERSION =
|
13
|
+
VERSION = '4.0.0'
|
12
14
|
end
|
data/lib/wrest.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright 2009 Sidu Ponnappa
|
2
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
3
5
|
# you may not use this file except in compliance with the License.
|
@@ -14,18 +16,14 @@ require 'cgi'
|
|
14
16
|
require 'base64'
|
15
17
|
require 'logger'
|
16
18
|
require 'benchmark'
|
17
|
-
require 'multi_json'
|
18
19
|
require 'concurrent'
|
19
|
-
require '
|
20
|
-
require '
|
21
|
-
require 'active_support/core_ext/hash'
|
22
|
-
require 'active_support/core_ext/module'
|
23
|
-
require 'active_support/core_ext/object'
|
20
|
+
require 'nokogiri'
|
21
|
+
require 'json'
|
24
22
|
|
25
23
|
module Wrest
|
26
24
|
Root = File.dirname(__FILE__)
|
27
25
|
|
28
|
-
|
26
|
+
$LOAD_PATH.unshift Root
|
29
27
|
|
30
28
|
def self.logger=(logger)
|
31
29
|
@logger = logger
|
@@ -36,44 +34,44 @@ module Wrest
|
|
36
34
|
end
|
37
35
|
|
38
36
|
def self.enable_evented_requests!
|
39
|
-
require
|
37
|
+
require 'wrest/event_machine_backend'
|
40
38
|
end
|
41
39
|
|
42
40
|
# Switch Wrest to using Net::HTTP.
|
43
41
|
def self.use_native!
|
44
|
-
|
42
|
+
old_verbose = $VERBOSE
|
43
|
+
$VERBOSE = nil
|
44
|
+
Wrest.const_set('Http', Wrest::Native)
|
45
|
+
ensure
|
46
|
+
$VERBOSE = old_verbose
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
48
|
-
Wrest.logger =
|
50
|
+
Wrest.logger = Logger.new($stdout)
|
49
51
|
Wrest.logger.level = Logger::DEBUG
|
50
52
|
|
51
|
-
require
|
52
|
-
require
|
53
|
-
|
54
|
-
|
55
|
-
require "wrest/xml_mini"
|
53
|
+
require 'wrest/utils'
|
54
|
+
require 'wrest/core_ext/string'
|
55
|
+
require 'wrest/hash_with_indifferent_access'
|
56
|
+
require 'wrest/hash_with_case_insensitive_access'
|
56
57
|
|
57
58
|
# Load Wrest Core
|
58
|
-
require
|
59
|
-
require
|
60
|
-
require
|
61
|
-
require
|
62
|
-
require
|
63
|
-
require
|
59
|
+
require 'wrest/version'
|
60
|
+
require 'wrest/cache_proxy'
|
61
|
+
require 'wrest/http_shared'
|
62
|
+
require 'wrest/http_codes'
|
63
|
+
require 'wrest/callback'
|
64
|
+
require 'wrest/native'
|
64
65
|
|
65
|
-
require
|
66
|
-
require
|
67
|
-
require
|
66
|
+
require 'wrest/async_request/thread_pool'
|
67
|
+
require 'wrest/async_request/thread_backend'
|
68
|
+
require 'wrest/async_request'
|
68
69
|
|
69
|
-
require
|
70
|
+
require 'wrest/caching'
|
70
71
|
|
71
72
|
# Load Wrest Wrappers
|
72
|
-
require
|
73
|
-
require
|
74
|
-
require
|
75
|
-
require
|
76
|
-
require
|
77
|
-
|
78
|
-
# Load Wrest::Resource
|
79
|
-
# require "wrest/resource"
|
73
|
+
require 'wrest/uri/builders'
|
74
|
+
require 'wrest/uri'
|
75
|
+
require 'wrest/uri_template'
|
76
|
+
require 'wrest/exceptions'
|
77
|
+
require 'wrest/components'
|
data/lib/wrest_no_ext.rb
CHANGED
metadata
CHANGED
@@ -1,46 +1,88 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wrest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sidu Ponnappa
|
8
8
|
- Niranjan Paranjape
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-09-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activesupport
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '6'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '6'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '13.0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '13.0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rdoc
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '6.4'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '6.4'
|
14
56
|
- !ruby/object:Gem::Dependency
|
15
57
|
name: rspec
|
16
58
|
requirement: !ruby/object:Gem::Requirement
|
17
59
|
requirements:
|
18
60
|
- - "~>"
|
19
61
|
- !ruby/object:Gem::Version
|
20
|
-
version: '3.
|
62
|
+
version: '3.11'
|
21
63
|
type: :development
|
22
64
|
prerelease: false
|
23
65
|
version_requirements: !ruby/object:Gem::Requirement
|
24
66
|
requirements:
|
25
67
|
- - "~>"
|
26
68
|
- !ruby/object:Gem::Version
|
27
|
-
version: '3.
|
69
|
+
version: '3.11'
|
28
70
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
71
|
+
name: rubocop
|
30
72
|
requirement: !ruby/object:Gem::Requirement
|
31
73
|
requirements:
|
32
74
|
- - "~>"
|
33
75
|
- !ruby/object:Gem::Version
|
34
|
-
version: 1.
|
76
|
+
version: 1.35.0
|
35
77
|
type: :development
|
36
78
|
prerelease: false
|
37
79
|
version_requirements: !ruby/object:Gem::Requirement
|
38
80
|
requirements:
|
39
81
|
- - "~>"
|
40
82
|
- !ruby/object:Gem::Version
|
41
|
-
version: 1.
|
83
|
+
version: 1.35.0
|
42
84
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
85
|
+
name: rubocop-rake
|
44
86
|
requirement: !ruby/object:Gem::Requirement
|
45
87
|
requirements:
|
46
88
|
- - ">="
|
@@ -54,47 +96,47 @@ dependencies:
|
|
54
96
|
- !ruby/object:Gem::Version
|
55
97
|
version: '0'
|
56
98
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
99
|
+
name: rubocop-rspec
|
58
100
|
requirement: !ruby/object:Gem::Requirement
|
59
101
|
requirements:
|
60
|
-
- - "
|
102
|
+
- - ">="
|
61
103
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
63
|
-
type: :
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
64
106
|
prerelease: false
|
65
107
|
version_requirements: !ruby/object:Gem::Requirement
|
66
108
|
requirements:
|
67
|
-
- - "
|
109
|
+
- - ">="
|
68
110
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
111
|
+
version: '0'
|
70
112
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
113
|
+
name: sinatra
|
72
114
|
requirement: !ruby/object:Gem::Requirement
|
73
115
|
requirements:
|
74
|
-
- - "
|
116
|
+
- - "~>"
|
75
117
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
77
|
-
type: :
|
118
|
+
version: 2.0.0
|
119
|
+
type: :development
|
78
120
|
prerelease: false
|
79
121
|
version_requirements: !ruby/object:Gem::Requirement
|
80
122
|
requirements:
|
81
|
-
- - "
|
123
|
+
- - "~>"
|
82
124
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
125
|
+
version: 2.0.0
|
84
126
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
127
|
+
name: webrick
|
86
128
|
requirement: !ruby/object:Gem::Requirement
|
87
129
|
requirements:
|
88
|
-
- - "
|
130
|
+
- - ">="
|
89
131
|
- !ruby/object:Gem::Version
|
90
|
-
version: '
|
91
|
-
type: :
|
132
|
+
version: '0'
|
133
|
+
type: :development
|
92
134
|
prerelease: false
|
93
135
|
version_requirements: !ruby/object:Gem::Requirement
|
94
136
|
requirements:
|
95
|
-
- - "
|
137
|
+
- - ">="
|
96
138
|
- !ruby/object:Gem::Version
|
97
|
-
version: '
|
139
|
+
version: '0'
|
98
140
|
- !ruby/object:Gem::Dependency
|
99
141
|
name: concurrent-ruby
|
100
142
|
requirement: !ruby/object:Gem::Requirement
|
@@ -110,24 +152,24 @@ dependencies:
|
|
110
152
|
- !ruby/object:Gem::Version
|
111
153
|
version: '1.0'
|
112
154
|
- !ruby/object:Gem::Dependency
|
113
|
-
name:
|
155
|
+
name: nokogiri
|
114
156
|
requirement: !ruby/object:Gem::Requirement
|
115
157
|
requirements:
|
116
158
|
- - "~>"
|
117
159
|
- !ruby/object:Gem::Version
|
118
|
-
version: '
|
160
|
+
version: '1.0'
|
119
161
|
type: :runtime
|
120
162
|
prerelease: false
|
121
163
|
version_requirements: !ruby/object:Gem::Requirement
|
122
164
|
requirements:
|
123
165
|
- - "~>"
|
124
166
|
- !ruby/object:Gem::Version
|
125
|
-
version: '
|
126
|
-
description: Wrest is a fluent, easy-to-use, object oriented Ruby HTTP/REST client
|
167
|
+
version: '1.0'
|
168
|
+
description: "Wrest is a fluent, easy-to-use, object oriented Ruby HTTP/REST client
|
127
169
|
library with support for RFC2616 HTTP caching, multiple HTTP backends and async
|
128
|
-
calls. It runs on CRuby and JRuby and is in production use at
|
170
|
+
calls. It runs on CRuby and JRuby and is in production use at 10 * \U0001F984 scale."
|
129
171
|
email:
|
130
|
-
-
|
172
|
+
- ckponnappa@gmail.com
|
131
173
|
executables:
|
132
174
|
- wrest
|
133
175
|
extensions: []
|
@@ -156,19 +198,20 @@ files:
|
|
156
198
|
- lib/wrest/components/mutators.rb
|
157
199
|
- lib/wrest/components/mutators/base.rb
|
158
200
|
- lib/wrest/components/mutators/camel_to_snake_case.rb
|
159
|
-
- lib/wrest/components/mutators/
|
160
|
-
- lib/wrest/components/mutators/xml_simple_type_caster.rb
|
201
|
+
- lib/wrest/components/mutators/xml_type_caster.rb
|
161
202
|
- lib/wrest/components/translators.rb
|
162
203
|
- lib/wrest/components/translators/content_types.rb
|
163
204
|
- lib/wrest/components/translators/json.rb
|
164
205
|
- lib/wrest/components/translators/txt.rb
|
165
206
|
- lib/wrest/components/translators/xml.rb
|
207
|
+
- lib/wrest/components/translators/xml/conversions.rb
|
166
208
|
- lib/wrest/core_ext/hash.rb
|
167
209
|
- lib/wrest/core_ext/hash/conversions.rb
|
168
210
|
- lib/wrest/core_ext/string.rb
|
169
211
|
- lib/wrest/core_ext/string/conversions.rb
|
170
212
|
- lib/wrest/exceptions.rb
|
171
213
|
- lib/wrest/hash_with_case_insensitive_access.rb
|
214
|
+
- lib/wrest/hash_with_indifferent_access.rb
|
172
215
|
- lib/wrest/http_codes.rb
|
173
216
|
- lib/wrest/http_shared.rb
|
174
217
|
- lib/wrest/http_shared/headers.rb
|
@@ -180,6 +223,7 @@ files:
|
|
180
223
|
- lib/wrest/native/delete.rb
|
181
224
|
- lib/wrest/native/get.rb
|
182
225
|
- lib/wrest/native/options.rb
|
226
|
+
- lib/wrest/native/patch.rb
|
183
227
|
- lib/wrest/native/post.rb
|
184
228
|
- lib/wrest/native/post_multipart.rb
|
185
229
|
- lib/wrest/native/put.rb
|
@@ -193,21 +237,14 @@ files:
|
|
193
237
|
- lib/wrest/uri.rb
|
194
238
|
- lib/wrest/uri/builders.rb
|
195
239
|
- lib/wrest/uri_template.rb
|
240
|
+
- lib/wrest/utils.rb
|
196
241
|
- lib/wrest/version.rb
|
197
|
-
- lib/wrest/xml_mini.rb
|
198
|
-
- lib/wrest/xml_mini/jdom.rb
|
199
|
-
- lib/wrest/xml_mini/jdom/xpath_filter.rb
|
200
|
-
- lib/wrest/xml_mini/libxml.rb
|
201
|
-
- lib/wrest/xml_mini/libxml/xpath_filter.rb
|
202
|
-
- lib/wrest/xml_mini/nokogiri.rb
|
203
|
-
- lib/wrest/xml_mini/nokogiri/xpath_filter.rb
|
204
|
-
- lib/wrest/xml_mini/rexml.rb
|
205
|
-
- lib/wrest/xml_mini/rexml/xpath_filter.rb
|
206
242
|
- lib/wrest_no_ext.rb
|
207
|
-
homepage:
|
243
|
+
homepage: https://github.com/kaiwren/wrest
|
208
244
|
licenses: []
|
209
|
-
metadata:
|
210
|
-
|
245
|
+
metadata:
|
246
|
+
rubygems_mfa_required: 'true'
|
247
|
+
post_install_message:
|
211
248
|
rdoc_options:
|
212
249
|
- "--charset=UTF-8"
|
213
250
|
require_paths:
|
@@ -216,22 +253,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
216
253
|
requirements:
|
217
254
|
- - ">="
|
218
255
|
- !ruby/object:Gem::Version
|
219
|
-
version:
|
256
|
+
version: 2.6.0
|
220
257
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
221
258
|
requirements:
|
222
259
|
- - ">="
|
223
260
|
- !ruby/object:Gem::Version
|
224
|
-
version:
|
261
|
+
version: 3.0.0
|
225
262
|
requirements:
|
226
263
|
- To use Memcached as caching back-end, install the 'dalli' gem.
|
264
|
+
- To use Redis as caching back-end, install the 'redis' gem.
|
227
265
|
- To use multipart post, install the 'multipart-post' gem.
|
228
|
-
- To use curl as the http engine, install the 'patron' gem. This feature is not available
|
229
|
-
(and should be unneccessary) on jruby.
|
230
266
|
- To use eventmachine as a parallel backend, install the 'eventmachine' gem.
|
231
|
-
|
232
|
-
|
233
|
-
signing_key:
|
267
|
+
rubygems_version: 3.3.7
|
268
|
+
signing_key:
|
234
269
|
specification_version: 4
|
235
|
-
summary: Wrest is a fluent, object oriented HTTP client library for 2.
|
236
|
-
|
270
|
+
summary: Wrest is a fluent, object oriented HTTP client library for CRuby 2.6.x, 3.x.x
|
271
|
+
and JRuby 9.3.x.x
|
237
272
|
test_files: []
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# Copyright 2009 Sidu Ponnappa
|
2
|
-
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
6
|
-
# Unless required by applicable law or agreed to in writing, software distributed under the License
|
7
|
-
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
8
|
-
# See the License for the specific language governing permissions and limitations under the License.
|
9
|
-
|
10
|
-
module Wrest
|
11
|
-
module Components
|
12
|
-
# This mutator undertands how do type casting
|
13
|
-
# using the type data embedded in a hash
|
14
|
-
# created by deserialising an xml using
|
15
|
-
# xml-simple
|
16
|
-
class Mutators::XmlSimpleTypeCaster < Mutators::Base
|
17
|
-
def do_mutate(tuple)
|
18
|
-
out_key = tuple.first
|
19
|
-
in_value = tuple.last[0]
|
20
|
-
out_value = in_value
|
21
|
-
|
22
|
-
case in_value
|
23
|
-
when Hash
|
24
|
-
if in_value['nil'] == 'true'
|
25
|
-
out_value = nil
|
26
|
-
elsif in_value.key?('type')
|
27
|
-
out_value = ActiveSupport::XmlMini::PARSING[in_value['type']].call(in_value['content'])
|
28
|
-
else
|
29
|
-
out_value = in_value.mutate_using(self)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
[out_key, out_value]
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
raise "JRuby is required to use the JDOM backend for XmlMini" unless RUBY_PLATFORM =~ /java/
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
module XmlMini
|
7
|
-
module JDOM
|
8
|
-
module XPathFilter
|
9
|
-
#Enables filtering of an xml response using a specified xpath
|
10
|
-
#Returns an array of elements matching the xpath
|
11
|
-
def filter(xml_body,xpath)
|
12
|
-
raise NotImplementedError, "'filter' method is not implemented if JDOM backend is being used"
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/lib/wrest/xml_mini/jdom.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
module XmlMini
|
2
|
-
module LibXML
|
3
|
-
module XPathFilter
|
4
|
-
#Enables filtering of an xml response using a specified xpath
|
5
|
-
#Returns an array of elements matching the xpath
|
6
|
-
def filter(xml_body,xpath)
|
7
|
-
doc = ::LibXML::XML::Document.string(xml_body)
|
8
|
-
doc.find(xpath).to_a
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module XmlMini
|
2
|
-
module Nokogiri
|
3
|
-
module XPathFilter
|
4
|
-
#Enables filtering of an xml response using a specified xpath
|
5
|
-
#Returns all elements that match the xpath
|
6
|
-
def filter(xml_body,xpath)
|
7
|
-
doc = ::Nokogiri::XML(xml_body)
|
8
|
-
doc.xpath(xpath).to_a
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
|
15
|
-
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module XmlMini
|
2
|
-
module Rexml
|
3
|
-
module XPathFilter
|
4
|
-
#Enables filtering of an xml response using a specified xpath
|
5
|
-
#Returns an array of elements matching the xpath
|
6
|
-
def filter(xml_body,xpath)
|
7
|
-
doc = REXML::Document.new(xml_body)
|
8
|
-
REXML::XPath.each(doc,xpath).to_a
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
|
15
|
-
|
data/lib/wrest/xml_mini/rexml.rb
DELETED