reststop 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +5 -0
- data/lib/reststop.rb +11 -11
- data/lib/reststop/version.rb +1 -1
- metadata +2 -2
data/History.txt
CHANGED
data/lib/reststop.rb
CHANGED
@@ -105,7 +105,7 @@ module Camping
|
|
105
105
|
# 1. By providing a second parameter to render()
|
106
106
|
# (eg: <tt>render(:foo, :HTML)</tt>)
|
107
107
|
# 2. By setting the @format variable
|
108
|
-
# 3. By providing a 'format' parameter in the request (i.e.
|
108
|
+
# 3. By providing a 'format' parameter in the request (i.e. input[:format])
|
109
109
|
# 4. By adding a file-format extension to the url (e.g. /items.xml or
|
110
110
|
# /items/2.html).
|
111
111
|
#
|
@@ -309,9 +309,9 @@ module Camping
|
|
309
309
|
$LOG.debug("Creating RESTful controller for #{r.inspect} using Reststop #{::Reststop::VERSION::STRING}") if $LOG
|
310
310
|
|
311
311
|
def get(id_or_custom_action = nil, custom_action = nil) # :nodoc:
|
312
|
-
id =
|
312
|
+
id = input['id'] if input['id']
|
313
313
|
|
314
|
-
custom_action =
|
314
|
+
custom_action = input['action'] if input['action']
|
315
315
|
|
316
316
|
if self.methods.include? id_or_custom_action
|
317
317
|
custom_action ||= id_or_custom_action
|
@@ -322,13 +322,13 @@ module Camping
|
|
322
322
|
|
323
323
|
id = id.to_i if id && id =~ /^[0-9]+$/
|
324
324
|
|
325
|
-
@format = Controllers.read_format(
|
325
|
+
@format = Controllers.read_format(input, @env)
|
326
326
|
|
327
327
|
begin
|
328
|
-
if id.nil? &&
|
328
|
+
if id.nil? && input['id'].nil?
|
329
329
|
custom_action ? send(custom_action) : list
|
330
330
|
else
|
331
|
-
custom_action ? send(custom_action, id ||
|
331
|
+
custom_action ? send(custom_action, id || input['id']) : read(id || input['id'])
|
332
332
|
end
|
333
333
|
rescue NoMethodError => e
|
334
334
|
# FIXME: this is probably not a good way to do this, but we need to somehow differentiate
|
@@ -345,22 +345,22 @@ module Camping
|
|
345
345
|
|
346
346
|
|
347
347
|
def post(custom_action = nil) # :nodoc:
|
348
|
-
@format = Controllers.read_format(
|
348
|
+
@format = Controllers.read_format(input, @env)
|
349
349
|
custom_action ? send(custom_action) : create
|
350
350
|
end
|
351
351
|
|
352
352
|
|
353
353
|
def put(id, custom_action = nil) # :nodoc:
|
354
354
|
id = id.to_i if id =~ /^[0-9]+$/
|
355
|
-
@format = Controllers.read_format(
|
356
|
-
custom_action ? send(custom_action, id ||
|
355
|
+
@format = Controllers.read_format(input, @env)
|
356
|
+
custom_action ? send(custom_action, id || input['id']) : update(id || input['id'])
|
357
357
|
end
|
358
358
|
|
359
359
|
|
360
360
|
def delete(id, custom_action = nil) # :nodoc:
|
361
361
|
id = id.to_i if id =~ /^[0-9]+$/
|
362
|
-
@format = Controllers.read_format(
|
363
|
-
custom_action ? send(custom_action, id ||
|
362
|
+
@format = Controllers.read_format(input, @env)
|
363
|
+
custom_action ? send(custom_action, id || input['id']) : destroy(id || input['id'])
|
364
364
|
end
|
365
365
|
|
366
366
|
private
|
data/lib/reststop/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reststop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Zukowski
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-08 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|