ddy_remote_resource 0.4.2 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/remote_resource.rb +3 -3
- data/lib/remote_resource/base.rb +1 -5
- data/lib/remote_resource/version.rb +1 -1
- data/remote_resource.gemspec +2 -2
- data/spec/lib/remote_resource/base_spec.rb +2 -2
- data/spec/lib/remote_resource/request_spec.rb +10 -6
- data/spec/lib/remote_resource/version_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57d80488ade688d52701471d6532652efbe3675f
|
4
|
+
data.tar.gz: 583505b4037a9b8eed898c10f2e8fd732a138ec7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bad3f981adebf946c9bcee91dd1851c25f681dcc3b29d20d0fe5d94f219e412406b4cbe896d2d18e7583928c8b80f9d363d837322027eaec6809360e715d4a4
|
7
|
+
data.tar.gz: 09c52c8ce325004846c3c5a39be66b3ed5b0872f62a67cd535977a7f8d6a80c1464fcd01259a901157c2780aad07aee74840e1281c0bb634bedf862175755360
|
data/lib/remote_resource.rb
CHANGED
@@ -29,10 +29,10 @@ module RemoteResource
|
|
29
29
|
class HTTPError < RemoteResourceError # HTTP errors
|
30
30
|
|
31
31
|
def initialize(response)
|
32
|
-
if response.try
|
33
|
-
super "with HTTP response status: #{response.response_code} and response: #{response}"
|
32
|
+
if response.try(:response_code)
|
33
|
+
super "for url: #{response.try(:effective_url)} with HTTP response status: #{response.response_code} and response: #{response.inspect}"
|
34
34
|
else
|
35
|
-
super "with HTTP response: #{response}"
|
35
|
+
super "for url: #{response.try(:effective_url)} with HTTP response: #{response.inspect}"
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
data/lib/remote_resource/base.rb
CHANGED
@@ -36,7 +36,7 @@ module RemoteResource
|
|
36
36
|
module ClassMethods
|
37
37
|
|
38
38
|
def connection_options
|
39
|
-
|
39
|
+
RemoteResource::ConnectionOptions.new(self)
|
40
40
|
end
|
41
41
|
|
42
42
|
def threaded_connection_options
|
@@ -59,10 +59,6 @@ module RemoteResource
|
|
59
59
|
"remote_resource.#{_module_name}.threaded_connection_options"
|
60
60
|
end
|
61
61
|
|
62
|
-
def connection_options_thread_name
|
63
|
-
"remote_resource.#{_module_name}.connection_options"
|
64
|
-
end
|
65
|
-
|
66
62
|
def _module_name
|
67
63
|
self.name.to_s.demodulize.underscore.downcase
|
68
64
|
end
|
data/remote_resource.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'remote_resource/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'ddy_remote_resource'
|
8
8
|
spec.version = RemoteResource::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Jan van der Pas']
|
10
|
+
spec.email = ['jvanderpas@digidentity.eu']
|
11
11
|
spec.summary = %q{RemoteResource, a gem to use resources with REST services.}
|
12
12
|
spec.description = %q{RemoteResource, a gem to use resources with REST services. A replacement for ActiveResource gem.}
|
13
13
|
spec.homepage = ''
|
@@ -74,8 +74,8 @@ describe RemoteResource::Base do
|
|
74
74
|
expect(dummy_class.connection_options.base_class).to be RemoteResource::Dummy
|
75
75
|
end
|
76
76
|
|
77
|
-
it '
|
78
|
-
expect(dummy_class.connection_options).
|
77
|
+
it 'does NOT memorize the connection options' do
|
78
|
+
expect(dummy_class.connection_options.object_id).not_to eql dummy_class.connection_options.object_id
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -520,10 +520,14 @@ describe RemoteResource::Request do
|
|
520
520
|
end
|
521
521
|
|
522
522
|
describe '#raise_http_errors' do
|
523
|
+
let(:effective_url) { 'http://www.foobar.com/request_dummy.json' }
|
523
524
|
let(:response) { instance_double Typhoeus::Response }
|
524
525
|
let(:raise_http_errors) { request.send :raise_http_errors, response }
|
525
526
|
|
526
|
-
before
|
527
|
+
before do
|
528
|
+
allow(response).to receive(:response_code) { response_code }
|
529
|
+
allow(response).to receive(:effective_url) { effective_url }
|
530
|
+
end
|
527
531
|
|
528
532
|
context 'when the response code is 301, 302, 303 or 307' do
|
529
533
|
response_codes = [301, 302, 303, 307]
|
@@ -532,7 +536,7 @@ describe RemoteResource::Request do
|
|
532
536
|
it "raises a RemoteResource::HTTPRedirectionError with response code #{response_code}" do
|
533
537
|
allow(response).to receive(:response_code) { response_code }
|
534
538
|
|
535
|
-
expect{ raise_http_errors }.to raise_error RemoteResource::HTTPRedirectionError, "with HTTP response status: #{response_code} and response: #{response}"
|
539
|
+
expect{ raise_http_errors }.to raise_error RemoteResource::HTTPRedirectionError, "for url: #{effective_url} with HTTP response status: #{response_code} and response: #{response.inspect}"
|
536
540
|
end
|
537
541
|
end
|
538
542
|
end
|
@@ -561,7 +565,7 @@ describe RemoteResource::Request do
|
|
561
565
|
it "raises a #{error_class} with response code #{response_code}" do
|
562
566
|
allow(response).to receive(:response_code) { response_code }
|
563
567
|
|
564
|
-
expect{ raise_http_errors }.to raise_error error_class, "with HTTP response status: #{response_code} and response: #{response}"
|
568
|
+
expect{ raise_http_errors }.to raise_error error_class, "for url: #{effective_url} with HTTP response status: #{response_code} and response: #{response.inspect}"
|
565
569
|
end
|
566
570
|
end
|
567
571
|
end
|
@@ -570,7 +574,7 @@ describe RemoteResource::Request do
|
|
570
574
|
let(:response_code) { 430 }
|
571
575
|
|
572
576
|
it 'raises a RemoteResource::HTTPClientError' do
|
573
|
-
expect{ raise_http_errors }.to raise_error RemoteResource::HTTPClientError, "with HTTP response status: #{response_code} and response: #{response}"
|
577
|
+
expect{ raise_http_errors }.to raise_error RemoteResource::HTTPClientError, "for url: #{effective_url} with HTTP response status: #{response_code} and response: #{response.inspect}"
|
574
578
|
end
|
575
579
|
end
|
576
580
|
|
@@ -578,7 +582,7 @@ describe RemoteResource::Request do
|
|
578
582
|
let(:response_code) { 501 }
|
579
583
|
|
580
584
|
it 'raises a RemoteResource::HTTPServerError' do
|
581
|
-
expect{ raise_http_errors }.to raise_error RemoteResource::HTTPServerError, "with HTTP response status: #{response_code} and response: #{response}"
|
585
|
+
expect{ raise_http_errors }.to raise_error RemoteResource::HTTPServerError, "for url: #{effective_url} with HTTP response status: #{response_code} and response: #{response.inspect}"
|
582
586
|
end
|
583
587
|
end
|
584
588
|
|
@@ -586,7 +590,7 @@ describe RemoteResource::Request do
|
|
586
590
|
let(:response_code) { nil }
|
587
591
|
|
588
592
|
it 'raises a RemoteResource::HTTPError' do
|
589
|
-
expect{ raise_http_errors }.to raise_error RemoteResource::HTTPError, "with HTTP response: #{response}"
|
593
|
+
expect{ raise_http_errors }.to raise_error RemoteResource::HTTPError, "for url: #{effective_url} with HTTP response: #{response.inspect}"
|
590
594
|
end
|
591
595
|
end
|
592
596
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddy_remote_resource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan van der Pas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|