diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-06-23 17:29:54 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-06-23 17:29:54 +0000 |
commit | ae4838fff20857b11b1092d82b34ef7d32edfcab (patch) | |
tree | 94e11f3370ca3240dcfd56c5820c565e6f7c3278 /activeresource/lib/active_resource/connection.rb | |
parent | 753cbf1cd45c0f82ba24d70830f5a8581cb55bc0 (diff) | |
download | rails-ae4838fff20857b11b1092d82b34ef7d32edfcab.tar.gz rails-ae4838fff20857b11b1092d82b34ef7d32edfcab.tar.bz2 rails-ae4838fff20857b11b1092d82b34ef7d32edfcab.zip |
Big documentation upgrade for ARes (closes #8694) [jeremymcanally]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7098 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activeresource/lib/active_resource/connection.rb')
-rw-r--r-- | activeresource/lib/active_resource/connection.rb | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/activeresource/lib/active_resource/connection.rb b/activeresource/lib/active_resource/connection.rb index 8245c797b3..5aef6f4d42 100644 --- a/activeresource/lib/active_resource/connection.rb +++ b/activeresource/lib/active_resource/connection.rb @@ -5,7 +5,7 @@ require 'uri' require 'benchmark' module ActiveResource - class ConnectionError < StandardError + class ConnectionError < StandardError # :nodoc: attr_reader :response def initialize(response, message = nil) @@ -18,20 +18,28 @@ module ActiveResource end end - class ClientError < ConnectionError; end # 4xx Client Error - class ResourceNotFound < ClientError; end # 404 Not Found - class ResourceConflict < ClientError; end # 409 Conflict + # 4xx Client Error + class ClientError < ConnectionError; end # :nodoc: + + # 404 Not Found + class ResourceNotFound < ClientError; end # :nodoc: + + # 409 Conflict + class ResourceConflict < ClientError; end # :nodoc: - class ServerError < ConnectionError; end # 5xx Server Error + # 5xx Server Error + class ServerError < ConnectionError; end # :nodoc: # 405 Method Not Allowed - class MethodNotAllowed < ClientError + class MethodNotAllowed < ClientError # :nodoc: def allowed_methods @response['Allow'].split(',').map { |verb| verb.strip.downcase.to_sym } end end - # Class to handle connections to remote services. + # Class to handle connections to remote web services. + # This class is used by ActiveResource::Base to interface with REST + # services. class Connection attr_reader :site @@ -46,6 +54,8 @@ module ActiveResource end end + # The +site+ parameter is required and will set the +site+ + # attribute to the URI for the remote resource service. def initialize(site) raise ArgumentError, 'Missing site URI' unless site self.site = site @@ -84,7 +94,6 @@ module ActiveResource from_xml_data(Hash.from_xml(response.body)) end - private # Makes request to remote service. def request(method, path, *arguments) @@ -152,6 +161,5 @@ module ActiveResource data end end - end -end +end
\ No newline at end of file |