activeresource 3.1.1 → 3.1.2.rc1

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.

@@ -0,0 +1,329 @@
1
+ ## Rails 3.1.1 (October 7, 2011) ##
2
+
3
+ * No changes
4
+
5
+
6
+ ## Rails 3.1.0 (August 30, 2011) ##
7
+
8
+ * The default format has been changed to JSON for all requests. If you want to continue to use XML you will need to set `self.format = :xml` in the class. eg.
9
+
10
+ class User < ActiveResource::Base
11
+ self.format = :xml
12
+ end
13
+
14
+
15
+ ## Rails 3.0.7 (April 18, 2011) ##
16
+
17
+ * No changes.
18
+
19
+
20
+ * Rails 3.0.6 (April 5, 2011)
21
+
22
+ * No changes.
23
+
24
+
25
+ ## Rails 3.0.5 (February 26, 2011) ##
26
+
27
+ * No changes.
28
+
29
+
30
+ ## Rails 3.0.4 (February 8, 2011) ##
31
+
32
+ * No changes.
33
+
34
+
35
+ ## Rails 3.0.3 (November 16, 2010) ##
36
+
37
+ * No changes.
38
+
39
+
40
+ ## Rails 3.0.2 (November 15, 2010) ##
41
+
42
+ * No changes
43
+
44
+
45
+ ## Rails 3.0.1 (October 15, 2010) ##
46
+
47
+ * No Changes, just a version bump.
48
+
49
+
50
+ ## Rails 3.0.0 (August 29, 2010) ##
51
+
52
+ * 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*
53
+
54
+ * Add support for errors in JSON format. #1956 *Fabien Jakimowicz*
55
+
56
+ * Recognizes 410 as Resource Gone. #2316 *Jordan Brough, Jatinder Singh*
57
+
58
+ * More thorough SSL support. #2370 *Roy Nicholson*
59
+
60
+ * HTTP proxy support. #2133 *Marshall Huss, Sébastien Dabet*
61
+
62
+
63
+ ## 2.3.2 Final (March 15, 2009) ##
64
+
65
+ * Nothing new, just included in 2.3.2
66
+
67
+
68
+ ## 2.2.1 RC2 (November 14th, 2008) ##
69
+
70
+ * Fixed that ActiveResource#post would post an empty string when it shouldn't be posting anything #525 *Paolo Angelini*
71
+
72
+
73
+ ## 2.2.0 RC1 (October 24th, 2008) ##
74
+
75
+ * Add ActiveResource::Base#to_xml and ActiveResource::Base#to_json. #1011 *Rasik Pandey, Cody Fauser*
76
+
77
+ * Add ActiveResource::Base.find(:last). [#754 state:resolved] (Adrian Mugnolo)
78
+
79
+ * Fixed problems with the logger used if the logging string included %'s [#840 state:resolved] (Jamis Buck)
80
+
81
+ * Fixed Base#exists? to check status code as integer [#299 state:resolved] (Wes Oldenbeuving)
82
+
83
+
84
+ ## 2.1.0 (May 31st, 2008) ##
85
+
86
+ * Fixed response logging to use length instead of the entire thing (seangeo) *#27*
87
+
88
+ * Fixed that to_param should be used and honored instead of hardcoding the id #11406 *gspiers*
89
+
90
+ * Improve documentation. *Ryan Bigg, Jan De Poorter, Cheah Chu Yeow, Xavier Shay, Jack Danger Canty, Emilio Tagua, Xavier Noria, Sunny Ripert*
91
+
92
+ * Use HEAD instead of GET in exists? *bscofield*
93
+
94
+ * Fix small documentation typo. Closes #10670 *Luca Guidi*
95
+
96
+ * find_or_create_resource_for handles module nesting. #10646 *xavier*
97
+
98
+ * Allow setting ActiveResource::Base#format before #site. *Rick Olson*
99
+
100
+ * Support agnostic formats when calling custom methods. Closes #10635 *joerichsen*
101
+
102
+ * Document custom methods. #10589 *Cheah Chu Yeow*
103
+
104
+ * Ruby 1.9 compatibility. *Jeremy Kemper*
105
+
106
+
107
+ ## 2.0.2 (December 16th, 2007) ##
108
+
109
+ * Added more specific exceptions for 400, 401, and 403 (all descending from ClientError so existing rescues will work) #10326 *trek*
110
+
111
+ * Correct empty response handling. #10445 *seangeo*
112
+
113
+
114
+ ## 2.0.1 (December 7th, 2007) ##
115
+
116
+ * Don't cache net/http object so that ActiveResource is more thread-safe. Closes #10142 *kou*
117
+
118
+ * Update XML documentation examples to include explicit type attributes. Closes #9754 *Josh Susser*
119
+
120
+ * Added one-off declarations of mock behavior [David Heinemeier Hansson]. Example:
121
+
122
+ Before:
123
+ ActiveResource::HttpMock.respond_to do |mock|
124
+ mock.get "/people/1.xml", {}, "<person><name>David</name></person>"
125
+ end
126
+
127
+ Now:
128
+ ActiveResource::HttpMock.respond_to.get "/people/1.xml", {}, "<person><name>David</name></person>"
129
+
130
+ * Added ActiveResource.format= which defaults to :xml but can also be set to :json [David Heinemeier Hansson]. Example:
131
+
132
+ class Person < ActiveResource::Base
133
+ self.site = "http://app/"
134
+ self.format = :json
135
+ end
136
+
137
+ person = Person.find(1) # => GET http://app/people/1.json
138
+ person.name = "David"
139
+ person.save # => PUT http://app/people/1.json {name: "David"}
140
+
141
+ Person.format = :xml
142
+ person.name = "Mary"
143
+ person.save # => PUT http://app/people/1.json <person><name>Mary</name></person>
144
+
145
+ * Fix reload error when path prefix is used. #8727 *Ian Warshak*
146
+
147
+ * Remove ActiveResource::Struct because it hasn't proven very useful. Creating a new ActiveResource::Base subclass is often less code and always clearer. #8612 *Josh Peek*
148
+
149
+ * Fix query methods on resources. *Cody Fauser*
150
+
151
+ * pass the prefix_options to the instantiated record when using find without a specific id. Closes #8544 *Eloy Duran*
152
+
153
+ * Recognize and raise an exception on 405 Method Not Allowed responses. #7692 *Josh Peek*
154
+
155
+ * Handle string and symbol param keys when splitting params into prefix params and query params.
156
+
157
+ Comment.find(:all, :params => { :article_id => 5, :page => 2 }) or Comment.find(:all, :params => { 'article_id' => 5, :page => 2 })
158
+
159
+ * Added find-one with symbol [David Heinemeier Hansson]. Example: Person.find(:one, :from => :leader) # => GET /people/leader.xml
160
+
161
+ * BACKWARDS INCOMPATIBLE: Changed the finder API to be more extensible with :params and more strict usage of scopes [David Heinemeier Hansson]. Changes:
162
+
163
+ Person.find(:all, :title => "CEO") ...becomes: Person.find(:all, :params => { :title => "CEO" })
164
+ Person.find(:managers) ...becomes: Person.find(:all, :from => :managers)
165
+ Person.find("/companies/1/manager.xml") ...becomes: Person.find(:one, :from => "/companies/1/manager.xml")
166
+
167
+ * Add support for setting custom headers per Active Resource model *Rick Olson*
168
+
169
+ class Project
170
+ headers['X-Token'] = 'foo'
171
+ end
172
+
173
+ \# makes the GET request with the custom X-Token header
174
+ Project.find(:all)
175
+
176
+ * Added find-by-path options to ActiveResource::Base.find [David Heinemeier Hansson]. Examples:
177
+
178
+ employees = Person.find(:all, :from => "/companies/1/people.xml") # => GET /companies/1/people.xml
179
+ manager = Person.find("/companies/1/manager.xml") # => GET /companies/1/manager.xml
180
+
181
+
182
+ * Added support for using classes from within a single nested module [David Heinemeier Hansson]. Example:
183
+
184
+ module Highrise
185
+ class Note < ActiveResource::Base
186
+ self.site = "http://37s.sunrise.i:3000"
187
+ end
188
+
189
+ class Comment < ActiveResource::Base
190
+ self.site = "http://37s.sunrise.i:3000"
191
+ end
192
+ end
193
+
194
+ assert_kind_of Highrise::Comment, Note.find(1).comments.first
195
+
196
+
197
+ * Added load_attributes_from_response as a way of loading attributes from other responses than just create *David Heinemeier Hansson*
198
+
199
+ class Highrise::Task < ActiveResource::Base
200
+ def complete
201
+ load_attributes_from_response(post(:complete))
202
+ end
203
+ end
204
+
205
+ ...will set "done_at" when complete is called.
206
+
207
+
208
+ * Added support for calling custom methods #6979 *rwdaigle*
209
+
210
+ Person.find(:managers) # => GET /people/managers.xml
211
+ Kase.find(1).post(:close) # => POST /kases/1/close.xml
212
+
213
+ * Remove explicit prefix_options parameter for ActiveResource::Base#initialize. *Rick Olson*
214
+ ActiveResource splits the prefix_options from it automatically.
215
+
216
+ * Allow ActiveResource::Base.delete with custom prefix. *Rick Olson*
217
+
218
+ * Add ActiveResource::Base#dup *Rick Olson*
219
+
220
+ * Fixed constant warning when fetching the same object multiple times *David Heinemeier Hansson*
221
+
222
+ * Added that saves which get a body response (and not just a 201) will use that response to update themselves *David Heinemeier Hansson*
223
+
224
+ * Disregard namespaces from the default element name, so Highrise::Person will just try to fetch from "/people", not "/highrise/people" *David Heinemeier Hansson*
225
+
226
+ * Allow array and hash query parameters. #7756 *Greg Spurrier*
227
+
228
+ * Loading a resource preserves its prefix_options. #7353 *Ryan Daigle*
229
+
230
+ * Carry over the convenience of #create from ActiveRecord. Closes #7340. *Ryan Daigle*
231
+
232
+ * Increase ActiveResource::Base test coverage. Closes #7173, #7174 *Rich Collins*
233
+
234
+ * Interpret 422 Unprocessable Entity as ResourceInvalid. #7097 *dkubb*
235
+
236
+ * Mega documentation patches. #7025, #7069 *rwdaigle*
237
+
238
+ * Base.exists?(id, options) and Base#exists? check whether the resource is found. #6970 *rwdaigle*
239
+
240
+ * Query string support. *untext, Jeremy Kemper*
241
+ # GET /forums/1/topics.xml?sort=created_at
242
+ Topic.find(:all, :forum_id => 1, :sort => 'created_at')
243
+
244
+ * Base#==, eql?, and hash methods. == returns true if its argument is identical to self or if it's an instance of the same class, is not new?, and has the same id. eql? is an alias for ==. hash delegates to id. *Jeremy Kemper*
245
+
246
+ * Allow subclassed resources to share the site info *Rick Olson, Jeremy Kemper*
247
+ d
248
+ class BeastResource < ActiveResource::Base
249
+ self.site = 'http://beast.caboo.se'
250
+ end
251
+
252
+ class Forum < BeastResource
253
+ # taken from BeastResource
254
+ # self.site = 'http://beast.caboo.se'
255
+ end
256
+
257
+ class Topic < BeastResource
258
+ self.site += '/forums/:forum_id'
259
+ end
260
+
261
+ * Fix issues with ActiveResource collection handling. Closes #6291. *bmilekic*
262
+
263
+ * Use attr_accessor_with_default to dry up attribute initialization. References #6538. *Stuart Halloway*
264
+
265
+ * Add basic logging support for logging outgoing requests. *Jamis Buck*
266
+
267
+ * Add Base.delete for deleting resources without having to instantiate them first. *Jamis Buck*
268
+
269
+ * Make #save behavior mimic AR::Base#save (true on success, false on failure). *Jamis Buck*
270
+
271
+ * Add Basic HTTP Authentication to ActiveResource (closes #6305). *jonathan*
272
+
273
+ * Extracted #id_from_response as an entry point for customizing how a created resource gets its own ID.
274
+ By default, it extracts from the Location response header.
275
+
276
+ * Optimistic locking: raise ActiveResource::ResourceConflict on 409 Conflict response. *Jeremy Kemper*
277
+
278
+ # Example controller action
279
+ def update
280
+ @person.save!
281
+ rescue ActiveRecord::StaleObjectError
282
+ render :xml => @person.reload.to_xml, :status => '409 Conflict'
283
+ end
284
+
285
+ * Basic validation support *Rick Olson*
286
+
287
+ Parses the xml response of ActiveRecord::Errors#to_xml with a similar interface to ActiveRecord::Errors.
288
+
289
+ render :xml => @person.errors.to_xml, :status => '400 Validation Error'
290
+
291
+ * Deep hashes are converted into collections of resources. *Jeremy Kemper*
292
+ Person.new :name => 'Bob',
293
+ :address => { :id => 1, :city => 'Portland' },
294
+ :contacts => [{ :id => 1 }, { :id => 2 }]
295
+ Looks for Address and Contact resources and creates them if unavailable.
296
+ So clients can fetch a complex resource in a single request if you e.g.
297
+ render :xml => @person.to_xml(:include => [:address, :contacts])
298
+ in your controller action.
299
+
300
+ * Major updates *Rick Olson*
301
+
302
+ * Add full support for find/create/update/destroy
303
+ * Add support for specifying prefixes.
304
+ * Allow overriding of element_name, collection_name, and primary key
305
+ * Provide simpler HTTP mock interface for testing
306
+
307
+ # rails routing code
308
+ map.resources :posts do |post|
309
+ post.resources :comments
310
+ end
311
+
312
+ # ActiveResources
313
+ class Post < ActiveResource::Base
314
+ self.site = "http://37s.sunrise.i:3000/"
315
+ end
316
+
317
+ class Comment < ActiveResource::Base
318
+ self.site = "http://37s.sunrise.i:3000/posts/:post_id/"
319
+ end
320
+
321
+ @post = Post.find 5
322
+ @comments = Comment.find :all, :post_id => @post.id
323
+
324
+ @comment = Comment.new({:body => 'hello world'}, {:post_id => @post.id})
325
+ @comment.save
326
+
327
+ * Base.site= accepts URIs. 200...400 are valid response codes. PUT and POST request bodies default to ''. *Jeremy Kemper*
328
+
329
+ * Initial checkin: object-oriented client for restful HTTP resources which follow the Rails convention. *David Heinemeier Hansson*
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2006-2011 David Heinemeier Hansson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -637,6 +637,10 @@ module ActiveResource
637
637
  # Post.element_path(1)
638
638
  # # => /posts/1.json
639
639
  #
640
+ # class Comment < ActiveResource::Base
641
+ # self.site = "http://37s.sunrise.i/posts/:post_id/"
642
+ # end
643
+ #
640
644
  # Comment.element_path(1, :post_id => 5)
641
645
  # # => /posts/5/comments/1.json
642
646
  #
@@ -663,6 +667,10 @@ module ActiveResource
663
667
  # Post.new_element_path
664
668
  # # => /posts/new.json
665
669
  #
670
+ # class Comment < ActiveResource::Base
671
+ # self.site = "http://37s.sunrise.i/posts/:post_id/"
672
+ # end
673
+ #
666
674
  # Comment.collection_path(:post_id => 5)
667
675
  # # => /posts/5/comments/new.json
668
676
  def new_element_path(prefix_options = {})
@@ -2,8 +2,8 @@ module ActiveResource
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 1
5
- TINY = 1
6
- PRE = nil
5
+ TINY = 2
6
+ PRE = "rc1"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
9
9
  end
metadata CHANGED
@@ -1,13 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeresource
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
5
- prerelease: false
4
+ hash: 15424119
5
+ prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 1
9
+ - 2
10
+ - rc
9
11
  - 1
10
- version: 3.1.1
12
+ version: 3.1.2.rc1
11
13
  platform: ruby
12
14
  authors:
13
15
  - David Heinemeier Hansson
@@ -15,41 +17,44 @@ autorequire:
15
17
  bindir: bin
16
18
  cert_chain: []
17
19
 
18
- date: 2011-10-07 00:00:00 -02:00
19
- default_executable:
20
+ date: 2011-11-14 00:00:00 Z
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
22
23
  name: activesupport
24
+ type: :runtime
23
25
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
26
+ version_requirements: &id001 !ruby/object:Gem::Requirement
25
27
  none: false
26
28
  requirements:
27
29
  - - "="
28
30
  - !ruby/object:Gem::Version
29
- hash: 1
31
+ hash: 15424119
30
32
  segments:
31
33
  - 3
32
34
  - 1
35
+ - 2
36
+ - rc
33
37
  - 1
34
- version: 3.1.1
35
- type: :runtime
36
- version_requirements: *id001
38
+ version: 3.1.2.rc1
39
+ requirement: *id001
37
40
  - !ruby/object:Gem::Dependency
38
41
  name: activemodel
42
+ type: :runtime
39
43
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
44
+ version_requirements: &id002 !ruby/object:Gem::Requirement
41
45
  none: false
42
46
  requirements:
43
47
  - - "="
44
48
  - !ruby/object:Gem::Version
45
- hash: 1
49
+ hash: 15424119
46
50
  segments:
47
51
  - 3
48
52
  - 1
53
+ - 2
54
+ - rc
49
55
  - 1
50
- version: 3.1.1
51
- type: :runtime
52
- version_requirements: *id002
56
+ version: 3.1.2.rc1
57
+ requirement: *id002
53
58
  description: REST on Rails. Wrap your RESTful web app with Ruby classes and work with them like Active Record models.
54
59
  email: david@loudthinking.com
55
60
  executables: []
@@ -59,25 +64,25 @@ extensions: []
59
64
  extra_rdoc_files:
60
65
  - README.rdoc
61
66
  files:
62
- - CHANGELOG
67
+ - CHANGELOG.md
68
+ - MIT-LICENSE
63
69
  - README.rdoc
64
70
  - examples/performance.rb
65
- - lib/active_resource/base.rb
66
- - lib/active_resource/connection.rb
67
- - lib/active_resource/custom_methods.rb
68
- - lib/active_resource/exceptions.rb
69
- - lib/active_resource/formats/json_format.rb
71
+ - lib/active_resource.rb
72
+ - lib/active_resource/schema.rb
70
73
  - lib/active_resource/formats/xml_format.rb
71
- - lib/active_resource/formats.rb
72
- - lib/active_resource/http_mock.rb
73
- - lib/active_resource/log_subscriber.rb
74
+ - lib/active_resource/formats/json_format.rb
75
+ - lib/active_resource/exceptions.rb
74
76
  - lib/active_resource/observing.rb
77
+ - lib/active_resource/log_subscriber.rb
78
+ - lib/active_resource/version.rb
79
+ - lib/active_resource/connection.rb
75
80
  - lib/active_resource/railtie.rb
76
- - lib/active_resource/schema.rb
81
+ - lib/active_resource/formats.rb
82
+ - lib/active_resource/http_mock.rb
83
+ - lib/active_resource/custom_methods.rb
77
84
  - lib/active_resource/validations.rb
78
- - lib/active_resource/version.rb
79
- - lib/active_resource.rb
80
- has_rdoc: true
85
+ - lib/active_resource/base.rb
81
86
  homepage: http://www.rubyonrails.org
82
87
  licenses: []
83
88
 
@@ -101,16 +106,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
101
106
  required_rubygems_version: !ruby/object:Gem::Requirement
102
107
  none: false
103
108
  requirements:
104
- - - ">="
109
+ - - ">"
105
110
  - !ruby/object:Gem::Version
106
- hash: 3
111
+ hash: 25
107
112
  segments:
108
- - 0
109
- version: "0"
113
+ - 1
114
+ - 3
115
+ - 1
116
+ version: 1.3.1
110
117
  requirements: []
111
118
 
112
119
  rubyforge_project:
113
- rubygems_version: 1.3.7
120
+ rubygems_version: 1.8.6
114
121
  signing_key:
115
122
  specification_version: 3
116
123
  summary: REST modeling framework (part of Rails).
data/CHANGELOG DELETED
@@ -1,329 +0,0 @@
1
- *Rails 3.1.1 (unreleased)*
2
-
3
- * No changes
4
-
5
-
6
- *Rails 3.1.0 (August 30, 2011)*
7
-
8
- * The default format has been changed to JSON for all requests. If you want to continue to use XML you will need to set `self.format = :xml` in the class. eg.
9
-
10
- class User < ActiveResource::Base
11
- self.format = :xml
12
- end
13
-
14
-
15
- *Rails 3.0.7 (April 18, 2011)*
16
-
17
- * No changes.
18
-
19
-
20
- *Rails 3.0.6 (April 5, 2011)
21
-
22
- * No changes.
23
-
24
-
25
- *Rails 3.0.5 (February 26, 2011)*
26
-
27
- * No changes.
28
-
29
-
30
- *Rails 3.0.4 (February 8, 2011)*
31
-
32
- * No changes.
33
-
34
-
35
- *Rails 3.0.3 (November 16, 2010)*
36
-
37
- * No changes.
38
-
39
-
40
- *Rails 3.0.2 (November 15, 2010)*
41
-
42
- * No changes
43
-
44
-
45
- *Rails 3.0.1 (October 15, 2010)*
46
-
47
- * No Changes, just a version bump.
48
-
49
-
50
- *Rails 3.0.0 (August 29, 2010)*
51
-
52
- * 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]
53
-
54
- * Add support for errors in JSON format. #1956 [Fabien Jakimowicz]
55
-
56
- * Recognizes 410 as Resource Gone. #2316 [Jordan Brough, Jatinder Singh]
57
-
58
- * More thorough SSL support. #2370 [Roy Nicholson]
59
-
60
- * HTTP proxy support. #2133 [Marshall Huss, Sébastien Dabet]
61
-
62
-
63
- *2.3.2 [Final] (March 15, 2009)*
64
-
65
- * Nothing new, just included in 2.3.2
66
-
67
-
68
- *2.2.1 [RC2] (November 14th, 2008)*
69
-
70
- * Fixed that ActiveResource#post would post an empty string when it shouldn't be posting anything #525 [Paolo Angelini]
71
-
72
-
73
- *2.2.0 [RC1] (October 24th, 2008)*
74
-
75
- * Add ActiveResource::Base#to_xml and ActiveResource::Base#to_json. #1011 [Rasik Pandey, Cody Fauser]
76
-
77
- * Add ActiveResource::Base.find(:last). [#754 state:resolved] (Adrian Mugnolo)
78
-
79
- * Fixed problems with the logger used if the logging string included %'s [#840 state:resolved] (Jamis Buck)
80
-
81
- * Fixed Base#exists? to check status code as integer [#299 state:resolved] (Wes Oldenbeuving)
82
-
83
-
84
- *2.1.0 (May 31st, 2008)*
85
-
86
- * Fixed response logging to use length instead of the entire thing (seangeo) [#27]
87
-
88
- * Fixed that to_param should be used and honored instead of hardcoding the id #11406 [gspiers]
89
-
90
- * Improve documentation. [Ryan Bigg, Jan De Poorter, Cheah Chu Yeow, Xavier Shay, Jack Danger Canty, Emilio Tagua, Xavier Noria, Sunny Ripert]
91
-
92
- * Use HEAD instead of GET in exists? [bscofield]
93
-
94
- * Fix small documentation typo. Closes #10670 [Luca Guidi]
95
-
96
- * find_or_create_resource_for handles module nesting. #10646 [xavier]
97
-
98
- * Allow setting ActiveResource::Base#format before #site. [Rick Olson]
99
-
100
- * Support agnostic formats when calling custom methods. Closes #10635 [joerichsen]
101
-
102
- * Document custom methods. #10589 [Cheah Chu Yeow]
103
-
104
- * Ruby 1.9 compatibility. [Jeremy Kemper]
105
-
106
-
107
- *2.0.2 (December 16th, 2007)*
108
-
109
- * Added more specific exceptions for 400, 401, and 403 (all descending from ClientError so existing rescues will work) #10326 [trek]
110
-
111
- * Correct empty response handling. #10445 [seangeo]
112
-
113
-
114
- *2.0.1 (December 7th, 2007)*
115
-
116
- * Don't cache net/http object so that ActiveResource is more thread-safe. Closes #10142 [kou]
117
-
118
- * Update XML documentation examples to include explicit type attributes. Closes #9754 [Josh Susser]
119
-
120
- * Added one-off declarations of mock behavior [David Heinemeier Hansson]. Example:
121
-
122
- Before:
123
- ActiveResource::HttpMock.respond_to do |mock|
124
- mock.get "/people/1.xml", {}, "<person><name>David</name></person>"
125
- end
126
-
127
- Now:
128
- ActiveResource::HttpMock.respond_to.get "/people/1.xml", {}, "<person><name>David</name></person>"
129
-
130
- * Added ActiveResource.format= which defaults to :xml but can also be set to :json [David Heinemeier Hansson]. Example:
131
-
132
- class Person < ActiveResource::Base
133
- self.site = "http://app/"
134
- self.format = :json
135
- end
136
-
137
- person = Person.find(1) # => GET http://app/people/1.json
138
- person.name = "David"
139
- person.save # => PUT http://app/people/1.json {name: "David"}
140
-
141
- Person.format = :xml
142
- person.name = "Mary"
143
- person.save # => PUT http://app/people/1.json <person><name>Mary</name></person>
144
-
145
- * Fix reload error when path prefix is used. #8727 [Ian Warshak]
146
-
147
- * Remove ActiveResource::Struct because it hasn't proven very useful. Creating a new ActiveResource::Base subclass is often less code and always clearer. #8612 [Josh Peek]
148
-
149
- * Fix query methods on resources. [Cody Fauser]
150
-
151
- * pass the prefix_options to the instantiated record when using find without a specific id. Closes #8544 [Eloy Duran]
152
-
153
- * Recognize and raise an exception on 405 Method Not Allowed responses. #7692 [Josh Peek]
154
-
155
- * Handle string and symbol param keys when splitting params into prefix params and query params.
156
-
157
- Comment.find(:all, :params => { :article_id => 5, :page => 2 }) or Comment.find(:all, :params => { 'article_id' => 5, :page => 2 })
158
-
159
- * Added find-one with symbol [David Heinemeier Hansson]. Example: Person.find(:one, :from => :leader) # => GET /people/leader.xml
160
-
161
- * BACKWARDS INCOMPATIBLE: Changed the finder API to be more extensible with :params and more strict usage of scopes [David Heinemeier Hansson]. Changes:
162
-
163
- Person.find(:all, :title => "CEO") ...becomes: Person.find(:all, :params => { :title => "CEO" })
164
- Person.find(:managers) ...becomes: Person.find(:all, :from => :managers)
165
- Person.find("/companies/1/manager.xml") ...becomes: Person.find(:one, :from => "/companies/1/manager.xml")
166
-
167
- * Add support for setting custom headers per Active Resource model [Rick Olson]
168
-
169
- class Project
170
- headers['X-Token'] = 'foo'
171
- end
172
-
173
- # makes the GET request with the custom X-Token header
174
- Project.find(:all)
175
-
176
- * Added find-by-path options to ActiveResource::Base.find [David Heinemeier Hansson]. Examples:
177
-
178
- employees = Person.find(:all, :from => "/companies/1/people.xml") # => GET /companies/1/people.xml
179
- manager = Person.find("/companies/1/manager.xml") # => GET /companies/1/manager.xml
180
-
181
-
182
- * Added support for using classes from within a single nested module [David Heinemeier Hansson]. Example:
183
-
184
- module Highrise
185
- class Note < ActiveResource::Base
186
- self.site = "http://37s.sunrise.i:3000"
187
- end
188
-
189
- class Comment < ActiveResource::Base
190
- self.site = "http://37s.sunrise.i:3000"
191
- end
192
- end
193
-
194
- assert_kind_of Highrise::Comment, Note.find(1).comments.first
195
-
196
-
197
- * Added load_attributes_from_response as a way of loading attributes from other responses than just create [David Heinemeier Hansson]
198
-
199
- class Highrise::Task < ActiveResource::Base
200
- def complete
201
- load_attributes_from_response(post(:complete))
202
- end
203
- end
204
-
205
- ...will set "done_at" when complete is called.
206
-
207
-
208
- * Added support for calling custom methods #6979 [rwdaigle]
209
-
210
- Person.find(:managers) # => GET /people/managers.xml
211
- Kase.find(1).post(:close) # => POST /kases/1/close.xml
212
-
213
- * Remove explicit prefix_options parameter for ActiveResource::Base#initialize. [Rick Olson]
214
- ActiveResource splits the prefix_options from it automatically.
215
-
216
- * Allow ActiveResource::Base.delete with custom prefix. [Rick Olson]
217
-
218
- * Add ActiveResource::Base#dup [Rick Olson]
219
-
220
- * Fixed constant warning when fetching the same object multiple times [David Heinemeier Hansson]
221
-
222
- * Added that saves which get a body response (and not just a 201) will use that response to update themselves [David Heinemeier Hansson]
223
-
224
- * Disregard namespaces from the default element name, so Highrise::Person will just try to fetch from "/people", not "/highrise/people" [David Heinemeier Hansson]
225
-
226
- * Allow array and hash query parameters. #7756 [Greg Spurrier]
227
-
228
- * Loading a resource preserves its prefix_options. #7353 [Ryan Daigle]
229
-
230
- * Carry over the convenience of #create from ActiveRecord. Closes #7340. [Ryan Daigle]
231
-
232
- * Increase ActiveResource::Base test coverage. Closes #7173, #7174 [Rich Collins]
233
-
234
- * Interpret 422 Unprocessable Entity as ResourceInvalid. #7097 [dkubb]
235
-
236
- * Mega documentation patches. #7025, #7069 [rwdaigle]
237
-
238
- * Base.exists?(id, options) and Base#exists? check whether the resource is found. #6970 [rwdaigle]
239
-
240
- * Query string support. [untext, Jeremy Kemper]
241
- # GET /forums/1/topics.xml?sort=created_at
242
- Topic.find(:all, :forum_id => 1, :sort => 'created_at')
243
-
244
- * Base#==, eql?, and hash methods. == returns true if its argument is identical to self or if it's an instance of the same class, is not new?, and has the same id. eql? is an alias for ==. hash delegates to id. [Jeremy Kemper]
245
-
246
- * Allow subclassed resources to share the site info [Rick Olson, Jeremy Kemper]
247
- d
248
- class BeastResource < ActiveResource::Base
249
- self.site = 'http://beast.caboo.se'
250
- end
251
-
252
- class Forum < BeastResource
253
- # taken from BeastResource
254
- # self.site = 'http://beast.caboo.se'
255
- end
256
-
257
- class Topic < BeastResource
258
- self.site += '/forums/:forum_id'
259
- end
260
-
261
- * Fix issues with ActiveResource collection handling. Closes #6291. [bmilekic]
262
-
263
- * Use attr_accessor_with_default to dry up attribute initialization. References #6538. [Stuart Halloway]
264
-
265
- * Add basic logging support for logging outgoing requests. [Jamis Buck]
266
-
267
- * Add Base.delete for deleting resources without having to instantiate them first. [Jamis Buck]
268
-
269
- * Make #save behavior mimic AR::Base#save (true on success, false on failure). [Jamis Buck]
270
-
271
- * Add Basic HTTP Authentication to ActiveResource (closes #6305). [jonathan]
272
-
273
- * Extracted #id_from_response as an entry point for customizing how a created resource gets its own ID.
274
- By default, it extracts from the Location response header.
275
-
276
- * Optimistic locking: raise ActiveResource::ResourceConflict on 409 Conflict response. [Jeremy Kemper]
277
-
278
- # Example controller action
279
- def update
280
- @person.save!
281
- rescue ActiveRecord::StaleObjectError
282
- render :xml => @person.reload.to_xml, :status => '409 Conflict'
283
- end
284
-
285
- * Basic validation support [Rick Olson]
286
-
287
- Parses the xml response of ActiveRecord::Errors#to_xml with a similar interface to ActiveRecord::Errors.
288
-
289
- render :xml => @person.errors.to_xml, :status => '400 Validation Error'
290
-
291
- * Deep hashes are converted into collections of resources. [Jeremy Kemper]
292
- Person.new :name => 'Bob',
293
- :address => { :id => 1, :city => 'Portland' },
294
- :contacts => [{ :id => 1 }, { :id => 2 }]
295
- Looks for Address and Contact resources and creates them if unavailable.
296
- So clients can fetch a complex resource in a single request if you e.g.
297
- render :xml => @person.to_xml(:include => [:address, :contacts])
298
- in your controller action.
299
-
300
- * Major updates [Rick Olson]
301
-
302
- * Add full support for find/create/update/destroy
303
- * Add support for specifying prefixes.
304
- * Allow overriding of element_name, collection_name, and primary key
305
- * Provide simpler HTTP mock interface for testing
306
-
307
- # rails routing code
308
- map.resources :posts do |post|
309
- post.resources :comments
310
- end
311
-
312
- # ActiveResources
313
- class Post < ActiveResource::Base
314
- self.site = "http://37s.sunrise.i:3000/"
315
- end
316
-
317
- class Comment < ActiveResource::Base
318
- self.site = "http://37s.sunrise.i:3000/posts/:post_id/"
319
- end
320
-
321
- @post = Post.find 5
322
- @comments = Comment.find :all, :post_id => @post.id
323
-
324
- @comment = Comment.new({:body => 'hello world'}, {:post_id => @post.id})
325
- @comment.save
326
-
327
- * Base.site= accepts URIs. 200...400 are valid response codes. PUT and POST request bodies default to ''. [Jeremy Kemper]
328
-
329
- * Initial checkin: object-oriented client for restful HTTP resources which follow the Rails convention. [David Heinemeier Hansson]