Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

root/trunk/activeresource/CHANGELOG

Revision 9227, 9.0 kB (checked in by pratik, 5 months ago)

Fix more typos and changelog

Line 
1 *SVN*
2
3 * Fixed that to_param should be used and honored instead of hardcoding the id #11406 [gspiers]
4
5 * Improve documentation. [Radar, Jan De Poorter, chuyeow, xaviershay, danger, miloops, Xavier Noria,  Sunny Ripert]
6
7 * Use HEAD instead of GET in exists? [bscofield]
8
9 * Fix small documentation typo.  Closes #10670 [l.guidi]
10
11 * find_or_create_resource_for handles module nesting.  #10646 [xavier]
12
13 * Allow setting ActiveResource::Base#format before #site.  [rick]
14
15 * Support agnostic formats when calling custom methods.  Closes #10635 [joerichsen]
16
17 * Document custom methods.  #10589 [Cheah Chu Yeow]
18
19 * Ruby 1.9 compatibility.  [Jeremy Kemper]
20
21
22 *2.0.2* (December 16th, 2007)
23
24 * Added more specific exceptions for 400, 401, and 403 (all descending from ClientError so existing rescues will work) #10326 [trek]
25
26 * Correct empty response handling.  #10445 [seangeo]
27
28
29 *2.0.1* (December 7th, 2007)
30
31 * Don't cache net/http object so that ActiveResource is more thread-safe.  Closes #10142 [kou]
32
33 * Update XML documentation examples to include explicit type attributes. Closes #9754 [hasmanyjosh]
34
35 * Added one-off declarations of mock behavior [DHH]. Example:
36
37     Before:
38       ActiveResource::HttpMock.respond_to do |mock|
39         mock.get "/people/1.xml", {}, "<person><name>David</name></person>"
40       end
41      
42     Now:
43       ActiveResource::HttpMock.respond_to.get "/people/1.xml", {}, "<person><name>David</name></person>"
44
45 * Added ActiveResource.format= which defaults to :xml but can also be set to :json [DHH]. Example:
46
47     class Person < ActiveResource::Base
48       self.site   = "http://app/"
49       self.format = :json
50     end
51    
52     person = Person.find(1) # => GET http://app/people/1.json
53     person.name = "David"
54     person.save             # => PUT http://app/people/1.json {name: "David"}
55    
56     Person.format = :xml
57     person.name = "Mary"
58     person.save             # => PUT http://app/people/1.json <person><name>Mary</name></person>   
59
60 * Fix reload error when path prefix is used.  #8727 [Ian Warshak]
61
62 * 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]
63
64 * Fix query methods on resources. [Cody Fauser]
65
66 * pass the prefix_options to the instantiated record when using find without a specific id. Closes #8544 [alloy]
67
68 * Recognize and raise an exception on 405 Method Not Allowed responses.  #7692 [Josh Peek]
69
70 * Handle string and symbol param keys when splitting params into prefix params and query params.
71
72     Comment.find(:all, :params => { :article_id => 5, :page => 2 }) or Comment.find(:all, :params => { 'article_id' => 5, :page => 2 })
73
74 * Added find-one with symbol [DHH]. Example: Person.find(:one, :from => :leader) # => GET /people/leader.xml
75
76 * BACKWARDS INCOMPATIBLE: Changed the finder API to be more extensible with :params and more strict usage of scopes [DHH]. Changes:
77
78     Person.find(:all, :title => "CEO")      ...becomes: Person.find(:all, :params => { :title => "CEO" })
79     Person.find(:managers)                  ...becomes: Person.find(:all, :from => :managers)
80     Person.find("/companies/1/manager.xml") ...becomes: Person.find(:one, :from => "/companies/1/manager.xml")
81
82 * Add support for setting custom headers per Active Resource model [Rick]
83
84   class Project
85     headers['X-Token'] = 'foo'
86   end
87  
88   # makes the GET request with the custom X-Token header
89   Project.find(:all)
90
91 * Added find-by-path options to ActiveResource::Base.find [DHH]. Examples:
92
93     employees = Person.find(:all, :from => "/companies/1/people.xml") # => GET /companies/1/people.xml
94     manager   = Person.find("/companies/1/manager.xml")               # => GET /companies/1/manager.xml
95
96
97 * Added support for using classes from within a single nested module [DHH]. Example:
98
99     module Highrise
100       class Note < ActiveResource::Base
101         self.site = "http://37s.sunrise.i:3000"
102       end
103
104       class Comment < ActiveResource::Base
105         self.site = "http://37s.sunrise.i:3000"
106       end
107     end
108
109   assert_kind_of Highrise::Comment, Note.find(1).comments.first
110    
111
112 * Added load_attributes_from_response as a way of loading attributes from other responses than just create [DHH]
113
114     class Highrise::Task < ActiveResource::Base
115       def complete
116         load_attributes_from_response(post(:complete))
117       end
118     end
119
120   ...will set "done_at" when complete is called.
121
122
123 * Added support for calling custom methods #6979 [rwdaigle]
124
125     Person.find(:managers)    # => GET /people/managers.xml
126     Kase.find(1).post(:close) # => POST /kases/1/close.xml
127
128 * Remove explicit prefix_options parameter for ActiveResource::Base#initialize. [Rick]
129   ActiveResource splits the prefix_options from it automatically.
130
131 * Allow ActiveResource::Base.delete with custom prefix. [Rick]
132
133 * Add ActiveResource::Base#dup [Rick]
134
135 * Fixed constant warning when fetching the same object multiple times [DHH]
136
137 * Added that saves which get a body response (and not just a 201) will use that response to update themselves [DHH]
138
139 * Disregard namespaces from the default element name, so Highrise::Person will just try to fetch from "/people", not "/highrise/people" [DHH]
140
141 * Allow array and hash query parameters.  #7756 [Greg Spurrier]
142
143 * Loading a resource preserves its prefix_options.  #7353 [Ryan Daigle]
144
145 * Carry over the convenience of #create from ActiveRecord.  Closes #7340.  [Ryan Daigle]
146
147 * Increase ActiveResource::Base test coverage.  Closes #7173, #7174 [Rich Collins]
148
149 * Interpret 422 Unprocessable Entity as ResourceInvalid.  #7097 [dkubb]
150
151 * Mega documentation patches. #7025, #7069 [rwdaigle]
152
153 * Base.exists?(id, options) and Base#exists? check whether the resource is found.  #6970 [rwdaigle]
154
155 * Query string support.  [untext, Jeremy Kemper]
156     # GET /forums/1/topics.xml?sort=created_at
157     Topic.find(:all, :forum_id => 1, :sort => 'created_at')
158
159 * 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]
160
161 * Allow subclassed resources to share the site info [Rick, Jeremy Kemper]
162 d
163     class BeastResource < ActiveResource::Base
164       self.site = 'http://beast.caboo.se'
165     end
166
167     class Forum < BeastResource
168       # taken from BeastResource
169       # self.site = 'http://beast.caboo.se'
170     end
171
172     class Topic < BeastResource
173       self.site += '/forums/:forum_id'
174     end
175
176 * Fix issues with ActiveResource collection handling.  Closes #6291. [bmilekic]
177
178 * Use attr_accessor_with_default to dry up attribute initialization. References #6538. [Stuart Halloway]
179
180 * Add basic logging support for logging outgoing requests. [Jamis Buck]
181
182 * Add Base.delete for deleting resources without having to instantiate them first. [Jamis Buck]
183
184 * Make #save behavior mimic AR::Base#save (true on success, false on failure). [Jamis Buck]
185
186 * Add Basic HTTP Authentication to ActiveResource (closes #6305). [jonathan]
187
188 * Extracted #id_from_response as an entry point for customizing how a created resource gets its own ID.
189   By default, it extracts from the Location response header.
190
191 * Optimistic locking: raise ActiveResource::ResourceConflict on 409 Conflict response. [Jeremy Kemper]
192
193     # Example controller action
194     def update
195       @person.save!
196     rescue ActiveRecord::StaleObjectError
197       render :xml => @person.reload.to_xml, :status => '409 Conflict'
198     end
199
200 * Basic validation support [Rick Olson]
201
202   Parses the xml response of ActiveRecord::Errors#to_xml with a similar interface to ActiveRecord::Errors. 
203  
204     render :xml => @person.errors.to_xml, :status => '400 Validation Error'
205
206 * Deep hashes are converted into collections of resources.  [Jeremy Kemper]
207     Person.new :name => 'Bob',
208                :address => { :id => 1, :city => 'Portland' },
209                :contacts => [{ :id => 1 }, { :id => 2 }]
210   Looks for Address and Contact resources and creates them if unavailable.
211   So clients can fetch a complex resource in a single request if you e.g.
212     render :xml => @person.to_xml(:include => [:address, :contacts])
213   in your controller action.
214
215 * Major updates [Rick Olson]
216
217   * Add full support for find/create/update/destroy
218   * Add support for specifying prefixes.
219   * Allow overriding of element_name, collection_name, and primary key
220   * Provide simpler HTTP mock interface for testing
221  
222     # rails routing code
223     map.resources :posts do |post|
224       post.resources :comments
225     end
226    
227     # ActiveResources
228     class Post < ActiveResource::Base
229       self.site = "http://37s.sunrise.i:3000/"
230     end
231
232     class Comment < ActiveResource::Base
233       self.site = "http://37s.sunrise.i:3000/posts/:post_id/"
234     end
235    
236     @post     = Post.find 5
237     @comments = Comment.find :all, :post_id => @post.id
238
239     @comment  = Comment.new({:body => 'hello world'}, {:post_id => @post.id})
240     @comment.save
241
242 * Base.site= accepts URIs. 200...400 are valid response codes. PUT and POST request bodies default to ''. [Jeremy Kemper]
243
244 * Initial checkin: object-oriented client for restful HTTP resources which follow the Rails convention. [DHH]
Note: See TracBrowser for help on using the browser.