Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 166 lines (108 sloc) 5.956 kb
8261f17 @jeremy start an Active Resource changelog
jeremy authored
1 *SVN*
2
bd50d82 @technoweenie Add support for setting custom headers per ActiveResource model [Rick]
technoweenie authored
3 * Add support for setting custom headers per ActiveResource model [Rick]
4
5 class Project
8e8fd99 @technoweenie change #custom_headers to just #headers [Rick]
technoweenie authored
6 headers['X-Token'] = 'foo'
bd50d82 @technoweenie Add support for setting custom headers per ActiveResource model [Rick]
technoweenie authored
7 end
8
9 # makes the GET request with the custom X-Token header
10 Project.find(:all)
11
1d5c34c @dhh Added find-by-path options to ActiveResource::Base.find [DHH]
dhh authored
12 * Added find-by-path options to ActiveResource::Base.find [DHH]. Examples:
13
14 employees = Person.find(:all, :from => "/companies/1/people.xml") # => GET /companies/1/people.xml
15 manager = Person.find("/companies/1/manager.xml") # => GET /companies/1/manager.xml
16
17
234b0b7 @dhh Added support for using classes from within a single nested module [DHH]
dhh authored
18 * Added support for using classes from within a single nested module [DHH]. Example:
19
20 module Highrise
21 class Note < ActiveResource::Base
22 self.site = "http://37s.sunrise.i:3000"
23 end
24
25 class Comment < ActiveResource::Base
26 self.site = "http://37s.sunrise.i:3000"
27 end
28 end
29
30 assert_kind_of Highrise::Comment, Note.find(1).comments.first
31
32
37e8e35 @dhh Added load_attributes_from_response as a way of loading attributes from ...
dhh authored
33 * Added load_attributes_from_response as a way of loading attributes from other responses than just create [DHH]
34
35 class Highrise::Task < ActiveResource::Base
36 def complete
37 load_attributes_from_response(post(:complete))
38 end
39 end
40
41 ...will set "done_at" when complete is called.
42
43
9b8399f @dhh Added support for calling custom methods #6979 [rwdaigle]
dhh authored
44 * Added support for calling custom methods #6979 [rwdaigle]
45
46 Person.find(:managers) # => GET /people/managers.xml
47 Kase.find(1).post(:close) # => POST /kases/1/close.xml
48
208d12d @technoweenie Remove explicit prefix_options parameter for ActiveResource::Base#initia...
technoweenie authored
49 * Remove explicit prefix_options parameter for ActiveResource::Base#initialize. [Rick]
50 ActiveResource splits the prefix_options from it automatically.
51
52 * Allow ActiveResource::Base.delete with custom prefix. [Rick]
53
54 * Add ActiveResource::Base#dup [Rick]
55
c97f329 @dhh Disregard namespaces from the default element name, so Highrise::Person ...
dhh authored
56 * Fixed constant warning when fetching the same object multiple times [DHH]
57
58 * Added that saves which get a body response (and not just a 201) will use that response to update themselves [DHH]
59
60 * Disregard namespaces from the default element name, so Highrise::Person will just try to fetch from "/people", not "/highrise/people" [DHH]
61
d97456d @jeremy Allow array and hash query parameters. Closes #7756.
jeremy authored
62 * Allow array and hash query parameters. #7756 [Greg Spurrier]
63
1b1ddf1 @jeremy Loading a resource preserves its prefix_options. Closes #7353. Silence p...
jeremy authored
64 * Loading a resource preserves its prefix_options. #7353 [Ryan Daigle]
65
f49e449 @technoweenie Carry over the convenience of #create from ActiveRecord. Closes #7340. ...
technoweenie authored
66 * Carry over the convenience of #create from ActiveRecord. Closes #7340. [Ryan Daigle]
67
1bdb14b @technoweenie Increase ActiveResource::Base test coverage. Closes #7173, #7174 [Rich ...
technoweenie authored
68 * Increase ActiveResource::Base test coverage. Closes #7173, #7174 [Rich Collins]
69
e00e6a2 @jeremy Interpret 422 Unprocessable Entity as ResourceInvalid. Closes #7097.
jeremy authored
70 * Interpret 422 Unprocessable Entity as ResourceInvalid. #7097 [dkubb]
71
932e7b0 @technoweenie Mega documentation patches. #7025, #7069 [rwdaigle]
technoweenie authored
72 * Mega documentation patches. #7025, #7069 [rwdaigle]
73
2bb33bb @jeremy Base.exists?(id, options) and Base#exists? check whether the resource is...
jeremy authored
74 * Base.exists?(id, options) and Base#exists? check whether the resource is found. #6970 [rwdaigle]
75
4e57ac3 @jeremy Query string support. Closes #6855.
jeremy authored
76 * Query string support. [untext, Jeremy Kemper]
77 # GET /forums/1/topics.xml?sort=created_at
78 Topic.find(:all, :forum_id => 1, :sort => 'created_at')
79
c172154 @jeremy Base#==, eql?, and hash methods. == returns true if its argument is iden...
jeremy authored
80 * 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]
81
e6988ef @jeremy Subclasses share superclass site until explicitly set. This way you can ...
jeremy authored
82 * 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
83 d
011f4e7 @technoweenie Allow subclassed resources to share the site info [Rick]
technoweenie authored
84 class BeastResource < ActiveResource::Base
85 self.site = 'http://beast.caboo.se'
86 end
e6988ef @jeremy Subclasses share superclass site until explicitly set. This way you can ...
jeremy authored
87
011f4e7 @technoweenie Allow subclassed resources to share the site info [Rick]
technoweenie authored
88 class Forum < BeastResource
89 # taken from BeastResource
90 # self.site = 'http://beast.caboo.se'
91 end
e6988ef @jeremy Subclasses share superclass site until explicitly set. This way you can ...
jeremy authored
92
011f4e7 @technoweenie Allow subclassed resources to share the site info [Rick]
technoweenie authored
93 class Topic < BeastResource
e6988ef @jeremy Subclasses share superclass site until explicitly set. This way you can ...
jeremy authored
94 self.site += '/forums/:forum_id'
011f4e7 @technoweenie Allow subclassed resources to share the site info [Rick]
technoweenie authored
95 end
96
55d4dbb @technoweenie Fix issues with ActiveResource collection handling. Closes #6291. [bmil...
technoweenie authored
97 * Fix issues with ActiveResource collection handling. Closes #6291. [bmilekic]
98
1d31a04 Use attr_accessor_with_default to dry up attribute initialization. Refer...
Marcel Molina authored
99 * Use attr_accessor_with_default to dry up attribute initialization. References #6538. [Stuart Halloway]
100
9c94438 @jamis Add basic logging support for logging outgoing requests.
jamis authored
101 * Add basic logging support for logging outgoing requests. [Jamis Buck]
102
6c0609f @jamis Add Base.delete for deleting resources without having to instantiate the...
jamis authored
103 * Add Base.delete for deleting resources without having to instantiate them first. [Jamis Buck]
104
628838e @jamis Make #save behavior mimic AR::Base#save (true on success, false on failu...
jamis authored
105 * Make #save behavior mimic AR::Base#save (true on success, false on failure). [Jamis Buck]
106
7ac6ed8 @technoweenie Add Basic HTTP Authentication to ActiveResource (closes #6305). [jonatha...
technoweenie authored
107 * Add Basic HTTP Authentication to ActiveResource (closes #6305). [jonathan]
108
4d63e01 @technoweenie fixed failing tests now that non-GET requests are sent with .xml file ex...
technoweenie authored
109 * Extracted #id_from_response as an entry point for customizing how a created resource gets its own ID.
110 By default, it extracts from the Location response header.
111
0a84624 @jeremy Optimistic locking: raise ActiveResource::ResourceConflict on 409 Confli...
jeremy authored
112 * Optimistic locking: raise ActiveResource::ResourceConflict on 409 Conflict response. [Jeremy Kemper]
113
114 # Example controller action
115 def update
116 @person.save!
117 rescue ActiveRecord::StaleObjectError
118 render :xml => @person.reload.to_xml, :status => '409 Conflict'
119 end
120
8d9e660 @technoweenie Basic validation support [Rick Olson]
technoweenie authored
121 * Basic validation support [Rick Olson]
122
123 Parses the xml response of ActiveRecord::Errors#to_xml with a similar interface to ActiveRecord::Errors.
124
125 render :xml => @person.errors.to_xml, :status => '400 Validation Error'
126
c918fbf @jeremy Deep hashes are converted into collections of resources. Class attribute...
jeremy authored
127 * Deep hashes are converted into collections of resources. [Jeremy Kemper]
128 Person.new :name => 'Bob',
129 :address => { :id => 1, :city => 'Portland' },
130 :contacts => [{ :id => 1 }, { :id => 2 }]
131 Looks for Address and Contact resources and creates them if unavailable.
132 So clients can fetch a complex resource in a single request if you e.g.
133 render :xml => @person.to_xml(:include => [:address, :contacts])
134 in your controller action.
135
7749c9c @technoweenie Major updates to ActiveResource, please see changelog and unit tests [Ri...
technoweenie authored
136 * Major updates [Rick Olson]
137
138 * Add full support for find/create/update/destroy
139 * Add support for specifying prefixes.
140 * Allow overriding of element_name, collection_name, and primary key
141 * Provide simpler HTTP mock interface for testing
142
143 # rails routing code
144 map.resources :posts do |post|
145 post.resources :comments
146 end
147
148 # ActiveResources
149 class Post < ActiveResource::Base
150 self.site = "http://37s.sunrise.i:3000/"
151 end
152
153 class Comment < ActiveResource::Base
154 self.site = "http://37s.sunrise.i:3000/posts/:post_id/"
155 end
156
157 @post = Post.find 5
158 @comments = Comment.find :all, :post_id => @post.id
159
160 @comment = Comment.new({:body => 'hello world'}, {:post_id => @post.id})
161 @comment.save
162
f9b3694 @jeremy 200...400 are valid response codes. PUT and POST request bodies default ...
jeremy authored
163 * 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
164
8261f17 @jeremy start an Active Resource changelog
jeremy authored
165 * Initial checkin: object-oriented client for restful HTTP resources which follow the Rails convention. [DHH]
Something went wrong with that request. Please try again.