djatoka 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/djatoka.gemspec +1 -1
- data/lib/djatoka.rb +1 -0
- data/lib/djatoka/net.rb +9 -1
- data/test/fixtures/https_metadata_request.json +16 -0
- data/test/helper.rb +4 -1
- data/test/test_metadata.rb +10 -0
- metadata +2 -1
data/djatoka.gemspec
CHANGED
data/lib/djatoka.rb
CHANGED
data/lib/djatoka/net.rb
CHANGED
@@ -11,7 +11,15 @@ module Djatoka::Net
|
|
11
11
|
c.perform
|
12
12
|
else
|
13
13
|
uri = URI.parse(url)
|
14
|
-
|
14
|
+
if uri.scheme == 'https'
|
15
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
16
|
+
http.use_ssl = true
|
17
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
18
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
19
|
+
response = http.request(request)
|
20
|
+
else
|
21
|
+
response = Net::HTTP.get_response(uri)
|
22
|
+
end
|
15
23
|
case response
|
16
24
|
when Net::HTTPSuccess
|
17
25
|
data = JSON.parse(response.body)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Date: Mon, 08 Apr 2013 19:00:52 GMT
|
3
|
+
Server: Apache-Coyote/1.1
|
4
|
+
Content-Type: application/json
|
5
|
+
Content-Length: 169
|
6
|
+
Set-Cookie: JSESSIONID=6E14483BD6783720ED2AEE04519A1AF7; Path=/adore-djatoka/; HttpOnly
|
7
|
+
|
8
|
+
{
|
9
|
+
"identifier": "0004817",
|
10
|
+
"imagefile": "/storage/00048/0004817.jp2",
|
11
|
+
"width": "7575",
|
12
|
+
"height": "10669",
|
13
|
+
"dwtLevels": "7",
|
14
|
+
"levels": "7",
|
15
|
+
"compositingLayerCount": "1"
|
16
|
+
}
|
data/test/helper.rb
CHANGED
@@ -52,4 +52,7 @@ FakeWeb.register_uri(:get, "http://african.lanl.gov/adore-djatoka/resolver?rft_i
|
|
52
52
|
:response => File.read('test/fixtures/5aa182c2-c092-4596-af6e-e95d2e263de3.json'))
|
53
53
|
|
54
54
|
FakeWeb.register_uri(:get, "http://african.lanl.gov/adore-djatoka/resolver?url_ver=Z39.88-2004&svc_id=info%3Alanl-repo%2Fsvc%2Fping&rft_id=info%3Alanl-repo%2Fds%2F5aa182c2-c092-4596-af6e-e95d2e263de3",
|
55
|
-
:response => File.read('test/fixtures/ping-5aa182c2-c092-4596-af6e-e95d2e263de3.json'))
|
55
|
+
:response => File.read('test/fixtures/ping-5aa182c2-c092-4596-af6e-e95d2e263de3.json'))
|
56
|
+
|
57
|
+
FakeWeb.register_uri(:get, "https://scrc.lib.ncsu.edu/adore-djatoka/resolver?rft_id=0004817&svc_id=info%3Alanl-repo%2Fsvc%2FgetMetadata&url_ver=Z39.88-2004",
|
58
|
+
:response => File.read('test/fixtures/https_metadata_request.json'))
|
data/test/test_metadata.rb
CHANGED
@@ -60,6 +60,16 @@ class TestDjatokaMetadata < Test::Unit::TestCase
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
+
context 'using net::https' do
|
64
|
+
should 'get metadata when using an https URI' do
|
65
|
+
Djatoka.use_curb=false
|
66
|
+
resolver = Djatoka::Resolver.new('https://scrc.lib.ncsu.edu/adore-djatoka/resolver')
|
67
|
+
metadata_obj = resolver.metadata('0004817')
|
68
|
+
metadata = metadata_obj.perform
|
69
|
+
assert_equal('10669', metadata.height)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
63
73
|
context 'determining all the levels for a particular metadata response' do
|
64
74
|
setup do
|
65
75
|
@metadata_obj = @resolver.metadata(@identifier)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: djatoka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -166,6 +166,7 @@ files:
|
|
166
166
|
- test/fixtures/5aa182c2-c092-4596-af6e-e95d2e263de3.json
|
167
167
|
- test/fixtures/b820f537-26a1-4af8-b86a-e7a4cac6187a.json
|
168
168
|
- test/fixtures/empty-metadata.json
|
169
|
+
- test/fixtures/https_metadata_request.json
|
169
170
|
- test/fixtures/ping-5aa182c2-c092-4596-af6e-e95d2e263de3.json
|
170
171
|
- test/fixtures/ping-asdf.json
|
171
172
|
- test/fixtures/ua023_015-006-bx0003-014-075-metadata.json
|