Michael Granger avatar Michael Granger committed bfbbcdf

Add some documentation to the REST Resources plugin

Comments (0)

Files changed (1)

lib/strelka/app/restresources.rb

 # parameters[Strelka::App::Parameters] plugins, and will load them
 # automatically if they haven't been already.
 #
-# Stuff left to do:
+# Goals:
 #
-# * Composite resources generated from associations
-# * Honor If-unmodified-since and If-match headers
-# * Caching support (ETag, If-modified-since)
-# * Means of tailoring responses for requests for which the response
-#   isn't clearly specified in the RFC (DELETE /resource)
-# * Sequel plugin for adding links to serialized representations
+# [√] Composite resources generated from associations
+# [ ] Honor If-unmodified-since and If-match headers
+# [ ] Caching support (ETag, If-modified-since)
+# [ ] Means of tailoring responses for requests for which the response
+#     isn't clearly specified in the RFC (DELETE /resource)
+# [ ] Sequel plugin for adding links to serialized representations
+# 
+# == Caveats / Known Problems
+#
+# * Dataset methods declared using the 'subset' declaration don't allow the
+#   introspection necessary for automatically building routes, so you have
+#   to declare them as normal methods in a dataset module:
+#
+#       dataset_module do
+#           def by_name( string )
+#               filter(:name => string)
+#           end
+#       end
+#
+#
 module Strelka::App::RestResources
 	extend Strelka::Plugin
 
 
 		### Add routes for the methods declared in the dataset module +mod+.
 		def add_dataset_module_routes( route_prefix, rsrcobj, mod, options )
+			self.log.debug "Adding dataset module routes."
+
 			mod.instance_methods.each do |methname|
 				meth = mod.instance_method( methname )
 				self.log.debug "    instance_method: %p" % [ meth ]
 				self.log.debug "  route for dataset method %s: %s" % [ methname, route ]
 				self.add_dataset_read_handler( route, rsrcobj, methname, params, options )
 			end
+
+			self.log.debug "  done with dataset module routes."
 		end
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.