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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb2c03a904db96aa05327826f442deb7b2852228
4
- data.tar.gz: 4cd7f8229e8a6c7d43d47bc1e4d45c1f3cdb832c
3
+ metadata.gz: 57d80488ade688d52701471d6532652efbe3675f
4
+ data.tar.gz: 583505b4037a9b8eed898c10f2e8fd732a138ec7
5
5
  SHA512:
6
- metadata.gz: 7390456c69a1ca82d053f44e7966f6f160e0b361af64f4670e2000bb5fe5160feafb2499809be857538c8d1b8e03dc96db218da497c3f73be6e97e5401cec7f3
7
- data.tar.gz: aa727cdb44ed2933313c2c3681f6fa7e400c66d607be48194c6ade900add787f6754e107885c1fc4a1549a1504641ffa787b12158593b7d634f4ff51418dc0fd
6
+ metadata.gz: 2bad3f981adebf946c9bcee91dd1851c25f681dcc3b29d20d0fe5d94f219e412406b4cbe896d2d18e7583928c8b80f9d363d837322027eaec6809360e715d4a4
7
+ data.tar.gz: 09c52c8ce325004846c3c5a39be66b3ed5b0872f62a67cd535977a7f8d6a80c1464fcd01259a901157c2780aad07aee74840e1281c0bb634bedf862175755360
@@ -29,10 +29,10 @@ module RemoteResource
29
29
  class HTTPError < RemoteResourceError # HTTP errors
30
30
 
31
31
  def initialize(response)
32
- if response.try :response_code
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
@@ -36,7 +36,7 @@ module RemoteResource
36
36
  module ClassMethods
37
37
 
38
38
  def connection_options
39
- Thread.current[connection_options_thread_name] ||= RemoteResource::ConnectionOptions.new(self)
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
@@ -1,3 +1,3 @@
1
1
  module RemoteResource
2
- VERSION = '0.4.2'
2
+ VERSION = '0.4.3'
3
3
  end
@@ -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 = ["Jan van der Pas"]
10
- spec.email = ["jvanderpas@digidentity.eu"]
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 'sets the name of Thread variable with the implemented class' do
78
- expect(dummy_class.connection_options).to eql Thread.current['remote_resource.dummy.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 { allow(response).to receive(:response_code) { response_code } }
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
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe RemoteResource::VERSION do
4
4
 
5
- it { should eql '0.4.2' }
5
+ it { should eql '0.4.3' }
6
6
  end
7
7
 
8
8
 
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.2
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: 2014-12-12 00:00:00.000000000 Z
11
+ date: 2015-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler