Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 233 lines (147 sloc) 8.744 kb
a1ec3aa @jeremy Ruby 1.9 compatibility
jeremy authored
1 *SVN*
2
c54b915 @technoweenie Support agnostic formats when calling custom methods. Closes #10635 [jo...
technoweenie authored
3 * Support agnostic formats when calling custom methods. Closes #10635 [joerichsen]
4
470fc02 @jeremy Document custom methods. Closes #10589.
jeremy authored
5 * Document custom methods. #10589 [Cheah Chu Yeow]
6
a1ec3aa @jeremy Ruby 1.9 compatibility
jeremy authored
7 * Ruby 1.9 compatibility. [Jeremy Kemper]
8
9
69edebf @dhh Prepare for 2.0.2 release
dhh authored
10 *2.0.2* (December 16th, 2007)
c81fff2 @jeremy Correct empty response handling. Closes #10445.
jeremy authored
11
1ceccde @dhh Added more specific exceptions for 400, 401, and 403 (all descending fro...
dhh authored
12 * Added more specific exceptions for 400, 401, and 403 (all descending from ClientError so existing rescues will work) #10326 [trek]
13
c81fff2 @jeremy Correct empty response handling. Closes #10445.
jeremy authored
14 * Correct empty response handling. #10445 [seangeo]
15
16
1acd54a @dhh Make ready for 2.0.1
dhh authored
17 *2.0.1* (December 7th, 2007)
54a75de @dhh Prep for RC2
dhh authored
18
24e6cbc @technoweenie Don't cache net/http object so that ActiveResource is more thread-safe. ...
technoweenie authored
19 * Don't cache net/http object so that ActiveResource is more thread-safe. Closes #10142 [kou]
20
7863c4a Update XML documentation examples to include explicit type attributes. C...
Marcel Molina authored
21 * Update XML documentation examples to include explicit type attributes. Closes #9754 [hasmanyjosh]
22
dc399b9 @dhh Added ActiveResource.format= which defaults to :xml but can also be set ...
dhh authored
23 * Added one-off declarations of mock behavior [DHH]. Example:
24
25 Before:
26 ActiveResource::HttpMock.respond_to do |mock|
27 mock.get "/people/1.xml", {}, "<person><name>David</name></person>"
28 end
29
30 Now:
31 ActiveResource::HttpMock.respond_to.get "/people/1.xml", {}, "<person><name>David</name></person>"
32
33 * Added ActiveResource.format= which defaults to :xml but can also be set to :json [DHH]. Example:
34
35 class Person < ActiveResource::Base
36 self.site = "http://app/"
37 self.format = :json
38 end
39
40 person = Person.find(1) # => GET http://app/people/1.json
41 person.name = "David"
42 person.save # => PUT http://app/people/1.json {name: "David"}
43
44 Person.format = :xml
45 person.name = "Mary"
46 person.save # => PUT http://app/people/1.json <person><name>Mary</name></person>
47
e682fee @jeremy Fix reload error when path prefix is used. Closes #8727.
jeremy authored
48 * Fix reload error when path prefix is used. #8727 [Ian Warshak]
49
fde3d9d @jeremy Remove ActiveResource::Struct because it hasn't proven very useful. Crea...
jeremy authored
50 * 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]
51
bfda4cd Fixed query methods on resources. [Cody Fauser]
Tobias Lütke authored
52 * Fix query methods on resources. [Cody Fauser]
53
4d1c87a @technoweenie pass the prefix_options to the instantiated record when using find witho...
technoweenie authored
54 * pass the prefix_options to the instantiated record when using find without a specific id. Closes #8544 [alloy]
55
849038e @jeremy Recognize and raise an exception on 405 Method Not Allowed responses. Cl...
jeremy authored
56 * Recognize and raise an exception on 405 Method Not Allowed responses. #7692 [Josh Peek]
57
0873678 @technoweenie Handle string and symbol param keys when splitting params into prefix pa...
technoweenie authored
58 * Handle string and symbol param keys when splitting params into prefix params and query params.
59
60 Comment.find(:all, :params => { :article_id => 5, :page => 2 }) or Comment.find(:all, :params => { 'article_id' => 5, :page => 2 })
61
04fd94d @dhh BACKWARDS INCOMPATIBLE: Changed the finder API to be more extensible wit...
dhh authored
62 * Added find-one with symbol [DHH]. Example: Person.find(:one, :from => :leader) # => GET /people/leader.xml
63
64 * BACKWARDS INCOMPATIBLE: Changed the finder API to be more extensible with :params and more strict usage of scopes [DHH]. Changes:
65
66 Person.find(:all, :title => "CEO") ...becomes: Person.find(:all, :params => { :title => "CEO" })
67 Person.find(:managers) ...becomes: Person.find(:all, :from => :managers)
68 Person.find("/companies/1/manager.xml") ...becomes: Person.find(:one, :from => "/companies/1/manager.xml")
69
70 * Add support for setting custom headers per Active Resource model [Rick]
bd50d82 @technoweenie Add support for setting custom headers per ActiveResource model [Rick]
technoweenie authored
71
72 class Project
8e8fd99 @technoweenie change #custom_headers to just #headers [Rick]
technoweenie authored
73 headers['X-Token'] = 'foo'
bd50d82 @technoweenie Add support for setting custom headers per ActiveResource model [Rick]
technoweenie authored
74 end
75
76 # makes the GET request with the custom X-Token header
77 Project.find(:all)
78
1d5c34c @dhh Added find-by-path options to ActiveResource::Base.find [DHH]
dhh authored
79 * Added find-by-path options to ActiveResource::Base.find [DHH]. Examples:
80
81 employees = Person.find(:all, :from => "/companies/1/people.xml") # => GET /companies/1/people.xml
82 manager = Person.find("/companies/1/manager.xml") # => GET /companies/1/manager.xml
83
84
234b0b7 @dhh Added support for using classes from within a single nested module [DHH]
dhh authored
85 * Added support for using classes from within a single nested module [DHH]. Example:
86
87 module Highrise
88 class Note < ActiveResource::Base
89 self.site = "http://37s.sunrise.i:3000"
90 end
91
92 class Comment < ActiveResource::Base
93 self.site = "http://37s.sunrise.i:3000"
94 end
95 end
96
97 assert_kind_of Highrise::Comment, Note.find(1).comments.first
98
99
37e8e35 @dhh Added load_attributes_from_response as a way of loading attributes from ...
dhh authored
100 * Added load_attributes_from_response as a way of loading attributes from other responses than just create [DHH]
101
102 class Highrise::Task < ActiveResource::Base
103 def complete
104 load_attributes_from_response(post(:complete))
105 end
106 end
107
108 ...will set "done_at" when complete is called.
109
110
9b8399f @dhh Added support for calling custom methods #6979 [rwdaigle]
dhh authored
111 * Added support for calling custom methods #6979 [rwdaigle]
112
113 Person.find(:managers) # => GET /people/managers.xml
114 Kase.find(1).post(:close) # => POST /kases/1/close.xml
115
208d12d @technoweenie Remove explicit prefix_options parameter for ActiveResource::Base#initia...
technoweenie authored
116 * Remove explicit prefix_options parameter for ActiveResource::Base#initialize. [Rick]
117 ActiveResource splits the prefix_options from it automatically.
118
119 * Allow ActiveResource::Base.delete with custom prefix. [Rick]
120
121 * Add ActiveResource::Base#dup [Rick]
122
c97f329 @dhh Disregard namespaces from the default element name, so Highrise::Person ...
dhh authored
123 * Fixed constant warning when fetching the same object multiple times [DHH]
124
125 * Added that saves which get a body response (and not just a 201) will use that response to update themselves [DHH]
126
127 * Disregard namespaces from the default element name, so Highrise::Person will just try to fetch from "/people", not "/highrise/people" [DHH]
128
d97456d @jeremy Allow array and hash query parameters. Closes #7756.
jeremy authored
129 * Allow array and hash query parameters. #7756 [Greg Spurrier]
130
1b1ddf1 @jeremy Loading a resource preserves its prefix_options. Closes #7353. Silence p...
jeremy authored
131 * Loading a resource preserves its prefix_options. #7353 [Ryan Daigle]
132
f49e449 @technoweenie Carry over the convenience of #create from ActiveRecord. Closes #7340. ...
technoweenie authored
133 * Carry over the convenience of #create from ActiveRecord. Closes #7340. [Ryan Daigle]
134
1bdb14b @technoweenie Increase ActiveResource::Base test coverage. Closes #7173, #7174 [Rich ...
technoweenie authored
135 * Increase ActiveResource::Base test coverage. Closes #7173, #7174 [Rich Collins]
136
e00e6a2 @jeremy Interpret 422 Unprocessable Entity as ResourceInvalid. Closes #7097.
jeremy authored
137 * Interpret 422 Unprocessable Entity as ResourceInvalid. #7097 [dkubb]
138
932e7b0 @technoweenie Mega documentation patches. #7025, #7069 [rwdaigle]
technoweenie authored
139 * Mega documentation patches. #7025, #7069 [rwdaigle]
140
2bb33bb @jeremy Base.exists?(id, options) and Base#exists? check whether the resource is...
jeremy authored
141 * Base.exists?(id, options) and Base#exists? check whether the resource is found. #6970 [rwdaigle]
142
4e57ac3 @jeremy Query string support. Closes #6855.
jeremy authored
143 * Query string support. [untext, Jeremy Kemper]
144 # GET /forums/1/topics.xml?sort=created_at
145 Topic.find(:all, :forum_id => 1, :sort => 'created_at')
146
c172154 @jeremy Base#==, eql?, and hash methods. == returns true if its argument is iden...
jeremy authored
147 * 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]
148
e6988ef @jeremy Subclasses share superclass site until explicitly set. This way you can ...
jeremy authored
149 * Allow subclassed resources to share the site info [Rick, Jeremy Kemper]
2df386a @technoweenie why oh why do i always forget to save the changelog
technoweenie authored
150 d
011f4e7 @technoweenie Allow subclassed resources to share the site info [Rick]
technoweenie authored
151 class BeastResource < ActiveResource::Base
152 self.site = 'http://beast.caboo.se'
153 end
e6988ef @jeremy Subclasses share superclass site until explicitly set. This way you can ...
jeremy authored
154
011f4e7 @technoweenie Allow subclassed resources to share the site info [Rick]
technoweenie authored
155 class Forum < BeastResource
156 # taken from BeastResource
157 # self.site = 'http://beast.caboo.se'
158 end
e6988ef @jeremy Subclasses share superclass site until explicitly set. This way you can ...
jeremy authored
159
011f4e7 @technoweenie Allow subclassed resources to share the site info [Rick]
technoweenie authored
160 class Topic < BeastResource
e6988ef @jeremy Subclasses share superclass site until explicitly set. This way you can ...
jeremy authored
161 self.site += '/forums/:forum_id'
011f4e7 @technoweenie Allow subclassed resources to share the site info [Rick]
technoweenie authored
162 end
163
55d4dbb @technoweenie Fix issues with ActiveResource collection handling. Closes #6291. [bmil...
technoweenie authored
164 * Fix issues with ActiveResource collection handling. Closes #6291. [bmilekic]
165
1d31a04 Use attr_accessor_with_default to dry up attribute initialization. Refer...
Marcel Molina authored
166 * Use attr_accessor_with_default to dry up attribute initialization. References #6538. [Stuart Halloway]
167
9c94438 @jamis Add basic logging support for logging outgoing requests.
jamis authored
168 * Add basic logging support for logging outgoing requests. [Jamis Buck]
169
6c0609f @jamis Add Base.delete for deleting resources without having to instantiate the...
jamis authored
170 * Add Base.delete for deleting resources without having to instantiate them first. [Jamis Buck]
171
628838e @jamis Make #save behavior mimic AR::Base#save (true on success, false on failu...
jamis authored
172 * Make #save behavior mimic AR::Base#save (true on success, false on failure). [Jamis Buck]
173
7ac6ed8 @technoweenie Add Basic HTTP Authentication to ActiveResource (closes #6305). [jonatha...
technoweenie authored
174 * Add Basic HTTP Authentication to ActiveResource (closes #6305). [jonathan]
175
4d63e01 @technoweenie fixed failing tests now that non-GET requests are sent with .xml file ex...
technoweenie authored
176 * Extracted #id_from_response as an entry point for customizing how a created resource gets its own ID.
177 By default, it extracts from the Location response header.
178
0a84624 @jeremy Optimistic locking: raise ActiveResource::ResourceConflict on 409 Confli...
jeremy authored
179 * Optimistic locking: raise ActiveResource::ResourceConflict on 409 Conflict response. [Jeremy Kemper]
180
181 # Example controller action
182 def update
183 @person.save!
184 rescue ActiveRecord::StaleObjectError
185 render :xml => @person.reload.to_xml, :status => '409 Conflict'
186 end
187
8d9e660 @technoweenie Basic validation support [Rick Olson]
technoweenie authored
188 * Basic validation support [Rick Olson]
189
190 Parses the xml response of ActiveRecord::Errors#to_xml with a similar interface to ActiveRecord::Errors.
191
192 render :xml => @person.errors.to_xml, :status => '400 Validation Error'
193
c918fbf @jeremy Deep hashes are converted into collections of resources. Class attribute...
jeremy authored
194 * Deep hashes are converted into collections of resources. [Jeremy Kemper]
195 Person.new :name => 'Bob',
196 :address => { :id => 1, :city => 'Portland' },
197 :contacts => [{ :id => 1 }, { :id => 2 }]
198 Looks for Address and Contact resources and creates them if unavailable.
199 So clients can fetch a complex resource in a single request if you e.g.
200 render :xml => @person.to_xml(:include => [:address, :contacts])
201 in your controller action.
202
7749c9c @technoweenie Major updates to ActiveResource, please see changelog and unit tests [Ri...
technoweenie authored
203 * Major updates [Rick Olson]
204
205 * Add full support for find/create/update/destroy
206 * Add support for specifying prefixes.
207 * Allow overriding of element_name, collection_name, and primary key
208 * Provide simpler HTTP mock interface for testing
209
210 # rails routing code
211 map.resources :posts do |post|
212 post.resources :comments
213 end
214
215 # ActiveResources
216 class Post < ActiveResource::Base
217 self.site = "http://37s.sunrise.i:3000/"
218 end
219
220 class Comment < ActiveResource::Base
221 self.site = "http://37s.sunrise.i:3000/posts/:post_id/"
222 end
223
224 @post = Post.find 5
225 @comments = Comment.find :all, :post_id => @post.id
226
227 @comment = Comment.new({:body => 'hello world'}, {:post_id => @post.id})
228 @comment.save
229
f9b3694 @jeremy 200...400 are valid response codes. PUT and POST request bodies default ...
jeremy authored
230 * Base.site= accepts URIs. 200...400 are valid response codes. PUT and POST request bodies default to ''. [Jeremy Kemper]
c1af2db @jeremy site= accepts URIs
jeremy authored
231
8261f17 @jeremy start an Active Resource changelog
jeremy authored
232 * Initial checkin: object-oriented client for restful HTTP resources which follow the Rails convention. [DHH]
Something went wrong with that request. Please try again.