2006-08-26 04:23:36 -04:00
|
|
|
*SVN*
|
|
|
|
|
2006-12-12 21:15:27 -05:00
|
|
|
* Allow subclassed resources to share the site info [Rick]
|
|
|
|
|
|
|
|
class BeastResource < ActiveResource::Base
|
|
|
|
self.site = 'http://beast.caboo.se'
|
|
|
|
end
|
|
|
|
|
|
|
|
class Forum < BeastResource
|
|
|
|
# taken from BeastResource
|
|
|
|
# self.site = 'http://beast.caboo.se'
|
|
|
|
end
|
|
|
|
|
|
|
|
class Topic < BeastResource
|
|
|
|
site << '/forums/:forum_id'
|
|
|
|
end
|
|
|
|
|
2006-12-12 10:29:54 -05:00
|
|
|
* Fix issues with ActiveResource collection handling. Closes #6291. [bmilekic]
|
|
|
|
|
2006-11-16 14:36:50 -05:00
|
|
|
* Use attr_accessor_with_default to dry up attribute initialization. References #6538. [Stuart Halloway]
|
|
|
|
|
2006-10-23 18:21:09 -04:00
|
|
|
* Add basic logging support for logging outgoing requests. [Jamis Buck]
|
|
|
|
|
2006-10-06 13:25:10 -04:00
|
|
|
* Add Base.delete for deleting resources without having to instantiate them first. [Jamis Buck]
|
|
|
|
|
2006-10-02 18:14:15 -04:00
|
|
|
* Make #save behavior mimic AR::Base#save (true on success, false on failure). [Jamis Buck]
|
|
|
|
|
2006-09-29 12:25:49 -04:00
|
|
|
* Add Basic HTTP Authentication to ActiveResource (closes #6305). [jonathan]
|
|
|
|
|
2006-09-20 15:31:17 -04:00
|
|
|
* Extracted #id_from_response as an entry point for customizing how a created resource gets its own ID.
|
|
|
|
By default, it extracts from the Location response header.
|
|
|
|
|
2006-09-08 20:11:12 -04:00
|
|
|
* Optimistic locking: raise ActiveResource::ResourceConflict on 409 Conflict response. [Jeremy Kemper]
|
|
|
|
|
|
|
|
# Example controller action
|
|
|
|
def update
|
|
|
|
@person.save!
|
|
|
|
rescue ActiveRecord::StaleObjectError
|
|
|
|
render :xml => @person.reload.to_xml, :status => '409 Conflict'
|
|
|
|
end
|
|
|
|
|
2006-09-07 20:07:30 -04:00
|
|
|
* Basic validation support [Rick Olson]
|
|
|
|
|
|
|
|
Parses the xml response of ActiveRecord::Errors#to_xml with a similar interface to ActiveRecord::Errors.
|
|
|
|
|
|
|
|
render :xml => @person.errors.to_xml, :status => '400 Validation Error'
|
|
|
|
|
2006-09-04 06:04:23 -04:00
|
|
|
* Deep hashes are converted into collections of resources. [Jeremy Kemper]
|
|
|
|
Person.new :name => 'Bob',
|
|
|
|
:address => { :id => 1, :city => 'Portland' },
|
|
|
|
:contacts => [{ :id => 1 }, { :id => 2 }]
|
|
|
|
Looks for Address and Contact resources and creates them if unavailable.
|
|
|
|
So clients can fetch a complex resource in a single request if you e.g.
|
|
|
|
render :xml => @person.to_xml(:include => [:address, :contacts])
|
|
|
|
in your controller action.
|
|
|
|
|
2006-08-31 21:15:10 -04:00
|
|
|
* Major updates [Rick Olson]
|
|
|
|
|
|
|
|
* Add full support for find/create/update/destroy
|
|
|
|
* Add support for specifying prefixes.
|
|
|
|
* Allow overriding of element_name, collection_name, and primary key
|
|
|
|
* Provide simpler HTTP mock interface for testing
|
|
|
|
|
|
|
|
# rails routing code
|
|
|
|
map.resources :posts do |post|
|
|
|
|
post.resources :comments
|
|
|
|
end
|
|
|
|
|
|
|
|
# ActiveResources
|
|
|
|
class Post < ActiveResource::Base
|
|
|
|
self.site = "http://37s.sunrise.i:3000/"
|
|
|
|
end
|
|
|
|
|
|
|
|
class Comment < ActiveResource::Base
|
|
|
|
self.site = "http://37s.sunrise.i:3000/posts/:post_id/"
|
|
|
|
end
|
|
|
|
|
|
|
|
@post = Post.find 5
|
|
|
|
@comments = Comment.find :all, :post_id => @post.id
|
|
|
|
|
|
|
|
@comment = Comment.new({:body => 'hello world'}, {:post_id => @post.id})
|
|
|
|
@comment.save
|
|
|
|
|
2006-08-31 05:31:11 -04:00
|
|
|
* Base.site= accepts URIs. 200...400 are valid response codes. PUT and POST request bodies default to ''. [Jeremy Kemper]
|
2006-08-31 03:55:31 -04:00
|
|
|
|
2006-08-26 04:23:36 -04:00
|
|
|
* Initial checkin: object-oriented client for restful HTTP resources which follow the Rails convention. [DHH]
|