activeresource 3.0.0.rc2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activeresource might be problematic. Click here for more details.
- data/CHANGELOG +1 -19
- data/README.rdoc +1 -1
- data/lib/active_resource/base.rb +5 -5
- data/lib/active_resource/http_mock.rb +6 -2
- data/lib/active_resource/version.rb +1 -2
- metadata +12 -17
data/CHANGELOG
CHANGED
@@ -1,25 +1,7 @@
|
|
1
|
-
*Rails 3.0.0
|
2
|
-
|
3
|
-
* No material changes (see http://github.com/rails/rails/compare/v3.0.0_RC...v3.0.0_RC2 for gory details)
|
4
|
-
|
5
|
-
|
6
|
-
*Rails 3.0.0 [release candidate] (July 26th, 2010)*
|
7
|
-
|
8
|
-
* No material changes
|
9
|
-
|
10
|
-
|
11
|
-
*Rails 3.0.0 [beta 4] (June 8th, 2010)*
|
1
|
+
*Rails 3.0.0 (August 29, 2010)*
|
12
2
|
|
13
3
|
* JSON: set Base.include_root_in_json = true to include a root value in the JSON: {"post": {"title": ...}}. Mirrors the Active Record option. [Santiago Pastorino]
|
14
4
|
|
15
|
-
|
16
|
-
*Rails 3.0.0 [beta 3] (April 13th, 2010)*
|
17
|
-
|
18
|
-
* No changes
|
19
|
-
|
20
|
-
|
21
|
-
*Rails 3.0.0 [beta 1] (February 4, 2010)*
|
22
|
-
|
23
5
|
* Add support for errors in JSON format. #1956 [Fabien Jakimowicz]
|
24
6
|
|
25
7
|
* Recognizes 410 as Resource Gone. #2316 [Jordan Brough, Jatinder Singh]
|
data/README.rdoc
CHANGED
@@ -30,7 +30,7 @@ that inherits from ActiveResource::Base and providing a <tt>site</tt> class vari
|
|
30
30
|
end
|
31
31
|
|
32
32
|
Now the Person class is REST enabled and can invoke REST services very similarly to how Active Record invokes
|
33
|
-
|
33
|
+
life cycle methods that operate against a persistent store.
|
34
34
|
|
35
35
|
# Find a person with id = 1
|
36
36
|
ryan = Person.find(1)
|
data/lib/active_resource/base.rb
CHANGED
@@ -21,7 +21,7 @@ require 'active_resource/log_subscriber'
|
|
21
21
|
module ActiveResource
|
22
22
|
# ActiveResource::Base is the main class for mapping RESTful resources as models in a Rails application.
|
23
23
|
#
|
24
|
-
# For an outline of what Active Resource is capable of, see link:files/
|
24
|
+
# For an outline of what Active Resource is capable of, see its {README}[link:files/activeresource/README_rdoc.html].
|
25
25
|
#
|
26
26
|
# == Automated mapping
|
27
27
|
#
|
@@ -35,7 +35,7 @@ module ActiveResource
|
|
35
35
|
# end
|
36
36
|
#
|
37
37
|
# Now the Person class is mapped to RESTful resources located at <tt>http://api.people.com:3000/people/</tt>, and
|
38
|
-
# you can now use Active Resource's
|
38
|
+
# you can now use Active Resource's life cycle methods to manipulate resources. In the case where you already have
|
39
39
|
# an existing model with the same name as the desired RESTful resource you can set the +element_name+ value.
|
40
40
|
#
|
41
41
|
# class PersonResource < ActiveResource::Base
|
@@ -51,7 +51,7 @@ module ActiveResource
|
|
51
51
|
# end
|
52
52
|
#
|
53
53
|
#
|
54
|
-
# ==
|
54
|
+
# == Life cycle methods
|
55
55
|
#
|
56
56
|
# Active Resource exposes methods for creating, finding, updating, and deleting resources
|
57
57
|
# from REST web services.
|
@@ -70,12 +70,12 @@ module ActiveResource
|
|
70
70
|
#
|
71
71
|
# ryan.destroy # => true
|
72
72
|
#
|
73
|
-
# As you can see, these are very similar to Active Record's
|
73
|
+
# As you can see, these are very similar to Active Record's life cycle methods for database records.
|
74
74
|
# You can read more about each of these methods in their respective documentation.
|
75
75
|
#
|
76
76
|
# === Custom REST methods
|
77
77
|
#
|
78
|
-
# Since simple CRUD/
|
78
|
+
# Since simple CRUD/life cycle methods can't accomplish every task, Active Resource also supports
|
79
79
|
# defining your own custom REST methods. To invoke them, Active Resource provides the <tt>get</tt>,
|
80
80
|
# <tt>post</tt>, <tt>put</tt> and <tt>\delete</tt> methods where you can specify a custom REST method
|
81
81
|
# name to invoke.
|
@@ -126,7 +126,7 @@ module ActiveResource
|
|
126
126
|
# if response = self.class.responses.assoc(request)
|
127
127
|
# response[1]
|
128
128
|
# else
|
129
|
-
# raise InvalidRequestError.new("
|
129
|
+
# raise InvalidRequestError.new("Could not find a response recorded for #{request.to_s} - Responses recorded are: - #{inspect_responses}")
|
130
130
|
# end
|
131
131
|
# end
|
132
132
|
module_eval <<-EOE, __FILE__, __LINE__ + 1
|
@@ -136,7 +136,7 @@ module ActiveResource
|
|
136
136
|
if response = self.class.responses.assoc(request)
|
137
137
|
response[1]
|
138
138
|
else
|
139
|
-
raise InvalidRequestError.new("
|
139
|
+
raise InvalidRequestError.new("Could not find a response recorded for \#{request.to_s} - Responses recorded are: \#{inspect_responses}")
|
140
140
|
end
|
141
141
|
end
|
142
142
|
EOE
|
@@ -146,6 +146,10 @@ module ActiveResource
|
|
146
146
|
def initialize(site) #:nodoc:
|
147
147
|
@site = site
|
148
148
|
end
|
149
|
+
|
150
|
+
def inspect_responses #:nodoc:
|
151
|
+
self.class.responses.map { |r| r[0].to_s }.inspect
|
152
|
+
end
|
149
153
|
end
|
150
154
|
|
151
155
|
class Request
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeresource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 7
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
9
|
- 0
|
10
|
-
|
11
|
-
version: 3.0.0.rc2
|
10
|
+
version: 3.0.0
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- David Heinemeier Hansson
|
@@ -16,7 +15,7 @@ autorequire:
|
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-29 00:00:00 -05:00
|
20
19
|
default_executable:
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
@@ -27,13 +26,12 @@ dependencies:
|
|
27
26
|
requirements:
|
28
27
|
- - "="
|
29
28
|
- !ruby/object:Gem::Version
|
30
|
-
hash:
|
29
|
+
hash: 7
|
31
30
|
segments:
|
32
31
|
- 3
|
33
32
|
- 0
|
34
33
|
- 0
|
35
|
-
|
36
|
-
version: 3.0.0.rc2
|
34
|
+
version: 3.0.0
|
37
35
|
type: :runtime
|
38
36
|
version_requirements: *id001
|
39
37
|
- !ruby/object:Gem::Dependency
|
@@ -44,13 +42,12 @@ dependencies:
|
|
44
42
|
requirements:
|
45
43
|
- - "="
|
46
44
|
- !ruby/object:Gem::Version
|
47
|
-
hash:
|
45
|
+
hash: 7
|
48
46
|
segments:
|
49
47
|
- 3
|
50
48
|
- 0
|
51
49
|
- 0
|
52
|
-
|
53
|
-
version: 3.0.0.rc2
|
50
|
+
version: 3.0.0
|
54
51
|
type: :runtime
|
55
52
|
version_requirements: *id002
|
56
53
|
description: REST on Rails. Wrap your RESTful web app with Ruby classes and work with them like Active Record models.
|
@@ -104,14 +101,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
102
|
none: false
|
106
103
|
requirements:
|
107
|
-
- - "
|
104
|
+
- - ">="
|
108
105
|
- !ruby/object:Gem::Version
|
109
|
-
hash:
|
106
|
+
hash: 3
|
110
107
|
segments:
|
111
|
-
-
|
112
|
-
|
113
|
-
- 1
|
114
|
-
version: 1.3.1
|
108
|
+
- 0
|
109
|
+
version: "0"
|
115
110
|
requirements: []
|
116
111
|
|
117
112
|
rubyforge_project: activeresource
|