maremma 2.3 → 2.3.1
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 +8 -8
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/lib/maremma.rb +3 -1
- data/lib/maremma/version.rb +1 -1
- data/spec/maremma_spec.rb +29 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjQ3OGFkNDYzZDQ2NGE1NzFiOWY0NWViZDYxNzRkMjViYTMxYTFlNA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTAyZGI5NzNhMWJjYmU0YTA3ZGMzYzQyZGEwYzFlMzkxZGY2MWY2OA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NWZiY2Y0NGQzNTViY2JkMDE1N2I1MjA2NjVlOTg1NDI4MTZhN2YwODE0ZWNh
|
10
|
+
ODUxZDg5NDY2OWNlYjAxOTI3ZWU4MTBkNDUyYTEyMjg3NDFiN2MwM2NlOThm
|
11
|
+
ZjcyZjc0NzA2MTU0NmZmYjc2YjE2MGRmMDU1M2YxMjJmYzlmMDQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDRiM2E0M2ZjYjBmZTNlYjljODMzNDlkYjZmMjE1NzY1ZDkyMzFjYjhkODYx
|
14
|
+
ZDY0NjViNTE4NmQzNTE0NDI3ZGU5MDkzNzA5ZGM5ZDQ3YjhmMzJlZGQ1NzZh
|
15
|
+
ZWIwZmQxMGQ3NjRlMzJkMDJhYzY5NjE2Y2QxOGZmMWUxYjliMzA=
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## v.2.3.1 (September 2, 2016)
|
2
|
+
|
3
|
+
[maremma 2.3.1](https://github.com/datacite/maremma/releases/tag/v.2.3.1) was released on September 2, 2016:
|
4
|
+
|
5
|
+
* handle `Faraday::ConnectionFailed` errors with an appropriate error message
|
6
|
+
|
1
7
|
## v.2.3 (August 16, 2016)
|
2
8
|
|
3
9
|
[maremma 2.3](https://github.com/datacite/maremma/releases/tag/v.2.3) was released on August 16, 2016:
|
data/Gemfile.lock
CHANGED
data/lib/maremma.rb
CHANGED
@@ -109,7 +109,9 @@ module Maremma
|
|
109
109
|
def self.rescue_faraday_error(error)
|
110
110
|
if error.is_a?(Faraday::ResourceNotFound)
|
111
111
|
{ 'errors' => [{ 'status' => 404, 'title' => "Not found" }] }
|
112
|
-
elsif error.is_a?(Faraday::
|
112
|
+
elsif error.is_a?(Faraday::ConnectionFailed)
|
113
|
+
{ 'errors' => [{ 'status' => "403", 'title' => parse_error_response(error.message) }] }
|
114
|
+
elsif error.is_a?(Faraday::TimeoutError) || (error.try(:response) && error.response[:status] == 408)
|
113
115
|
{ 'errors' => [{ 'status' => 408, 'title' =>"Request timeout" }] }
|
114
116
|
else
|
115
117
|
{ 'errors' => [{ 'status' => 400, 'title' => parse_error_response(error.message) }] }
|
data/lib/maremma/version.rb
CHANGED
data/spec/maremma_spec.rb
CHANGED
@@ -140,6 +140,35 @@ describe Maremma do
|
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
|
+
context "connection failed" do
|
144
|
+
it "get json" do
|
145
|
+
stub = stub_request(:get, url).to_raise(Faraday::ConnectionFailed.new("Connection refused - connect(2)"))
|
146
|
+
response = subject.get(url)
|
147
|
+
expect(response).to eq("errors"=>[{"status"=>"403", "title"=>"Connection refused - connect(2)"}])
|
148
|
+
expect(stub).to have_been_requested
|
149
|
+
end
|
150
|
+
|
151
|
+
it "get xml" do
|
152
|
+
stub = stub_request(:get, url).to_raise(Faraday::ConnectionFailed.new("Connection refused - connect(2)"))
|
153
|
+
response = subject.get(url, content_type: 'xml')
|
154
|
+
expect(response).to eq("errors"=>[{"status"=>"403", "title"=>"Connection refused - connect(2)"}])
|
155
|
+
expect(stub).to have_been_requested
|
156
|
+
end
|
157
|
+
|
158
|
+
it "get html" do
|
159
|
+
stub = stub_request(:get, url).to_raise(Faraday::ConnectionFailed.new("Connection refused - connect(2)"))
|
160
|
+
response = subject.get(url, content_type: 'html')
|
161
|
+
expect(response).to eq("errors"=>[{"status"=>"403", "title"=>"Connection refused - connect(2)"}])
|
162
|
+
expect(stub).to have_been_requested
|
163
|
+
end
|
164
|
+
|
165
|
+
it "post xml" do
|
166
|
+
stub = stub_request(:post, url).with(:body => post_data.to_xml).to_raise(Faraday::ConnectionFailed.new("Connection refused - connect(2)"))
|
167
|
+
subject.post(url, content_type: 'xml', data: post_data.to_xml) { |response| expect(response).to be_nil }
|
168
|
+
expect(stub).to have_been_requested
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
143
172
|
context "request timeout internal" do
|
144
173
|
it "get json" do
|
145
174
|
stub = stub_request(:get, url).to_timeout
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maremma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Fenner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|