described_routes 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.rdoc +22 -0
  2. data/lib/described_routes.rb +1 -1
  3. metadata +1 -1
data/README.rdoc CHANGED
@@ -6,6 +6,8 @@ Outputs hierarchical, framework-neutral descriptions of Rails routes in JSON, YA
6
6
 
7
7
  == SYNOPSIS:
8
8
 
9
+ === Build-time output
10
+
9
11
  In your Rakefile:
10
12
 
11
13
  require 'tasks/described_routes'
@@ -50,6 +52,25 @@ For a flavour, try the short form:
50
52
 
51
53
  The above YAML is an abbreviated form that shows only name, rel, path_template for each resource in the hierarchy. The full form includes parameter lists (both mandatory and optional) and options (i.e. HTTP methods).
52
54
 
55
+ === Run time
56
+
57
+ Include the controller, perhaps in an initializer:
58
+
59
+ require 'described_routes/rails_controller'
60
+
61
+ Add the following route in config/routes.rb:
62
+
63
+ map.resources :described_routes, :controller => "described_routes/rails"
64
+
65
+ You (or your client application) can now browse to any of the following:
66
+
67
+ * .../described_routes.json
68
+ * .../described_routes.xml
69
+ * .../described_routes.yaml
70
+ * .../described_routes.yaml?short=true
71
+
72
+ If the application has a route named "root", run-time-generated data will include URI templates based on root_url.
73
+
53
74
  == DATA STRUCTURES and FORMATS
54
75
 
55
76
  === Natural structure
@@ -62,6 +83,7 @@ Attributes:
62
83
  +rel+:: An indication of a child resource's relationship to its parent
63
84
  +options+:: A list of HTTP methods supported by the resource
64
85
  +path_template+:: A template for the resource's path, in the style of URI Template but as a relative path
86
+ +uri_template+:: A template for the resource's URI (generated only if the root URI is known at generation time)
65
87
  +params+:: A list of parameters required by path_template
66
88
  +optional_params+:: A list of optional parameters that may be incorporated by the path_template
67
89
 
@@ -2,7 +2,7 @@ require 'described_routes/resource_template'
2
2
 
3
3
  module DescribedRoutes
4
4
  # rubygem version
5
- VERSION = "0.1.3"
5
+ VERSION = "0.1.4"
6
6
 
7
7
  # Convert an array of ResourceTemplate objects to array of hashes equivalent to their JSON or YAML representations
8
8
  def self.to_parsed(resource_templates)
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.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Burrows