diff options
author | Luke Kanies <luke@madstop.com> | 2008-08-24 20:54:47 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-08-26 22:40:41 -0700 |
commit | 30dea6839b0360e2fabbeb833e6c2b8658d3f53c (patch) | |
tree | 0be9491fa9a5aee7137925731f6e9df6269941ca /lib | |
parent | 40e76fb83ef466425fec736abbf1913a6426bf01 (diff) | |
download | puppet-30dea6839b0360e2fabbeb833e6c2b8658d3f53c.tar.gz puppet-30dea6839b0360e2fabbeb833e6c2b8658d3f53c.tar.xz puppet-30dea6839b0360e2fabbeb833e6c2b8658d3f53c.zip |
Adding a 'plural?' method to the Indirection::Request class.
I'm in the process of creating a new service for handling
all of the http calls, including generation of the RESTian
URL. This service obviously needs to know whether the url should
be plural or singular, and the request knows the method in use,
so it can easily answer the question.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/indirector/request.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/puppet/indirector/request.rb b/lib/puppet/indirector/request.rb index 194b9e031..49cc01aab 100644 --- a/lib/puppet/indirector/request.rb +++ b/lib/puppet/indirector/request.rb @@ -1,7 +1,8 @@ require 'puppet/indirector' -# Provide any attributes or functionality needed for indirected -# instances. +# This class encapsulates all of the information you need to make an +# Indirection call, and as a a result also handles REST calls. It's somewhat +# analogous to an HTTP Request object, except tuned for our Indirector. class Puppet::Indirector::Request attr_accessor :indirection_name, :key, :method, :options, :instance, :node, :ip, :authenticated @@ -50,6 +51,11 @@ class Puppet::Indirector::Request Puppet::Indirector::Indirection.instance(@indirection_name) end + # Are we trying to interact with multiple resources, or just one? + def plural? + method == :search + end + private # Parse the key as a URI, setting attributes appropriately. |