wrest 1.0.0.beta5-universal-java-1.6 → 1.0.0.beta6-universal-java-1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +4 -0
- data/README.rdoc +8 -8
- data/lib/wrest.rb +2 -1
- data/lib/wrest/components.rb +1 -2
- data/lib/wrest/components/mutators.rb +3 -2
- data/lib/wrest/components/translators/xml.rb +45 -3
- data/lib/wrest/core_ext/hash.rb +1 -1
- data/lib/wrest/curl/response.rb +5 -5
- data/lib/wrest/native/response.rb +7 -6
- data/lib/wrest/uri_template.rb +1 -1
- data/lib/wrest/version.rb +1 -1
- metadata +47 -47
data/CHANGELOG
CHANGED
@@ -18,6 +18,10 @@ Features under a numbered section are complete and available in the Wrest gem.
|
|
18
18
|
|
19
19
|
== Current
|
20
20
|
|
21
|
+
== 1.0.0.beta6
|
22
|
+
* GH#35 Wrest::UriTemplate extensions swallow existing path
|
23
|
+
* GH#41 Make Hash core_ext opt out
|
24
|
+
|
21
25
|
== 1.0.0.beta5
|
22
26
|
* GH#30 Replace rails app in spec/sample_rails_app with a lighter sinatra app
|
23
27
|
* GH#37 Allow opting out of Adding to_uri to string
|
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= Wrest 1.0.0.
|
1
|
+
= Wrest 1.0.0.beta5
|
2
2
|
|
3
3
|
(c) Copyright 2009-2010 {Sidu Ponnappa}[http://blog.sidu.in]. All Rights Reserved.
|
4
4
|
|
@@ -147,10 +147,10 @@ You can launch the interactive Wrest shell by running bin/wrest if you have the
|
|
147
147
|
|
148
148
|
== Contributors
|
149
149
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
150
|
+
* Sidu Ponnappa : {kaiwren}[http://github.com/kaiwren]
|
151
|
+
* Niranjan Paranjape : {achamian}[http://github.com/achamian]
|
152
|
+
* Aakash Dharmadhkari : {aakashd}[http://github.com/aakashd]
|
153
|
+
* Srushti : {srushti}[http://github.com/srushti]
|
154
|
+
* Preethi Ramdev : {preethiramdev}[http://github.com/preethiramdev]
|
155
|
+
* Nikhil Vallishayee : {nikhilvallishayee}[http://github.com/nikhilvallishayee]
|
156
|
+
* Jacques Crocker : {railsjedi}[http://github.com/railsjedi]
|
data/lib/wrest.rb
CHANGED
@@ -80,7 +80,8 @@ RUBY_PLATFORM =~ /java/ ? gem('json-jruby', '>= 1.4.2') : gem('json', '>= 1.4.2'
|
|
80
80
|
ActiveSupport::JSON.backend = "JSONGem"
|
81
81
|
|
82
82
|
|
83
|
-
|
83
|
+
|
84
|
+
require "#{Wrest::Root}/wrest/core_ext/string"
|
84
85
|
|
85
86
|
# Load Wrest Core
|
86
87
|
require "#{Wrest::Root}/wrest/version"
|
data/lib/wrest/components.rb
CHANGED
@@ -32,8 +32,9 @@ module Wrest
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
35
|
-
|
35
|
+
require "#{Wrest::Root}/wrest/core_ext/hash"
|
36
36
|
require "#{Wrest::Root}/wrest/components/mutators/base"
|
37
37
|
require "#{Wrest::Root}/wrest/components/mutators/xml_simple_type_caster"
|
38
38
|
require "#{Wrest::Root}/wrest/components/mutators/xml_mini_type_caster"
|
39
|
-
require "#{Wrest::Root}/wrest/components/mutators/camel_to_snake_case"
|
39
|
+
require "#{Wrest::Root}/wrest/components/mutators/camel_to_snake_case"
|
40
|
+
|
@@ -6,19 +6,61 @@
|
|
6
6
|
# Unless required by applicable law or agreed to in writing, software distributed under the License
|
7
7
|
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
8
8
|
# See the License for the specific language governing permissions and limitations under the License.
|
9
|
-
|
9
|
+
# require 'jruby'
|
10
|
+
# include Java
|
11
|
+
#
|
12
|
+
# java_import javax.xml.parsers.DocumentBuilder
|
13
|
+
# java_import javax.xml.parsers.DocumentBuilderFactory
|
14
|
+
# java_import java.io.StringReader
|
15
|
+
# java_import org.xml.sax.InputSource
|
16
|
+
# java_import javax.xml.xpath.XPath
|
17
|
+
# java_import javax.xml.xpath.XPathFactory
|
18
|
+
# java_import javax.xml.xpath.XPathConstants
|
19
|
+
# java_import javax.xml.xpath.XPathExpression
|
20
|
+
# #java_import Java::org.jdom.input.SAXBuilder
|
10
21
|
module Wrest
|
11
22
|
module Components::Translators
|
12
23
|
module Xml
|
13
24
|
extend self
|
14
25
|
|
15
|
-
def deserialise(response)
|
16
|
-
|
26
|
+
def deserialise(response,options={})
|
27
|
+
if(!options[:xpath].nil?)
|
28
|
+
Hash.from_xml(filter(response,options[:xpath]))
|
29
|
+
else
|
30
|
+
Hash.from_xml(response.body)
|
31
|
+
end
|
17
32
|
end
|
18
33
|
|
19
34
|
def serialise(hash, options = {})
|
20
35
|
hash.to_xml(options)
|
21
36
|
end
|
37
|
+
|
38
|
+
def filter(response,xpath)
|
39
|
+
filter_rexml(response,xpath)
|
40
|
+
end
|
41
|
+
|
42
|
+
def filter_rexml(response,xpath)
|
43
|
+
doc = REXML::Document.new(response.body)
|
44
|
+
REXML::XPath.first(doc,xpath).to_s
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
# def filter_jdom(response,xpath)
|
49
|
+
# # string_reader = StringReader.new(response.body)
|
50
|
+
# input_source = InputSource.new(string_reader)
|
51
|
+
# #p input_source.to_s
|
52
|
+
# doc = DocumentBuilderFactory.new_instance.new_document_builder.parse(input_source)
|
53
|
+
# #doc = SAXBuilder.new.build(string_reader)
|
54
|
+
# p doc
|
55
|
+
# p doc.toString
|
56
|
+
# #xpath_instance = XPathFactory.new_instance.newXPath
|
57
|
+
# #expr = xpath_instance.compile(xpath)
|
58
|
+
# #p expr.to_s
|
59
|
+
# #result = expr.evaluate(doc)
|
60
|
+
|
61
|
+
# #puts result
|
62
|
+
# end
|
63
|
+
|
22
64
|
end
|
23
65
|
end
|
24
66
|
end
|
data/lib/wrest/core_ext/hash.rb
CHANGED
data/lib/wrest/curl/response.rb
CHANGED
@@ -30,12 +30,12 @@ module Wrest #:nodoc:
|
|
30
30
|
initialize_http_header
|
31
31
|
end
|
32
32
|
|
33
|
-
def deserialise
|
34
|
-
deserialise_using(Wrest::Components::Translators.lookup(content_type))
|
33
|
+
def deserialise(options = {})
|
34
|
+
deserialise_using(Wrest::Components::Translators.lookup(content_type),options)
|
35
35
|
end
|
36
36
|
|
37
|
-
def deserialise_using(translator)
|
38
|
-
translator.deserialise(@http_response)
|
37
|
+
def deserialise_using(translator,options={})
|
38
|
+
translator.deserialise(@http_response,options)
|
39
39
|
end
|
40
40
|
|
41
41
|
def code
|
@@ -68,4 +68,4 @@ module Wrest #:nodoc:
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
71
|
-
end
|
71
|
+
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
# Unless required by applicable law or agreed to in writing, software distributed under the License
|
7
7
|
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
8
8
|
# See the License for the specific language governing permissions and limitations under the License.
|
9
|
-
|
9
|
+
require "rexml/document"
|
10
10
|
module Wrest #:nodoc:
|
11
11
|
module Native #:nodoc:
|
12
12
|
# Decorates a response providing support for deserialisation.
|
@@ -40,12 +40,13 @@ module Wrest #:nodoc:
|
|
40
40
|
@http_response = http_response
|
41
41
|
end
|
42
42
|
|
43
|
-
|
44
|
-
|
43
|
+
|
44
|
+
def deserialise(options = {})
|
45
|
+
deserialise_using(Wrest::Components::Translators.lookup(@http_response.content_type),options)
|
45
46
|
end
|
46
47
|
|
47
|
-
def deserialise_using(translator)
|
48
|
-
translator.deserialise(@http_response)
|
48
|
+
def deserialise_using(translator,options = {})
|
49
|
+
translator.deserialise(@http_response,options)
|
49
50
|
end
|
50
51
|
|
51
52
|
def headers
|
@@ -54,7 +55,7 @@ module Wrest #:nodoc:
|
|
54
55
|
|
55
56
|
# A null object implementation - invoking this method on
|
56
57
|
# a response simply returns the same response unless
|
57
|
-
# the response is
|
58
|
+
# the response is Redirection (code 3xx), in which case a
|
58
59
|
# get is invoked on the url stored in the response headers
|
59
60
|
# under the key 'location' and the new Response is returned.
|
60
61
|
def follow(redirect_request_options = {})
|
data/lib/wrest/uri_template.rb
CHANGED
data/lib/wrest/version.rb
CHANGED
metadata
CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
|
|
6
6
|
- 1
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.0.
|
9
|
+
- beta6
|
10
|
+
version: 1.0.0.beta6
|
11
11
|
platform: universal-java-1.6
|
12
12
|
authors:
|
13
13
|
- Sidu Ponnappa
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-09-
|
19
|
+
date: 2010-09-21 00:00:00 +05:30
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -108,63 +108,63 @@ extensions: []
|
|
108
108
|
extra_rdoc_files:
|
109
109
|
- README.rdoc
|
110
110
|
files:
|
111
|
-
- bin/wrest
|
112
111
|
- bin/wrest_shell.rb
|
113
|
-
-
|
112
|
+
- bin/wrest
|
114
113
|
- lib/wrest_no_ext.rb
|
115
|
-
- lib/wrest
|
114
|
+
- lib/wrest.rb
|
115
|
+
- lib/wrest/uri_template.rb
|
116
|
+
- lib/wrest/version.rb
|
117
|
+
- lib/wrest/test.rb
|
116
118
|
- lib/wrest/curl.rb
|
117
|
-
- lib/wrest/exceptions.rb
|
118
|
-
- lib/wrest/http_shared.rb
|
119
|
-
- lib/wrest/multipart.rb
|
120
119
|
- lib/wrest/native.rb
|
121
|
-
- lib/wrest/
|
122
|
-
- lib/wrest/test.rb
|
120
|
+
- lib/wrest/http_shared.rb
|
123
121
|
- lib/wrest/uri.rb
|
124
|
-
- lib/wrest/
|
125
|
-
- lib/wrest/
|
126
|
-
- lib/wrest/
|
127
|
-
- lib/wrest/
|
128
|
-
- lib/wrest/
|
129
|
-
- lib/wrest/
|
130
|
-
- lib/wrest/
|
131
|
-
- lib/wrest/components/mutators/base.rb
|
132
|
-
- lib/wrest/components/mutators/camel_to_snake_case.rb
|
133
|
-
- lib/wrest/components/mutators/xml_mini_type_caster.rb
|
134
|
-
- lib/wrest/components/mutators/xml_simple_type_caster.rb
|
135
|
-
- lib/wrest/components/translators/content_types.rb
|
136
|
-
- lib/wrest/components/translators/json.rb
|
137
|
-
- lib/wrest/components/translators/xml.rb
|
122
|
+
- lib/wrest/components.rb
|
123
|
+
- lib/wrest/exceptions.rb
|
124
|
+
- lib/wrest/resource.rb
|
125
|
+
- lib/wrest/multipart.rb
|
126
|
+
- lib/wrest/resource/state.rb
|
127
|
+
- lib/wrest/resource/base.rb
|
128
|
+
- lib/wrest/resource/collection.rb
|
138
129
|
- lib/wrest/core_ext/hash.rb
|
139
130
|
- lib/wrest/core_ext/string.rb
|
140
131
|
- lib/wrest/core_ext/hash/conversions.rb
|
141
132
|
- lib/wrest/core_ext/string/conversions.rb
|
142
|
-
- lib/wrest/
|
143
|
-
- lib/wrest/
|
133
|
+
- lib/wrest/native/session.rb
|
134
|
+
- lib/wrest/native/redirection.rb
|
135
|
+
- lib/wrest/native/response.rb
|
136
|
+
- lib/wrest/native/options.rb
|
137
|
+
- lib/wrest/native/get.rb
|
138
|
+
- lib/wrest/native/connection_factory.rb
|
139
|
+
- lib/wrest/native/request.rb
|
140
|
+
- lib/wrest/native/post.rb
|
141
|
+
- lib/wrest/native/put_multipart.rb
|
142
|
+
- lib/wrest/native/put.rb
|
143
|
+
- lib/wrest/native/delete.rb
|
144
|
+
- lib/wrest/native/post_multipart.rb
|
145
|
+
- lib/wrest/curl/session.rb
|
146
|
+
- lib/wrest/curl/response.rb
|
144
147
|
- lib/wrest/curl/options.rb
|
148
|
+
- lib/wrest/curl/get.rb
|
149
|
+
- lib/wrest/curl/request.rb
|
145
150
|
- lib/wrest/curl/post.rb
|
146
151
|
- lib/wrest/curl/put.rb
|
147
|
-
- lib/wrest/curl/
|
148
|
-
- lib/wrest/
|
149
|
-
- lib/wrest/
|
150
|
-
- lib/wrest/
|
151
|
-
- lib/wrest/
|
152
|
+
- lib/wrest/curl/delete.rb
|
153
|
+
- lib/wrest/components/mutators.rb
|
154
|
+
- lib/wrest/components/translators.rb
|
155
|
+
- lib/wrest/components/container.rb
|
156
|
+
- lib/wrest/components/translators/json.rb
|
157
|
+
- lib/wrest/components/translators/xml.rb
|
158
|
+
- lib/wrest/components/translators/content_types.rb
|
159
|
+
- lib/wrest/components/container/alias_accessors.rb
|
160
|
+
- lib/wrest/components/container/typecaster.rb
|
161
|
+
- lib/wrest/components/mutators/camel_to_snake_case.rb
|
162
|
+
- lib/wrest/components/mutators/xml_mini_type_caster.rb
|
163
|
+
- lib/wrest/components/mutators/base.rb
|
164
|
+
- lib/wrest/components/mutators/xml_simple_type_caster.rb
|
152
165
|
- lib/wrest/http_shared/standard_tokens.rb
|
153
|
-
- lib/wrest/
|
154
|
-
- lib/wrest/
|
155
|
-
- lib/wrest/native/get.rb
|
156
|
-
- lib/wrest/native/options.rb
|
157
|
-
- lib/wrest/native/post.rb
|
158
|
-
- lib/wrest/native/post_multipart.rb
|
159
|
-
- lib/wrest/native/put.rb
|
160
|
-
- lib/wrest/native/put_multipart.rb
|
161
|
-
- lib/wrest/native/redirection.rb
|
162
|
-
- lib/wrest/native/request.rb
|
163
|
-
- lib/wrest/native/response.rb
|
164
|
-
- lib/wrest/native/session.rb
|
165
|
-
- lib/wrest/resource/base.rb
|
166
|
-
- lib/wrest/resource/collection.rb
|
167
|
-
- lib/wrest/resource/state.rb
|
166
|
+
- lib/wrest/http_shared/standard_headers.rb
|
167
|
+
- lib/wrest/http_shared/headers.rb
|
168
168
|
- lib/wrest/test/request_patches.rb
|
169
169
|
- README.rdoc
|
170
170
|
- CHANGELOG
|