giraffesoft-classy_resources 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,5 +1,7 @@
1
1
  = Classy Resources
2
2
 
3
+ With a simple, declarative syntax, you can create active_resource compatible REST APIs incredibly quickly.
4
+
3
5
  Think resource_controller, except for Sinatra.
4
6
 
5
7
  = Installation
@@ -29,6 +31,28 @@ The above declaration will create the five actions specified, each responding to
29
31
 
30
32
  Since ClassyResources was designed to be active resource compatible, the params formats and return values are what AR expects.
31
33
 
34
+ = Overrides
35
+
36
+ In the above example, :posts would map to a Post class. If your class is named differently, you just override class_for. For example, if your Post class was stored in a module:
37
+
38
+ def class_for(resource)
39
+ MyModule.const_get(resource.to_s.singularize.classify.constantize)
40
+ end
41
+
42
+ Or, if you wanted to change how objects were being serialized:
43
+
44
+ def serialize(object, format)
45
+ MySerializer.new(object, format).to_s
46
+ end
47
+
48
+ Other method signatures you might want to override:
49
+
50
+ - def load_collection(resource)
51
+ - def build_object(resource, params)
52
+ - def load_object(resource, id)
53
+ - def update_object(object, params) # Note that this doesn't save. It just changes the attributes.
54
+ - def destroy_object(object)
55
+
32
56
  == Copyright
33
57
 
34
58
  Copyright (c) 2008 James Golick, Daniel Haran, GiraffeSoft Inc.. See LICENSE for details.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 0
2
+ :patch: 1
3
3
  :major: 0
4
4
  :minor: 3
@@ -1,5 +1,6 @@
1
1
  dir = File.expand_path(File.dirname(__FILE__))
2
2
  $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
3
+ require 'active_support'
3
4
  require 'classy_resources/mime_type'
4
5
  require 'classy_resources/post_body_params'
5
6
 
@@ -1,4 +1,5 @@
1
1
  require 'rubygems'
2
+ gem 'activerecord', '2.2.2'
2
3
  require 'activerecord'
3
4
  require 'sinatra'
4
5
  require 'classy_resources/active_record'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: giraffesoft-classy_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Golick
@@ -9,10 +9,29 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-30 00:00:00 -08:00
12
+ date: 2009-02-16 00:00:00 -08:00
13
13
  default_executable:
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: activesupport
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - "="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.2.2
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: sinatra-sinatra
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 0.9.0.4
34
+ version:
16
35
  description: TODO
17
36
  email: james@giraffesoft.ca
18
37
  executables: []
@@ -64,6 +83,6 @@ rubyforge_project:
64
83
  rubygems_version: 1.2.0
65
84
  signing_key:
66
85
  specification_version: 2
67
- summary: TODO
86
+ summary: Instant ActiveResource compatible resources. Think resource_controller, for sinatra.
68
87
  test_files: []
69
88