wrest 1.4.4 → 1.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/README.rdoc +1 -1
- data/lib/wrest/components/translators/json.rb +9 -1
- data/lib/wrest/components/translators/xml.rb +8 -0
- data/lib/wrest/curl/response.rb +11 -3
- data/lib/wrest/http_shared/standard_tokens.rb +1 -0
- data/lib/wrest/native/response.rb +9 -1
- data/lib/wrest/uri.rb +3 -1
- data/lib/wrest/version.rb +1 -1
- metadata +2 -2
data/CHANGELOG
CHANGED
@@ -2,6 +2,9 @@ Features under the section marked 'Current' are completed but pending release as
|
|
2
2
|
|
3
3
|
Features under a numbered section are complete and available in the Wrest gem.
|
4
4
|
|
5
|
+
== 1.4.5
|
6
|
+
* GH#107 alias :deserialize :deserialise
|
7
|
+
|
5
8
|
== 1.4.4
|
6
9
|
* GH#105 Reduce Rubgems version requirements to 1.3.x or greater from > 1.5
|
7
10
|
|
data/README.rdoc
CHANGED
@@ -13,13 +13,21 @@ module Wrest
|
|
13
13
|
module Translators::Json
|
14
14
|
extend self
|
15
15
|
|
16
|
-
def deserialise(response,options = {})
|
16
|
+
def deserialise(response, options = {})
|
17
17
|
ActiveSupport::JSON.decode(response.body)
|
18
18
|
end
|
19
19
|
|
20
|
+
def deserialize(response, options = {})
|
21
|
+
deserialise(response, options)
|
22
|
+
end
|
23
|
+
|
20
24
|
def serialise(hash, options = {})
|
21
25
|
hash.to_json(options)
|
22
26
|
end
|
27
|
+
|
28
|
+
def serialize(hash, options = {})
|
29
|
+
serialise(hash, options)
|
30
|
+
end
|
23
31
|
end
|
24
32
|
end
|
25
33
|
end
|
@@ -19,9 +19,17 @@ module Wrest
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
def deserialize(response, options = {})
|
23
|
+
deserialise(response, options)
|
24
|
+
end
|
25
|
+
|
22
26
|
def serialise(hash, options = {})
|
23
27
|
hash.to_xml(options)
|
24
28
|
end
|
29
|
+
|
30
|
+
def serialize(hash, options = {})
|
31
|
+
serialise(hash, options)
|
32
|
+
end
|
25
33
|
end
|
26
34
|
end
|
27
35
|
end
|
data/lib/wrest/curl/response.rb
CHANGED
@@ -37,12 +37,20 @@ module Wrest #:nodoc:
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def deserialise(options = {})
|
40
|
-
|
40
|
+
@deserialised_body ||= deserialise_using(Wrest::Components::Translators.lookup(content_type),options)
|
41
41
|
end
|
42
|
-
|
43
|
-
def
|
42
|
+
|
43
|
+
def deserialize(options = {})
|
44
|
+
deserialise(options)
|
45
|
+
end
|
46
|
+
|
47
|
+
def deserialise_using(translator, options={})
|
44
48
|
translator.deserialise(@http_response,options)
|
45
49
|
end
|
50
|
+
|
51
|
+
def deserialize_using(options = {})
|
52
|
+
deserialise_using(options)
|
53
|
+
end
|
46
54
|
|
47
55
|
def code
|
48
56
|
@http_response.status
|
@@ -74,13 +74,21 @@ module Wrest #:nodoc:
|
|
74
74
|
|
75
75
|
|
76
76
|
def deserialise(options = {})
|
77
|
-
|
77
|
+
@deserialised_body ||= deserialise_using(Wrest::Components::Translators.lookup(@http_response.content_type),options)
|
78
|
+
end
|
79
|
+
|
80
|
+
def deserialize(options = {})
|
81
|
+
deserialise(options)
|
78
82
|
end
|
79
83
|
|
80
84
|
def deserialise_using(translator,options = {})
|
81
85
|
translator.deserialise(@http_response,options)
|
82
86
|
end
|
83
87
|
|
88
|
+
def deserialize_using(options = {})
|
89
|
+
deserialise_using(options)
|
90
|
+
end
|
91
|
+
|
84
92
|
# Gives a hash of the response headers. The keys of the hash are case-insensitive.
|
85
93
|
def headers
|
86
94
|
return @headers if @headers
|
data/lib/wrest/uri.rb
CHANGED
@@ -81,7 +81,9 @@ module Wrest #:nodoc:
|
|
81
81
|
# Clones a Uri, building a new instance with exactly the same uri string.
|
82
82
|
# You can however change the Uri options or add new ones.
|
83
83
|
def clone(opts = {})
|
84
|
-
|
84
|
+
merged_options = @options.merge(opts)
|
85
|
+
merged_options[:default_headers] = opts[:default_headers] ? @default_headers.merge(opts[:default_headers]) : {}
|
86
|
+
Uri.new(@uri_string, merged_options)
|
85
87
|
end
|
86
88
|
|
87
89
|
def eql?(other)
|
data/lib/wrest/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: wrest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.4.
|
5
|
+
version: 1.4.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Sidu Ponnappa
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-05-
|
14
|
+
date: 2011-05-26 00:00:00 +05:30
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|