wrest 1.0.0.beta2-universal-java-1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +59 -0
- data/LICENCE +7 -0
- data/README.rdoc +127 -0
- data/bin/wrest +3 -0
- data/bin/wrest_shell.rb +21 -0
- data/lib/wrest.rb +101 -0
- data/lib/wrest.rbc +1900 -0
- data/lib/wrest/components.rb +20 -0
- data/lib/wrest/components.rbc +217 -0
- data/lib/wrest/components/container.rb +185 -0
- data/lib/wrest/components/container.rbc +2466 -0
- data/lib/wrest/components/container/alias_accessors.rb +66 -0
- data/lib/wrest/components/container/alias_accessors.rbc +905 -0
- data/lib/wrest/components/container/typecaster.rb +127 -0
- data/lib/wrest/components/container/typecaster.rbc +1985 -0
- data/lib/wrest/components/mutators.rb +39 -0
- data/lib/wrest/components/mutators.rbc +650 -0
- data/lib/wrest/components/mutators/base.rb +56 -0
- data/lib/wrest/components/mutators/base.rbc +702 -0
- data/lib/wrest/components/mutators/camel_to_snake_case.rb +22 -0
- data/lib/wrest/components/mutators/camel_to_snake_case.rbc +360 -0
- data/lib/wrest/components/mutators/xml_mini_type_caster.rb +43 -0
- data/lib/wrest/components/mutators/xml_mini_type_caster.rbc +679 -0
- data/lib/wrest/components/mutators/xml_simple_type_caster.rb +37 -0
- data/lib/wrest/components/mutators/xml_simple_type_caster.rbc +559 -0
- data/lib/wrest/components/translators.rb +28 -0
- data/lib/wrest/components/translators.rbc +517 -0
- data/lib/wrest/components/translators/content_types.rb +20 -0
- data/lib/wrest/components/translators/content_types.rbc +339 -0
- data/lib/wrest/components/translators/json.rb +25 -0
- data/lib/wrest/components/translators/json.rbc +462 -0
- data/lib/wrest/components/translators/xml.rb +24 -0
- data/lib/wrest/components/translators/xml.rbc +457 -0
- data/lib/wrest/core_ext/hash.rb +5 -0
- data/lib/wrest/core_ext/hash.rbc +182 -0
- data/lib/wrest/core_ext/hash/conversions.rb +44 -0
- data/lib/wrest/core_ext/hash/conversions.rbc +501 -0
- data/lib/wrest/core_ext/string.rb +5 -0
- data/lib/wrest/core_ext/string.rbc +182 -0
- data/lib/wrest/core_ext/string/conversions.rb +23 -0
- data/lib/wrest/core_ext/string/conversions.rbc +471 -0
- data/lib/wrest/curl.rb +49 -0
- data/lib/wrest/curl.rbc +704 -0
- data/lib/wrest/curl/delete.rb +23 -0
- data/lib/wrest/curl/get.rb +23 -0
- data/lib/wrest/curl/options.rb +16 -0
- data/lib/wrest/curl/post.rb +23 -0
- data/lib/wrest/curl/put.rb +23 -0
- data/lib/wrest/curl/request.rb +97 -0
- data/lib/wrest/curl/response.rb +71 -0
- data/lib/wrest/curl/session.rb +57 -0
- data/lib/wrest/exceptions.rb +33 -0
- data/lib/wrest/exceptions.rbc +312 -0
- data/lib/wrest/http_shared.rb +23 -0
- data/lib/wrest/http_shared.rbc +279 -0
- data/lib/wrest/http_shared/headers.rb +343 -0
- data/lib/wrest/http_shared/headers.rbc +353 -0
- data/lib/wrest/http_shared/standard_headers.rb +21 -0
- data/lib/wrest/http_shared/standard_headers.rbc +336 -0
- data/lib/wrest/http_shared/standard_tokens.rb +18 -0
- data/lib/wrest/http_shared/standard_tokens.rbc +316 -0
- data/lib/wrest/multipart.rb +52 -0
- data/lib/wrest/native.rb +33 -0
- data/lib/wrest/native.rbc +513 -0
- data/lib/wrest/native/connection_factory.rb +23 -0
- data/lib/wrest/native/connection_factory.rbc +445 -0
- data/lib/wrest/native/delete.rb +23 -0
- data/lib/wrest/native/delete.rbc +371 -0
- data/lib/wrest/native/get.rb +51 -0
- data/lib/wrest/native/get.rbc +855 -0
- data/lib/wrest/native/options.rb +23 -0
- data/lib/wrest/native/options.rbc +347 -0
- data/lib/wrest/native/post.rb +23 -0
- data/lib/wrest/native/post.rbc +388 -0
- data/lib/wrest/native/post_multipart.rb +32 -0
- data/lib/wrest/native/put.rb +23 -0
- data/lib/wrest/native/put.rbc +388 -0
- data/lib/wrest/native/put_multipart.rb +32 -0
- data/lib/wrest/native/redirection.rb +38 -0
- data/lib/wrest/native/redirection.rbc +520 -0
- data/lib/wrest/native/request.rb +94 -0
- data/lib/wrest/native/request.rbc +1675 -0
- data/lib/wrest/native/response.rb +120 -0
- data/lib/wrest/native/response.rbc +2150 -0
- data/lib/wrest/native/session.rb +57 -0
- data/lib/wrest/native/session.rbc +1372 -0
- data/lib/wrest/resource.rb +18 -0
- data/lib/wrest/resource.rbc +163 -0
- data/lib/wrest/resource/base.rb +99 -0
- data/lib/wrest/resource/base.rbc +2115 -0
- data/lib/wrest/resource/collection.rb +12 -0
- data/lib/wrest/resource/state.rb +6 -0
- data/lib/wrest/test.rb +1 -0
- data/lib/wrest/test/request_patches.rb +5 -0
- data/lib/wrest/uri.rb +160 -0
- data/lib/wrest/uri.rbc +2599 -0
- data/lib/wrest/uri_template.rb +49 -0
- data/lib/wrest/uri_template.rbc +505 -0
- data/lib/wrest/version.rb +23 -0
- data/lib/wrest/version.rbc +372 -0
- metadata +231 -0
@@ -0,0 +1,23 @@
|
|
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::Curl
|
11
|
+
class Delete < Request
|
12
|
+
def initialize(wrest_uri, parameters = {}, headers = {}, options = {})
|
13
|
+
super(
|
14
|
+
wrest_uri,
|
15
|
+
:delete,
|
16
|
+
parameters,
|
17
|
+
nil,
|
18
|
+
headers,
|
19
|
+
options
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
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::Curl
|
11
|
+
class Get < Request
|
12
|
+
def initialize(wrest_uri, parameters = {}, headers = {}, options = {})
|
13
|
+
super(
|
14
|
+
wrest_uri,
|
15
|
+
:get,
|
16
|
+
parameters,
|
17
|
+
nil,
|
18
|
+
headers,
|
19
|
+
options
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,16 @@
|
|
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::Curl
|
11
|
+
class Options < Request
|
12
|
+
def initialize(*args)
|
13
|
+
raise Wrest::Exceptions::UnsupportedHttpVerb, 'Options'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,23 @@
|
|
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::Curl
|
11
|
+
class Post < Request
|
12
|
+
def initialize(wrest_uri, body = '', headers = {}, parameters = {}, options = {})
|
13
|
+
super(
|
14
|
+
wrest_uri,
|
15
|
+
:post,
|
16
|
+
parameters,
|
17
|
+
body,
|
18
|
+
headers,
|
19
|
+
options
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
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::Curl
|
11
|
+
class Put < Request
|
12
|
+
def initialize(wrest_uri, body = '', headers = {}, parameters = {}, options = {})
|
13
|
+
super(
|
14
|
+
wrest_uri,
|
15
|
+
:put,
|
16
|
+
parameters,
|
17
|
+
body,
|
18
|
+
headers,
|
19
|
+
options
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,97 @@
|
|
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 Curl
|
12
|
+
# This represents a HTTP request. Typically you will never need to instantiate
|
13
|
+
# one of these yourself - you can use one of the more conveient APIs via Wrest::Uri
|
14
|
+
# or Wrest::Curl::Get etc. instead.
|
15
|
+
class Request
|
16
|
+
attr_reader :http_request, :uri, :body, :headers, :username, :password, :follow_redirects,
|
17
|
+
:follow_redirects_limit, :timeout, :connection, :parameters, :auth_type
|
18
|
+
# Valid tuples for the options are:
|
19
|
+
# :username => String, defaults to nil
|
20
|
+
# :password => String, defaults to nil
|
21
|
+
# :follow_redirects => Boolean, defaults to true for Get, false for anything else
|
22
|
+
# :follow_redirects_limit => Integer, defaults to 5. This is the number of redirects
|
23
|
+
# that Wrest will automatically follow before raising an
|
24
|
+
# Wrest::Exceptions::AutoRedirectLimitExceeded exception.
|
25
|
+
# For example, if you set this to 1, the very first redirect
|
26
|
+
# will raise the exception.
|
27
|
+
# :timeout => The period, in seconds, after which a Timeout::Error is raised
|
28
|
+
# in the event of a connection failing to open. Defaulted to 60 by Uri#create_connection.
|
29
|
+
# :connection => The HTTP Connection object to use. This is how a keep-alive connection can be
|
30
|
+
# used for multiple requests. Not yet fully implemented for Curl.
|
31
|
+
#
|
32
|
+
# Curl specific options:
|
33
|
+
# :auth_type => This is a curl specific option and can be one of :basic, :digest, or :any. The default is :basic.
|
34
|
+
def initialize(wrest_uri, http_verb, parameters = {}, body = nil, headers = {}, options = {})
|
35
|
+
@uri = wrest_uri
|
36
|
+
@headers = headers.stringify_keys
|
37
|
+
@parameters = parameters
|
38
|
+
@body = body
|
39
|
+
|
40
|
+
@options = options.clone
|
41
|
+
@auth_type = @options[:auth_type] || :basic
|
42
|
+
@username = @options[:username]
|
43
|
+
@password = @options[:password]
|
44
|
+
@follow_redirects = (@options[:follow_redirects] ||= false)
|
45
|
+
|
46
|
+
@follow_redirects_limit = (@options[:follow_redirects_limit] ||= 5)
|
47
|
+
@timeout = @options[:timeout] || 60
|
48
|
+
@connection = @options[:connection]
|
49
|
+
|
50
|
+
@http_request = Patron::Request.new
|
51
|
+
@http_request.action = http_verb
|
52
|
+
@http_request.upload_data = body
|
53
|
+
@http_request.headers = headers
|
54
|
+
@http_request.username = username
|
55
|
+
@http_request.password = password
|
56
|
+
@http_request.auth_type = auth_type
|
57
|
+
@http_request.url = parameters.empty? ? uri.to_s : "#{uri.to_s}?#{parameters.to_query}"
|
58
|
+
@http_request.max_redirects = follow_redirects_limit if follow_redirects
|
59
|
+
@http_request.timeout = @timeout
|
60
|
+
end
|
61
|
+
|
62
|
+
# Makes a request and returns a Wrest::Http::Response.
|
63
|
+
# Data about the request is and logged to Wrest.logger
|
64
|
+
# The log entry contains the following information:
|
65
|
+
#
|
66
|
+
# --> indicates a request
|
67
|
+
# <-- indicates a response
|
68
|
+
#
|
69
|
+
# The type of request is mentioned in caps, followed by a hash
|
70
|
+
# uniquely uniquely identifying a particular request/response pair.
|
71
|
+
# In a multi-process or multi-threaded scenario, this can be used
|
72
|
+
# to identify request-response pairs.
|
73
|
+
#
|
74
|
+
# The request hash is followed by a connection hash; requests using the
|
75
|
+
# same connection (effectively a keep-alive connection) will have the
|
76
|
+
# same connection hash.
|
77
|
+
#
|
78
|
+
# This is followed by the response code, the payload size and the time taken.
|
79
|
+
def invoke
|
80
|
+
response = nil
|
81
|
+
|
82
|
+
@connection ||= Patron::Session.new
|
83
|
+
raise ArgumentError, "Empty URL" if http_request.url.empty?
|
84
|
+
|
85
|
+
prefix = "#{http_request.action.to_s.upcase} #{http_request.hash} #{connection.hash}"
|
86
|
+
|
87
|
+
Wrest.logger.debug "--> (#{prefix}) #{http_request.url}"
|
88
|
+
time = Benchmark.realtime { response = Wrest::Curl::Response.new(connection.handle_request(http_request))}
|
89
|
+
Wrest.logger.debug "<-- (#{prefix}) %s (%d bytes %.2fs)" % [response.message, response.body ? response.body.length : 0, time]
|
90
|
+
|
91
|
+
response
|
92
|
+
rescue Patron::TimeoutError => e
|
93
|
+
raise Wrest::Exceptions::Timeout.new(e)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,71 @@
|
|
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 #:nodoc:
|
11
|
+
module Curl #:nodoc:
|
12
|
+
# Decorates a response providing support for deserialisation.
|
13
|
+
class Response
|
14
|
+
attr_reader :http_response
|
15
|
+
include HttpShared::Headers
|
16
|
+
|
17
|
+
extend Forwardable
|
18
|
+
def_delegators :@http_response, :body, :headers
|
19
|
+
|
20
|
+
def initialize_http_header
|
21
|
+
headers.merge!(headers.inject({}) do |downcased_headers, tuple|
|
22
|
+
key, value = tuple
|
23
|
+
downcased_headers[key.downcase] = value
|
24
|
+
downcased_headers
|
25
|
+
end)
|
26
|
+
end
|
27
|
+
|
28
|
+
def initialize(http_response)
|
29
|
+
@http_response = http_response
|
30
|
+
initialize_http_header
|
31
|
+
end
|
32
|
+
|
33
|
+
def deserialise
|
34
|
+
deserialise_using(Wrest::Components::Translators.lookup(content_type))
|
35
|
+
end
|
36
|
+
|
37
|
+
def deserialise_using(translator)
|
38
|
+
translator.deserialise(@http_response)
|
39
|
+
end
|
40
|
+
|
41
|
+
def code
|
42
|
+
@http_response.status
|
43
|
+
end
|
44
|
+
|
45
|
+
def message
|
46
|
+
@http_response.status_line
|
47
|
+
end
|
48
|
+
|
49
|
+
def content_length
|
50
|
+
self[H::ContentLength].try(:to_i)
|
51
|
+
end
|
52
|
+
|
53
|
+
def content_type
|
54
|
+
self[H::ContentType].split(';').first
|
55
|
+
end
|
56
|
+
|
57
|
+
# A null object implementation - invoking this method on
|
58
|
+
# a response simply returns the same response unless
|
59
|
+
# the response is a Redirection (code 3xx), in which case a
|
60
|
+
# get is invoked on the url stored in the response headers
|
61
|
+
# under the key 'location' and the new Response is returned.
|
62
|
+
def follow(redirect_request_options = {})
|
63
|
+
self
|
64
|
+
end
|
65
|
+
|
66
|
+
def connection_closed?
|
67
|
+
self[StandardHeaders::Connection].downcase == StandardTokens::Close.downcase
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,57 @@
|
|
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::Native
|
11
|
+
# This class is a wrapper for a keep-alive HTTP connection. It simply passes the
|
12
|
+
# same connection instance as an option to all Wrest::Http::Request instances created using it.
|
13
|
+
#
|
14
|
+
# If at any point the server closes an existing connection during a Session by returning a
|
15
|
+
# Connection: Close header the current connection is destroyed and a fresh one created for the next
|
16
|
+
# request.
|
17
|
+
#
|
18
|
+
# The Session constructor can accept either a String URI or a Wrest::Uri as a parameter. If you
|
19
|
+
# need HTTP authentication, you should use a Wrest::Uri.
|
20
|
+
class Session
|
21
|
+
attr_reader :uri
|
22
|
+
def initialize(uri)
|
23
|
+
@uri = uri.is_a?(String) ? uri.to_uri : uri
|
24
|
+
@default_headers = { StandardHeaders::Connection => StandardTokens::KeepAlive }
|
25
|
+
|
26
|
+
yield(self) if block_given?
|
27
|
+
end
|
28
|
+
|
29
|
+
def connection
|
30
|
+
@connection ||= @uri.create_connection
|
31
|
+
end
|
32
|
+
|
33
|
+
def get(path = '', parameters = {}, headers = {})
|
34
|
+
maybe_destroy_connection @uri[path, {:connection => self.connection}].get(parameters, headers.merge(@default_headers))
|
35
|
+
end
|
36
|
+
|
37
|
+
def post(path = '', body = '', headers = {}, params = {})
|
38
|
+
maybe_destroy_connection @uri[path, {:connection => self.connection}].post(body, headers.merge(@default_headers), params)
|
39
|
+
end
|
40
|
+
|
41
|
+
def put(path = '', body = '', headers = {}, params = {})
|
42
|
+
maybe_destroy_connection @uri[path, {:connection => self.connection}].put(body, headers.merge(@default_headers), params)
|
43
|
+
end
|
44
|
+
|
45
|
+
def delete(path = '', parameters = {}, headers = {})
|
46
|
+
maybe_destroy_connection @uri[path, {:connection => self.connection}].delete(parameters, headers.merge(@default_headers))
|
47
|
+
end
|
48
|
+
|
49
|
+
def maybe_destroy_connection(response)
|
50
|
+
if response.connection_closed?
|
51
|
+
Wrest.logger.warn "Connection #{@connection.hash} has been closed by the server"
|
52
|
+
@connection = nil
|
53
|
+
end
|
54
|
+
response
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Wrest
|
2
|
+
module Exceptions #:nodoc:
|
3
|
+
# Raised when a base method that should be overriden
|
4
|
+
# is invoked on a subclass that has not implemented it.
|
5
|
+
class MethodNotOverridden < StandardError
|
6
|
+
end
|
7
|
+
|
8
|
+
# Raised when a translator for an unregisterd response content type
|
9
|
+
# is requested. See Translators.
|
10
|
+
class UnsupportedContentType < StandardError
|
11
|
+
end
|
12
|
+
|
13
|
+
# Raised when a request auto redirects more times than are allowed
|
14
|
+
# by its follow_redirects_limit. See Wrest::Http::Redirection.
|
15
|
+
class AutoRedirectLimitExceeded < StandardError
|
16
|
+
end
|
17
|
+
|
18
|
+
# Raised when a request is made when either RAILS_ENV or
|
19
|
+
# ENV['RAILS_ENV'] is set to 'test', which is the case when
|
20
|
+
# running tests/specs in a Rails application.
|
21
|
+
#
|
22
|
+
# See wrest/test/request_patches.
|
23
|
+
class RealRequestMadeInTestEnvironmet < StandardError
|
24
|
+
end
|
25
|
+
|
26
|
+
# Raised when a request times out
|
27
|
+
class Timeout < StandardError
|
28
|
+
end
|
29
|
+
|
30
|
+
class UnsupportedHttpVerb < StandardError
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,312 @@
|
|
1
|
+
!RBIX
|
2
|
+
0
|
3
|
+
x
|
4
|
+
M
|
5
|
+
1
|
6
|
+
n
|
7
|
+
n
|
8
|
+
x
|
9
|
+
10
|
10
|
+
__script__
|
11
|
+
i
|
12
|
+
28
|
13
|
+
99
|
14
|
+
7
|
15
|
+
0
|
16
|
+
65
|
17
|
+
49
|
18
|
+
1
|
19
|
+
2
|
20
|
+
13
|
21
|
+
99
|
22
|
+
12
|
23
|
+
7
|
24
|
+
2
|
25
|
+
12
|
26
|
+
7
|
27
|
+
3
|
28
|
+
12
|
29
|
+
65
|
30
|
+
12
|
31
|
+
49
|
32
|
+
4
|
33
|
+
4
|
34
|
+
15
|
35
|
+
49
|
36
|
+
2
|
37
|
+
0
|
38
|
+
15
|
39
|
+
2
|
40
|
+
11
|
41
|
+
I
|
42
|
+
6
|
43
|
+
I
|
44
|
+
0
|
45
|
+
I
|
46
|
+
0
|
47
|
+
I
|
48
|
+
0
|
49
|
+
n
|
50
|
+
p
|
51
|
+
5
|
52
|
+
x
|
53
|
+
5
|
54
|
+
Wrest
|
55
|
+
x
|
56
|
+
11
|
57
|
+
open_module
|
58
|
+
x
|
59
|
+
15
|
60
|
+
__module_init__
|
61
|
+
M
|
62
|
+
1
|
63
|
+
n
|
64
|
+
n
|
65
|
+
x
|
66
|
+
5
|
67
|
+
Wrest
|
68
|
+
i
|
69
|
+
28
|
70
|
+
5
|
71
|
+
66
|
72
|
+
99
|
73
|
+
7
|
74
|
+
0
|
75
|
+
65
|
76
|
+
49
|
77
|
+
1
|
78
|
+
2
|
79
|
+
13
|
80
|
+
99
|
81
|
+
12
|
82
|
+
7
|
83
|
+
2
|
84
|
+
12
|
85
|
+
7
|
86
|
+
3
|
87
|
+
12
|
88
|
+
65
|
89
|
+
12
|
90
|
+
49
|
91
|
+
4
|
92
|
+
4
|
93
|
+
15
|
94
|
+
49
|
95
|
+
2
|
96
|
+
0
|
97
|
+
11
|
98
|
+
I
|
99
|
+
6
|
100
|
+
I
|
101
|
+
0
|
102
|
+
I
|
103
|
+
0
|
104
|
+
I
|
105
|
+
0
|
106
|
+
n
|
107
|
+
p
|
108
|
+
5
|
109
|
+
x
|
110
|
+
10
|
111
|
+
Exceptions
|
112
|
+
x
|
113
|
+
11
|
114
|
+
open_module
|
115
|
+
x
|
116
|
+
15
|
117
|
+
__module_init__
|
118
|
+
M
|
119
|
+
1
|
120
|
+
n
|
121
|
+
n
|
122
|
+
x
|
123
|
+
10
|
124
|
+
Exceptions
|
125
|
+
i
|
126
|
+
80
|
127
|
+
5
|
128
|
+
66
|
129
|
+
99
|
130
|
+
7
|
131
|
+
0
|
132
|
+
45
|
133
|
+
1
|
134
|
+
2
|
135
|
+
65
|
136
|
+
49
|
137
|
+
3
|
138
|
+
3
|
139
|
+
15
|
140
|
+
1
|
141
|
+
15
|
142
|
+
99
|
143
|
+
7
|
144
|
+
4
|
145
|
+
45
|
146
|
+
1
|
147
|
+
5
|
148
|
+
65
|
149
|
+
49
|
150
|
+
3
|
151
|
+
3
|
152
|
+
15
|
153
|
+
1
|
154
|
+
15
|
155
|
+
99
|
156
|
+
7
|
157
|
+
6
|
158
|
+
45
|
159
|
+
1
|
160
|
+
7
|
161
|
+
65
|
162
|
+
49
|
163
|
+
3
|
164
|
+
3
|
165
|
+
15
|
166
|
+
1
|
167
|
+
15
|
168
|
+
99
|
169
|
+
7
|
170
|
+
8
|
171
|
+
45
|
172
|
+
1
|
173
|
+
9
|
174
|
+
65
|
175
|
+
49
|
176
|
+
3
|
177
|
+
3
|
178
|
+
15
|
179
|
+
1
|
180
|
+
15
|
181
|
+
99
|
182
|
+
7
|
183
|
+
10
|
184
|
+
45
|
185
|
+
1
|
186
|
+
11
|
187
|
+
65
|
188
|
+
49
|
189
|
+
3
|
190
|
+
3
|
191
|
+
15
|
192
|
+
1
|
193
|
+
15
|
194
|
+
99
|
195
|
+
7
|
196
|
+
12
|
197
|
+
45
|
198
|
+
1
|
199
|
+
13
|
200
|
+
65
|
201
|
+
49
|
202
|
+
3
|
203
|
+
3
|
204
|
+
15
|
205
|
+
1
|
206
|
+
11
|
207
|
+
I
|
208
|
+
4
|
209
|
+
I
|
210
|
+
0
|
211
|
+
I
|
212
|
+
0
|
213
|
+
I
|
214
|
+
0
|
215
|
+
n
|
216
|
+
p
|
217
|
+
14
|
218
|
+
x
|
219
|
+
19
|
220
|
+
MethodNotOverridden
|
221
|
+
x
|
222
|
+
13
|
223
|
+
StandardError
|
224
|
+
n
|
225
|
+
x
|
226
|
+
10
|
227
|
+
open_class
|
228
|
+
x
|
229
|
+
22
|
230
|
+
UnsupportedContentType
|
231
|
+
n
|
232
|
+
x
|
233
|
+
25
|
234
|
+
AutoRedirectLimitExceeded
|
235
|
+
n
|
236
|
+
x
|
237
|
+
31
|
238
|
+
RealRequestMadeInTestEnvironmet
|
239
|
+
n
|
240
|
+
x
|
241
|
+
7
|
242
|
+
Timeout
|
243
|
+
n
|
244
|
+
x
|
245
|
+
19
|
246
|
+
UnsupportedHttpVerb
|
247
|
+
n
|
248
|
+
p
|
249
|
+
13
|
250
|
+
I
|
251
|
+
2
|
252
|
+
I
|
253
|
+
5
|
254
|
+
I
|
255
|
+
f
|
256
|
+
I
|
257
|
+
a
|
258
|
+
I
|
259
|
+
1c
|
260
|
+
I
|
261
|
+
f
|
262
|
+
I
|
263
|
+
29
|
264
|
+
I
|
265
|
+
17
|
266
|
+
I
|
267
|
+
36
|
268
|
+
I
|
269
|
+
1b
|
270
|
+
I
|
271
|
+
43
|
272
|
+
I
|
273
|
+
1e
|
274
|
+
I
|
275
|
+
50
|
276
|
+
x
|
277
|
+
46
|
278
|
+
/Users/sidu/Work/wrest/lib/wrest/exceptions.rb
|
279
|
+
p
|
280
|
+
0
|
281
|
+
x
|
282
|
+
13
|
283
|
+
attach_method
|
284
|
+
p
|
285
|
+
3
|
286
|
+
I
|
287
|
+
2
|
288
|
+
I
|
289
|
+
2
|
290
|
+
I
|
291
|
+
1c
|
292
|
+
x
|
293
|
+
46
|
294
|
+
/Users/sidu/Work/wrest/lib/wrest/exceptions.rb
|
295
|
+
p
|
296
|
+
0
|
297
|
+
x
|
298
|
+
13
|
299
|
+
attach_method
|
300
|
+
p
|
301
|
+
3
|
302
|
+
I
|
303
|
+
0
|
304
|
+
I
|
305
|
+
1
|
306
|
+
I
|
307
|
+
1c
|
308
|
+
x
|
309
|
+
46
|
310
|
+
/Users/sidu/Work/wrest/lib/wrest/exceptions.rb
|
311
|
+
p
|
312
|
+
0
|