activeresource 6.1.0 → 6.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_resource/base.rb +4 -4
- data/lib/active_resource/connection.rb +6 -5
- data/lib/active_resource/exceptions.rb +4 -0
- data/lib/active_resource/railtie.rb +4 -0
- data/lib/active_resource/validations.rb +2 -2
- data/lib/active_resource/version.rb +1 -1
- data/lib/active_resource.rb +14 -0
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa6762874a2653d8a08929aa62b286ee759384949026c7229f792208a18e1a4e
|
4
|
+
data.tar.gz: b1bbe54d2cd8937cb58ba46ebd6c38bae69d937c8663f2f77e2d266011c68216
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bfa1af456b2b740e5472f2ce9c5a6138cbfb5449ec3480a6f637c2f75495d66da591fdd80f4e6c5092afeba3af6439545c7c5e7a75af187a981ef922ece053a
|
7
|
+
data.tar.gz: 17d6eb6cd168d7c5613a9ef594648529f9fc6b6bdec7927d7940d62012c0b75e9adb92c3c22f6790f725049bf2d6dbd86bd6082eb25d7145a9b2bcedd4f0e80b
|
data/lib/active_resource/base.rb
CHANGED
@@ -11,7 +11,6 @@ require "active_support/core_ext/object/blank"
|
|
11
11
|
require "active_support/core_ext/object/to_query"
|
12
12
|
require "active_support/core_ext/object/duplicable"
|
13
13
|
require "set"
|
14
|
-
require "uri"
|
15
14
|
|
16
15
|
require "active_resource/connection"
|
17
16
|
require "active_resource/formats"
|
@@ -213,6 +212,7 @@ module ActiveResource
|
|
213
212
|
# * 301, 302, 303, 307 - ActiveResource::Redirection
|
214
213
|
# * 400 - ActiveResource::BadRequest
|
215
214
|
# * 401 - ActiveResource::UnauthorizedAccess
|
215
|
+
# * 402 - ActiveResource::PaymentRequired
|
216
216
|
# * 403 - ActiveResource::ForbiddenAccess
|
217
217
|
# * 404 - ActiveResource::ResourceNotFound
|
218
218
|
# * 405 - ActiveResource::MethodNotAllowed
|
@@ -490,8 +490,8 @@ module ActiveResource
|
|
490
490
|
self._site = nil
|
491
491
|
else
|
492
492
|
self._site = create_site_uri_from(site)
|
493
|
-
self._user =
|
494
|
-
self._password =
|
493
|
+
self._user = URI_PARSER.unescape(_site.user) if _site.user
|
494
|
+
self._password = URI_PARSER.unescape(_site.password) if _site.password
|
495
495
|
end
|
496
496
|
end
|
497
497
|
|
@@ -750,7 +750,7 @@ module ActiveResource
|
|
750
750
|
# Default value is <tt>site.path</tt>.
|
751
751
|
def prefix=(value = "/")
|
752
752
|
# Replace :placeholders with '#{embedded options[:lookups]}'
|
753
|
-
prefix_call = value.gsub(/:\w+/) { |key| "\#{
|
753
|
+
prefix_call = value.gsub(/:\w+/) { |key| "\#{URI_PARSER.escape options[#{key}].to_s}" }
|
754
754
|
|
755
755
|
# Clear prefix parameters in case they have been cached
|
756
756
|
@prefix_parameters = nil
|
@@ -5,7 +5,6 @@ require "active_support/core_ext/object/inclusion"
|
|
5
5
|
require "net/https"
|
6
6
|
require "date"
|
7
7
|
require "time"
|
8
|
-
require "uri"
|
9
8
|
|
10
9
|
module ActiveResource
|
11
10
|
# Class to handle connections to remote web services.
|
@@ -43,8 +42,8 @@ module ActiveResource
|
|
43
42
|
def site=(site)
|
44
43
|
@site = site.is_a?(URI) ? site : URI.parse(site)
|
45
44
|
@ssl_options ||= {} if @site.is_a?(URI::HTTPS)
|
46
|
-
@user =
|
47
|
-
@password =
|
45
|
+
@user = URI_PARSER.unescape(@site.user) if @site.user
|
46
|
+
@password = URI_PARSER.unescape(@site.password) if @site.password
|
48
47
|
end
|
49
48
|
|
50
49
|
# Set the proxy for remote service.
|
@@ -140,6 +139,8 @@ module ActiveResource
|
|
140
139
|
raise(BadRequest.new(response))
|
141
140
|
when 401
|
142
141
|
raise(UnauthorizedAccess.new(response))
|
142
|
+
when 402
|
143
|
+
raise(PaymentRequired.new(response))
|
143
144
|
when 403
|
144
145
|
raise(ForbiddenAccess.new(response))
|
145
146
|
when 404
|
@@ -173,8 +174,8 @@ module ActiveResource
|
|
173
174
|
|
174
175
|
def new_http
|
175
176
|
if @proxy
|
176
|
-
user =
|
177
|
-
password =
|
177
|
+
user = URI_PARSER.unescape(@proxy.user) if @proxy.user
|
178
|
+
password = URI_PARSER.unescape(@proxy.password) if @proxy.password
|
178
179
|
Net::HTTP.new(@site.host, @site.port, @proxy.host, @proxy.port, user, password)
|
179
180
|
else
|
180
181
|
Net::HTTP.new(@site.host, @site.port)
|
@@ -21,5 +21,9 @@ module ActiveResource
|
|
21
21
|
app.config.active_job.custom_serializers << ActiveResource::ActiveJobSerializer
|
22
22
|
end
|
23
23
|
end
|
24
|
+
|
25
|
+
initializer "active_resource.deprecator" do |app|
|
26
|
+
app.deprecators[:active_resource] = ActiveResource.deprecator
|
27
|
+
end
|
24
28
|
end
|
25
29
|
end
|
@@ -57,7 +57,7 @@ module ActiveResource
|
|
57
57
|
errors = decoded["errors"] || {}
|
58
58
|
if errors.kind_of?(Array)
|
59
59
|
# 3.2.1-style with array of strings
|
60
|
-
|
60
|
+
ActiveResource.deprecator.warn("Returning errors as an array of strings is deprecated.")
|
61
61
|
from_array errors, save_cache
|
62
62
|
else
|
63
63
|
# 3.2.2+ style
|
@@ -65,7 +65,7 @@ module ActiveResource
|
|
65
65
|
end
|
66
66
|
else
|
67
67
|
# <3.2-style respond_with - lacks 'errors' key
|
68
|
-
|
68
|
+
ActiveResource.deprecator.warn('Returning errors as a hash without a root "errors" key is deprecated.')
|
69
69
|
from_hash decoded, save_cache
|
70
70
|
end
|
71
71
|
end
|
data/lib/active_resource.rb
CHANGED
@@ -23,6 +23,8 @@
|
|
23
23
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
24
|
#++
|
25
25
|
|
26
|
+
require "uri"
|
27
|
+
|
26
28
|
require "active_support"
|
27
29
|
require "active_model"
|
28
30
|
require "active_resource/exceptions"
|
@@ -31,6 +33,8 @@ require "active_resource/version"
|
|
31
33
|
module ActiveResource
|
32
34
|
extend ActiveSupport::Autoload
|
33
35
|
|
36
|
+
URI_PARSER = defined?(URI::RFC2396_PARSER) ? URI::RFC2396_PARSER : URI::RFC2396_Parser.new
|
37
|
+
|
34
38
|
autoload :Base
|
35
39
|
autoload :Callbacks
|
36
40
|
autoload :Connection
|
@@ -42,6 +46,16 @@ module ActiveResource
|
|
42
46
|
autoload :InheritingHash
|
43
47
|
autoload :Validations
|
44
48
|
autoload :Collection
|
49
|
+
|
50
|
+
if ActiveSupport::VERSION::STRING >= "7.2"
|
51
|
+
def self.deprecator
|
52
|
+
@deprecator ||= ActiveSupport::Deprecation.new(VERSION::STRING, "ActiveResource")
|
53
|
+
end
|
54
|
+
else
|
55
|
+
def self.deprecator
|
56
|
+
ActiveSupport::Deprecation
|
57
|
+
end
|
58
|
+
end
|
45
59
|
end
|
46
60
|
|
47
61
|
require "active_resource/railtie" if defined?(Rails.application)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeresource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.1.
|
4
|
+
version: 6.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -135,11 +135,11 @@ licenses:
|
|
135
135
|
- MIT
|
136
136
|
metadata:
|
137
137
|
bug_tracker_uri: https://github.com/rails/activeresource/issues
|
138
|
-
changelog_uri: https://github.com/rails/activeresource/releases/tag/v6.1.
|
138
|
+
changelog_uri: https://github.com/rails/activeresource/releases/tag/v6.1.2
|
139
139
|
documentation_uri: http://rubydoc.info/gems/activeresource
|
140
|
-
source_code_uri: https://github.com/rails/activeresource/tree/v6.1.
|
140
|
+
source_code_uri: https://github.com/rails/activeresource/tree/v6.1.2
|
141
141
|
rubygems_mfa_required: 'true'
|
142
|
-
post_install_message:
|
142
|
+
post_install_message:
|
143
143
|
rdoc_options: []
|
144
144
|
require_paths:
|
145
145
|
- lib
|
@@ -154,8 +154,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
154
|
- !ruby/object:Gem::Version
|
155
155
|
version: '0'
|
156
156
|
requirements: []
|
157
|
-
rubygems_version: 3.
|
158
|
-
signing_key:
|
157
|
+
rubygems_version: 3.5.11
|
158
|
+
signing_key:
|
159
159
|
specification_version: 4
|
160
160
|
summary: REST modeling framework (part of Rails).
|
161
161
|
test_files: []
|