reststop 0.2.0 → 0.2.0.50

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ === 0.2.1 :: In Progress...
2
+
3
+ * Restr should now work properly with Rails 2.x (fixes bug #17421).
4
+ * R helper method should now work properly when a Restful object is fed as
5
+ input along with a custom action.
6
+
1
7
  === 0.2.0 :: 2007-12-10
2
8
 
3
9
  * It is now possible to specify the format for rendering a page by appending
@@ -17,6 +23,7 @@
17
23
  * Pages now correctly return HTTP status code 501 when an unimplemented controller
18
24
  method is called. ActiveRecord::NotFound exceptions are caught and return 404
19
25
  status.
26
+ * R helper now works for routing RESTful controllers.
20
27
 
21
28
  === 0.1.0 :: 2007-07-30
22
29
 
@@ -0,0 +1 @@
1
+ See CHANGELOG.txt
@@ -1,4 +1,5 @@
1
1
  CHANGELOG.txt
2
+ History.txt
2
3
  LICENSE.txt
3
4
  Manifest.txt
4
5
  README.txt
data/README.txt CHANGED
@@ -1,18 +1,15 @@
1
1
  = Reststop
2
2
 
3
- <i>Copyright 2007 Urbacon Ltd.</i>
4
-
5
- For info and downloads please see:
3
+ <b>Reststop makes it easy to write RESTful[http://en.wikipedia.org/wiki/Representational_State_Transfer]
4
+ applications in Camping[http://camping.rubyforge.org/files/README.html].</b>
6
5
 
7
- http://rubyforge.org/projects/reststop/
6
+ For info and downloads please see http://rubyforge.org/projects/reststop
8
7
 
9
- You can contact the author at:
10
8
 
11
- matt at roughest dot net
12
-
9
+ *Author*:: Matt Zukowski (matt at roughest dot net)
10
+ *Copyright*:: Copyright (c) 2007 Urbacon Ltd.
11
+ *License*:: GNU Lesser General Public License Version 3
13
12
 
14
- <b>Reststop makes it easy to write RESTful[http://en.wikipedia.org/wiki/Representational_State_Transfer]
15
- applications in Camping[http://camping.rubyforge.org/files/README.html].</b>
16
13
 
17
14
  For an example of a complete Reststop-based Camping app, have a look at
18
15
  http://reststop.rubyforge.org/svn/trunk/examples/blog.rb
@@ -98,7 +95,7 @@ example of RESTful interaction with Restr:
98
95
  kitten = Restr.put('http://example.com/kittens/1.xml', kitten)
99
96
 
100
97
 
101
- ----
98
+ == License
102
99
 
103
100
  Reststop is free software; you can redistribute it and/or modify
104
101
  it under the terms of the GNU Lesser General Public License as published
data/Rakefile CHANGED
@@ -18,10 +18,11 @@ GEM_NAME = "reststop"
18
18
  RUBYFORGE_PROJECT = "reststop" # The unix name for your project
19
19
  HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
20
20
 
21
+ ENV['NODOT'] = '1'
21
22
 
22
23
  NAME = "reststop"
23
- REV = nil
24
- #REV = `svn info`[/Revision: (\d+)/, 1] rescue nil
24
+ #REV = nil
25
+ REV = `svn info`[/Revision: (\d+)/, 1] rescue nil
25
26
  VERS = ENV['VERSION'] || (Reststop::VERSION::STRING + (REV ? ".#{REV}" : ""))
26
27
  CLEAN.include ['**/.*.sw?', '*.gem', '.config']
27
28
  RDOC_OPTS = ['--quiet', '--title', "#{NAME} #{VERS} documentation",
@@ -90,7 +90,7 @@ class Restr
90
90
  end
91
91
 
92
92
  unless method_mod == 'Get'
93
- req.set_form_data(params, ';')
93
+ req.set_form_data(params, '&')
94
94
  end
95
95
 
96
96
  @@log.debug("Sending #{method.inspect} request to #{url.inspect} with data #{params.inspect}"+
@@ -115,8 +115,8 @@ class Restr
115
115
  return res.body
116
116
  end
117
117
  else
118
- $LAST_ERROR_BODY = res.body # FIXME: this is dumb
119
- @@log.error("Got error resposne '#{res.message}(#{res.code})': #{$LAST_ERROR_BODY}") if @@log
118
+ $LAST_ERROR_BODY = res.body # FIXME: this is dumb... need a better way of reporting errors
119
+ @@log.error("Got error response '#{res.message}(#{res.code})': #{$LAST_ERROR_BODY}") if @@log
120
120
  res.error!
121
121
  end
122
122
  end
@@ -100,12 +100,12 @@ module Camping
100
100
  # The format can also be specified in other ways (shown in this order
101
101
  # of precedence):
102
102
  #
103
- # # By providing a second parameter to render()
104
- # (eg: <tt>render(:foo, :HTML)</tt>)
105
- # # By setting the @format variable
106
- # # By providing a 'format' parameter in the request (i.e. @input[:format])
107
- # # By adding a file-format extension to the url (e.g. /items.xml or
108
- # /items/2.html).
103
+ # 1. By providing a second parameter to render()
104
+ # (eg: <tt>render(:foo, :HTML)</tt>)
105
+ # 2. By setting the @format variable
106
+ # 3. By providing a 'format' parameter in the request (i.e. @input[:format])
107
+ # 4. By adding a file-format extension to the url (e.g. /items.xml or
108
+ # /items/2.html).
109
109
  #
110
110
  # For example, you could have:
111
111
  #
@@ -237,8 +237,8 @@ module Camping
237
237
  # * list
238
238
  #
239
239
  # Routes will be automatically created based on the resource name fed to the
240
- # REST method. Note that your class must have the same (but CamelCaps'ed)
241
- # name as the resource name. So if your resource name is 'kittens',
240
+ # REST method. <b>Your class must have the same (but CamelCaps'ed)
241
+ # name as the resource name.</b> So if your resource name is 'kittens',
242
242
  # your controller class must be Kittens.
243
243
  #
244
244
  # For example:
@@ -267,11 +267,22 @@ module Camping
267
267
  # end
268
268
  # end
269
269
  #
270
+ # Custom actions are also possible. For example, to implement a 'meow'
271
+ # action simply add a 'meow' method to the above controller:
270
272
  #
271
- # Optionally, you can specify a :prefix key that will prepend this
272
- # string to the routes. For example, this will create all of the above
273
- # routes, prefixed with '/pets' (i.e. POST '/pets/kittens',
274
- # GET '/pets/kittens/(\d+)', etc.)
273
+ # # POST/GET/PUT/DELETE /kittens/meow
274
+ # # POST/GET/PUT/DELETE /kittens/(\d+)/meow
275
+ # def meow(id)
276
+ # end
277
+ #
278
+ # Note that a custom action will respond to all four HTTP methods
279
+ # (POST/GET/PUT/DELETE).
280
+ #
281
+ # Optionally, you can specify a <tt>:prefix</tt> key that will prepend the
282
+ # given string to the routes. For example, the following will create all
283
+ # of the above routes, prefixed with "/pets"
284
+ # (i.e. <tt>POST '/pets/kittens'</tt>, <tt>GET '/pets/kittens/(\d+)'</tt>,
285
+ # etc.):
275
286
  #
276
287
  # module Foobar::Controllers
277
288
  # class Items < REST 'kittens', :prefix => '/pets'
@@ -279,8 +290,9 @@ module Camping
279
290
  # end
280
291
  # end
281
292
  #
282
- # Additionally, format-based routing is possible. For example to get
283
- # a list of kittens in XML format, place a GET call to /kittens.xml.
293
+ # Format-based routing similar to that in ActiveResource is also implemented.
294
+ # For example, to get a list of kittens in XML format, place a
295
+ # <tt>GET</tt> call to <tt>/kittens.xml</tt>.
284
296
  # See the documentation for the render() method for more info.
285
297
  #
286
298
  def REST(r, options = {})
@@ -402,7 +414,8 @@ module Camping
402
414
  if Controllers.constants.include?(cl = c.class.name.split("::").last.pluralize)
403
415
  path = "/#{cl.underscore}/#{c.id}"
404
416
  path << ".#{@format.to_s.downcase}" if @format
405
- path << "?#{g}" unless g.empty? # FIXME: undefined behaviour if there are multiple arguments left
417
+ path << "/#{g.shift}" unless g.empty?
418
+ # FIXME: undefined behaviour if there are multiple arguments left... maybe we should allow for arbitrary params as a Hash?
406
419
  self / path
407
420
  elsif c.respond_to?(:restful?) && c.restful?
408
421
  base = c.name.split("::").last.underscore
metadata CHANGED
@@ -1,35 +1,33 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.2
3
- specification_version: 1
4
2
  name: reststop
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.2.0
7
- date: 2007-12-18 00:00:00 -05:00
8
- summary: Convenient RESTfulness for all your Camping needs (i.e. makes it easy to implement RESTful controllers in Camping).
9
- require_paths:
10
- - lib
11
- email: matt@roughest.net
12
- homepage: http://reststop.rubyforge.org
13
- rubyforge_project: reststop
14
- description: Convenient RESTfulness for all your Camping needs (i.e. makes it easy to implement RESTful controllers in Camping).
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 0.2.0.50
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Matt Zukowski
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-03-10 00:00:00 -04:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Convenient RESTfulness for all your Camping needs (i.e. makes it easy to implement RESTful controllers in Camping).
17
+ email: matt@roughest.net
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - CHANGELOG.txt
24
+ - History.txt
25
+ - LICENSE.txt
26
+ - Manifest.txt
27
+ - README.txt
31
28
  files:
32
29
  - CHANGELOG.txt
30
+ - History.txt
33
31
  - LICENSE.txt
34
32
  - Manifest.txt
35
33
  - README.txt
@@ -41,21 +39,32 @@ files:
41
39
  - setup.rb
42
40
  - test/reststop_test.rb
43
41
  - test/test_helper.rb
44
- test_files:
45
- - test/reststop_test.rb
42
+ has_rdoc: true
43
+ homepage: http://reststop.rubyforge.org
44
+ post_install_message:
46
45
  rdoc_options:
47
46
  - --main
48
47
  - README.txt
49
- extra_rdoc_files:
50
- - CHANGELOG.txt
51
- - LICENSE.txt
52
- - Manifest.txt
53
- - README.txt
54
- executables: []
55
-
56
- extensions: []
57
-
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: "0"
55
+ version:
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: "0"
61
+ version:
58
62
  requirements: []
59
63
 
60
- dependencies: []
61
-
64
+ rubyforge_project: reststop
65
+ rubygems_version: 1.0.1
66
+ signing_key:
67
+ specification_version: 2
68
+ summary: Convenient RESTfulness for all your Camping needs (i.e. makes it easy to implement RESTful controllers in Camping).
69
+ test_files:
70
+ - test/reststop_test.rb