umlaut 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,9 @@
5
5
 
6
6
  class ResolveController < UmlautController
7
7
 
8
+
9
+
10
+
8
11
  before_filter :init_processing
9
12
  # Init processing will look at this list, and for actions mentioned,
10
13
  # will not create a @user_request if an existing one can't be found.
@@ -151,6 +154,13 @@ class ResolveController < UmlautController
151
154
  # so we do this weird one.
152
155
  session[nil] = nil
153
156
 
157
+ # We have to clean the params of bad char encoding bytes, or it causes
158
+ # no end of problems later. We can't just refuse to process, sources
159
+ # do send us bad bytes, I'm afraid.
160
+ params.values.each do |v|
161
+ EnsureValidEncoding.ensure_valid_encoding!(v, :invalid => :replace)
162
+ end
163
+
154
164
  # Create an UmlautRequest object.
155
165
  options = {}
156
166
  if ( @@no_create_request_actions.include?(params[:action]) )
@@ -0,0 +1,68 @@
1
+ require 'nokogiri'
2
+ require 'open-uri'
3
+
4
+
5
+ class JournalTocs < Service
6
+ include MetadataHelper
7
+
8
+ def service_types_generated
9
+ return [ServiceTypeValue['table_of_contents']]
10
+ end
11
+
12
+ def initialize
13
+ @base_url = 'http://www.journaltocs.ac.uk/api'
14
+ super
15
+ end
16
+
17
+ def handle(request)
18
+ issn = get_issn(request.referent)
19
+
20
+ # Can only work with an ISSN
21
+ unless issn
22
+ return request.dispatched(self, true)
23
+ end
24
+
25
+ xml = Nokogiri::XML( open(request_url(url)) )
26
+
27
+ items = xml.search("//rss:item")
28
+
29
+ unless items.length > 0
30
+ # found nothing, no match, or no contents.
31
+ return request.dispatched(self, true)
32
+ end
33
+
34
+
35
+
36
+
37
+ end
38
+
39
+ def request_url(issn)
40
+ return "#{@base_url.chomp('/')}/#{issn}?output=articles"
41
+ end
42
+
43
+
44
+ def xml_ns
45
+ { "rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
46
+ "rss" => "http://purl.org/rss/1.0/",
47
+ "prism"="http://prismstandard.org/namespaces/1.2/basic/",
48
+ "dc"="http://purl.org/dc/elements/1.1/",
49
+ "mn"="http://usefulinc.com/rss/manifest/",
50
+ "content"="http://purl.org/rss/1.0/modules/content/"
51
+ }
52
+ end
53
+
54
+ # Given a Nokogiri list of rss:items, returns a list of OpenURL::ContextObjects
55
+ def extract_items(items)
56
+ items.collect do |item|
57
+
58
+ end
59
+
60
+ end
61
+
62
+ class Item
63
+ attr_accessor :title,
64
+ end
65
+
66
+
67
+ end
68
+
@@ -1,3 +1,3 @@
1
1
  module Umlaut
2
- VERSION = "3.0.0"
2
+ VERSION = "3.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: umlaut
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-19 00:00:00.000000000 Z
12
+ date: 2012-07-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ! '>='
68
68
  - !ruby/object:Gem::Version
69
- version: 0.3.0
69
+ version: 0.4.0
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,7 +74,7 @@ dependencies:
74
74
  requirements:
75
75
  - - ! '>='
76
76
  - !ruby/object:Gem::Version
77
- version: 0.3.0
77
+ version: 0.4.0
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: marc
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -177,6 +177,22 @@ dependencies:
177
177
  - - ~>
178
178
  - !ruby/object:Gem::Version
179
179
  version: 0.1.0
180
+ - !ruby/object:Gem::Dependency
181
+ name: ensure_valid_encoding
182
+ requirement: !ruby/object:Gem::Requirement
183
+ none: false
184
+ requirements:
185
+ - - ! '>='
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ none: false
192
+ requirements:
193
+ - - ! '>='
194
+ - !ruby/object:Gem::Version
195
+ version: '0'
180
196
  - !ruby/object:Gem::Dependency
181
197
  name: single_test
182
198
  requirement: !ruby/object:Gem::Requirement
@@ -406,6 +422,7 @@ files:
406
422
  - lib/service_adaptors/request_to_fixture.rb
407
423
  - lib/service_adaptors/isi.rb
408
424
  - lib/service_adaptors/primo_service.rb
425
+ - lib/service_adaptors/journal_tocs.progress
409
426
  - lib/service_adaptors/open_library.rb
410
427
  - lib/service_adaptors/elsevier_cover.rb
411
428
  - lib/service_adaptors/ulrichs_link.rb
@@ -558,7 +575,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
558
575
  version: '0'
559
576
  segments:
560
577
  - 0
561
- hash: 2484566373376550440
578
+ hash: 2563544091378142822
562
579
  required_rubygems_version: !ruby/object:Gem::Requirement
563
580
  none: false
564
581
  requirements:
@@ -567,7 +584,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
567
584
  version: '0'
568
585
  segments:
569
586
  - 0
570
- hash: 2484566373376550440
587
+ hash: 2563544091378142822
571
588
  requirements: []
572
589
  rubyforge_project:
573
590
  rubygems_version: 1.8.24