restrack 0.1.3 → 0.1.4

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/README.markdown CHANGED
@@ -1,4 +1,5 @@
1
- # RESTRack: serving JSON and XML with REST and pleasure.
1
+ # RESTRack
2
+ - serving JSON and XML with REST and pleasure.
2
3
 
3
4
  ## Description:
4
5
  RESTRack is a [Rack](http://rack.rubyforge.org/)-based [MVC](http://en.wikipedia.org/wiki/Model%E2%80%93View%E2%80%93Controller)
@@ -28,8 +29,8 @@ framework. The primary goal of of the development of RESTRack was to add as lit
28
29
  the web developer a good application space for developing JSON and XML services.
29
30
 
30
31
  Rails 3 instantiates approximately 80K more objects than RESTRack to do a hello world or nothing type response with
31
- the default setup. Trimming Rails down to just ActionController, by eliminating ActiveRecord, ActionMailer, and
32
- ActiveResource, it still instantiates over 47K more objects than RESTRack.
32
+ the default setup. Trimming Rails down by eliminating ActiveRecord, ActionMailer, and ActiveResource, it still
33
+ instantiates over 47K more objects than RESTRack.
33
34
 
34
35
 
35
36
  ## CLI Usage:
@@ -166,13 +167,13 @@ Custom XML serialization can be done by providing Builder gem templates in `view
166
167
  ## Inputs
167
168
 
168
169
  ### Query string parameters
169
- Available to controllers in the @params instance variable.
170
+ Available to controllers in the `@params` instance variable.
170
171
 
171
172
  ### POST data
172
- Available to controllers in the @input instance variable.
173
+ Available to controllers in the `@input` instance variable.
173
174
 
174
175
 
175
- ## Constant Definition (config/constants.yaml)
176
+ ## Constant Definition \(`config/constants.yaml`\)
176
177
 
177
178
  ### Required Configuration Settings
178
179
  #### :LOG
@@ -186,32 +187,35 @@ Sets the the logging level of the error log, based on the Ruby Logger object. S
186
187
  values being :DEBUG, :INFO, :WARN, etc.
187
188
 
188
189
  #### :REQUEST\_LOG\_LEVEL
189
- Sets the the logging level of the request log, similar to :LOG_LEVEL.
190
+ Sets the the logging level of the request log, similar to :LOG\_LEVEL.
190
191
 
191
192
  ### Optional Configuration Settings
192
193
  #### :DEFAULT\_FORMAT
193
194
  Sets the default format for the response. This is the format that the response will take if no extension is appended to
194
- the request string (i.e. /foo/123 rather than /foo/123.xml). Services will have a default format of JSON if this
195
+ the request string \(i.e. `/foo/123` rather than `/foo/123.xml`\). Services will have a default format of JSON if this
195
196
  configuration option is not defined.
196
197
 
197
198
  #### :DEFAULT\_RESOURCE
198
- Set this option in config/constants.yaml to use an implied root resource controller.
199
+ Set this option in config/constants.yaml to use an implied root resource controller. To make `/foo/123` also be accessible
200
+ at `/123`:
201
+
202
+ :DEFAULT_RESOURCE: foo
199
203
 
200
- :DEFAULT_RESOURCE: foo
201
- # /foo/123 could be accessed with /123
202
- # /foo could be accessed with /
203
204
 
204
205
  #### :ROOT\_RESOURCE\_ACCEPT
206
+ This defines an array of resources that can be accessed as the first resource in the URL chain, without being proxied
207
+ through another relation.
208
+
205
209
  :ROOT_RESOURCE_ACCEPT: [ 'foo', 'bar' ]
206
- # defines an array of resources that can be accessed (without being proxied through another relation).
207
210
 
208
211
 
209
212
  #### :ROOT\_RESOURCE\_DENY
213
+ This defines an array of resources that cannot be accessed without proxying though another controller.
214
+
210
215
  :ROOT_RESOURCE_DENY: [ 'baz' ]
211
- # defines an array of resources that cannot be accessed without proxying though another controller.
212
216
 
213
217
 
214
- ## License:
218
+ ## License
215
219
 
216
220
  Copyright (c) 2010 Chris St. John
217
221
 
@@ -74,7 +74,7 @@ module RESTRack
74
74
  if request_mime_type.like?( RESTRack.mime_type_for( :JSON ) )
75
75
  input = JSON.parse( input )
76
76
  elsif request_mime_type.like?( RESTRack.mime_type_for( :XML ) )
77
- input = XmlSimple.xml_in( input )
77
+ input = XmlSimple.xml_in( input, 'ForceArray' => false )
78
78
  elsif request_mime_type.like?( RESTRack.mime_type_for( :YAML ) )
79
79
  input = YAML.parse( input )
80
80
  end
@@ -1,3 +1,3 @@
1
1
  module RESTRack
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -1,5 +1,8 @@
1
1
  module RESTRack
2
2
  class WebService
3
+ # TODO: Fix logging, routes duplicated
4
+ # TODO: only one "info" level log for 200 to request log or one "warn" for <500 or "error" for 500, all else goes to error log
5
+ # request log data should contain status code, request IP address, request path, request_id
3
6
 
4
7
  # Establish the namespace pointer.
5
8
  def initialize
data/lib/restrack.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  %w[
2
2
  rack
3
3
  logger
4
+ pp
4
5
  find
5
6
  yaml
6
7
  rubygems
data/restrack.gemspec CHANGED
@@ -32,7 +32,7 @@ requests will then render the view template with the builder gem, rather than ge
32
32
  s.require_paths = ["lib"]
33
33
 
34
34
  s.add_runtime_dependency 'rack'
35
- s.add_runtime_dependency 'rack-test'
35
+ s.add_development_dependency 'rack-test'
36
36
  s.add_runtime_dependency 'i18n'
37
37
  s.add_runtime_dependency 'json'
38
38
  s.add_runtime_dependency 'xml-simple', '>= 1.0.13'
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: restrack
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.3
5
+ version: 0.1.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Chris St. John
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-13 00:00:00 -05:00
13
+ date: 2011-03-27 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -33,7 +33,7 @@ dependencies:
33
33
  - - ">="
34
34
  - !ruby/object:Gem::Version
35
35
  version: "0"
36
- type: :runtime
36
+ type: :development
37
37
  version_requirements: *id002
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: i18n