Skip to content

HTTPS clone URL

Subversion checkout URL

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