voyager_api 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/holdings/collection.rb +7 -3
- data/lib/holdings/record.rb +15 -4
- data/test/holdings/test_collection_output.rb +7 -2
- data/test/holdings/test_record.rb +2 -2
- metadata +28 -28
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
data/lib/holdings/collection.rb
CHANGED
@@ -113,7 +113,7 @@ module Voyager
|
|
113
113
|
:location_name => holding[:location_name],
|
114
114
|
:call_number => holding[:call_number],
|
115
115
|
:status => '',
|
116
|
-
:holding_id =>
|
116
|
+
:holding_id => [],
|
117
117
|
:copies => [],
|
118
118
|
:services => []
|
119
119
|
}
|
@@ -121,6 +121,9 @@ module Voyager
|
|
121
121
|
entries << entry
|
122
122
|
end
|
123
123
|
|
124
|
+
# add holding_id
|
125
|
+
entry[:holding_id] << holding[:holding_id]
|
126
|
+
|
124
127
|
# for simple holdings put consolidated status information in the first copy
|
125
128
|
if complexity == :simple
|
126
129
|
item_status = holding[:item_status]
|
@@ -262,10 +265,11 @@ module Voyager
|
|
262
265
|
entries
|
263
266
|
when :brief
|
264
267
|
entries.collect do |entry|
|
265
|
-
{:
|
268
|
+
{ :holding_id => entry[:holding_id],
|
269
|
+
:location_name => entry[:location_name],
|
266
270
|
:call_number => entry[:call_number],
|
267
271
|
:status => entry[:status],
|
268
|
-
:services => entry[:services]}
|
272
|
+
:services => entry[:services] }
|
269
273
|
end
|
270
274
|
end
|
271
275
|
|
data/lib/holdings/record.rb
CHANGED
@@ -342,12 +342,16 @@ module Voyager
|
|
342
342
|
if location_name.match(/^Offsite/) &&
|
343
343
|
HTTPClient.new.get_content("http://www.columbia.edu/cgi-bin/cul/lookupNBX?" + bibid) == "1"
|
344
344
|
return ['offsite']
|
345
|
-
end
|
346
345
|
# precat
|
347
|
-
|
348
|
-
|
346
|
+
elsif location_name.match(/^Precat/)
|
347
|
+
return ['precat']
|
348
|
+
#doc delivery
|
349
|
+
elsif ['Butler Stacks', 'Butler Reference', 'African', 'Comp Lit', 'Early Modern', 'Islamic', 'Latin American',
|
350
|
+
'Ancient', 'Moral', 'Papyrus', 'Edward Said', 'South Asian', 'US History'].any? { |loc| location_name.match(/^#{loc}/) }
|
351
|
+
return ['doc_delivery']
|
352
|
+
else
|
353
|
+
return []
|
349
354
|
end
|
350
|
-
return []
|
351
355
|
end
|
352
356
|
|
353
357
|
def process_some_available(location_name,bibid,messages)
|
@@ -357,6 +361,13 @@ module Voyager
|
|
357
361
|
if location_name.match(/^Offsite/) &&
|
358
362
|
HTTPClient.new.get_content("http://www.columbia.edu/cgi-bin/cul/lookupNBX?" + bibid) == "1"
|
359
363
|
services << 'offsite'
|
364
|
+
# precat
|
365
|
+
elsif location_name.match(/^Precat/)
|
366
|
+
services << 'precat'
|
367
|
+
# doc delivery
|
368
|
+
elsif ['Butler Stacks', 'Butler Reference', 'African', 'Comp Lit', 'Early Modern', 'Islamic', 'Latin American',
|
369
|
+
'Ancient', 'Moral', 'Papyrus', 'Edward Said', 'South Asian', 'US History'].any? { |loc| location_name.match(/^#{loc}/) }
|
370
|
+
services << 'doc_delivery'
|
360
371
|
end
|
361
372
|
|
362
373
|
services << scan_messages(messages)
|
@@ -17,7 +17,7 @@ class TestCollectionOutput < HoldingsTestCase
|
|
17
17
|
|
18
18
|
coll = load_fixture("holdings_5351573.xml")
|
19
19
|
output = coll.to_hash
|
20
|
-
coll = load_fixture("
|
20
|
+
coll = load_fixture("holdings_8661671.xml")
|
21
21
|
output = coll.to_hash
|
22
22
|
# assert_equal '', output
|
23
23
|
end
|
@@ -49,6 +49,11 @@ class TestCollectionOutput < HoldingsTestCase
|
|
49
49
|
output = coll.to_hash(:output_type => :condensed)
|
50
50
|
assert_kind_of Array, output[:condensed_holdings_full]
|
51
51
|
assert_equal 'Order Information: In the Pre-Order Process. Try Borrow Direct or ILL.', output[:condensed_holdings_full].first[:copies].first[:orders]
|
52
|
+
|
53
|
+
coll = load_fixture("holdings_8661671.xml")
|
54
|
+
output = coll.to_hash(:output_type => :condensed)
|
55
|
+
assert_kind_of Array, output[:condensed_holdings_full]
|
56
|
+
assert_equal ["11739902", "11739903", "11740343"], output[:condensed_holdings_full][1][:holding_id]
|
52
57
|
|
53
58
|
end
|
54
59
|
|
@@ -63,7 +68,7 @@ class TestCollectionOutput < HoldingsTestCase
|
|
63
68
|
assert_equal 'Butler Stacks (Enter at the Butler Circulation Desk)', output[:condensed_holdings_brief].first[:location_name]
|
64
69
|
assert_equal 'BL80.3 .D74 2011', output[:condensed_holdings_brief].first[:call_number]
|
65
70
|
assert_equal 'available', output[:condensed_holdings_brief].first[:status]
|
66
|
-
assert_equal [], output[:condensed_holdings_brief].first[:services]
|
71
|
+
assert_equal ["doc_delivery"], output[:condensed_holdings_brief].first[:services]
|
67
72
|
|
68
73
|
coll = load_fixture("holdings_2606957.xml")
|
69
74
|
output = coll.to_hash(:output_type => :condensed, :content_type => :brief)
|
@@ -166,7 +166,7 @@ class TestHoldings < HoldingsTestCase
|
|
166
166
|
|
167
167
|
record = load_fixture("holdings_4191079.xml").records[2]
|
168
168
|
assert_equal 'some_available', record.item_status[:status]
|
169
|
-
assert_equal ["recall_hold", "borrow_direct", "ill"], record.services, 'recall, BD, ILL'
|
169
|
+
assert_equal ["doc_delivery", "recall_hold", "borrow_direct", "ill"], record.services, 'recall, BD, ILL'
|
170
170
|
end
|
171
171
|
|
172
172
|
def test_services_checkout_status_patron
|
@@ -176,7 +176,7 @@ class TestHoldings < HoldingsTestCase
|
|
176
176
|
|
177
177
|
record = load_fixture("holdings_4191079.xml").records[3]
|
178
178
|
assert_equal 'some_available', record.item_status[:status]
|
179
|
-
assert_equal ["borrow_direct", "ill"], record.services, 'BD, ILL'
|
179
|
+
assert_equal ["doc_delivery", "borrow_direct", "ill"], record.services, 'BD, ILL'
|
180
180
|
end
|
181
181
|
|
182
182
|
def test_services_offsite
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: voyager_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-10-
|
13
|
+
date: 2011-10-14 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
17
|
-
requirement: &
|
17
|
+
requirement: &2153202080 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2153202080
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: i18n
|
28
|
-
requirement: &
|
28
|
+
requirement: &2153201440 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *2153201440
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: httpclient
|
39
|
-
requirement: &
|
39
|
+
requirement: &2153200720 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *2153200720
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: nokogiri
|
50
|
-
requirement: &
|
50
|
+
requirement: &2153200040 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :runtime
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *2153200040
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: minitest
|
61
|
-
requirement: &
|
61
|
+
requirement: &2153199460 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: '0'
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *2153199460
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: bundler
|
72
|
-
requirement: &
|
72
|
+
requirement: &2153198940 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: 1.0.0
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *2153198940
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: jeweler
|
83
|
-
requirement: &
|
83
|
+
requirement: &2153198400 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - ~>
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: 1.6.4
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *2153198400
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: rcov
|
94
|
-
requirement: &
|
94
|
+
requirement: &2153197780 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ! '>='
|
@@ -99,10 +99,10 @@ dependencies:
|
|
99
99
|
version: '0'
|
100
100
|
type: :development
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
102
|
+
version_requirements: *2153197780
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: guard-minitest
|
105
|
-
requirement: &
|
105
|
+
requirement: &2153196980 !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
108
108
|
- - ! '>='
|
@@ -110,10 +110,10 @@ dependencies:
|
|
110
110
|
version: '0'
|
111
111
|
type: :development
|
112
112
|
prerelease: false
|
113
|
-
version_requirements: *
|
113
|
+
version_requirements: *2153196980
|
114
114
|
- !ruby/object:Gem::Dependency
|
115
115
|
name: rb-fsevent
|
116
|
-
requirement: &
|
116
|
+
requirement: &2153196320 !ruby/object:Gem::Requirement
|
117
117
|
none: false
|
118
118
|
requirements:
|
119
119
|
- - ! '>='
|
@@ -121,10 +121,10 @@ dependencies:
|
|
121
121
|
version: '0'
|
122
122
|
type: :development
|
123
123
|
prerelease: false
|
124
|
-
version_requirements: *
|
124
|
+
version_requirements: *2153196320
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: mocha
|
127
|
-
requirement: &
|
127
|
+
requirement: &2153195480 !ruby/object:Gem::Requirement
|
128
128
|
none: false
|
129
129
|
requirements:
|
130
130
|
- - ! '>='
|
@@ -132,10 +132,10 @@ dependencies:
|
|
132
132
|
version: '0'
|
133
133
|
type: :development
|
134
134
|
prerelease: false
|
135
|
-
version_requirements: *
|
135
|
+
version_requirements: *2153195480
|
136
136
|
- !ruby/object:Gem::Dependency
|
137
137
|
name: growl
|
138
|
-
requirement: &
|
138
|
+
requirement: &2153193920 !ruby/object:Gem::Requirement
|
139
139
|
none: false
|
140
140
|
requirements:
|
141
141
|
- - ! '>='
|
@@ -143,7 +143,7 @@ dependencies:
|
|
143
143
|
version: '0'
|
144
144
|
type: :development
|
145
145
|
prerelease: false
|
146
|
-
version_requirements: *
|
146
|
+
version_requirements: *2153193920
|
147
147
|
description: ! 'Middleware gem for Voyager 7 API calls, specificially holdings information '
|
148
148
|
email: github@jamesstuart.org
|
149
149
|
executables: []
|
@@ -225,7 +225,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
225
225
|
version: '0'
|
226
226
|
segments:
|
227
227
|
- 0
|
228
|
-
hash: -
|
228
|
+
hash: -943639021231407938
|
229
229
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
230
|
none: false
|
231
231
|
requirements:
|
@@ -234,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
234
234
|
version: '0'
|
235
235
|
requirements: []
|
236
236
|
rubyforge_project:
|
237
|
-
rubygems_version: 1.8.
|
237
|
+
rubygems_version: 1.8.6
|
238
238
|
signing_key:
|
239
239
|
specification_version: 3
|
240
240
|
summary: Columbia University Voyager 7 API wrapper
|