activeresource 3.1.12 → 3.2.0.rc1

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.md CHANGED
@@ -1,44 +1,23 @@
1
- ## Rails 3.1.11 (Feb 11, 2011) ##
1
+ ## Rails 3.2.0 (unreleased) ##
2
2
 
3
- * No changes.
4
-
5
- ## Rails 3.1.10 (Jan 8, 2013) ##
6
-
7
- * No changes.
8
-
9
- ## Rails 3.1.9 (Jan 2, 2013) ##
10
-
11
- * No changes.
12
-
13
- ## Rails 3.1.8 (Aug 9, 2012) ##
14
-
15
- * No changes.
3
+ * Redirect responses: 303 See Other and 307 Temporary Redirect now behave like
4
+ 301 Moved Permanently and 302 Found. GH #3302.
16
5
 
17
- ## Rails 3.1.7 (Jul 26, 2012) ##
6
+ *Jim Herz*
18
7
 
19
- * No changes.
20
8
 
21
- ## Rails 3.1.6 (Jun 12, 2012) ##
9
+ ## Rails 3.1.1 (October 7, 2011) ##
22
10
 
23
11
  * No changes.
24
12
 
25
- ## Rails 3.1.5 (May 31, 2012) ##
26
-
27
- * No changes
28
-
29
- ## Rails 3.1.1 (October 7, 2011) ##
30
-
31
- * No changes
32
13
 
33
14
  ## Rails 3.1.0 (August 30, 2011) ##
34
15
 
35
16
  * 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.
36
17
 
37
- class User < ActiveResource::Base
38
- self.format = :xml
18
+ class User < ActiveResource::Base self.format = :xml
39
19
  end
40
20
 
41
-
42
21
  ## Rails 3.0.7 (April 18, 2011) ##
43
22
 
44
23
  * No changes.
@@ -271,8 +250,7 @@
271
250
  * 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*
272
251
 
273
252
  * Allow subclassed resources to share the site info *Rick Olson, Jeremy Kemper*
274
- d
275
- class BeastResource < ActiveResource::Base
253
+ d class BeastResource < ActiveResource::Base
276
254
  self.site = 'http://beast.caboo.se'
277
255
  end
278
256
 
@@ -354,5 +332,3 @@
354
332
  * Base.site= accepts URIs. 200...400 are valid response codes. PUT and POST request bodies default to ''. *Jeremy Kemper*
355
333
 
356
334
  * Initial checkin: object-oriented client for restful HTTP resources which follow the Rails convention. *David Heinemeier Hansson*
357
-
358
- Please check [3-0-stable](https://github.com/rails/rails/blob/3-0-stable/activeresource/CHANGELOG) for previous changes.
data/README.rdoc CHANGED
@@ -20,6 +20,16 @@ Model classes are mapped to remote REST resources by Active Resource much the sa
20
20
  tables. When a request is made to a remote resource, a REST XML request is generated, transmitted, and the result
21
21
  received and serialized into a usable Ruby object.
22
22
 
23
+ == Download and installation
24
+
25
+ The latest version of Active Support can be installed with RubyGems:
26
+
27
+ % [sudo] gem install activeresource
28
+
29
+ Source code can be downloaded as part of the Rails project on GitHub
30
+
31
+ * https://github.com/rails/rails/tree/master/activeresource
32
+
23
33
  === Configuration and Usage
24
34
 
25
35
  Putting Active Resource to use is very similar to Active Record. It's as simple as creating a model class
@@ -125,8 +135,8 @@ as the id of the ARes object.
125
135
 
126
136
  ==== Update
127
137
 
128
- 'save' is also used to update an existing resource - and follows the same protocol as creating a resource
129
- with the exception that no response headers are needed - just an empty response when the update on the
138
+ 'save' is also used to update an existing resource and follows the same protocol as creating a resource
139
+ with the exception that no response headers are needed -- just an empty response when the update on the
130
140
  server side was successful.
131
141
 
132
142
  # <person><first>Ryan</first></person>
@@ -160,6 +170,18 @@ Destruction of a resource can be invoked as a class and instance method of the r
160
170
  Person.delete(2) # => true
161
171
  Person.exists?(2) # => false
162
172
 
173
+ == License
163
174
 
164
- You can find more usage information in the ActiveResource::Base documentation.
175
+ Active Support is released under the MIT license.
165
176
 
177
+ == Support
178
+
179
+ API documentation is at
180
+
181
+ * http://api.rubyonrails.org
182
+
183
+ Bug reports and feature requests can be filed with the rest for the Ruby on Rails project here:
184
+
185
+ * https://github.com/rails/rails/issues
186
+
187
+ You can find more usage information in the ActiveResource::Base documentation.
@@ -170,8 +170,8 @@ module ActiveResource
170
170
  # <tt>404</tt> is just one of the HTTP error response codes that Active Resource will handle with its own exception. The
171
171
  # following HTTP response codes will also result in these exceptions:
172
172
  #
173
- # * 200..399 - Valid response, no exception (other than 301, 302)
174
- # * 301, 302 - ActiveResource::Redirection
173
+ # * 200..399 - Valid response. No exceptions, other than these redirects:
174
+ # * 301, 302, 303, 307 - ActiveResource::Redirection
175
175
  # * 400 - ActiveResource::BadRequest
176
176
  # * 401 - ActiveResource::UnauthorizedAccess
177
177
  # * 403 - ActiveResource::ForbiddenAccess
@@ -283,7 +283,7 @@ module ActiveResource
283
283
  # attribute 'name', :string
284
284
  #
285
285
  # # or use the convenience methods and pass >=1 attribute names
286
- # string 'eye_colour', 'hair_colour'
286
+ # string 'eye_color', 'hair_color'
287
287
  # integer 'age'
288
288
  # float 'height', 'weight'
289
289
  #
@@ -963,7 +963,7 @@ module ActiveResource
963
963
  prefix_options, query_options = {}, {}
964
964
 
965
965
  (options || {}).each do |key, value|
966
- next if key.blank?
966
+ next if key.blank? || !key.respond_to?(:to_sym)
967
967
  (prefix_parameters.include?(key.to_sym) ? prefix_options : query_options)[key.to_sym] = value
968
968
  end
969
969
 
@@ -1392,6 +1392,10 @@ module ActiveResource
1392
1392
 
1393
1393
  private
1394
1394
 
1395
+ def read_attribute_for_serialization(n)
1396
+ attributes[n]
1397
+ end
1398
+
1395
1399
  # Determine whether the response is allowed to have a body per HTTP 1.1 spec section 4.4.1
1396
1400
  def response_code_allows_body?(c)
1397
1401
  !((100..199).include?(c) || [204,304].include?(c))
@@ -122,7 +122,7 @@ module ActiveResource
122
122
  # Handles response and error codes from the remote service.
123
123
  def handle_response(response)
124
124
  case response.code.to_i
125
- when 301,302
125
+ when 301, 302, 303, 307
126
126
  raise(Redirection.new(response))
127
127
  when 200...400
128
128
  response
@@ -238,8 +238,11 @@ module ActiveResource
238
238
  def digest_auth_header(http_method, uri)
239
239
  params = extract_params_from_response
240
240
 
241
+ request_uri = uri.path
242
+ request_uri << "?#{uri.query}" if uri.query
243
+
241
244
  ha1 = Digest::MD5.hexdigest("#{@user}:#{params['realm']}:#{@password}")
242
- ha2 = Digest::MD5.hexdigest("#{http_method.to_s.upcase}:#{uri.path}")
245
+ ha2 = Digest::MD5.hexdigest("#{http_method.to_s.upcase}:#{request_uri}")
243
246
 
244
247
  params.merge!('cnonce' => client_nonce)
245
248
  request_digest = Digest::MD5.hexdigest([ha1, params['nonce'], "0", params['cnonce'], params['qop'], ha2].join(":"))
@@ -85,37 +85,35 @@ module ActiveResource
85
85
  end
86
86
  end
87
87
 
88
- module InstanceMethods
89
- def get(method_name, options = {})
90
- self.class.format.decode(connection.get(custom_method_element_url(method_name, options), self.class.headers).body)
91
- end
88
+ def get(method_name, options = {})
89
+ self.class.format.decode(connection.get(custom_method_element_url(method_name, options), self.class.headers).body)
90
+ end
92
91
 
93
- def post(method_name, options = {}, body = nil)
94
- request_body = body.blank? ? encode : body
95
- if new?
96
- connection.post(custom_method_new_element_url(method_name, options), request_body, self.class.headers)
97
- else
98
- connection.post(custom_method_element_url(method_name, options), request_body, self.class.headers)
99
- end
92
+ def post(method_name, options = {}, body = nil)
93
+ request_body = body.blank? ? encode : body
94
+ if new?
95
+ connection.post(custom_method_new_element_url(method_name, options), request_body, self.class.headers)
96
+ else
97
+ connection.post(custom_method_element_url(method_name, options), request_body, self.class.headers)
100
98
  end
99
+ end
101
100
 
102
- def put(method_name, options = {}, body = '')
103
- connection.put(custom_method_element_url(method_name, options), body, self.class.headers)
104
- end
101
+ def put(method_name, options = {}, body = '')
102
+ connection.put(custom_method_element_url(method_name, options), body, self.class.headers)
103
+ end
105
104
 
106
- def delete(method_name, options = {})
107
- connection.delete(custom_method_element_url(method_name, options), self.class.headers)
108
- end
105
+ def delete(method_name, options = {})
106
+ connection.delete(custom_method_element_url(method_name, options), self.class.headers)
107
+ end
109
108
 
110
109
 
111
- private
112
- def custom_method_element_url(method_name, options = {})
113
- "#{self.class.prefix(prefix_options)}#{self.class.collection_name}/#{id}/#{method_name}.#{self.class.format.extension}#{self.class.__send__(:query_string, options)}"
114
- end
110
+ private
111
+ def custom_method_element_url(method_name, options = {})
112
+ "#{self.class.prefix(prefix_options)}#{self.class.collection_name}/#{id}/#{method_name}.#{self.class.format.extension}#{self.class.__send__(:query_string, options)}"
113
+ end
115
114
 
116
- def custom_method_new_element_url(method_name, options = {})
117
- "#{self.class.prefix(prefix_options)}#{self.class.collection_name}/new/#{method_name}.#{self.class.format.extension}#{self.class.__send__(:query_string, options)}"
118
- end
119
- end
115
+ def custom_method_new_element_url(method_name, options = {})
116
+ "#{self.class.prefix(prefix_options)}#{self.class.collection_name}/new/#{method_name}.#{self.class.format.extension}#{self.class.__send__(:query_string, options)}"
117
+ end
120
118
  end
121
119
  end
@@ -33,35 +33,45 @@ module ActiveResource
33
33
 
34
34
  # 3xx Redirection
35
35
  class Redirection < ConnectionError # :nodoc:
36
- def to_s; response['Location'] ? "#{super} => #{response['Location']}" : super; end
36
+ def to_s
37
+ response['Location'] ? "#{super} => #{response['Location']}" : super
38
+ end
37
39
  end
38
40
 
39
- # Raised when ...
40
- class MissingPrefixParam < ArgumentError; end # :nodoc:
41
+ class MissingPrefixParam < ArgumentError # :nodoc:
42
+ end
41
43
 
42
44
  # 4xx Client Error
43
- class ClientError < ConnectionError; end # :nodoc:
45
+ class ClientError < ConnectionError # :nodoc:
46
+ end
44
47
 
45
48
  # 400 Bad Request
46
- class BadRequest < ClientError; end # :nodoc
49
+ class BadRequest < ClientError # :nodoc:
50
+ end
47
51
 
48
52
  # 401 Unauthorized
49
- class UnauthorizedAccess < ClientError; end # :nodoc
53
+ class UnauthorizedAccess < ClientError # :nodoc:
54
+ end
50
55
 
51
56
  # 403 Forbidden
52
- class ForbiddenAccess < ClientError; end # :nodoc
57
+ class ForbiddenAccess < ClientError # :nodoc:
58
+ end
53
59
 
54
60
  # 404 Not Found
55
- class ResourceNotFound < ClientError; end # :nodoc:
61
+ class ResourceNotFound < ClientError # :nodoc:
62
+ end
56
63
 
57
64
  # 409 Conflict
58
- class ResourceConflict < ClientError; end # :nodoc:
65
+ class ResourceConflict < ClientError # :nodoc:
66
+ end
59
67
 
60
68
  # 410 Gone
61
- class ResourceGone < ClientError; end # :nodoc:
69
+ class ResourceGone < ClientError # :nodoc:
70
+ end
62
71
 
63
72
  # 5xx Server Error
64
- class ServerError < ConnectionError; end # :nodoc:
73
+ class ServerError < ConnectionError # :nodoc:
74
+ end
65
75
 
66
76
  # 405 Method Not Allowed
67
77
  class MethodNotAllowed < ClientError # :nodoc:
@@ -55,7 +55,7 @@ module ActiveResource
55
55
  @responses = responses
56
56
  end
57
57
 
58
- for method in [ :post, :put, :get, :delete, :head ]
58
+ [ :post, :put, :get, :delete, :head ].each do |method|
59
59
  # def post(path, request_headers = {}, body = nil, status = 200, response_headers = {})
60
60
  # @responses[Request.new(:post, path, nil, request_headers)] = Response.new(body || "", status, response_headers)
61
61
  # end
@@ -1,9 +1,9 @@
1
1
  module ActiveResource
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
- MINOR = 1
5
- TINY = 12
6
- PRE = nil
4
+ MINOR = 2
5
+ TINY = 0
6
+ PRE = "rc1"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
9
9
  end
metadata CHANGED
@@ -1,43 +1,38 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeresource
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.12
4
+ version: 3.2.0.rc1
5
+ prerelease: 6
5
6
  platform: ruby
6
7
  authors:
7
8
  - David Heinemeier Hansson
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-03-18 00:00:00.000000000 Z
12
+ date: 2011-12-20 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: activesupport
15
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &2156002680 !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - '='
19
+ - - =
18
20
  - !ruby/object:Gem::Version
19
- version: 3.1.12
21
+ version: 3.2.0.rc1
20
22
  type: :runtime
21
23
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '='
25
- - !ruby/object:Gem::Version
26
- version: 3.1.12
24
+ version_requirements: *2156002680
27
25
  - !ruby/object:Gem::Dependency
28
26
  name: activemodel
29
- requirement: !ruby/object:Gem::Requirement
27
+ requirement: &2156000440 !ruby/object:Gem::Requirement
28
+ none: false
30
29
  requirements:
31
- - - '='
30
+ - - =
32
31
  - !ruby/object:Gem::Version
33
- version: 3.1.12
32
+ version: 3.2.0.rc1
34
33
  type: :runtime
35
34
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '='
39
- - !ruby/object:Gem::Version
40
- version: 3.1.12
35
+ version_requirements: *2156000440
41
36
  description: REST on Rails. Wrap your RESTful web app with Ruby classes and work with
42
37
  them like Active Record models.
43
38
  email: david@loudthinking.com
@@ -67,7 +62,6 @@ files:
67
62
  - lib/active_resource.rb
68
63
  homepage: http://www.rubyonrails.org
69
64
  licenses: []
70
- metadata: {}
71
65
  post_install_message:
72
66
  rdoc_options:
73
67
  - --main
@@ -75,19 +69,21 @@ rdoc_options:
75
69
  require_paths:
76
70
  - lib
77
71
  required_ruby_version: !ruby/object:Gem::Requirement
72
+ none: false
78
73
  requirements:
79
- - - '>='
74
+ - - ! '>='
80
75
  - !ruby/object:Gem::Version
81
76
  version: 1.8.7
82
77
  required_rubygems_version: !ruby/object:Gem::Requirement
78
+ none: false
83
79
  requirements:
84
- - - '>='
80
+ - - ! '>'
85
81
  - !ruby/object:Gem::Version
86
- version: '0'
82
+ version: 1.3.1
87
83
  requirements: []
88
84
  rubyforge_project:
89
- rubygems_version: 2.0.2
85
+ rubygems_version: 1.8.7
90
86
  signing_key:
91
- specification_version: 4
87
+ specification_version: 3
92
88
  summary: REST modeling framework (part of Rails).
93
89
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: a165b98fa34b904d14e65e98569ecf8e63ab2f10
4
- data.tar.gz: 9f85a44ae64f0b7bc14d613c1c32984fc68ff36e
5
- SHA512:
6
- metadata.gz: 57edca5f8bb49a40a20b93521e0e10fe5a7877b71c2546e21d9f931f29074ca6005b0526093c7466cdb0143e7d1cdcd1eb11f03bfd6030c8efe8b035d4ba912e
7
- data.tar.gz: 7dd82420c7de2f31efb05f1a50cc1dc07b8ea2f150f8905eaf7152d577b99f9cf90d4ba0091975b78c4a894b6418caae80b5c0edd4c4f9f95d2d0a1dca296d48