restrack 0.1.0 → 0.1.1

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 +63 -29
  2. data/lib/restrack/version.rb +1 -1
  3. metadata +3 -3
data/README.rdoc CHANGED
@@ -1,7 +1,7 @@
1
1
  = RESTRack
2
2
 
3
3
  == Description:
4
- RESTRack is a Rack based MVC framework that makes it extremely easy to develop RESTful data services. It is inspired
4
+ RESTRack is a Rack-based MVC framework that makes it extremely easy to develop RESTful data services. It is inspired
5
5
  by Rails, and follows a few of its conventions. But it has no routes file, routing relationships are done through
6
6
  supplying custom code blocks to class methods such as 'has_relationship_to' or 'has_mapped_relationships_to'.
7
7
  RESTRack aims at being lightweight and easy to use. It will automatically render JSON and XML for the data
@@ -52,11 +52,13 @@
52
52
  Defining a controller for a resource means that you plan to expose that resource to requests to your service.
53
53
  Defining a controller relationship means that you plan to expose a path from this resource to another.
54
54
 
55
+ === 'pass_through_to'
55
56
  An open, or pass-through, path can be defined via the 'pass_through_to' class method for resource controllers. This
56
57
  exposes URL patterns like the following:
57
58
  GET /foo/123/bar/234 <= simple pass-through from Foo 123 to show Bar 234
58
59
  GET /foo/123/bar <= simple pass-through from Foo 123 to Bar index
59
60
 
61
+ === 'has_relationship_to'
60
62
  A direct path to a single related resource's controller can be defined with the 'has_relationship_to' method. This
61
63
  allows you to define a one-to-one relationship from this resource to a related resource, which means that the id of
62
64
  the related resource is implied through the id of the caller. The caller has one relation through a custom code block
@@ -71,6 +73,7 @@
71
73
  PUT /people/Henry/spouse <= direct route to update Henry's spouse
72
74
  POST /people/Jane/spouse <= direct route to add Jane's spouse
73
75
 
76
+ === 'has_relationships_to' and 'has_defined_relationships_to'
74
77
  A direct path to many related resources' controller can be defined with the 'has_relationships_to' and
75
78
  'has_defined_relationships_to' methods. These allows you to define one-to-many relationships. They work similar to
76
79
  'has_relationship_to', except that they accept code blocks which evaluate to arrays of related child ids. Each
@@ -88,6 +91,7 @@
88
91
  GET /people/Nancy/children/George <= direct route to show child 0
89
92
  DELETE /people/Robert/children/John <= direct route to destroy child 100
90
93
 
94
+ === 'has_mapped_relationships_to'
91
95
  Multiple named one-to-many relationships can be exposed with the 'has_mapped_relationships_to' method. This allows
92
96
  you to define many named or keyword paths to related resources. The method's code block should accepts the parent id
93
97
  and return a hash where the keys are your relationship names and the values are the child resource ids. For example,
@@ -111,37 +115,67 @@
111
115
  default data type of String is used if a different type is not specified.
112
116
 
113
117
 
114
- == Miscellaneous Details
118
+ == Logging/Logging Level
119
+ RESTRack logs to two logs, the standard log (or error log) and the request log. Paths and logging levels for these
120
+ can be configured in config/constants.yaml. RESTRack uses Logger from Ruby-stdlib.
121
+
122
+ == XML Serialization
123
+ RESTRack will convert the data structures that your actions return to JSON by default. You can change the default
124
+ by setting :DEFAULT_FORMAT to :XML in config/constants.yml.
125
+
126
+ === With XmlSimple
127
+ RESTRack will attempt to serialize the data structures that your action methods return automatically using the
128
+ xml-simple gem.
129
+
130
+ === With Builder
131
+ Custom XML serialization can be done by providing Builder gem templates in views/<controller>/<action>.xml.builder
115
132
 
116
- === Logging/Logging Level
117
- RESTRack logs to two logs, the standard log (or error log) and the request log. Paths and logging levels for these
118
- can be configured in config/constants.yaml. RESTRack uses Logger from Ruby-stdlib.
119
-
120
- === XML Serialization
121
- RESTRack will convert the data structures that your actions return to JSON by default. You can change the default
122
- by setting :DEFAULT_FORMAT to :XML in config/constants.yml.
123
133
 
124
- ==== With XmlSimple
125
- RESTRack will attempt to serialize the data structures that your action methods return automatically using the
126
- xml-simple gem.
127
-
128
- ==== With Builder
129
- Custom XML serialization can be done by providing Builder gem templates in views/<controller>/<action>.xml.builder
130
-
131
- === Inputs
132
- ==== Query string parameters
133
- Available to controllers in the @params instance variable.
134
- ==== POST data
135
- Available to controllers in the @input instance variable.
136
- === :DEFAULT_RESOURCE
134
+ == Inputs
135
+
136
+ === Query string parameters
137
+ Available to controllers in the @params instance variable.
138
+
139
+ === POST data
140
+ Available to controllers in the @input instance variable.
141
+
142
+
143
+ == Constant Definition (config/constants.yaml)
144
+
145
+ === Required Configuration Settings
146
+ ==== :LOG
147
+ Sets the location of the error log.
148
+
149
+ ==== :REQUEST_LOG
150
+ Sets the location of the request log.
151
+
152
+ ==== :LOG_LEVEL
153
+ Sets the the logging level of the error log, based on the Ruby Logger object. Supply these as a symbol, with valid
154
+ values being :DEBUG, :INFO, :WARN, etc.
155
+
156
+ ==== :REQUEST_LOG_LEVEL
157
+ Sets the the logging level of the request log, similar to :LOG_LEVEL.
158
+
159
+ === Optional Configuration Settings
160
+ ==== :DEFAULT_FORMAT
161
+ Sets the default format for the response. This is the format that the response will take if no extension is
162
+ appended to the request string (i.e. /foo/123 rather than /foo/123.xml). Services will have a default format of JSON
163
+ if this configuration option is not defined.
164
+
165
+ ==== :DEFAULT_RESOURCE
137
166
  Set this option in config/constants.yaml to use an implied root resource controller.
138
- :DEFAULT_RESOURCE: foo # /foo/123 could be accessed with /123, /foo could be accessed with /
139
-
140
- === :ROOT_RESOURCE_ACCEPT / :ROOT_RESOURCE_DENY
141
- :ROOT_RESOURCE_ACCEPT: [ 'foo', 'bar' ] # OPTIONAL
142
- defines an array of resources that can be accessed (without being proxied through another relation).
143
- :ROOT_RESOURCE_DENY: [ 'baz' ] # OPTIONAL
144
- defines an array of resources that cannot be accessed without proxying though another controller.
167
+ :DEFAULT_RESOURCE: foo
168
+ # /foo/123 could be accessed with /123
169
+ # /foo could be accessed with /
170
+
171
+ ==== :ROOT_RESOURCE_ACCEPT
172
+ :ROOT_RESOURCE_ACCEPT: [ 'foo', 'bar' ]
173
+ defines an array of resources that can be accessed (without being proxied through another relation).
174
+
175
+
176
+ ==== :ROOT_RESOURCE_DENY
177
+ :ROOT_RESOURCE_DENY: [ 'baz' ]
178
+ defines an array of resources that cannot be accessed without proxying though another controller.
145
179
 
146
180
 
147
181
  == License:
@@ -1,3 +1,3 @@
1
1
  module RESTRack
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Chris St. John
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-02-05 00:00:00 -05:00
17
+ date: 2011-02-06 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency