openurl 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,6 +18,7 @@ module OpenURL
18
18
  @author_keys = ['aulast','aufirst','auinit','auinit1','auinitm','ausuffix',
19
19
  'au', 'aucorp']
20
20
  end
21
+
21
22
  def method_missing(metadata, value=nil)
22
23
  meta = metadata.to_s.sub(/=$/,'')
23
24
  raise ArgumentError, "#{meta.to_s} is not a valid #{self.class} metadata field." unless (@author_keys+@metadata_keys).index(meta)
@@ -28,10 +29,16 @@ module OpenURL
28
29
  end
29
30
  else
30
31
  return self.metadata[meta]
31
- end
32
-
32
+ end
33
33
  end
34
34
 
35
+ def respond_to?(message)
36
+ # make it match method_messing
37
+ key = message.to_s.sub(/=$/,'')
38
+ super || (@author_keys+@metadata_keys).index(key)
39
+ end
40
+
41
+
35
42
  def set_metadata(key, val)
36
43
  @metadata[key] = val.to_s
37
44
  if @author_keys.index(key)
@@ -0,0 +1,13 @@
1
+ class ScholarlyCommonTest < Test::Unit::TestCase
2
+
3
+ def test_respond_to
4
+ kev = "url_ver=Z39.88-2004&rfr_id=info:sid/library.jhu.edu%3Axerxes+%28+OmniFile+Full+Text+Mega%29&rft.genre=article&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.issn=00297917&rft.date=2012&rft.tpages=2+pages&rft.jtitle=Occupational+Health&rft.volume=64&rft.issue=5&rft.spage=14&rft.epage=15&rft.atitle=Inhalation+versus+skin+exposure+%3A+have+we+got+the+balance+right%3F+&rft.aulast=Packham&rft.aufirst=Chris+Partner%2C+EnviroDerm+Services"
5
+
6
+ openurl = OpenURL::ContextObject.new_from_kev(kev)
7
+
8
+ assert openurl.referent.respond_to? :jtitle
9
+ assert openurl.referent.respond_to? :atitle
10
+
11
+ end
12
+
13
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openurl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,8 +10,24 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-10-10 00:00:00.000000000Z
14
- dependencies: []
13
+ date: 2011-10-10 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: marc
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
15
31
  description:
16
32
  email:
17
33
  - rochkind@jhu.edu
@@ -42,6 +58,7 @@ files:
42
58
  - test/test.yml
43
59
  - test/context_object_test.rb
44
60
  - test/encoding_test.rb
61
+ - test/scholarly_common_test.rb
45
62
  - README.md
46
63
  homepage: https://github.com/openurl/openurl
47
64
  licenses: []
@@ -63,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
80
  version: '0'
64
81
  requirements: []
65
82
  rubyforge_project:
66
- rubygems_version: 1.8.10
83
+ rubygems_version: 1.8.24
67
84
  signing_key:
68
85
  specification_version: 3
69
86
  summary: a Ruby library to create, parse and use NISO Z39.88 OpenURLs