2011-09-14 13:16:12 -04:00
*Rails 3.1.0 (August 30, 2011)*
2010-08-28 18:45:14 -04:00
2011-05-18 14:40:35 -04:00
* 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.
class User < ActiveResource::Base
self.format = :xml
end
2010-08-28 18:45:14 -04:00
2011-05-10 12:51:35 -04:00
*Rails 3.0.7 (April 18, 2011)*
2011-05-18 14:40:35 -04:00
* No changes.
2011-05-10 12:51:35 -04:00
*Rails 3.0.6 (April 5, 2011)
* No changes.
*Rails 3.0.5 (February 26, 2011)*
* No changes.
*Rails 3.0.4 (February 8, 2011)*
* No changes.
*Rails 3.0.3 (November 16, 2010)*
* No changes.
*Rails 3.0.2 (November 15, 2010)*
2010-11-09 14:56:41 -05:00
* No changes
2011-05-10 12:51:35 -04:00
2010-10-18 10:24:41 -04:00
*Rails 3.0.1 (October 15, 2010)*
* No Changes, just a version bump.
2010-08-28 18:45:14 -04:00
2011-05-10 12:51:35 -04:00
2010-08-30 01:06:48 -04:00
*Rails 3.0.0 (August 29, 2010)*
2010-04-26 18:21:04 -04:00
* 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]
2009-08-09 09:24:06 -04:00
* Add support for errors in JSON format. #1956 [Fabien Jakimowicz]
2009-08-09 17:53:04 -04:00
* Recognizes 410 as Resource Gone. #2316 [Jordan Brough, Jatinder Singh]
2009-08-09 13:57:20 -04:00
* More thorough SSL support. #2370 [Roy Nicholson]
2009-05-18 18:34:44 -04:00
* HTTP proxy support. #2133 [Marshall Huss, Sébastien Dabet]
2009-03-15 23:06:50 -04:00
*2.3.2 [Final] (March 15, 2009)*
2009-02-27 08:46:23 -05:00
2009-03-15 23:06:50 -04:00
* Nothing new, just included in 2.3.2
2009-02-01 16:06:40 -05:00
2008-11-14 06:26:50 -05:00
*2.2.1 [RC2] (November 14th, 2008)*
2008-10-30 07:47:23 -04:00
* Fixed that ActiveResource#post would post an empty string when it shouldn't be posting anything #525 [Paolo Angelini]
2008-10-24 07:08:47 -04:00
*2.2.0 [RC1] (October 24th, 2008)*
2008-06-02 22:58:42 -04:00
2008-10-07 12:05:41 -04:00
* Add ActiveResource::Base#to_xml and ActiveResource::Base#to_json. #1011 [Rasik Pandey, Cody Fauser]
2008-08-21 22:03:26 -04:00
* Add ActiveResource::Base.find(:last). [#754 state:resolved] (Adrian Mugnolo)
2008-08-15 10:27:07 -04:00
* Fixed problems with the logger used if the logging string included %'s [#840 state:resolved] (Jamis Buck)
2008-06-02 22:58:42 -04:00
* Fixed Base#exists? to check status code as integer [#299 state:resolved] (Wes Oldenbeuving)
2008-05-31 20:03:03 -04:00
*2.1.0 (May 31st, 2008)*
2007-12-21 06:22:03 -05:00
2008-04-29 18:16:36 -04:00
* Fixed response logging to use length instead of the entire thing (seangeo) [#27]
2008-03-28 15:58:46 -04:00
* Fixed that to_param should be used and honored instead of hardcoding the id #11406 [gspiers]
2008-12-09 18:53:32 -05:00
* Improve documentation. [Ryan Bigg, Jan De Poorter, Cheah Chu Yeow, Xavier Shay, Jack Danger Canty, Emilio Tagua, Xavier Noria, Sunny Ripert]
2008-03-26 08:27:52 -04:00
2008-02-09 17:21:55 -05:00
* Use HEAD instead of GET in exists? [bscofield]
2008-12-09 18:53:32 -05:00
* Fix small documentation typo. Closes #10670 [Luca Guidi]
2008-01-02 14:27:21 -05:00
2008-01-02 04:14:34 -05:00
* find_or_create_resource_for handles module nesting. #10646 [xavier]
2008-12-09 18:53:32 -05:00
* Allow setting ActiveResource::Base#format before #site. [Rick Olson]
2007-12-28 12:12:35 -05:00
2007-12-28 12:03:58 -05:00
* Support agnostic formats when calling custom methods. Closes #10635 [joerichsen]
2007-12-21 16:42:27 -05:00
* Document custom methods. #10589 [Cheah Chu Yeow]
2007-12-21 06:22:03 -05:00
* Ruby 1.9 compatibility. [Jeremy Kemper]
2011-05-18 14:40:35 -04:00
*2.0.2 (December 16th, 2007)*
2007-12-10 00:53:56 -05:00
2007-12-14 18:09:46 -05:00
* Added more specific exceptions for 400, 401, and 403 (all descending from ClientError so existing rescues will work) #10326 [trek]
2007-12-10 00:53:56 -05:00
* Correct empty response handling. #10445 [seangeo]
2011-05-18 14:40:35 -04:00
*2.0.1 (December 7th, 2007)*
2007-11-28 19:27:53 -05:00
2007-11-18 19:06:23 -05:00
* Don't cache net/http object so that ActiveResource is more thread-safe. Closes #10142 [kou]
2008-12-09 18:53:32 -05:00
* Update XML documentation examples to include explicit type attributes. Closes #9754 [Josh Susser]
2007-11-06 13:33:45 -05:00
2008-12-09 18:53:32 -05:00
* Added one-off declarations of mock behavior [David Heinemeier Hansson]. Example:
2007-09-20 19:18:05 -04:00
Before:
ActiveResource::HttpMock.respond_to do |mock|
mock.get "/people/1.xml", {}, "<person><name>David</name></person>"
end
2010-08-14 01:13:00 -04:00
2007-09-20 19:18:05 -04:00
Now:
ActiveResource::HttpMock.respond_to.get "/people/1.xml", {}, "<person><name>David</name></person>"
2008-12-09 18:53:32 -05:00
* Added ActiveResource.format= which defaults to :xml but can also be set to :json [David Heinemeier Hansson]. Example:
2007-09-20 19:18:05 -04:00
class Person < ActiveResource::Base
self.site = "http://app/"
self.format = :json
end
2010-08-14 01:13:00 -04:00
2007-09-20 19:18:05 -04:00
person = Person.find(1) # => GET http://app/people/1.json
person.name = "David"
person.save # => PUT http://app/people/1.json {name: "David"}
2010-08-14 01:13:00 -04:00
2007-09-20 19:18:05 -04:00
Person.format = :xml
person.name = "Mary"
2010-08-14 01:13:00 -04:00
person.save # => PUT http://app/people/1.json <person><name>Mary</name></person>
2007-09-20 19:18:05 -04:00
2007-06-22 14:15:40 -04:00
* Fix reload error when path prefix is used. #8727 [Ian Warshak]
2007-06-09 00:42:32 -04:00
* 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]
2007-06-08 15:32:15 -04:00
* Fix query methods on resources. [Cody Fauser]
2008-12-09 18:53:32 -05:00
* pass the prefix_options to the instantiated record when using find without a specific id. Closes #8544 [Eloy Duran]
2007-06-01 13:14:14 -04:00
2007-05-26 16:57:08 -04:00
* Recognize and raise an exception on 405 Method Not Allowed responses. #7692 [Josh Peek]
2007-05-08 23:51:06 -04:00
* Handle string and symbol param keys when splitting params into prefix params and query params.
Comment.find(:all, :params => { :article_id => 5, :page => 2 }) or Comment.find(:all, :params => { 'article_id' => 5, :page => 2 })
2008-12-09 18:53:32 -05:00
* Added find-one with symbol [David Heinemeier Hansson]. Example: Person.find(:one, :from => :leader) # => GET /people/leader.xml
2007-05-01 00:48:48 -04:00
2008-12-09 18:53:32 -05:00
* BACKWARDS INCOMPATIBLE: Changed the finder API to be more extensible with :params and more strict usage of scopes [David Heinemeier Hansson]. Changes:
2007-05-01 00:48:48 -04:00
Person.find(:all, :title => "CEO") ...becomes: Person.find(:all, :params => { :title => "CEO" })
Person.find(:managers) ...becomes: Person.find(:all, :from => :managers)
Person.find("/companies/1/manager.xml") ...becomes: Person.find(:one, :from => "/companies/1/manager.xml")
2008-12-09 18:53:32 -05:00
* Add support for setting custom headers per Active Resource model [Rick Olson]
2007-04-28 23:14:36 -04:00
class Project
2007-04-29 00:46:14 -04:00
headers['X-Token'] = 'foo'
2007-04-28 23:14:36 -04:00
end
2010-08-14 01:13:00 -04:00
2007-04-28 23:14:36 -04:00
# makes the GET request with the custom X-Token header
Project.find(:all)
2008-12-09 18:53:32 -05:00
* Added find-by-path options to ActiveResource::Base.find [David Heinemeier Hansson]. Examples:
2007-04-27 16:54:53 -04:00
employees = Person.find(:all, :from => "/companies/1/people.xml") # => GET /companies/1/people.xml
manager = Person.find("/companies/1/manager.xml") # => GET /companies/1/manager.xml
2008-12-09 18:53:32 -05:00
* Added support for using classes from within a single nested module [David Heinemeier Hansson]. Example:
2007-04-26 15:38:16 -04:00
module Highrise
class Note < ActiveResource::Base
self.site = "http://37s.sunrise.i:3000"
end
class Comment < ActiveResource::Base
self.site = "http://37s.sunrise.i:3000"
end
end
assert_kind_of Highrise::Comment, Note.find(1).comments.first
2010-08-14 01:13:00 -04:00
2007-04-26 15:38:16 -04:00
2008-12-09 18:53:32 -05:00
* Added load_attributes_from_response as a way of loading attributes from other responses than just create [David Heinemeier Hansson]
2007-04-25 22:11:16 -04:00
class Highrise::Task < ActiveResource::Base
def complete
load_attributes_from_response(post(:complete))
end
end
...will set "done_at" when complete is called.
2007-04-25 21:53:01 -04:00
* Added support for calling custom methods #6979 [rwdaigle]
Person.find(:managers) # => GET /people/managers.xml
Kase.find(1).post(:close) # => POST /kases/1/close.xml
2008-12-09 18:53:32 -05:00
* Remove explicit prefix_options parameter for ActiveResource::Base#initialize. [Rick Olson]
2007-04-24 12:05:20 -04:00
ActiveResource splits the prefix_options from it automatically.
2008-12-09 18:53:32 -05:00
* Allow ActiveResource::Base.delete with custom prefix. [Rick Olson]
2007-04-24 12:05:20 -04:00
2008-12-09 18:53:32 -05:00
* Add ActiveResource::Base#dup [Rick Olson]
2007-04-24 12:05:20 -04:00
2008-12-09 18:53:32 -05:00
* Fixed constant warning when fetching the same object multiple times [David Heinemeier Hansson]
2007-04-19 18:18:03 -04:00
2008-12-09 18:53:32 -05:00
* Added that saves which get a body response (and not just a 201) will use that response to update themselves [David Heinemeier Hansson]
2007-04-19 18:18:03 -04:00
2008-12-09 18:53:32 -05:00
* Disregard namespaces from the default element name, so Highrise::Person will just try to fetch from "/people", not "/highrise/people" [David Heinemeier Hansson]
2007-04-19 18:18:03 -04:00
2007-03-11 09:27:57 -04:00
* Allow array and hash query parameters. #7756 [Greg Spurrier]
2007-01-24 13:27:36 -05:00
* Loading a resource preserves its prefix_options. #7353 [Ryan Daigle]
2007-01-23 21:40:32 -05:00
* Carry over the convenience of #create from ActiveRecord. Closes #7340. [Ryan Daigle]
2007-01-23 00:22:33 -05:00
* Increase ActiveResource::Base test coverage. Closes #7173, #7174 [Rich Collins]
2007-01-16 19:46:32 -05:00
* Interpret 422 Unprocessable Entity as ResourceInvalid. #7097 [dkubb]
2007-01-16 01:34:10 -05:00
* Mega documentation patches. #7025, #7069 [rwdaigle]
2007-01-12 02:20:05 -05:00
* Base.exists?(id, options) and Base#exists? check whether the resource is found. #6970 [rwdaigle]
2006-12-28 20:18:09 -05:00
* Query string support. [untext, Jeremy Kemper]
# GET /forums/1/topics.xml?sort=created_at
Topic.find(:all, :forum_id => 1, :sort => 'created_at')
2006-12-22 16:42:52 -05:00
* 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]
2008-12-09 18:53:32 -05:00
* Allow subclassed resources to share the site info [Rick Olson, Jeremy Kemper]
2007-04-24 12:05:59 -04:00
d
2006-12-12 21:15:27 -05:00
class BeastResource < ActiveResource::Base
self.site = 'http://beast.caboo.se'
end
2006-12-21 17:12:21 -05:00
2006-12-12 21:15:27 -05:00
class Forum < BeastResource
# taken from BeastResource
# self.site = 'http://beast.caboo.se'
end
2006-12-21 17:12:21 -05:00
2006-12-12 21:15:27 -05:00
class Topic < BeastResource
2006-12-21 17:12:21 -05:00
self.site += '/forums/:forum_id'
2006-12-12 21:15:27 -05:00
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]
2010-08-14 01:13:00 -04:00
Parses the xml response of ActiveRecord::Errors#to_xml with a similar interface to ActiveRecord::Errors.
2006-09-07 20:07:30 -04:00
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
2010-08-14 01:13:00 -04:00
2006-08-31 21:15:10 -04:00
# rails routing code
map.resources :posts do |post|
post.resources :comments
end
2010-08-14 01:13:00 -04:00
2006-08-31 21:15:10 -04:00
# 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
2010-08-14 01:13:00 -04:00
2006-08-31 21:15:10 -04:00
@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
2008-12-09 18:53:32 -05:00
* Initial checkin: object-oriented client for restful HTTP resources which follow the Rails convention. [David Heinemeier Hansson]