activeresource 2.3.2 → 2.3.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activeresource might be problematic. Click here for more details.

data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ *2.3.3 (July 20, 2009)*
2
+
3
+ * No changes, just a version bump.
4
+
1
5
  *2.3.2 [Final] (March 15, 2009)*
2
6
 
3
7
  * Nothing new, just included in 2.3.2
data/Rakefile CHANGED
@@ -4,7 +4,6 @@ require 'rake/testtask'
4
4
  require 'rake/rdoctask'
5
5
  require 'rake/packagetask'
6
6
  require 'rake/gempackagetask'
7
- require 'rake/contrib/sshpublisher'
8
7
 
9
8
  require File.join(File.dirname(__FILE__), 'lib', 'active_resource', 'version')
10
9
 
@@ -67,7 +66,7 @@ spec = Gem::Specification.new do |s|
67
66
  s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
68
67
  end
69
68
 
70
- s.add_dependency('activesupport', '= 2.3.2' + PKG_BUILD)
69
+ s.add_dependency('activesupport', '= 2.3.3' + PKG_BUILD)
71
70
 
72
71
  s.require_path = 'lib'
73
72
  s.autorequire = 'active_resource'
@@ -117,12 +116,14 @@ end
117
116
 
118
117
  desc "Publish the beta gem"
119
118
  task :pgem => [:package] do
119
+ require 'rake/contrib/sshpublisher'
120
120
  Rake::SshFilePublisher.new("gems.rubyonrails.org", "/u/sites/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
121
121
  `ssh gems.rubyonrails.org '/u/sites/gems/gemupdate.sh'`
122
122
  end
123
123
 
124
124
  desc "Publish the API documentation"
125
125
  task :pdoc => [:rdoc] do
126
+ require 'rake/contrib/sshpublisher'
126
127
  Rake::SshDirPublisher.new("wrath.rubyonrails.org", "public_html/ar", "doc").upload
127
128
  end
128
129
 
@@ -832,7 +832,7 @@ module ActiveResource
832
832
  !new? && self.class.exists?(to_param, :params => prefix_options)
833
833
  end
834
834
 
835
- # A method to convert the the resource to an XML string.
835
+ # Converts the resource to an XML string representation.
836
836
  #
837
837
  # ==== Options
838
838
  # The +options+ parameter is handed off to the +to_xml+ method on each
@@ -841,7 +841,14 @@ module ActiveResource
841
841
  #
842
842
  # * <tt>:indent</tt> - Set the indent level for the XML output (default is +2+).
843
843
  # * <tt>:dasherize</tt> - Boolean option to determine whether or not element names should
844
- # replace underscores with dashes (default is <tt>false</tt>).
844
+ # replace underscores with dashes. Default is <tt>true</tt>. The default can be set to <tt>false</tt>
845
+ # by setting the module attribute <tt>ActiveSupport.dasherize_xml = false</tt> in an initializer. Because save
846
+ # uses this method, and there are no options on save, then you will have to set the default if you don't
847
+ # want underscores in element names to become dashes when the resource is saved. This is important when
848
+ # integrating with non-Rails applications.
849
+ # * <tt>:camelize</tt> - Boolean option to determine whether or not element names should be converted
850
+ # to camel case, e.g some_name to SomeName. Default is <tt>false</tt>. Like <tt>:dasherize</tt> you can
851
+ # change the default by setting the module attribute <tt>ActiveSupport.camelise_xml = true</tt> in an initializer.
845
852
  # * <tt>:skip_instruct</tt> - Toggle skipping the +instruct!+ call on the XML builder
846
853
  # that generates the XML declaration (default is <tt>false</tt>).
847
854
  #
@@ -861,8 +868,7 @@ module ActiveResource
861
868
  attributes.to_xml({:root => self.class.element_name}.merge(options))
862
869
  end
863
870
 
864
- # Returns a JSON string representing the model. Some configuration is
865
- # available through +options+.
871
+ # Coerces to a hash for JSON encoding.
866
872
  #
867
873
  # ==== Options
868
874
  # The +options+ are passed to the +to_json+ method on each
@@ -886,8 +892,8 @@ module ActiveResource
886
892
  #
887
893
  # person.to_json(:except => ["first_name"])
888
894
  # # => {"last_name": "Smith"}
889
- def to_json(options={})
890
- attributes.to_json(options)
895
+ def as_json(options = nil)
896
+ attributes.as_json(options)
891
897
  end
892
898
 
893
899
  # Returns the serialized string representation of the resource in the configured
@@ -11,8 +11,8 @@ module ActiveResource
11
11
  "application/json"
12
12
  end
13
13
 
14
- def encode(hash, options={})
15
- hash.to_json(options)
14
+ def encode(hash, options = nil)
15
+ ActiveSupport::JSON.encode(hash, options)
16
16
  end
17
17
 
18
18
  def decode(json)
@@ -2,7 +2,7 @@ module ActiveResource
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 2
4
4
  MINOR = 3
5
- TINY = 2
5
+ TINY = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -1,8 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'test/unit'
3
-
4
- gem 'mocha', '>= 0.9.5'
5
- require 'mocha'
3
+ require 'active_support/test_case'
6
4
 
7
5
  $:.unshift "#{File.dirname(__FILE__)}/../lib"
8
6
  $:.unshift "#{File.dirname(__FILE__)}/../../activesupport/lib"
data/test/debug.log ADDED
@@ -0,0 +1,274 @@
1
+ # Logfile created on Sun Feb 01 22:17:52 +0100 2009 by /
2
+ DELETE http://localhost:80/people/2.xml
3
+ --> 200 200 (0 0ms)
4
+ GET http://localhost:80/people/2.xml
5
+ --> 200 200 (107 0ms)
6
+ POST http://localhost:80/people/2/addresses.xml
7
+ --> 201 201 (0 0ms)
8
+ PUT http://localhost:80/people/2.xml
9
+ --> 204 204 (0 0ms)
10
+ POST http://localhost:80/people/2.xml
11
+ POST http://localhost:80/people/2/addresses.xml
12
+ PUT http://localhost:80/people/2.xml
13
+ DELETE http://localhost:80/people/2.xml
14
+ POST http://37s.sunrise.i:3000/people.xml
15
+ --> 422 422 (209 0ms)
16
+ POST http://37s.sunrise.i:3000/people.xml
17
+ --> 422 422 (209 0ms)
18
+ POST http://37s.sunrise.i:3000/people.xml
19
+ --> 422 422 (209 0ms)
20
+ POST http://37s.sunrise.i:3000/people.xml
21
+ --> 422 422 (209 0ms)
22
+ POST http://37s.sunrise.i:3000/people.xml
23
+ --> 422 422 (209 0ms)
24
+ POST http://37s.sunrise.i:3000/people.xml
25
+ --> 422 422 (209 0ms)
26
+ GET http://37s.sunrise.i:3000/people/1.xml
27
+ --> 200 200 (106 0ms)
28
+ GET http://37s.sunrise.i:3000/people/1.xml
29
+ --> 200 200 (106 0ms)
30
+ GET http://37s.sunrise.i:3000/people/1/addresses/1.xml
31
+ --> 200 200 (120 0ms)
32
+ POST http://37s.sunrise.i:3000/people.xml
33
+ --> 201 201 (109 0ms)
34
+ POST http://37s.sunrise.i:3000/people.xml
35
+ --> 409 409 (0 0ms)
36
+ POST http://37s.sunrise.i:3000/people/1/addresses.xml
37
+ --> 201 201 (0 0ms)
38
+ POST http://37s.sunrise.i:3000/people.xml
39
+ --> 201 201 (0 0ms)
40
+ GET http://37s.sunrise.i:3000/people/Greg.xml
41
+ --> 200 200 (106 0ms)
42
+ GET http://37s.sunrise.i:3000/people/4.xml
43
+ --> 404 404 (0 0ms)
44
+ DELETE http://37s.sunrise.i:3000/people/1.xml
45
+ --> 200 200 (0 0ms)
46
+ GET http://37s.sunrise.i:3000/people/1.xml
47
+ --> 404 404 (0 0ms)
48
+ DELETE http://37s.sunrise.i:3000/people/1/addresses/1.xml
49
+ --> 200 200 (0 0ms)
50
+ GET http://37s.sunrise.i:3000/people/1/addresses/1.xml
51
+ --> 404 404 (0 0ms)
52
+ GET http://37s.sunrise.i:3000/people/1.xml
53
+ --> 200 200 (106 0ms)
54
+ DELETE http://37s.sunrise.i:3000/people/1.xml
55
+ --> 200 200 (0 0ms)
56
+ GET http://37s.sunrise.i:3000/people/1.xml
57
+ --> 404 404 (0 0ms)
58
+ GET http://37s.sunrise.i:3000/people/1/addresses/1.xml
59
+ --> 200 200 (120 0ms)
60
+ DELETE http://37s.sunrise.i:3000/people/1/addresses/1.xml
61
+ --> 200 200 (0 0ms)
62
+ GET http://37s.sunrise.i:3000/people/1/addresses/1.xml
63
+ --> 404 404 (0 0ms)
64
+ HEAD http://37s.sunrise.i:3000/people/1.xml
65
+ --> 200 200 (0 0ms)
66
+ HEAD http://37s.sunrise.i:3000/people/99.xml
67
+ --> 404 404 (0 0ms)
68
+ GET http://37s.sunrise.i:3000/people/1.xml
69
+ --> 200 200 (106 0ms)
70
+ HEAD http://37s.sunrise.i:3000/people/1.xml
71
+ --> 200 200 (0 0ms)
72
+ HEAD http://37s.sunrise.i:3000/people/99.xml
73
+ --> 404 404 (0 0ms)
74
+ HEAD http://37s.sunrise.i:3000/people/1/addresses/1.xml
75
+ --> 200 200 (0 0ms)
76
+ HEAD http://37s.sunrise.i:3000/people/2/addresses/1.xml
77
+ --> 404 404 (0 0ms)
78
+ HEAD http://37s.sunrise.i:3000/people/1/addresses/2.xml
79
+ --> 404 404 (0 0ms)
80
+ GET http://37s.sunrise.i:3000/people/1/addresses/1.xml
81
+ --> 200 200 (120 0ms)
82
+ HEAD http://37s.sunrise.i:3000/people/1/addresses/1.xml
83
+ --> 200 200 (0 0ms)
84
+ HEAD http://37s.sunrise.i:3000/people/2/addresses/1.xml
85
+ --> 404 404 (0 0ms)
86
+ HEAD http://37s.sunrise.i:3000/people/1/addresses/2.xml
87
+ --> 404 404 (0 0ms)
88
+ HEAD http://37s.sunrise.i:3000/people/Greg.xml
89
+ --> 200 200 (0 0ms)
90
+ GET http://37s.sunrise.i:3000/people/Greg.xml
91
+ --> 200 200 (106 0ms)
92
+ HEAD http://37s.sunrise.i:3000/people/Greg.xml
93
+ --> 200 200 (0 0ms)
94
+ GET http://37s.sunrise.i:3000/people/Greg.xml
95
+ --> 200 200 (106 0ms)
96
+ HEAD http://37s.sunrise.i:3000/people/Greg/addresses/1.xml
97
+ --> 200 200 (0 0ms)
98
+ GET http://37s.sunrise.i:3000/people/Greg.xml
99
+ --> 200 200 (106 0ms)
100
+ GET http://37s.sunrise.i:3000/people/Greg/addresses/1.xml
101
+ --> 200 200 (120 0ms)
102
+ HEAD http://37s.sunrise.i:3000/people/Greg/addresses/1.xml
103
+ --> 200 200 (0 0ms)
104
+ GET http://37s.sunrise.i:3000/people.xml
105
+ --> 200 200 (222 0ms)
106
+ GET http://37s.sunrise.i:3000/companies/1/people.xml
107
+ --> 200 200 (147 0ms)
108
+ GET http://37s.sunrise.i:3000/companies/1/people.xml
109
+ --> 200 200 (147 0ms)
110
+ GET http://37s.sunrise.i:3000/people/managers.xml
111
+ --> 200 200 (147 0ms)
112
+ GET http://37s.sunrise.i:3000/people/1.xml
113
+ --> 200 200 (106 0ms)
114
+ GET http://37s.sunrise.i:3000/people/99.xml
115
+ --> 404 404 (0 0ms)
116
+ GET http://37s.sunrise.i:3000/people//addresses/1.xml
117
+ --> 404 404 (0 0ms)
118
+ GET http://37s.sunrise.i:3000/people/1/addresses/1.xml
119
+ --> 200 200 (120 0ms)
120
+ GET http://37s.sunrise.i:3000/people.xml
121
+ --> 200 200 (222 0ms)
122
+ GET http://37s.sunrise.i:3000/people.xml
123
+ --> 200 200 (222 0ms)
124
+ GET http://37s.sunrise.i:3000/companies/1/manager.xml
125
+ --> 200 200 (107 0ms)
126
+ GET http://37s.sunrise.i:3000/people/leader.xml
127
+ --> 200 200 (107 0ms)
128
+ GET http://37s.sunrise.i:3000/people/1/addresses/1.xml
129
+ --> 200 200 (120 0ms)
130
+ GET http://37s.sunrise.i:3000/people/5.xml
131
+ --> 200 200 (230 0ms)
132
+ GET http://37s.sunrise.i:3000/people/1/addresses/1.xml
133
+ --> 200 200 (120 0ms)
134
+ GET http://37s.sunrise.i:3000/customers/1.xml
135
+ --> 200 200 (1458 0ms)
136
+ GET http://37s.sunrise.i:3000/people/Greg.xml
137
+ --> 200 200 (106 0ms)
138
+ GET http://37s.sunrise.i:3000/people/Greg.xml
139
+ --> 200 200 (106 0ms)
140
+ GET http://37s.sunrise.i:3000/people/1/addresses/1.xml
141
+ --> 200 200 (120 0ms)
142
+ GET http://37s.sunrise.i:3000/people/1/addresses/1.xml
143
+ --> 200 200 (120 0ms)
144
+ GET http://37s.sunrise.i:3000/people.xml
145
+ --> 200 200 (222 0ms)
146
+ GET http://37s.sunrise.i:3000/people/1.xml
147
+ --> 200 200 (106 0ms)
148
+ GET http://37s.sunrise.i:3000/people/1.xml
149
+ --> 200 200 (106 0ms)
150
+ POST http://37s.sunrise.i:3000/people.xml
151
+ --> 201 201 (109 0ms)
152
+ GET http://somewhere.else:80/people/1.xml
153
+ --> 200 200 (106 0ms)
154
+ GET http://somewhere.else:80/people/1.xml
155
+ --> 200 200 (106 0ms)
156
+ GET http://somewhere.else:80/people.xml
157
+ --> 200 200 (222 0ms)
158
+ PUT http://somewhere.else:80/people/1.xml
159
+ --> 204 204 (0 0ms)
160
+ GET http://somewhere.else:80/people/2.xml
161
+ --> 200 200 (107 0ms)
162
+ PUT http://somewhere.else:80/people/2.xml
163
+ --> 409 409 (0 0ms)
164
+ GET http://37s.sunrise.i:3000/people/1/addresses/1.xml
165
+ --> 200 200 (120 0ms)
166
+ PUT http://37s.sunrise.i:3000/people/1/addresses/1.xml
167
+ --> 204 204 (0 0ms)
168
+ GET http://37s.sunrise.i:3000/people/1/addresses.xml
169
+ --> 200 200 (166 0ms)
170
+ PUT http://37s.sunrise.i:3000/people/1/addresses/1.xml
171
+ --> 204 204 (0 0ms)
172
+ GET http://localhost:80/people/1.xml
173
+ --> 200 200 (106 0ms)
174
+ DELETE http://localhost:80/people/1.xml
175
+ --> 200 200 (0 0ms)
176
+ DELETE http://localhost:80/people/2.xml
177
+ --> 200 200 (0 0ms)
178
+ GET http://localhost:80/people/1.xml
179
+ --> 200 200 (106 0ms)
180
+ GET http://localhost:80/people.xml
181
+ --> 200 200 (222 0ms)
182
+ GET http://localhost:80/people_empty_elements.xml
183
+ --> 200 200 (77 0ms)
184
+ GET http://localhost:80/people_single_elements.xml
185
+ --> 200 200 (208 0ms)
186
+ GET http://localhost:80/people/2.xml
187
+ --> 200 200 (107 0ms)
188
+ HEAD http://localhost:80/people/1.xml
189
+ --> 200 200 (0 0ms)
190
+ POST http://localhost:80/people.xml
191
+ --> 201 201 (0 0ms)
192
+ POST http://localhost:80/members.xml
193
+ --> 201 201 (1 0ms)
194
+ PUT http://localhost:80/people/1.xml
195
+ --> 204 204 (0 0ms)
196
+ PUT http://localhost:80/people/2.xml
197
+ --> 204 204 (0 0ms)
198
+ GET http://localhost:80/people_timeout.xml
199
+ GET http://somewhere.else:80/people/retrieve.xml?name=Matz
200
+ --> 200 200 (146 0ms)
201
+ POST http://somewhere.else:80/people/hire.xml?name=Matz
202
+ --> 201 201 (0 0ms)
203
+ PUT http://somewhere.else:80/people/promote.xml?name=Matz
204
+ --> 204 204 (0 0ms)
205
+ PUT http://somewhere.else:80/people/sort.xml?by=name
206
+ --> 204 204 (0 0ms)
207
+ DELETE http://somewhere.else:80/people/deactivate.xml?name=Matz
208
+ --> 200 200 (0 0ms)
209
+ PUT http://37s.sunrise.i:3000/people/1/addresses/sort.xml?by=name
210
+ --> 204 204 (0 0ms)
211
+ GET http://somewhere.else:80/people/1.xml
212
+ --> 200 200 (106 0ms)
213
+ GET http://somewhere.else:80/people/1/shallow.xml
214
+ --> 200 200 (106 0ms)
215
+ GET http://somewhere.else:80/people/1.xml
216
+ --> 200 200 (106 0ms)
217
+ GET http://somewhere.else:80/people/1/deep.xml
218
+ --> 200 200 (129 0ms)
219
+ GET http://somewhere.else:80/people/1.xml
220
+ --> 200 200 (106 0ms)
221
+ PUT http://somewhere.else:80/people/1/promote.xml?position=Manager
222
+ --> 204 204 (0 0ms)
223
+ GET http://somewhere.else:80/people/1.xml
224
+ --> 200 200 (106 0ms)
225
+ DELETE http://somewhere.else:80/people/1/deactivate.xml
226
+ --> 200 200 (0 0ms)
227
+ GET http://37s.sunrise.i:3000/people/1/addresses/1.xml
228
+ --> 200 200 (120 0ms)
229
+ GET http://37s.sunrise.i:3000/people/1/addresses/1/deep.xml
230
+ --> 200 200 (139 0ms)
231
+ GET http://37s.sunrise.i:3000/people/1/addresses/1.xml
232
+ --> 200 200 (120 0ms)
233
+ PUT http://37s.sunrise.i:3000/people/1/addresses/1/normalize_phone.xml?locale=US
234
+ --> 204 204 (0 0ms)
235
+ POST http://somewhere.else:80/people/new/register.xml
236
+ --> 201 201 (78 0ms)
237
+ POST http://37s.sunrise.i:3000/people/1/addresses/new/link.xml
238
+ --> 201 201 (92 0ms)
239
+ POST http://somewhere.else:80/people/1/register.xml
240
+ --> 201 201 (106 0ms)
241
+ GET http://somewhere.else:80/people/managers.xml
242
+ --> 200 200 (146 0ms)
243
+ GET http://somewhere.else:80/people.json
244
+ --> 200 200 (55 0ms)
245
+ GET http://somewhere.else:80/people.xml
246
+ --> 200 200 (224 0ms)
247
+ GET http://somewhere.else:80/people/retrieve.json?name=David
248
+ --> 200 200 (28 0ms)
249
+ GET http://somewhere.else:80/people/retrieve.xml?name=David
250
+ --> 200 200 (149 0ms)
251
+ GET http://somewhere.else:80/people/2.json
252
+ --> 200 200 (26 0ms)
253
+ GET http://somewhere.else:80/people/2/shallow.json
254
+ --> 200 200 (26 0ms)
255
+ GET http://somewhere.else:80/people/2.xml
256
+ --> 200 200 (103 0ms)
257
+ GET http://somewhere.else:80/people/2/shallow.xml
258
+ --> 200 200 (103 0ms)
259
+ POST http://somewhere.else:80/people.json
260
+ --> 201 201 (16 0ms)
261
+ POST http://somewhere.else:80/people/new/register.json
262
+ --> 201 201 (16 0ms)
263
+ POST http://somewhere.else:80/people.xml
264
+ --> 201 201 (74 0ms)
265
+ POST http://somewhere.else:80/people/new/register.xml
266
+ --> 201 201 (74 0ms)
267
+ GET http://somewhere.else:80/people/1.json
268
+ --> 200 200 (26 0ms)
269
+ GET http://somewhere.else:80/people/1.xml
270
+ --> 200 200 (103 0ms)
271
+ POST http://somewhere.else:80/people.json
272
+ --> 201 201 (54 0ms)
273
+ POST http://somewhere.else:80/people.xml
274
+ --> 201 201 (132 0ms)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeresource
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.2
4
+ version: 2.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -9,7 +9,7 @@ autorequire: active_resource
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-15 00:00:00 -05:00
12
+ date: 2009-07-20 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - "="
22
22
  - !ruby/object:Gem::Version
23
- version: 2.3.2
23
+ version: 2.3.3
24
24
  version:
25
25
  description: Wraps web resources in model classes that can be manipulated through XML over REST.
26
26
  email: david@loudthinking.com
@@ -56,6 +56,7 @@ files:
56
56
  - test/base_errors_test.rb
57
57
  - test/base_test.rb
58
58
  - test/connection_test.rb
59
+ - test/debug.log
59
60
  - test/fixtures
60
61
  - test/fixtures/beast.rb
61
62
  - test/fixtures/customer.rb