djatoka 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +18 -8
- data/Rakefile +8 -4
- data/VERSION +1 -1
- data/bin/djatoka_url +4 -4
- data/lib/djatoka.rb +1 -1
- data/lib/djatoka/region.rb +3 -1
- data/test/helper.rb +10 -1
- data/test/test_djatoka.rb +1 -0
- data/test/test_metadata.rb +1 -1
- data/test/test_region.rb +1 -1
- metadata +23 -9
data/README.rdoc
CHANGED
@@ -10,19 +10,22 @@ used by Djatoka.
|
|
10
10
|
|
11
11
|
gem install djatoka
|
12
12
|
|
13
|
+
If you wish to use the curb gem instead of Net::HTTP, install it:
|
14
|
+
gem install curb
|
15
|
+
|
13
16
|
== Example usage
|
14
17
|
# Create a resolver object with a URL.
|
15
18
|
resolver = Djatoka::Resolver.new('http://african.lanl.gov/adore-djatoka/resolver')
|
16
|
-
|
19
|
+
|
17
20
|
# A known good identifier
|
18
21
|
identifier = 'info:lanl-repo/ds/5aa182c2-c092-4596-af6e-e95d2e263de3'
|
19
|
-
|
22
|
+
|
20
23
|
# Ping the server to see if that resource exists.
|
21
24
|
resolver.ping(identifier)
|
22
25
|
# => <Mash identifier="info:lanl-repo/ds/5aa182c2-c092-4596-af6e-e95d2e263de3" status="OK">
|
23
26
|
resolver.ping('foobar')
|
24
27
|
# => nil
|
25
|
-
|
28
|
+
|
26
29
|
# Create a Djatoka::Metadata object and perform the request to the server for metadata.
|
27
30
|
metadata = resolver.metadata(identifier).perform
|
28
31
|
metadata.levels
|
@@ -78,17 +81,24 @@ at the same site (domain and port) as your application. The scripts also expect
|
|
78
81
|
the resolver to remain at /adore-djatoka/resolver so maintain that path if you
|
79
82
|
proxy Djatoka or dig into the javascript to change the path.
|
80
83
|
|
84
|
+
== Ruby versions
|
85
|
+
|
86
|
+
Tested with the following Ruby versions:
|
87
|
+
- 1.8.7-p249
|
88
|
+
- 1.8.7-p302
|
89
|
+
- 1.9.2-p0
|
90
|
+
|
81
91
|
== Commandline
|
82
92
|
|
83
93
|
There is also a little commandline utility for outputting the OpenURL.
|
84
94
|
|
85
|
-
$ djatoka_url --resolver http://african.lanl.gov/adore-djatoka/resolver --
|
95
|
+
$ djatoka_url --resolver http://african.lanl.gov/adore-djatoka/resolver --rftid info:lanl-repo/ds/5aa182c2-c092-4596-af6e-e95d2e263de3 --scale 300 --square
|
86
96
|
{"region"=>"0,874,421,421", "scale"=>"300", "level"=>"3"}
|
87
97
|
http://african.lanl.gov/adore-djatoka/resolver?svc.level=3&url_ver=Z39.88-2004&svc.region=0%2C874%2C421%2C421&svc.scale=300&rft_id=info%3Alanl-repo%2Fds%2F5aa182c2-c092-4596-af6e-e95d2e263de3&svc_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajpeg2000&svc_id=info%3Alanl-repo%2Fsvc%2FgetRegion
|
88
|
-
|
89
|
-
$ djatoka_url --resolver http://african.lanl.gov/adore-djatoka/resolver --
|
90
|
-
|
91
|
-
$ djatoka_url --help
|
98
|
+
|
99
|
+
$ djatoka_url --resolver http://african.lanl.gov/adore-djatoka/resolver --rftid info:lanl-repo/ds/5aa182c2-c092-4596-af6e-e95d2e263de3 --smallbox --browser chromium-browser
|
100
|
+
|
101
|
+
$ djatoka_url --help
|
92
102
|
|
93
103
|
|
94
104
|
== TODO
|
data/Rakefile
CHANGED
@@ -11,9 +11,10 @@ begin
|
|
11
11
|
gem.homepage = "http://github.com/jronallo/djatoka"
|
12
12
|
gem.authors = ["Jason Ronallo"]
|
13
13
|
gem.add_development_dependency "shoulda", ">= 0"
|
14
|
-
gem.add_development_dependency "ruby-debug", ">= 0"
|
14
|
+
#gem.add_development_dependency "ruby-debug", ">= 0"
|
15
|
+
gem.add_development_dependency "hanna", ">= 0"
|
15
16
|
gem.add_dependency "addressable", "2.1.2"
|
16
|
-
|
17
|
+
gem.add_development_dependency "curb", ">= 0"
|
17
18
|
gem.add_dependency "json", ">= 0"
|
18
19
|
gem.add_dependency 'trollop', '>= 0'
|
19
20
|
gem.add_dependency 'hashie', '>= 0'
|
@@ -49,8 +50,11 @@ task :test => :check_dependencies
|
|
49
50
|
|
50
51
|
task :default => :test
|
51
52
|
|
52
|
-
|
53
|
-
require 'hanna/rdoctask'
|
53
|
+
begin
|
54
|
+
require 'hanna/rdoctask'
|
55
|
+
rescue LoadError
|
56
|
+
require 'rake/rdoctask'
|
57
|
+
end
|
54
58
|
Rake::RDocTask.new do |rdoc|
|
55
59
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
56
60
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
data/bin/djatoka_url
CHANGED
@@ -10,12 +10,12 @@ This script take a Djatoka resolver base URL and returns a full URI for a partic
|
|
10
10
|
identifier.
|
11
11
|
|
12
12
|
Usage:
|
13
|
-
djatoka_url [options] --resolver http://african.lanl.gov/adore-djatoka/resolver --
|
13
|
+
djatoka_url [options] --resolver http://african.lanl.gov/adore-djatoka/resolver --rftid info:lanl-repo/ds/5aa182c2-c092-4596-af6e-e95d2e263de3
|
14
14
|
|
15
15
|
where options are:
|
16
16
|
EOS
|
17
17
|
opt :resolver, "A Djatoka resolver base URL", :required => true, :type => String
|
18
|
-
opt :
|
18
|
+
opt :rftid, "Resource identifier", :required => true, :type => String, :short => :i
|
19
19
|
opt :level, 'Level', :type => String
|
20
20
|
opt :rotate, 'Rotate', :type => String
|
21
21
|
opt :region, 'Region', :type => String
|
@@ -30,7 +30,7 @@ EOS
|
|
30
30
|
end
|
31
31
|
|
32
32
|
resolver = Djatoka::Resolver.new(opts[:resolver])
|
33
|
-
region = resolver.region(opts[:
|
33
|
+
region = resolver.region(opts[:rftid])
|
34
34
|
|
35
35
|
[:level, :rotate, :region, :scale, :format, :clayer].each do |param|
|
36
36
|
region.send(param, opts[param]) if opts[param]
|
@@ -45,7 +45,7 @@ if opts[:square]
|
|
45
45
|
end
|
46
46
|
|
47
47
|
if opts[:metadata] or opts[:levels]
|
48
|
-
metadata = resolver.metadata(opts[:
|
48
|
+
metadata = resolver.metadata(opts[:rftid])
|
49
49
|
metadata.perform
|
50
50
|
if opts[:metadata]
|
51
51
|
puts metadata.url
|
data/lib/djatoka.rb
CHANGED
data/lib/djatoka/region.rb
CHANGED
@@ -124,7 +124,9 @@ class Djatoka::Region
|
|
124
124
|
def map_params(params)
|
125
125
|
params.each do |k,v|
|
126
126
|
if k.to_s != 'resolver' and self.respond_to?(k) and
|
127
|
-
self.class.instance_methods(false).include?(k.to_s)
|
127
|
+
(self.class.instance_methods(false).include?(k.to_s) or
|
128
|
+
self.class.instance_methods(false).include?(k.to_sym)
|
129
|
+
)
|
128
130
|
self.send(k,v)
|
129
131
|
end
|
130
132
|
end
|
data/test/helper.rb
CHANGED
@@ -5,7 +5,7 @@ require 'shoulda'
|
|
5
5
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
6
6
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
7
7
|
require 'djatoka'
|
8
|
-
require 'ruby-debug'
|
8
|
+
#require 'ruby-debug'
|
9
9
|
|
10
10
|
class Test::Unit::TestCase
|
11
11
|
def self.with_a_resolver(&block)
|
@@ -20,5 +20,14 @@ class Test::Unit::TestCase
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
def set_testing_curb
|
24
|
+
begin
|
25
|
+
require 'curb'
|
26
|
+
Djatoka.use_curb = true
|
27
|
+
rescue LoadError
|
28
|
+
Djatoka.use_curb = false
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
23
32
|
end
|
24
33
|
|
data/test/test_djatoka.rb
CHANGED
data/test/test_metadata.rb
CHANGED
@@ -56,7 +56,7 @@ class TestDjatokaMetadata < Test::Unit::TestCase
|
|
56
56
|
should 'return a height for a good request' do
|
57
57
|
Djatoka.use_curb=false
|
58
58
|
assert_equal '3372', Djatoka::Metadata.new(@resolver, @identifier).perform.height
|
59
|
-
|
59
|
+
set_testing_curb
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
data/test/test_region.rb
CHANGED
@@ -126,7 +126,7 @@ class TestDjatokaMetadata < Test::Unit::TestCase
|
|
126
126
|
assert_equal 'image/png', region.query.format
|
127
127
|
end
|
128
128
|
should 'accept param keys as strings' do
|
129
|
-
params = {'level'=> 3, 'rotate'=>180, 'region' => '0,0,500,500',
|
129
|
+
params = {'level'=> 3, 'rotate'=> 180, 'region' => '0,0,500,500',
|
130
130
|
'scale' => 75, 'format' => 'image/png'
|
131
131
|
}
|
132
132
|
region = Djatoka::Region.new(@resolver,@identifier,params)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: djatoka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jason Ronallo
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-08-22 00:00:00 -04:00
|
19
19
|
default_executable: djatoka_url
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
type: :development
|
34
34
|
version_requirements: *id001
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
36
|
+
name: hanna
|
37
37
|
prerelease: false
|
38
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
@@ -63,7 +63,7 @@ dependencies:
|
|
63
63
|
type: :runtime
|
64
64
|
version_requirements: *id003
|
65
65
|
- !ruby/object:Gem::Dependency
|
66
|
-
name:
|
66
|
+
name: curb
|
67
67
|
prerelease: false
|
68
68
|
requirement: &id004 !ruby/object:Gem::Requirement
|
69
69
|
none: false
|
@@ -74,10 +74,10 @@ dependencies:
|
|
74
74
|
segments:
|
75
75
|
- 0
|
76
76
|
version: "0"
|
77
|
-
type: :
|
77
|
+
type: :development
|
78
78
|
version_requirements: *id004
|
79
79
|
- !ruby/object:Gem::Dependency
|
80
|
-
name:
|
80
|
+
name: json
|
81
81
|
prerelease: false
|
82
82
|
requirement: &id005 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
@@ -91,7 +91,7 @@ dependencies:
|
|
91
91
|
type: :runtime
|
92
92
|
version_requirements: *id005
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
|
-
name:
|
94
|
+
name: trollop
|
95
95
|
prerelease: false
|
96
96
|
requirement: &id006 !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
@@ -104,6 +104,20 @@ dependencies:
|
|
104
104
|
version: "0"
|
105
105
|
type: :runtime
|
106
106
|
version_requirements: *id006
|
107
|
+
- !ruby/object:Gem::Dependency
|
108
|
+
name: hashie
|
109
|
+
prerelease: false
|
110
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
hash: 3
|
116
|
+
segments:
|
117
|
+
- 0
|
118
|
+
version: "0"
|
119
|
+
type: :runtime
|
120
|
+
version_requirements: *id007
|
107
121
|
description: The djatoka library provides some simple methods for creation of the OpenURLs needed to communicate with the Djatoka image server.
|
108
122
|
email: jronallo@gmail.com
|
109
123
|
executables:
|