described_routes 0.7.1 → 0.8.0

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 CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.8.0 2009-08-01
2
+
3
+ * Rails integration via Rack middleware!
4
+
1
5
  == 0.7.1 2009-07-30
2
6
 
3
7
  * Refactor helper module to use new link_header gem
data/PostInstall.txt CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
+ ATTENTION: 0.8.0 adds Rails integration via Rack middleware. The Rails controller and helpers are hereby deprecated!
3
+
2
4
  For more information on described_routes, see http://describedroutes.rubyforge.org
3
5
 
4
- NOTE: Change this information in PostInstall.txt
5
- You can also delete it if you don't want it.
6
6
 
7
7
 
data/README.rdoc CHANGED
@@ -8,7 +8,9 @@ Features:
8
8
  * Easy integration with Rails
9
9
  * JSON, YAML and XML formats, also a bonus plain text report
10
10
 
11
- == SYNOPSIS:
11
+ ATTENTION: 0.8.0 adds Rails integration via Rack middleware; the Rails controller and helpers are hereby deprecated!
12
+
13
+ == USAGE:
12
14
 
13
15
  === Build time
14
16
 
@@ -60,15 +62,14 @@ include full URI templates.
60
62
 
61
63
  === Run time
62
64
 
63
- There are two integration steps for run time support:
64
-
65
- 1) Somewhere in your application include the controller, perhaps in an initializer:
66
-
67
- require 'described_routes/rails_controller'
65
+ In your config/environment.rb, add the DescribedRoutes::Middleware::Rails middleware in the <code>Rails::Initializer.run</code> block:
68
66
 
69
- 2) Add the following route in config/routes.rb:
70
-
71
- map.resources :described_routes, :controller => "described_routes/rails"
67
+ require 'described_routes/middleware/rails'
68
+
69
+ Rails::Initializer.run do |config|
70
+ config.middleware.use DescribedRoutes::Middleware::Rails
71
+ end
72
+ There are two integration steps for run time support:
72
73
 
73
74
  You (or your client application) can now browse to any of the following top level addresses:
74
75
 
@@ -88,7 +89,7 @@ and for the named route "users" (say):
88
89
 
89
90
  In the absence of content negotiation, requests to addresses without format extensions redirect to the respective .txt address.
90
91
 
91
- If the application has a route named "root", run-time-generated data will include full URIs in <code>uri_template</code> attributes based on <code>root_url</code> in addition to the <code>path_template</code> attributes supported at build time.
92
+ Note that
92
93
 
93
94
  Example:
94
95
 
@@ -171,16 +172,13 @@ JSON example (after pretty printing):
171
172
  ]
172
173
  }
173
174
 
174
- === Link Generation
175
-
176
- Generate link headers (see the draft spec http://tools.ietf.org/id/draft-nottingham-http-link-header-06.txt) by including
175
+ === Link Header Discovery Protocol
177
176
 
178
- include DescribedRoutes::DescribedRoutesHelper
179
- after_filter :set_link_header
177
+ A discovery protocol based on link headers is added automatically by the middleware (controller changes are no longer required). This protocol is understood by <code>path-to</code> (enabling client APIs to be bootstrapped easily) and the link headers can be regarded as adding useful type information to resources.
180
178
 
181
- in your controllers. You can do this once in ApplicationController to get this behaviour across all controllers, or in specific controllers (for example the one for the root resource).
179
+ Regular resources are given a link header that points to that resource's <code>ResourceTemplate</code> metadata. That in turn is given a link header that points to the </code>ResourceTemplates</code> metadata for the entire application. The root resource has a link header that points to the </code>ResourceTemplates</code> metadata directly.
182
180
 
183
- See DescribedRoutes::DescribedRoutesHelper#link_data for configuration options; note however that you will need to define a new filter method if you wish to override the defaults. These are set to provide the minimum information necessary to support site discovery via resource-specific metadata links.
181
+ For further information on link headers, see the draft spec http://tools.ietf.org/id/draft-nottingham-http-link-header-06.txt and the <code>link_header</code> gem.
184
182
 
185
183
  == DATA STRUCTURES and FORMATS
186
184
 
@@ -1,4 +1,5 @@
1
1
  require 'resource_template'
2
+ require 'active_support'
2
3
 
3
4
  module DescribedRoutes
4
5
  module RailsRoutes
@@ -2,5 +2,5 @@ require 'resource_template'
2
2
 
3
3
  module DescribedRoutes
4
4
  # rubygem version
5
- VERSION = "0.7.1"
5
+ VERSION = "0.8.0"
6
6
  end
@@ -7,7 +7,6 @@ class ApplicationController < ActionController::Base
7
7
  include DescribedRoutes::DescribedRoutesHelper
8
8
  helper DescribedRoutes::DescribedRoutesHelper
9
9
 
10
- after_filter :set_link_headers
11
10
 
12
11
  layout "default"
13
12
 
@@ -15,10 +14,14 @@ class ApplicationController < ActionController::Base
15
14
 
16
15
  # Scrub sensitive parameters from your log
17
16
  # filter_parameter_logging :password
18
-
19
- protected
20
-
21
- def set_link_headers
22
- set_link_header :self => true, :up => true, :describedby => true, :related => true
23
- end
17
+
18
+ # This is no longer required - DescribedRoutes::Middleware::Rails takes care of it all!
19
+ #
20
+ # after_filter :set_link_headers
21
+ #
22
+ # protected
23
+ #
24
+ # def set_link_headers
25
+ # set_link_header :self => true, :up => true, :describedby => true, :related => true
26
+ # end
24
27
  end
@@ -1,12 +1,16 @@
1
1
  # Be sure to restart your server when you modify this file
2
2
 
3
+ require "described_routes/middleware/rails"
4
+
3
5
  # Specifies gem version of Rails to use when vendor/rails is not present
4
- RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
6
+ RAILS_GEM_VERSION = '2.3.3' unless defined? RAILS_GEM_VERSION
5
7
 
6
8
  # Bootstrap the Rails environment, frameworks, and default configuration
7
9
  require File.join(File.dirname(__FILE__), 'boot')
8
10
 
9
11
  Rails::Initializer.run do |config|
12
+ config.middleware.use DescribedRoutes::Middleware::Rails, :self => true, :up => true, :related => true
13
+
10
14
  # Settings in config/environments/* take precedence over those specified here.
11
15
  # Application configuration should go into files in config/initializers
12
16
  # -- all .rb files in that directory are automatically loaded.
@@ -38,4 +42,4 @@ Rails::Initializer.run do |config|
38
42
  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
39
43
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
40
44
  # config.i18n.default_locale = :de
41
- end
45
+ end
@@ -1 +1,3 @@
1
- require 'described_routes/rails_controller'
1
+ # This is no longer required - DescribedRoutes::Middleware::Rails takes care of it all!
2
+ #
3
+ # require 'described_routes/rails_controller'
@@ -22,7 +22,8 @@ ActionController::Routing::Routes.draw do |map|
22
22
  map.root :controller => "welcome"
23
23
 
24
24
  #
25
- # described_routes at runtime
25
+ # described_routes at runtime. DEPRECATED - use DescribedRoutes::Middleware::Rails instead - but retained here
26
+ # until the test fixtures have had the resulting routes removed
26
27
  #
27
28
  map.resources :described_routes, :controller => "described_routes/rails"
28
29
  end
@@ -1 +1 @@
1
- [{"name":"root","path_template":"\/"},{"name":"admin_products","resource_templates":[{"name":"new_admin_product","options":["GET"],"path_template":"\/admin\/products\/new{-prefix|.|format}","rel":"new_admin_product","optional_params":["format"]},{"name":"admin_product","resource_templates":[{"name":"edit_admin_product","options":["GET"],"path_template":"\/admin\/products\/{product_id}\/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["product_id"]}],"options":["GET","PUT","DELETE"],"path_template":"\/admin\/products\/{product_id}{-prefix|.|format}","optional_params":["format"],"params":["product_id"]}],"options":["GET","POST"],"path_template":"\/admin\/products{-prefix|.|format}","optional_params":["format"]},{"name":"described_routes","resource_templates":[{"name":"new_described_route","options":["GET"],"path_template":"\/described_routes\/new{-prefix|.|format}","rel":"new_described_route","optional_params":["format"]},{"name":"described_route","resource_templates":[{"name":"edit_described_route","options":["GET"],"path_template":"\/described_routes\/{route_name}\/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["route_name"]}],"options":["GET","PUT","DELETE"],"path_template":"\/described_routes\/{route_name}{-prefix|.|format}","optional_params":["format"],"params":["route_name"]}],"options":["GET","POST"],"path_template":"\/described_routes{-prefix|.|format}","optional_params":["format"]},{"name":"pages","resource_templates":[{"name":"new_page","options":["GET"],"path_template":"\/pages\/new{-prefix|.|format}","rel":"new_page","optional_params":["format"]},{"name":"page","resource_templates":[{"name":"edit_page","options":["GET"],"path_template":"\/pages\/{page_id}\/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["page_id"]},{"name":"summary_page","options":["GET"],"path_template":"\/pages\/{page_id}\/summary{-prefix|.|format}","rel":"summary","optional_params":["format"],"params":["page_id"]},{"name":"toggle_visibility_page","options":["POST"],"path_template":"\/pages\/{page_id}\/toggle_visibility{-prefix|.|format}","rel":"toggle_visibility","optional_params":["format"],"params":["page_id"]}],"options":["GET","PUT","DELETE"],"path_template":"\/pages\/{page_id}{-prefix|.|format}","optional_params":["format"],"params":["page_id"]}],"options":["GET","POST"],"path_template":"\/pages{-prefix|.|format}","optional_params":["format"]},{"name":"users","resource_templates":[{"name":"new_user","options":["GET"],"path_template":"\/users\/new{-prefix|.|format}","rel":"new_user","optional_params":["format"]},{"name":"user","resource_templates":[{"name":"edit_user","options":["GET"],"path_template":"\/users\/{user_id}\/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["user_id"]},{"name":"user_articles","resource_templates":[{"name":"new_user_article","options":["GET"],"path_template":"\/users\/{user_id}\/articles\/new{-prefix|.|format}","rel":"new_user_article","optional_params":["format"],"params":["user_id"]},{"name":"recent_user_articles","options":["GET"],"path_template":"\/users\/{user_id}\/articles\/recent{-prefix|.|format}","rel":"recent","optional_params":["format"],"params":["user_id"]},{"name":"user_article","resource_templates":[{"name":"edit_user_article","options":["GET"],"path_template":"\/users\/{user_id}\/articles\/{article_id}\/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["user_id","article_id"]}],"options":["GET","PUT","DELETE"],"path_template":"\/users\/{user_id}\/articles\/{article_id}{-prefix|.|format}","optional_params":["format"],"params":["user_id","article_id"]}],"options":["GET","POST"],"path_template":"\/users\/{user_id}\/articles{-prefix|.|format}","rel":"articles","optional_params":["format"],"params":["user_id"]},{"name":"user_profile","resource_templates":[{"name":"edit_user_profile","options":["GET"],"path_template":"\/users\/{user_id}\/profile\/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["user_id"]},{"name":"new_user_profile","options":["GET"],"path_template":"\/users\/{user_id}\/profile\/new{-prefix|.|format}","rel":"new","optional_params":["format"],"params":["user_id"]}],"options":["GET","PUT","DELETE","POST"],"path_template":"\/users\/{user_id}\/profile{-prefix|.|format}","rel":"profile","optional_params":["format"],"params":["user_id"]}],"options":["GET","PUT","DELETE"],"path_template":"\/users\/{user_id}{-prefix|.|format}","optional_params":["format"],"params":["user_id"]}],"options":["GET","POST"],"path_template":"\/users{-prefix|.|format}","optional_params":["format"]}]
1
+ [{"name":"root","path_template":"/"},{"name":"admin_products","resource_templates":[{"name":"new_admin_product","options":["GET"],"path_template":"/admin/products/new{-prefix|.|format}","rel":"new_admin_product","optional_params":["format"]},{"name":"admin_product","resource_templates":[{"name":"edit_admin_product","options":["GET"],"path_template":"/admin/products/{product_id}/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["product_id"]}],"options":["GET","PUT","DELETE"],"path_template":"/admin/products/{product_id}{-prefix|.|format}","optional_params":["format"],"params":["product_id"]}],"options":["GET","POST"],"path_template":"/admin/products{-prefix|.|format}","optional_params":["format"]},{"name":"described_routes","resource_templates":[{"name":"new_described_route","options":["GET"],"path_template":"/described_routes/new{-prefix|.|format}","rel":"new_described_route","optional_params":["format"]},{"name":"described_route","resource_templates":[{"name":"edit_described_route","options":["GET"],"path_template":"/described_routes/{route_name}/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["route_name"]}],"options":["GET","PUT","DELETE"],"path_template":"/described_routes/{route_name}{-prefix|.|format}","optional_params":["format"],"params":["route_name"]}],"options":["GET","POST"],"path_template":"/described_routes{-prefix|.|format}","optional_params":["format"]},{"name":"pages","resource_templates":[{"name":"new_page","options":["GET"],"path_template":"/pages/new{-prefix|.|format}","rel":"new_page","optional_params":["format"]},{"name":"page","resource_templates":[{"name":"edit_page","options":["GET"],"path_template":"/pages/{page_id}/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["page_id"]},{"name":"summary_page","options":["GET"],"path_template":"/pages/{page_id}/summary{-prefix|.|format}","rel":"summary","optional_params":["format"],"params":["page_id"]},{"name":"toggle_visibility_page","options":["POST"],"path_template":"/pages/{page_id}/toggle_visibility{-prefix|.|format}","rel":"toggle_visibility","optional_params":["format"],"params":["page_id"]}],"options":["GET","PUT","DELETE"],"path_template":"/pages/{page_id}{-prefix|.|format}","optional_params":["format"],"params":["page_id"]}],"options":["GET","POST"],"path_template":"/pages{-prefix|.|format}","optional_params":["format"]},{"name":"users","resource_templates":[{"name":"new_user","options":["GET"],"path_template":"/users/new{-prefix|.|format}","rel":"new_user","optional_params":["format"]},{"name":"user","resource_templates":[{"name":"edit_user","options":["GET"],"path_template":"/users/{user_id}/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["user_id"]},{"name":"user_articles","resource_templates":[{"name":"new_user_article","options":["GET"],"path_template":"/users/{user_id}/articles/new{-prefix|.|format}","rel":"new_user_article","optional_params":["format"],"params":["user_id"]},{"name":"recent_user_articles","options":["GET"],"path_template":"/users/{user_id}/articles/recent{-prefix|.|format}","rel":"recent","optional_params":["format"],"params":["user_id"]},{"name":"user_article","resource_templates":[{"name":"edit_user_article","options":["GET"],"path_template":"/users/{user_id}/articles/{article_id}/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["user_id","article_id"]}],"options":["GET","PUT","DELETE"],"path_template":"/users/{user_id}/articles/{article_id}{-prefix|.|format}","optional_params":["format"],"params":["user_id","article_id"]}],"options":["GET","POST"],"path_template":"/users/{user_id}/articles{-prefix|.|format}","rel":"articles","optional_params":["format"],"params":["user_id"]},{"name":"user_profile","resource_templates":[{"name":"edit_user_profile","options":["GET"],"path_template":"/users/{user_id}/profile/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["user_id"]},{"name":"new_user_profile","options":["GET"],"path_template":"/users/{user_id}/profile/new{-prefix|.|format}","rel":"new","optional_params":["format"],"params":["user_id"]}],"options":["GET","PUT","DELETE","POST"],"path_template":"/users/{user_id}/profile{-prefix|.|format}","rel":"profile","optional_params":["format"],"params":["user_id"]}],"options":["GET","PUT","DELETE"],"path_template":"/users/{user_id}{-prefix|.|format}","optional_params":["format"],"params":["user_id"]}],"options":["GET","POST"],"path_template":"/users{-prefix|.|format}","optional_params":["format"]}]
@@ -1 +1 @@
1
- [{"name":"root","path_template":"\/","uri_template":"http:\/\/www.example.com\/"},{"name":"admin_products","resource_templates":[{"name":"new_admin_product","options":["GET"],"path_template":"\/admin\/products\/new{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/admin\/products\/new{-prefix|.|format}","rel":"new_admin_product","optional_params":["format"]},{"name":"admin_product","resource_templates":[{"name":"edit_admin_product","options":["GET"],"path_template":"\/admin\/products\/{product_id}\/edit{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/admin\/products\/{product_id}\/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["product_id"]}],"options":["GET","PUT","DELETE"],"path_template":"\/admin\/products\/{product_id}{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/admin\/products\/{product_id}{-prefix|.|format}","optional_params":["format"],"params":["product_id"]}],"options":["GET","POST"],"path_template":"\/admin\/products{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/admin\/products{-prefix|.|format}","optional_params":["format"]},{"name":"described_routes","resource_templates":[{"name":"new_described_route","options":["GET"],"path_template":"\/described_routes\/new{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/described_routes\/new{-prefix|.|format}","rel":"new_described_route","optional_params":["format"]},{"name":"described_route","resource_templates":[{"name":"edit_described_route","options":["GET"],"path_template":"\/described_routes\/{route_name}\/edit{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/described_routes\/{route_name}\/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["route_name"]}],"options":["GET","PUT","DELETE"],"path_template":"\/described_routes\/{route_name}{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/described_routes\/{route_name}{-prefix|.|format}","optional_params":["format"],"params":["route_name"]}],"options":["GET","POST"],"path_template":"\/described_routes{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/described_routes{-prefix|.|format}","optional_params":["format"]},{"name":"pages","resource_templates":[{"name":"new_page","options":["GET"],"path_template":"\/pages\/new{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/pages\/new{-prefix|.|format}","rel":"new_page","optional_params":["format"]},{"name":"page","resource_templates":[{"name":"edit_page","options":["GET"],"path_template":"\/pages\/{page_id}\/edit{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/pages\/{page_id}\/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["page_id"]},{"name":"summary_page","options":["GET"],"path_template":"\/pages\/{page_id}\/summary{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/pages\/{page_id}\/summary{-prefix|.|format}","rel":"summary","optional_params":["format"],"params":["page_id"]},{"name":"toggle_visibility_page","options":["POST"],"path_template":"\/pages\/{page_id}\/toggle_visibility{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/pages\/{page_id}\/toggle_visibility{-prefix|.|format}","rel":"toggle_visibility","optional_params":["format"],"params":["page_id"]}],"options":["GET","PUT","DELETE"],"path_template":"\/pages\/{page_id}{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/pages\/{page_id}{-prefix|.|format}","optional_params":["format"],"params":["page_id"]}],"options":["GET","POST"],"path_template":"\/pages{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/pages{-prefix|.|format}","optional_params":["format"]},{"name":"users","resource_templates":[{"name":"new_user","options":["GET"],"path_template":"\/users\/new{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/users\/new{-prefix|.|format}","rel":"new_user","optional_params":["format"]},{"name":"user","resource_templates":[{"name":"edit_user","options":["GET"],"path_template":"\/users\/{user_id}\/edit{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/users\/{user_id}\/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["user_id"]},{"name":"user_articles","resource_templates":[{"name":"new_user_article","options":["GET"],"path_template":"\/users\/{user_id}\/articles\/new{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/users\/{user_id}\/articles\/new{-prefix|.|format}","rel":"new_user_article","optional_params":["format"],"params":["user_id"]},{"name":"recent_user_articles","options":["GET"],"path_template":"\/users\/{user_id}\/articles\/recent{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/users\/{user_id}\/articles\/recent{-prefix|.|format}","rel":"recent","optional_params":["format"],"params":["user_id"]},{"name":"user_article","resource_templates":[{"name":"edit_user_article","options":["GET"],"path_template":"\/users\/{user_id}\/articles\/{article_id}\/edit{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/users\/{user_id}\/articles\/{article_id}\/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["user_id","article_id"]}],"options":["GET","PUT","DELETE"],"path_template":"\/users\/{user_id}\/articles\/{article_id}{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/users\/{user_id}\/articles\/{article_id}{-prefix|.|format}","optional_params":["format"],"params":["user_id","article_id"]}],"options":["GET","POST"],"path_template":"\/users\/{user_id}\/articles{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/users\/{user_id}\/articles{-prefix|.|format}","rel":"articles","optional_params":["format"],"params":["user_id"]},{"name":"user_profile","resource_templates":[{"name":"edit_user_profile","options":["GET"],"path_template":"\/users\/{user_id}\/profile\/edit{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/users\/{user_id}\/profile\/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["user_id"]},{"name":"new_user_profile","options":["GET"],"path_template":"\/users\/{user_id}\/profile\/new{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/users\/{user_id}\/profile\/new{-prefix|.|format}","rel":"new","optional_params":["format"],"params":["user_id"]}],"options":["GET","PUT","DELETE","POST"],"path_template":"\/users\/{user_id}\/profile{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/users\/{user_id}\/profile{-prefix|.|format}","rel":"profile","optional_params":["format"],"params":["user_id"]}],"options":["GET","PUT","DELETE"],"path_template":"\/users\/{user_id}{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/users\/{user_id}{-prefix|.|format}","optional_params":["format"],"params":["user_id"]}],"options":["GET","POST"],"path_template":"\/users{-prefix|.|format}","uri_template":"http:\/\/www.example.com\/users{-prefix|.|format}","optional_params":["format"]}]
1
+ [{"name":"root","path_template":"/","uri_template":"http://www.example.com/"},{"name":"admin_products","resource_templates":[{"name":"new_admin_product","options":["GET"],"path_template":"/admin/products/new{-prefix|.|format}","uri_template":"http://www.example.com/admin/products/new{-prefix|.|format}","rel":"new_admin_product","optional_params":["format"]},{"name":"admin_product","resource_templates":[{"name":"edit_admin_product","options":["GET"],"path_template":"/admin/products/{product_id}/edit{-prefix|.|format}","uri_template":"http://www.example.com/admin/products/{product_id}/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["product_id"]}],"options":["GET","PUT","DELETE"],"path_template":"/admin/products/{product_id}{-prefix|.|format}","uri_template":"http://www.example.com/admin/products/{product_id}{-prefix|.|format}","optional_params":["format"],"params":["product_id"]}],"options":["GET","POST"],"path_template":"/admin/products{-prefix|.|format}","uri_template":"http://www.example.com/admin/products{-prefix|.|format}","optional_params":["format"]},{"name":"described_routes","resource_templates":[{"name":"new_described_route","options":["GET"],"path_template":"/described_routes/new{-prefix|.|format}","uri_template":"http://www.example.com/described_routes/new{-prefix|.|format}","rel":"new_described_route","optional_params":["format"]},{"name":"described_route","resource_templates":[{"name":"edit_described_route","options":["GET"],"path_template":"/described_routes/{route_name}/edit{-prefix|.|format}","uri_template":"http://www.example.com/described_routes/{route_name}/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["route_name"]}],"options":["GET","PUT","DELETE"],"path_template":"/described_routes/{route_name}{-prefix|.|format}","uri_template":"http://www.example.com/described_routes/{route_name}{-prefix|.|format}","optional_params":["format"],"params":["route_name"]}],"options":["GET","POST"],"path_template":"/described_routes{-prefix|.|format}","uri_template":"http://www.example.com/described_routes{-prefix|.|format}","optional_params":["format"]},{"name":"pages","resource_templates":[{"name":"new_page","options":["GET"],"path_template":"/pages/new{-prefix|.|format}","uri_template":"http://www.example.com/pages/new{-prefix|.|format}","rel":"new_page","optional_params":["format"]},{"name":"page","resource_templates":[{"name":"edit_page","options":["GET"],"path_template":"/pages/{page_id}/edit{-prefix|.|format}","uri_template":"http://www.example.com/pages/{page_id}/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["page_id"]},{"name":"summary_page","options":["GET"],"path_template":"/pages/{page_id}/summary{-prefix|.|format}","uri_template":"http://www.example.com/pages/{page_id}/summary{-prefix|.|format}","rel":"summary","optional_params":["format"],"params":["page_id"]},{"name":"toggle_visibility_page","options":["POST"],"path_template":"/pages/{page_id}/toggle_visibility{-prefix|.|format}","uri_template":"http://www.example.com/pages/{page_id}/toggle_visibility{-prefix|.|format}","rel":"toggle_visibility","optional_params":["format"],"params":["page_id"]}],"options":["GET","PUT","DELETE"],"path_template":"/pages/{page_id}{-prefix|.|format}","uri_template":"http://www.example.com/pages/{page_id}{-prefix|.|format}","optional_params":["format"],"params":["page_id"]}],"options":["GET","POST"],"path_template":"/pages{-prefix|.|format}","uri_template":"http://www.example.com/pages{-prefix|.|format}","optional_params":["format"]},{"name":"users","resource_templates":[{"name":"new_user","options":["GET"],"path_template":"/users/new{-prefix|.|format}","uri_template":"http://www.example.com/users/new{-prefix|.|format}","rel":"new_user","optional_params":["format"]},{"name":"user","resource_templates":[{"name":"edit_user","options":["GET"],"path_template":"/users/{user_id}/edit{-prefix|.|format}","uri_template":"http://www.example.com/users/{user_id}/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["user_id"]},{"name":"user_articles","resource_templates":[{"name":"new_user_article","options":["GET"],"path_template":"/users/{user_id}/articles/new{-prefix|.|format}","uri_template":"http://www.example.com/users/{user_id}/articles/new{-prefix|.|format}","rel":"new_user_article","optional_params":["format"],"params":["user_id"]},{"name":"recent_user_articles","options":["GET"],"path_template":"/users/{user_id}/articles/recent{-prefix|.|format}","uri_template":"http://www.example.com/users/{user_id}/articles/recent{-prefix|.|format}","rel":"recent","optional_params":["format"],"params":["user_id"]},{"name":"user_article","resource_templates":[{"name":"edit_user_article","options":["GET"],"path_template":"/users/{user_id}/articles/{article_id}/edit{-prefix|.|format}","uri_template":"http://www.example.com/users/{user_id}/articles/{article_id}/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["user_id","article_id"]}],"options":["GET","PUT","DELETE"],"path_template":"/users/{user_id}/articles/{article_id}{-prefix|.|format}","uri_template":"http://www.example.com/users/{user_id}/articles/{article_id}{-prefix|.|format}","optional_params":["format"],"params":["user_id","article_id"]}],"options":["GET","POST"],"path_template":"/users/{user_id}/articles{-prefix|.|format}","uri_template":"http://www.example.com/users/{user_id}/articles{-prefix|.|format}","rel":"articles","optional_params":["format"],"params":["user_id"]},{"name":"user_profile","resource_templates":[{"name":"edit_user_profile","options":["GET"],"path_template":"/users/{user_id}/profile/edit{-prefix|.|format}","uri_template":"http://www.example.com/users/{user_id}/profile/edit{-prefix|.|format}","rel":"edit","optional_params":["format"],"params":["user_id"]},{"name":"new_user_profile","options":["GET"],"path_template":"/users/{user_id}/profile/new{-prefix|.|format}","uri_template":"http://www.example.com/users/{user_id}/profile/new{-prefix|.|format}","rel":"new","optional_params":["format"],"params":["user_id"]}],"options":["GET","PUT","DELETE","POST"],"path_template":"/users/{user_id}/profile{-prefix|.|format}","uri_template":"http://www.example.com/users/{user_id}/profile{-prefix|.|format}","rel":"profile","optional_params":["format"],"params":["user_id"]}],"options":["GET","PUT","DELETE"],"path_template":"/users/{user_id}{-prefix|.|format}","uri_template":"http://www.example.com/users/{user_id}{-prefix|.|format}","optional_params":["format"],"params":["user_id"]}],"options":["GET","POST"],"path_template":"/users{-prefix|.|format}","uri_template":"http://www.example.com/users{-prefix|.|format}","optional_params":["format"]}]
@@ -30,7 +30,7 @@ class DescribedRoutesRunTimeTest < ActionController::IntegrationTest
30
30
  end
31
31
 
32
32
  def test_partial_expand
33
- get "/described_routes/new_user_profile.text?user_id=dojo&format=json"
33
+ get "/described_routes/new_user_profile.text", "user_id" => "dojo", "format" => "json"
34
34
  assert_equal("new_user_profile new_user_profile GET http://www.example.com/users/dojo/profile/new.json", body.chomp)
35
35
  end
36
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: described_routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Burrows
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-30 00:00:00 +01:00
12
+ date: 2009-08-02 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -58,6 +58,8 @@ description: |-
58
58
  * A link header-based discovery protocol, enabling clients to find <code>ResourceTemplate</code> metadata from the resources of any enabled controller
59
59
  * Easy integration with Rails
60
60
  * JSON, YAML and XML formats, also a bonus plain text report
61
+
62
+ ATTENTION: 0.8.0 adds Rails integration via Rack middleware; the Rails controller and helpers are hereby deprecated!
61
63
  email:
62
64
  - mjb@asplake.co.uk
63
65
  executables: []
@@ -149,7 +151,7 @@ rubyforge_project: describedroutes
149
151
  rubygems_version: 1.3.5
150
152
  signing_key:
151
153
  specification_version: 3
152
- summary: "Features: * Dynamic, framework-neutral, client-friendly <code>ResourceTemplate</code> metadata describing the path/URI structures of your whole site or of specific resources * A link header-based discovery protocol, enabling clients to find <code>ResourceTemplate</code> metadata from the resources of any enabled controller * Easy integration with Rails * JSON, YAML and XML formats, also a bonus plain text report"
154
+ summary: "Features: * Dynamic, framework-neutral, client-friendly <code>ResourceTemplate</code> metadata describing the path/URI structures of your whole site or of specific resources * A link header-based discovery protocol, enabling clients to find <code>ResourceTemplate</code> metadata from the resources of any enabled controller * Easy integration with Rails * JSON, YAML and XML formats, also a bonus plain text report ATTENTION: 0.8.0 adds Rails integration via Rack middleware; the Rails controller and helpers are hereby deprecated!"
153
155
  test_files:
154
156
  - test/test_described_routes.rb
155
157
  - test/test_helper.rb