wrest 1.0.2-universal-java-1.6 → 1.1.0-universal-java-1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/README.rdoc +30 -5
- data/bin/wrest.compiled.rbc +78 -0
- data/bin/wrest_shell.rb +1 -1
- data/bin/wrest_shell.rbc +659 -0
- data/lib/wrest.rb +36 -2
- data/lib/wrest/cache_proxy.rb +111 -0
- data/lib/wrest/components/cache_store/memcached.rb +34 -0
- data/lib/wrest/curl.rb +2 -2
- data/lib/wrest/curl/request.rb +2 -2
- data/lib/wrest/hash_with_case_insensitive_access.rb +52 -0
- data/lib/wrest/native/get.rb +33 -3
- data/lib/wrest/native/redirection.rb +1 -1
- data/lib/wrest/native/request.rb +6 -6
- data/lib/wrest/native/response.rb +168 -34
- data/lib/wrest/version.rb +1 -12
- metadata +112 -20
- data/lib/wrest/resource.rb +0 -18
- data/lib/wrest/resource/base.rb +0 -101
- data/lib/wrest/resource/collection.rb +0 -12
- data/lib/wrest/resource/state.rb +0 -6
data/lib/wrest/version.rb
CHANGED
@@ -8,16 +8,5 @@
|
|
8
8
|
# See the License for the specific language governing permissions and limitations under the License.
|
9
9
|
|
10
10
|
module Wrest
|
11
|
-
|
12
|
-
unless defined? MAJOR
|
13
|
-
MAJOR = 1
|
14
|
-
MINOR = 0
|
15
|
-
TINY = 2
|
16
|
-
BUILD = nil
|
17
|
-
|
18
|
-
STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
|
19
|
-
|
20
|
-
SUMMARY = "wrest version #{STRING}"
|
21
|
-
end
|
22
|
-
end
|
11
|
+
VERSION = "1.1.0"
|
23
12
|
end
|
metadata
CHANGED
@@ -3,10 +3,10 @@ name: wrest
|
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
|
+
- 1
|
6
7
|
- 1
|
7
8
|
- 0
|
8
|
-
|
9
|
-
version: 1.0.2
|
9
|
+
version: 1.1.0
|
10
10
|
platform: universal-java-1.6
|
11
11
|
authors:
|
12
12
|
- Sidu Ponnappa
|
@@ -15,29 +15,77 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-28 00:00:00 +05:30
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
name:
|
22
|
+
name: rubyforge
|
23
23
|
prerelease: false
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
type: :development
|
32
|
+
version_requirements: *id001
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: hanna
|
35
|
+
prerelease: false
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
segments:
|
41
|
+
- 0
|
42
|
+
version: "0"
|
43
|
+
type: :development
|
44
|
+
version_requirements: *id002
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: rspec
|
47
|
+
prerelease: false
|
48
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
25
49
|
requirements:
|
26
50
|
- - ~>
|
27
51
|
- !ruby/object:Gem::Version
|
28
52
|
segments:
|
29
53
|
- 2
|
54
|
+
- 4
|
55
|
+
- 0
|
56
|
+
version: 2.4.0
|
57
|
+
type: :development
|
58
|
+
version_requirements: *id003
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: sinatra
|
61
|
+
prerelease: false
|
62
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ~>
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
segments:
|
67
|
+
- 1
|
30
68
|
- 0
|
31
69
|
- 0
|
32
|
-
|
33
|
-
- 22
|
34
|
-
version: 2.0.0.beta.22
|
70
|
+
version: 1.0.0
|
35
71
|
type: :development
|
36
|
-
version_requirements: *
|
72
|
+
version_requirements: *id004
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
name: metric_fu
|
75
|
+
prerelease: false
|
76
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
segments:
|
81
|
+
- 0
|
82
|
+
version: "0"
|
83
|
+
type: :development
|
84
|
+
version_requirements: *id005
|
37
85
|
- !ruby/object:Gem::Dependency
|
38
86
|
name: activesupport
|
39
87
|
prerelease: false
|
40
|
-
requirement: &
|
88
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
41
89
|
requirements:
|
42
90
|
- - ~>
|
43
91
|
- !ruby/object:Gem::Version
|
@@ -47,11 +95,11 @@ dependencies:
|
|
47
95
|
- 0
|
48
96
|
version: 3.0.0
|
49
97
|
type: :runtime
|
50
|
-
version_requirements: *
|
98
|
+
version_requirements: *id006
|
51
99
|
- !ruby/object:Gem::Dependency
|
52
100
|
name: builder
|
53
101
|
prerelease: false
|
54
|
-
requirement: &
|
102
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
55
103
|
requirements:
|
56
104
|
- - ~>
|
57
105
|
- !ruby/object:Gem::Version
|
@@ -61,11 +109,53 @@ dependencies:
|
|
61
109
|
- 2
|
62
110
|
version: 2.1.2
|
63
111
|
type: :runtime
|
64
|
-
version_requirements: *
|
112
|
+
version_requirements: *id007
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: i18n
|
115
|
+
prerelease: false
|
116
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
segments:
|
121
|
+
- 0
|
122
|
+
- 4
|
123
|
+
- 1
|
124
|
+
version: 0.4.1
|
125
|
+
type: :runtime
|
126
|
+
version_requirements: *id008
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
name: tzinfo
|
129
|
+
prerelease: false
|
130
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
segments:
|
135
|
+
- 0
|
136
|
+
- 3
|
137
|
+
- 23
|
138
|
+
version: 0.3.23
|
139
|
+
type: :runtime
|
140
|
+
version_requirements: *id009
|
141
|
+
- !ruby/object:Gem::Dependency
|
142
|
+
name: jruby-openssl
|
143
|
+
prerelease: false
|
144
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ~>
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
segments:
|
149
|
+
- 0
|
150
|
+
- 7
|
151
|
+
- 1
|
152
|
+
version: 0.7.1
|
153
|
+
type: :runtime
|
154
|
+
version_requirements: *id010
|
65
155
|
- !ruby/object:Gem::Dependency
|
66
156
|
name: json-jruby
|
67
157
|
prerelease: false
|
68
|
-
requirement: &
|
158
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
69
159
|
requirements:
|
70
160
|
- - ~>
|
71
161
|
- !ruby/object:Gem::Version
|
@@ -76,11 +166,11 @@ dependencies:
|
|
76
166
|
- 1
|
77
167
|
version: 1.4.3.1
|
78
168
|
type: :runtime
|
79
|
-
version_requirements: *
|
169
|
+
version_requirements: *id011
|
80
170
|
- !ruby/object:Gem::Dependency
|
81
171
|
name: nokogiri
|
82
172
|
prerelease: false
|
83
|
-
requirement: &
|
173
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
84
174
|
requirements:
|
85
175
|
- - ~>
|
86
176
|
- !ruby/object:Gem::Version
|
@@ -91,7 +181,7 @@ dependencies:
|
|
91
181
|
- 1
|
92
182
|
version: 1.4.3.1
|
93
183
|
type: :runtime
|
94
|
-
version_requirements: *
|
184
|
+
version_requirements: *id012
|
95
185
|
description: Wrest is a HTTP and REST client library which allows you to quickly build well encapsulated, object oriented wrappers around any web service.
|
96
186
|
email:
|
97
187
|
- sidu@c42.in
|
@@ -102,17 +192,20 @@ extensions: []
|
|
102
192
|
extra_rdoc_files:
|
103
193
|
- README.rdoc
|
104
194
|
files:
|
195
|
+
- bin/wrest.compiled.rbc
|
105
196
|
- bin/wrest_shell.rb
|
197
|
+
- bin/wrest_shell.rbc
|
106
198
|
- bin/wrest
|
107
199
|
- lib/wrest_no_ext.rb
|
108
200
|
- lib/wrest.rb
|
109
201
|
- lib/wrest/http_shared.rb
|
202
|
+
- lib/wrest/cache_proxy.rb
|
110
203
|
- lib/wrest/native.rb
|
111
204
|
- lib/wrest/multipart.rb
|
112
205
|
- lib/wrest/xml_mini.rb
|
113
206
|
- lib/wrest/exceptions.rb
|
207
|
+
- lib/wrest/hash_with_case_insensitive_access.rb
|
114
208
|
- lib/wrest/curl.rb
|
115
|
-
- lib/wrest/resource.rb
|
116
209
|
- lib/wrest/test.rb
|
117
210
|
- lib/wrest/uri_template.rb
|
118
211
|
- lib/wrest/uri.rb
|
@@ -122,6 +215,7 @@ files:
|
|
122
215
|
- lib/wrest/components/translators.rb
|
123
216
|
- lib/wrest/components/container.rb
|
124
217
|
- lib/wrest/components/mutators.rb
|
218
|
+
- lib/wrest/components/cache_store/memcached.rb
|
125
219
|
- lib/wrest/components/mutators/xml_mini_type_caster.rb
|
126
220
|
- lib/wrest/components/mutators/base.rb
|
127
221
|
- lib/wrest/components/mutators/camel_to_snake_case.rb
|
@@ -157,9 +251,6 @@ files:
|
|
157
251
|
- lib/wrest/curl/options.rb
|
158
252
|
- lib/wrest/curl/session.rb
|
159
253
|
- lib/wrest/curl/post.rb
|
160
|
-
- lib/wrest/resource/base.rb
|
161
|
-
- lib/wrest/resource/collection.rb
|
162
|
-
- lib/wrest/resource/state.rb
|
163
254
|
- lib/wrest/xml_mini/libxml.rb
|
164
255
|
- lib/wrest/xml_mini/jdom.rb
|
165
256
|
- lib/wrest/xml_mini/nokogiri.rb
|
@@ -201,6 +292,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
292
|
- 7
|
202
293
|
version: 1.3.7
|
203
294
|
requirements:
|
295
|
+
- To use Memcached as caching back-end, install the 'dalli' gem.
|
204
296
|
- To use multipart post, install the 'multipart-post' gem.
|
205
297
|
- To use curl as the http engine, install the 'patron' gem. This feature is not available (and should be unneccessary) on jruby.
|
206
298
|
rubyforge_project: wrest
|
data/lib/wrest/resource.rb
DELETED
@@ -1,18 +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
|
-
# Wrest::Resource is a re-implementation
|
12
|
-
# of ActiveResource using Wrest::Components
|
13
|
-
# and with some of the rough edges removed
|
14
|
-
module Resource
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
require "#{Wrest::Root}/wrest/resource/base"
|
data/lib/wrest/resource/base.rb
DELETED
@@ -1,101 +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::Resource #:nodoc:
|
11
|
-
# Resource::Base is the equivalent of ActiveResource::Base.
|
12
|
-
# It is a REST client targetted at Rails REST apps.
|
13
|
-
#
|
14
|
-
# Note that it is currently incomplete.
|
15
|
-
class Base
|
16
|
-
include Wrest::Components::Container
|
17
|
-
|
18
|
-
always_has :id
|
19
|
-
typecast :id => as_integer
|
20
|
-
attr_reader :attributes
|
21
|
-
|
22
|
-
def ==(other)
|
23
|
-
return true if self.equal?(other)
|
24
|
-
return false unless other.class == self.class
|
25
|
-
return self.attributes == other.attributes
|
26
|
-
end
|
27
|
-
|
28
|
-
def hash
|
29
|
-
id.hash
|
30
|
-
end
|
31
|
-
|
32
|
-
def to_xml(options={})
|
33
|
-
attributes.to_xml({:root => self.class.resource_name.gsub('_', '-')}.merge(options))
|
34
|
-
end
|
35
|
-
|
36
|
-
class << self
|
37
|
-
def inherited(klass)
|
38
|
-
klass.set_resource_name klass.name
|
39
|
-
end
|
40
|
-
|
41
|
-
# Allows the resource name to be configured and creates
|
42
|
-
# a getter method for it.
|
43
|
-
# This is a useful feature when using anonymous classes like
|
44
|
-
# we often do while writing tests.
|
45
|
-
# By default, the resource name is set to the name of the class.
|
46
|
-
def set_resource_name(resource_name)
|
47
|
-
self.class_eval "def self.resource_name; '#{resource_name.to_s.underscore}';end"
|
48
|
-
end
|
49
|
-
|
50
|
-
# Allows the host url at which the resource is found to be configured
|
51
|
-
# and creates a getter method for it.
|
52
|
-
# For example in the url
|
53
|
-
# http://localhost:3000/users/1/settings
|
54
|
-
# you would set
|
55
|
-
# http://localhost:3000
|
56
|
-
# as the host url.
|
57
|
-
def set_host(host)
|
58
|
-
self.class_eval "def self.host; '#{host}';end"
|
59
|
-
end
|
60
|
-
|
61
|
-
def set_default_format(format)
|
62
|
-
self.class_eval "def self.default_format; '#{format.to_s}';end"
|
63
|
-
end
|
64
|
-
|
65
|
-
def set_redirect_handler(method_object)
|
66
|
-
end
|
67
|
-
|
68
|
-
def resource_collection_name
|
69
|
-
@resource_collection_name ||= "#{resource_name.underscore.pluralize}"
|
70
|
-
end
|
71
|
-
|
72
|
-
def find_one_uri_template
|
73
|
-
@find_one_template ||= Wrest::UriTemplate.new(':host/:resource_collection_name/:id.:format')
|
74
|
-
end
|
75
|
-
|
76
|
-
def find(id)
|
77
|
-
response = find_one_uri_template.to_uri(
|
78
|
-
:host => host,
|
79
|
-
:resource_collection_name => resource_collection_name,
|
80
|
-
:id => id,
|
81
|
-
:format => default_format
|
82
|
-
).get
|
83
|
-
self.new(response.deserialise.mutate_using(
|
84
|
-
Wrest::Components::Mutators.chain(:xml_mini_type_caster, :camel_to_snake_case)
|
85
|
-
).shift.last)
|
86
|
-
end
|
87
|
-
|
88
|
-
def create(attributes = {})
|
89
|
-
response = Wrest::UriTemplate.new(':host/:resource_collection_name.:format').to_uri(
|
90
|
-
:host => host,
|
91
|
-
:resource_collection_name => resource_collection_name,
|
92
|
-
:format => default_format
|
93
|
-
).post(self.new(attributes).to_xml, 'Content-Type' => "application/#{default_format}")
|
94
|
-
|
95
|
-
self.new(response.deserialise.mutate_using(
|
96
|
-
Wrest::Components::Mutators.chain(:xml_mini_type_caster, :camel_to_snake_case)
|
97
|
-
).shift.last)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
@@ -1,12 +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
|
-
# Understands how to contain a collection of Wrest::Resources
|
11
|
-
class Wrest::Resource::Collection
|
12
|
-
end
|