lib/active_resource/singleton.rb in insales_api-0.1.3 vs lib/active_resource/singleton.rb in insales_api-0.2.0
- old
+ new
@@ -58,36 +58,36 @@
# A failure to find the requested object raises a ResourceNotFound
# exception.
#
# Inventory.find
# # => raises ResourceNotFound
- def find(options={})
+ def find(options = {})
find_singleton(options)
end
private
+
# Find singleton resource
def find_singleton(options)
prefix_options, query_options = split_options(options[:params])
path = singleton_path(prefix_options, query_options)
resp = self.format.decode(self.connection.get(path, self.headers).body)
instantiate_record(resp, {})
end
-
end
+
# Deletes the resource from the remove service.
#
# ==== Examples
# weather = Weather.find
# weather.destroy
# Weather.find # 404 (Resource Not Found)
def destroy
connection.delete(singleton_path, self.class.headers)
end
-
protected
# Update the resource on the remote service
def update
connection.put(singleton_path(prefix_options), encode, self.class.headers).tap do |response|
@@ -106,9 +106,7 @@
private
def singleton_path(options = nil)
self.class.singleton_path(options || prefix_options)
end
-
end
-
-end
\ No newline at end of file
+end