aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource
diff options
context:
space:
mode:
Diffstat (limited to 'activeresource')
-rw-r--r--activeresource/lib/active_resource/base.rb68
1 files changed, 34 insertions, 34 deletions
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb
index 492ab27bef..9b71ac3bd1 100644
--- a/activeresource/lib/active_resource/base.rb
+++ b/activeresource/lib/active_resource/base.rb
@@ -54,7 +54,7 @@ module ActiveResource
#
# Since simple CRUD/lifecycle methods can't accomplish every task, Active Resource also supports
# defining your own custom REST methods. To invoke them, Active Resource provides the <tt>get</tt>,
- # <tt>post</tt>, <tt>put</tt> and <tt>delete</tt> methods where you can specify a custom REST method
+ # <tt>post</tt>, <tt>put</tt> and <tt>\delete</tt> methods where you can specify a custom REST method
# name to invoke.
#
# # POST to the custom 'register' REST method, i.e. POST /people/new/register.xml.
@@ -175,7 +175,7 @@ module ActiveResource
# === Timeouts
#
# Active Resource relies on HTTP to access RESTful APIs and as such is inherently susceptible to slow or
- # unresponsive servers. In such cases, your Active Resource method calls could timeout. You can control the
+ # unresponsive servers. In such cases, your Active Resource method calls could \timeout. You can control the
# amount of time before Active Resource times out with the +timeout+ variable.
#
# class Person < ActiveResource::Base
@@ -189,7 +189,7 @@ module ActiveResource
# http://en.wikipedia.org/wiki/Fail-fast) rather than cause cascading failures that could incapacitate your
# server.
#
- # When a timeout occurs, an ActiveResource::TimeoutError is raised. You should rescue from
+ # When a \timeout occurs, an ActiveResource::TimeoutError is raised. You should rescue from
# ActiveResource::TimeoutError in your Active Resource method calls.
#
# Internally, Active Resource relies on Ruby's Net::HTTP library to make HTTP requests. Setting +timeout+
@@ -238,7 +238,7 @@ module ActiveResource
end
end
- # Gets the user for REST HTTP authentication.
+ # Gets the \user for REST HTTP authentication.
def user
# Not using superclass_delegating_reader. See +site+ for explanation
if defined?(@user)
@@ -248,13 +248,13 @@ module ActiveResource
end
end
- # Sets the user for REST HTTP authentication.
+ # Sets the \user for REST HTTP authentication.
def user=(user)
@connection = nil
@user = user
end
- # Gets the password for REST HTTP authentication.
+ # Gets the \password for REST HTTP authentication.
def password
# Not using superclass_delegating_reader. See +site+ for explanation
if defined?(@password)
@@ -264,7 +264,7 @@ module ActiveResource
end
end
- # Sets the password for REST HTTP authentication.
+ # Sets the \password for REST HTTP authentication.
def password=(password)
@connection = nil
@password = password
@@ -307,8 +307,8 @@ module ActiveResource
end
end
- # An instance of ActiveResource::Connection that is the base connection to the remote service.
- # The +refresh+ parameter toggles whether or not the connection is refreshed at every request
+ # An instance of ActiveResource::Connection that is the base \connection to the remote service.
+ # The +refresh+ parameter toggles whether or not the \connection is refreshed at every request
# or not (defaults to <tt>false</tt>).
def connection(refresh = false)
if defined?(@connection) || superclass == Object
@@ -333,8 +333,8 @@ module ActiveResource
attr_accessor_with_default(:collection_name) { element_name.pluralize } #:nodoc:
attr_accessor_with_default(:primary_key, 'id') #:nodoc:
- # Gets the prefix for a resource's nested URL (e.g., <tt>prefix/collectionname/1.xml</tt>)
- # This method is regenerated at runtime based on what the prefix is set to.
+ # Gets the \prefix for a resource's nested URL (e.g., <tt>prefix/collectionname/1.xml</tt>)
+ # This method is regenerated at runtime based on what the \prefix is set to.
def prefix(options={})
default = site.path
default << '/' unless default[-1..-1] == '/'
@@ -343,14 +343,14 @@ module ActiveResource
prefix(options)
end
- # An attribute reader for the source string for the resource path prefix. This
- # method is regenerated at runtime based on what the prefix is set to.
+ # An attribute reader for the source string for the resource path \prefix. This
+ # method is regenerated at runtime based on what the \prefix is set to.
def prefix_source
prefix # generate #prefix and #prefix_source methods first
prefix_source
end
- # Sets the prefix for a resource's nested URL (e.g., <tt>prefix/collectionname/1.xml</tt>).
+ # Sets the \prefix for a resource's nested URL (e.g., <tt>prefix/collectionname/1.xml</tt>).
# Default value is <tt>site.path</tt>.
def prefix=(value = '/')
# Replace :placeholders with '#{embedded options[:lookups]}'
@@ -373,12 +373,12 @@ module ActiveResource
alias_method :set_collection_name, :collection_name= #:nodoc:
# Gets the element path for the given ID in +id+. If the +query_options+ parameter is omitted, Rails
- # will split from the prefix options.
+ # will split from the \prefix options.
#
# ==== Options
- # +prefix_options+ - A hash to add a prefix to the request for nested URLs (e.g., <tt>:account_id => 19</tt>
+ # +prefix_options+ - A \hash to add a \prefix to the request for nested URLs (e.g., <tt>:account_id => 19</tt>
# would yield a URL like <tt>/accounts/19/purchases.xml</tt>).
- # +query_options+ - A hash to add items to the query string for the request.
+ # +query_options+ - A \hash to add items to the query string for the request.
#
# ==== Examples
# Post.element_path(1)
@@ -467,7 +467,7 @@ module ActiveResource
# ==== Options
#
# * <tt>:from</tt> - Sets the path or custom method that resources will be fetched from.
- # * <tt>:params</tt> - Sets query and prefix (nested URL) parameters.
+ # * <tt>:params</tt> - Sets query and \prefix (nested URL) parameters.
#
# ==== Examples
# Person.find(1)
@@ -511,7 +511,7 @@ module ActiveResource
# Deletes the resources with the ID in the +id+ parameter.
#
# ==== Options
- # All options specify prefix and query parameters.
+ # All options specify \prefix and query parameters.
#
# ==== Examples
# Event.delete(2) # sends DELETE /events/2
@@ -622,8 +622,8 @@ module ActiveResource
attr_accessor :attributes #:nodoc:
attr_accessor :prefix_options #:nodoc:
- # Constructor method for new resources; the optional +attributes+ parameter takes a hash
- # of attributes for the new resource.
+ # Constructor method for \new resources; the optional +attributes+ parameter takes a \hash
+ # of attributes for the \new resource.
#
# ==== Examples
# my_course = Course.new
@@ -639,8 +639,8 @@ module ActiveResource
load(attributes)
end
- # Returns a clone of the resource that hasn't been assigned an +id+ yet and
- # is treated as a new resource.
+ # Returns a \clone of the resource that hasn't been assigned an +id+ yet and
+ # is treated as a \new resource.
#
# ryan = Person.find(1)
# not_ryan = ryan.clone
@@ -675,7 +675,7 @@ module ActiveResource
end
- # A method to determine if the resource a new object (i.e., it has not been POSTed to the remote service yet).
+ # A method to determine if the resource a \new object (i.e., it has not been POSTed to the remote service yet).
#
# ==== Examples
# not_new = Computer.create(:brand => 'Apple', :make => 'MacBook', :vendor => 'MacMall')
@@ -691,12 +691,12 @@ module ActiveResource
id.nil?
end
- # Get the +id+ attribute of the resource.
+ # Gets the <tt>\id</tt> attribute of the resource.
def id
attributes[self.class.primary_key]
end
- # Set the +id+ attribute of the resource.
+ # Sets the <tt>\id</tt> attribute of the resource.
def id=(id)
attributes[self.class.primary_key] = id
end
@@ -737,7 +737,7 @@ module ActiveResource
self == other
end
- # Delegates to id in order to allow two resources of the same type and id to work with something like:
+ # Delegates to id in order to allow two resources of the same type and \id to work with something like:
# [Person.find(1), Person.find(2)] & [Person.find(1), Person.find(4)] # => [Person.find(1)]
def hash
id.hash
@@ -762,9 +762,9 @@ module ActiveResource
end
end
- # A method to save (+POST+) or update (+PUT+) a resource. It delegates to +create+ if a new object,
- # +update+ if it is existing. If the response to the save includes a body, it will be assumed that this body
- # is XML for the final object as it looked after the save (which would include attributes like +created_at+
+ # A method to \save (+POST+) or \update (+PUT+) a resource. It delegates to +create+ if a \new object,
+ # +update+ if it is existing. If the response to the \save includes a body, it will be assumed that this body
+ # is XML for the final object as it looked after the \save (which would include attributes like +created_at+
# that weren't part of the original submit).
#
# ==== Examples
@@ -844,7 +844,7 @@ module ActiveResource
attributes.to_xml({:root => self.class.element_name}.merge(options))
end
- # A method to reload the attributes of this object from the remote web service.
+ # A method to \reload the attributes of this object from the remote web service.
#
# ==== Examples
# my_branch = Branch.find(:first)
@@ -859,8 +859,8 @@ module ActiveResource
self.load(self.class.find(to_param, :params => @prefix_options).attributes)
end
- # A method to manually load attributes from a hash. Recursively loads collections of
- # resources. This method is called in +initialize+ and +create+ when a hash of attributes
+ # A method to manually load attributes from a \hash. Recursively loads collections of
+ # resources. This method is called in +initialize+ and +create+ when a \hash of attributes
# is provided.
#
# ==== Examples
@@ -931,7 +931,7 @@ module ActiveResource
end
end
- # Create (i.e., save to the remote service) the new resource.
+ # Create (i.e., \save to the remote service) the \new resource.
def create
returning connection.post(collection_path, to_xml, self.class.headers) do |response|
self.id = id_from_response(response)