LibrarySolution 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README ADDED
@@ -0,0 +1,24 @@
1
+ # The LibrarySolution class represents programmatic access to a
2
+ # TLC Library.Solution v3.3.5 OPAC.
3
+ # The new method takes two arguments:
4
+ # * the web server domain - default "demo.tlcdelivers.com"
5
+ # * the configuration name - default "pac"
6
+ # e.g. - ls = TLC::LibrarySolution.new('demo.tlcdelivers.com', 'pac')
7
+
8
+ # Example using the TLC demo server and Da Vinci Code:
9
+
10
+ # require 'librarysolution'
11
+
12
+ # ls = TLC::LibrarySolution.new('demo.tlcdelivers.com')
13
+
14
+ # puts "0385504209"
15
+ # puts "rn"
16
+ # puts ls.get_recordnumber("0385504209")
17
+ # puts "url"
18
+ # puts ls.get_url("0385504209")
19
+ # puts "link"
20
+ # puts ls.get_link("0385504209")
21
+ # puts "xml"
22
+ # puts ls.get_avail("0385504209", :isbn)
23
+ # puts "has?"
24
+ # puts ls.has?("0385504209")
@@ -0,0 +1,130 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: TLC</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">TLC</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/library_solution_rb.html">
59
+ library_solution.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+ <div id="description">
76
+ <p>
77
+ Pure ruby wrappers for <a href="TLC.html">TLC</a> (<a
78
+ href="http://www.tlcdelivers.com">www.tlcdelivers.com</a>) web services
79
+ </p>
80
+ <table>
81
+ <tr><td valign="top">Author:</td><td>Justin Duewel-Zahniser (<a
82
+ href="mailto:justin@justindz.org">justin@justindz.org</a>)
83
+
84
+ </td></tr>
85
+ <tr><td valign="top">Copyright:</td><td>Copyright &#169; 2006 Justin Duewel-Zahniser
86
+
87
+ </td></tr>
88
+ <tr><td valign="top">License:</td><td>Distributes under the same terms as Ruby
89
+
90
+ </td></tr>
91
+ </table>
92
+
93
+ </div>
94
+
95
+
96
+ </div>
97
+
98
+
99
+ </div>
100
+
101
+
102
+ <!-- if includes -->
103
+
104
+ <div id="section">
105
+
106
+ <div id="class-list">
107
+ <h3 class="section-bar">Classes and Modules</h3>
108
+
109
+ Class <a href="TLC/LibrarySolution.html" class="link">TLC::LibrarySolution</a><br />
110
+
111
+ </div>
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+ <!-- if method_list -->
120
+
121
+
122
+ </div>
123
+
124
+
125
+ <div id="validator-badges">
126
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
127
+ </div>
128
+
129
+ </body>
130
+ </html>
@@ -0,0 +1,319 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: TLC::LibrarySolution</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">TLC::LibrarySolution</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/library_solution_rb.html">
59
+ library_solution.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+ <div id="description">
82
+ <p>
83
+ The <a href="LibrarySolution.html">LibrarySolution</a> class represents
84
+ programmatic access to a <a href="../TLC.html">TLC</a> Library.Solution
85
+ v3.3.5 OPAC. The new method takes two arguments:
86
+ </p>
87
+ <ul>
88
+ <li>the web server domain - default &quot;demo.tlcdelivers.com&quot;
89
+
90
+ </li>
91
+ <li>the configuration name - default &quot;pac&quot;
92
+
93
+ </li>
94
+ </ul>
95
+ <p>
96
+ e.g. - ls = <a
97
+ href="LibrarySolution.html#M000001">TLC::LibrarySolution.new</a>(&#8216;demo.tlcdelivers.com&#8217;,
98
+ &#8216;pac&#8217;)
99
+ </p>
100
+
101
+ </div>
102
+
103
+
104
+ </div>
105
+
106
+ <div id="method-list">
107
+ <h3 class="section-bar">Methods</h3>
108
+
109
+ <div class="name-list">
110
+ <a href="#M000007">clean</a>&nbsp;&nbsp;
111
+ <a href="#M000002">get_avail</a>&nbsp;&nbsp;
112
+ <a href="#M000005">get_link</a>&nbsp;&nbsp;
113
+ <a href="#M000003">get_recordnumber</a>&nbsp;&nbsp;
114
+ <a href="#M000004">get_url</a>&nbsp;&nbsp;
115
+ <a href="#M000006">has?</a>&nbsp;&nbsp;
116
+ <a href="#M000001">new</a>&nbsp;&nbsp;
117
+ </div>
118
+ </div>
119
+
120
+ </div>
121
+
122
+
123
+ <!-- if includes -->
124
+
125
+ <div id="section">
126
+
127
+
128
+
129
+
130
+
131
+ <div id="attribute-list">
132
+ <h3 class="section-bar">Attributes</h3>
133
+
134
+ <div class="name-list">
135
+ <table>
136
+ <tr class="top-aligned-row context-row">
137
+ <td class="context-item-name">availability_rn_url</td>
138
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
139
+ <td class="context-item-desc"></td>
140
+ </tr>
141
+ <tr class="top-aligned-row context-row">
142
+ <td class="context-item-name">availability_url</td>
143
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
144
+ <td class="context-item-desc"></td>
145
+ </tr>
146
+ <tr class="top-aligned-row context-row">
147
+ <td class="context-item-name">config</td>
148
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
149
+ <td class="context-item-desc"></td>
150
+ </tr>
151
+ <tr class="top-aligned-row context-row">
152
+ <td class="context-item-name">detail_url</td>
153
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
154
+ <td class="context-item-desc"></td>
155
+ </tr>
156
+ <tr class="top-aligned-row context-row">
157
+ <td class="context-item-name">web_server_address</td>
158
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
159
+ <td class="context-item-desc"></td>
160
+ </tr>
161
+ </table>
162
+ </div>
163
+ </div>
164
+
165
+
166
+
167
+ <!-- if method_list -->
168
+ <div id="methods">
169
+ <h3 class="section-bar">Public Class methods</h3>
170
+
171
+ <div id="method-M000001" class="method-detail">
172
+ <a name="M000001"></a>
173
+
174
+ <div class="method-heading">
175
+ <a href="LibrarySolution.src/M000001.html" target="Code" class="method-signature"
176
+ onclick="popupCode('LibrarySolution.src/M000001.html');return false;">
177
+ <span class="method-name">new</span><span class="method-args">(web_server_address='demo.tlcdelivers.com', config='pac')</span>
178
+ </a>
179
+ </div>
180
+
181
+ <div class="method-description">
182
+ </div>
183
+ </div>
184
+
185
+ <h3 class="section-bar">Public Instance methods</h3>
186
+
187
+ <div id="method-M000007" class="method-detail">
188
+ <a name="M000007"></a>
189
+
190
+ <div class="method-heading">
191
+ <a href="LibrarySolution.src/M000007.html" target="Code" class="method-signature"
192
+ onclick="popupCode('LibrarySolution.src/M000007.html');return false;">
193
+ <span class="method-name">clean</span><span class="method-args">(isbn)</span>
194
+ </a>
195
+ </div>
196
+
197
+ <div class="method-description">
198
+ <p>
199
+ This helper method just cleans up ISBNs
200
+ </p>
201
+ </div>
202
+ </div>
203
+
204
+ <div id="method-M000002" class="method-detail">
205
+ <a name="M000002"></a>
206
+
207
+ <div class="method-heading">
208
+ <a href="LibrarySolution.src/M000002.html" target="Code" class="method-signature"
209
+ onclick="popupCode('LibrarySolution.src/M000002.html');return false;">
210
+ <span class="method-name">get_avail</span><span class="method-args">(ids, type, detail=1)</span>
211
+ </a>
212
+ </div>
213
+
214
+ <div class="method-description">
215
+ <p>
216
+ This method returns the raw XML for a request as a REXML::Document. It
217
+ takes three parameters:
218
+ </p>
219
+ <ul>
220
+ <li>ids - either an ISBN or recordnumber or an array of ISBNs or recordnumbers
221
+
222
+ </li>
223
+ <li>type - :isbn or :rn
224
+
225
+ </li>
226
+ <li>detail - 0, 1 (default) or 2&#8212;you are unlikely to need to specify this
227
+
228
+ </li>
229
+ </ul>
230
+ <p>
231
+ The &amp;curbranch=Mail (e.g.) option is not currently supported.
232
+ </p>
233
+ </div>
234
+ </div>
235
+
236
+ <div id="method-M000005" class="method-detail">
237
+ <a name="M000005"></a>
238
+
239
+ <div class="method-heading">
240
+ <a href="LibrarySolution.src/M000005.html" target="Code" class="method-signature"
241
+ onclick="popupCode('LibrarySolution.src/M000005.html');return false;">
242
+ <span class="method-name">get_link</span><span class="method-args">(isbn)</span>
243
+ </a>
244
+ </div>
245
+
246
+ <div class="method-description">
247
+ <p>
248
+ This method takes an ISBN and returns a formatted link to the title record
249
+ display or nil
250
+ </p>
251
+ </div>
252
+ </div>
253
+
254
+ <div id="method-M000003" class="method-detail">
255
+ <a name="M000003"></a>
256
+
257
+ <div class="method-heading">
258
+ <a href="LibrarySolution.src/M000003.html" target="Code" class="method-signature"
259
+ onclick="popupCode('LibrarySolution.src/M000003.html');return false;">
260
+ <span class="method-name">get_recordnumber</span><span class="method-args">(isbn)</span>
261
+ </a>
262
+ </div>
263
+
264
+ <div class="method-description">
265
+ <p>
266
+ This method takes an ISBN and returns the internal recordnumber
267
+ </p>
268
+ </div>
269
+ </div>
270
+
271
+ <div id="method-M000004" class="method-detail">
272
+ <a name="M000004"></a>
273
+
274
+ <div class="method-heading">
275
+ <a href="LibrarySolution.src/M000004.html" target="Code" class="method-signature"
276
+ onclick="popupCode('LibrarySolution.src/M000004.html');return false;">
277
+ <span class="method-name">get_url</span><span class="method-args">(isbn)</span>
278
+ </a>
279
+ </div>
280
+
281
+ <div class="method-description">
282
+ <p>
283
+ This method takes an ISBN and returns a URL to the title record display or
284
+ nil
285
+ </p>
286
+ </div>
287
+ </div>
288
+
289
+ <div id="method-M000006" class="method-detail">
290
+ <a name="M000006"></a>
291
+
292
+ <div class="method-heading">
293
+ <a href="LibrarySolution.src/M000006.html" target="Code" class="method-signature"
294
+ onclick="popupCode('LibrarySolution.src/M000006.html');return false;">
295
+ <span class="method-name">has?</span><span class="method-args">(isbn)</span>
296
+ </a>
297
+ </div>
298
+
299
+ <div class="method-description">
300
+ <p>
301
+ This method takes an ISBN, checks the catalog for a matching record and
302
+ returns true or false
303
+ </p>
304
+ </div>
305
+ </div>
306
+
307
+
308
+ </div>
309
+
310
+
311
+ </div>
312
+
313
+
314
+ <div id="validator-badges">
315
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
316
+ </div>
317
+
318
+ </body>
319
+ </html>
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>new (TLC::LibrarySolution)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File library_solution.rb, line 22</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">web_server_address</span>=<span class="ruby-value str">'demo.tlcdelivers.com'</span>, <span class="ruby-identifier">config</span>=<span class="ruby-value str">'pac'</span>)
15
+ <span class="ruby-ivar">@avail_url</span> = <span class="ruby-value str">&quot;/TLCScripts/interpac.dll?GetAvailability&amp;IdList=&quot;</span>
16
+ <span class="ruby-ivar">@detail_url</span> = <span class="ruby-value str">&quot;/TLCScripts/interpac.dll?LabelDisplay&amp;config=pac&amp;recordnumber=&quot;</span>
17
+ <span class="ruby-ivar">@web_server_address</span> = <span class="ruby-identifier">web_server_address</span>
18
+ <span class="ruby-ivar">@config</span> = <span class="ruby-identifier">config</span>
19
+ <span class="ruby-keyword kw">end</span></pre>
20
+ </body>
21
+ </html>
@@ -0,0 +1,34 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>get_avail (TLC::LibrarySolution)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File library_solution.rb, line 35</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_avail</span>(<span class="ruby-identifier">ids</span>, <span class="ruby-identifier">type</span>, <span class="ruby-identifier">detail</span>=<span class="ruby-value">1</span>)
15
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ids</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Array</span>
16
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:isbn</span>
17
+ <span class="ruby-identifier">ids</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">isbn</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
18
+ <span class="ruby-identifier">ids</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-identifier">clean</span>(<span class="ruby-identifier">isbn</span>)
19
+ <span class="ruby-keyword kw">end</span>
20
+ <span class="ruby-keyword kw">end</span>
21
+ <span class="ruby-identifier">ids</span> = <span class="ruby-identifier">ids</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;,&quot;</span>)
22
+ <span class="ruby-keyword kw">else</span>
23
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:isbn</span>
24
+ <span class="ruby-identifier">ids</span> = <span class="ruby-identifier">clean</span>(<span class="ruby-identifier">ids</span>)
25
+ <span class="ruby-keyword kw">end</span>
26
+ <span class="ruby-keyword kw">end</span>
27
+ <span class="ruby-identifier">qs</span> = <span class="ruby-node">&quot;#{@avail_url}#{ids}&amp;detail=#{detail.to_s}&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:isbn</span> <span class="ruby-keyword kw">then</span> <span class="ruby-value str">&quot;&amp;type=isbn&quot;</span> <span class="ruby-keyword kw">else</span> <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-keyword kw">end</span>
28
+
29
+ <span class="ruby-identifier">xml</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">get</span>(<span class="ruby-ivar">@web_server_address</span>, <span class="ruby-identifier">qs</span>)
30
+ <span class="ruby-identifier">doc</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Document</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">xml</span>)
31
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">doc</span>
32
+ <span class="ruby-keyword kw">end</span></pre>
33
+ </body>
34
+ </html>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>get_recordnumber (TLC::LibrarySolution)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File library_solution.rb, line 56</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_recordnumber</span>(<span class="ruby-identifier">isbn</span>)
15
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">get_avail</span>(<span class="ruby-identifier">isbn</span>, <span class="ruby-identifier">:isbn</span>, <span class="ruby-value">0</span>).<span class="ruby-identifier">root</span>.<span class="ruby-identifier">elements</span>[<span class="ruby-value str">'t'</span>].<span class="ruby-identifier">attribute</span>(<span class="ruby-value str">'rn'</span>)
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>get_url (TLC::LibrarySolution)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File library_solution.rb, line 61</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_url</span>(<span class="ruby-identifier">isbn</span>)
15
+ <span class="ruby-identifier">rn</span> = <span class="ruby-identifier">get_recordnumber</span>(<span class="ruby-identifier">isbn</span>)
16
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rn</span>.<span class="ruby-identifier">nil?</span>
17
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
18
+ <span class="ruby-keyword kw">else</span>
19
+ <span class="ruby-keyword kw">return</span> <span class="ruby-node">&quot;http://#{@web_server_address}#{@detail_url}#{rn.to_s}&quot;</span>
20
+ <span class="ruby-keyword kw">end</span>
21
+ <span class="ruby-keyword kw">end</span></pre>
22
+ </body>
23
+ </html>
@@ -0,0 +1,26 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>get_link (TLC::LibrarySolution)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File library_solution.rb, line 71</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_link</span>(<span class="ruby-identifier">isbn</span>)
15
+ <span class="ruby-identifier">doc</span> = <span class="ruby-identifier">get_avail</span>(<span class="ruby-identifier">isbn</span>, <span class="ruby-identifier">:isbn</span>)
16
+ <span class="ruby-identifier">rn</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">root</span>.<span class="ruby-identifier">elements</span>[<span class="ruby-value str">'t'</span>].<span class="ruby-identifier">attribute</span>(<span class="ruby-value str">'rn'</span>)
17
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rn</span>.<span class="ruby-identifier">nil?</span>
18
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
19
+ <span class="ruby-keyword kw">else</span>
20
+ <span class="ruby-identifier">ac</span> = <span class="ruby-identifier">tc</span> = <span class="ruby-value">0</span>
21
+ <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">elements</span>.<span class="ruby-identifier">each</span>(<span class="ruby-value str">&quot;r/t/lo&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">lo</span><span class="ruby-operator">|</span> <span class="ruby-identifier">ac</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">lo</span>.<span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">get_attribute</span>(<span class="ruby-value str">'ac'</span>).<span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_i</span> ; <span class="ruby-identifier">tc</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">lo</span>.<span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">get_attribute</span>(<span class="ruby-value str">'tc'</span>).<span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_i</span> }
22
+ <span class="ruby-keyword kw">return</span> <span class="ruby-node">&quot;&lt;a href=\&quot;http://#{@web_server_address}#{@detail_url}#{rn.to_s}\&quot;&gt;#{ac} of #{tc} available&lt;/a&gt;&quot;</span>
23
+ <span class="ruby-keyword kw">end</span>
24
+ <span class="ruby-keyword kw">end</span></pre>
25
+ </body>
26
+ </html>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>has? (TLC::LibrarySolution)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File library_solution.rb, line 84</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has?</span>(<span class="ruby-identifier">isbn</span>)
15
+ <span class="ruby-keyword kw">return</span> <span class="ruby-operator">!</span><span class="ruby-identifier">get_avail</span>(<span class="ruby-identifier">isbn</span>, <span class="ruby-identifier">:isbn</span>, <span class="ruby-value">0</span>).<span class="ruby-identifier">root</span>.<span class="ruby-identifier">elements</span>[<span class="ruby-value str">'t'</span>].<span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">get_attribute</span>(<span class="ruby-value str">&quot;rn&quot;</span>).<span class="ruby-identifier">nil?</span>
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>clean (TLC::LibrarySolution)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File library_solution.rb, line 89</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clean</span>(<span class="ruby-identifier">isbn</span>)
15
+ <span class="ruby-identifier">isbn</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/[^0-9X]/</span>,<span class="ruby-value str">''</span>)
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1 @@
1
+ Wed Mar 08 13:33:01 Eastern Standard Time 2006
@@ -0,0 +1,109 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: library_solution.rb</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>library_solution.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>library_solution.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Wed Mar 08 13:31:26 Eastern Standard Time 2006</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+
72
+ <div id="requires-list">
73
+ <h3 class="section-bar">Required files</h3>
74
+
75
+ <div class="name-list">
76
+ net/http&nbsp;&nbsp;
77
+ rexml/document&nbsp;&nbsp;
78
+ </div>
79
+ </div>
80
+
81
+ </div>
82
+
83
+
84
+ </div>
85
+
86
+
87
+ <!-- if includes -->
88
+
89
+ <div id="section">
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+ <!-- if method_list -->
99
+
100
+
101
+ </div>
102
+
103
+
104
+ <div id="validator-badges">
105
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
106
+ </div>
107
+
108
+ </body>
109
+ </html>
@@ -0,0 +1,28 @@
1
+
2
+ <?xml version="1.0" encoding="iso-8859-1"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Classes
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Classes</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Classes</h1>
22
+ <div id="index-entries">
23
+ <a href="classes/TLC.html">TLC</a><br />
24
+ <a href="classes/TLC/LibrarySolution.html">TLC::LibrarySolution</a><br />
25
+ </div>
26
+ </div>
27
+ </body>
28
+ </html>
@@ -0,0 +1,27 @@
1
+
2
+ <?xml version="1.0" encoding="iso-8859-1"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Files
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Files</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Files</h1>
22
+ <div id="index-entries">
23
+ <a href="files/library_solution_rb.html">library_solution.rb</a><br />
24
+ </div>
25
+ </div>
26
+ </body>
27
+ </html>
@@ -0,0 +1,33 @@
1
+
2
+ <?xml version="1.0" encoding="iso-8859-1"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Methods
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Methods</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Methods</h1>
22
+ <div id="index-entries">
23
+ <a href="classes/TLC/LibrarySolution.html#M000007">clean (TLC::LibrarySolution)</a><br />
24
+ <a href="classes/TLC/LibrarySolution.html#M000002">get_avail (TLC::LibrarySolution)</a><br />
25
+ <a href="classes/TLC/LibrarySolution.html#M000005">get_link (TLC::LibrarySolution)</a><br />
26
+ <a href="classes/TLC/LibrarySolution.html#M000003">get_recordnumber (TLC::LibrarySolution)</a><br />
27
+ <a href="classes/TLC/LibrarySolution.html#M000004">get_url (TLC::LibrarySolution)</a><br />
28
+ <a href="classes/TLC/LibrarySolution.html#M000006">has? (TLC::LibrarySolution)</a><br />
29
+ <a href="classes/TLC/LibrarySolution.html#M000001">new (TLC::LibrarySolution)</a><br />
30
+ </div>
31
+ </div>
32
+ </body>
33
+ </html>
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
5
+
6
+ <!--
7
+
8
+ RDoc Documentation
9
+
10
+ -->
11
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
12
+ <head>
13
+ <title>RDoc Documentation</title>
14
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
15
+ </head>
16
+ <frameset rows="20%, 80%">
17
+ <frameset cols="25%,35%,45%">
18
+ <frame src="fr_file_index.html" title="Files" name="Files" />
19
+ <frame src="fr_class_index.html" name="Classes" />
20
+ <frame src="fr_method_index.html" name="Methods" />
21
+ </frameset>
22
+ <frame src="files/library_solution_rb.html" name="docwin" />
23
+ </frameset>
24
+ </html>
@@ -0,0 +1,208 @@
1
+
2
+ body {
3
+ font-family: Verdana,Arial,Helvetica,sans-serif;
4
+ font-size: 90%;
5
+ margin: 0;
6
+ margin-left: 40px;
7
+ padding: 0;
8
+ background: white;
9
+ }
10
+
11
+ h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
12
+ h1 { font-size: 150%; }
13
+ h2,h3,h4 { margin-top: 1em; }
14
+
15
+ a { background: #eef; color: #039; text-decoration: none; }
16
+ a:hover { background: #039; color: #eef; }
17
+
18
+ /* Override the base stylesheet's Anchor inside a table cell */
19
+ td > a {
20
+ background: transparent;
21
+ color: #039;
22
+ text-decoration: none;
23
+ }
24
+
25
+ /* and inside a section title */
26
+ .section-title > a {
27
+ background: transparent;
28
+ color: #eee;
29
+ text-decoration: none;
30
+ }
31
+
32
+ /* === Structural elements =================================== */
33
+
34
+ div#index {
35
+ margin: 0;
36
+ margin-left: -40px;
37
+ padding: 0;
38
+ font-size: 90%;
39
+ }
40
+
41
+
42
+ div#index a {
43
+ margin-left: 0.7em;
44
+ }
45
+
46
+ div#index .section-bar {
47
+ margin-left: 0px;
48
+ padding-left: 0.7em;
49
+ background: #ccc;
50
+ font-size: small;
51
+ }
52
+
53
+
54
+ div#classHeader, div#fileHeader {
55
+ width: auto;
56
+ color: white;
57
+ padding: 0.5em 1.5em 0.5em 1.5em;
58
+ margin: 0;
59
+ margin-left: -40px;
60
+ border-bottom: 3px solid #006;
61
+ }
62
+
63
+ div#classHeader a, div#fileHeader a {
64
+ background: inherit;
65
+ color: white;
66
+ }
67
+
68
+ div#classHeader td, div#fileHeader td {
69
+ background: inherit;
70
+ color: white;
71
+ }
72
+
73
+
74
+ div#fileHeader {
75
+ background: #057;
76
+ }
77
+
78
+ div#classHeader {
79
+ background: #048;
80
+ }
81
+
82
+
83
+ .class-name-in-header {
84
+ font-size: 180%;
85
+ font-weight: bold;
86
+ }
87
+
88
+
89
+ div#bodyContent {
90
+ padding: 0 1.5em 0 1.5em;
91
+ }
92
+
93
+ div#description {
94
+ padding: 0.5em 1.5em;
95
+ background: #efefef;
96
+ border: 1px dotted #999;
97
+ }
98
+
99
+ div#description h1,h2,h3,h4,h5,h6 {
100
+ color: #125;;
101
+ background: transparent;
102
+ }
103
+
104
+ div#validator-badges {
105
+ text-align: center;
106
+ }
107
+ div#validator-badges img { border: 0; }
108
+
109
+ div#copyright {
110
+ color: #333;
111
+ background: #efefef;
112
+ font: 0.75em sans-serif;
113
+ margin-top: 5em;
114
+ margin-bottom: 0;
115
+ padding: 0.5em 2em;
116
+ }
117
+
118
+
119
+ /* === Classes =================================== */
120
+
121
+ table.header-table {
122
+ color: white;
123
+ font-size: small;
124
+ }
125
+
126
+ .type-note {
127
+ font-size: small;
128
+ color: #DEDEDE;
129
+ }
130
+
131
+ .xxsection-bar {
132
+ background: #eee;
133
+ color: #333;
134
+ padding: 3px;
135
+ }
136
+
137
+ .section-bar {
138
+ color: #333;
139
+ border-bottom: 1px solid #999;
140
+ margin-left: -20px;
141
+ }
142
+
143
+
144
+ .section-title {
145
+ background: #79a;
146
+ color: #eee;
147
+ padding: 3px;
148
+ margin-top: 2em;
149
+ margin-left: -30px;
150
+ border: 1px solid #999;
151
+ }
152
+
153
+ .top-aligned-row { vertical-align: top }
154
+ .bottom-aligned-row { vertical-align: bottom }
155
+
156
+ /* --- Context section classes ----------------------- */
157
+
158
+ .context-row { }
159
+ .context-item-name { font-family: monospace; font-weight: bold; color: black; }
160
+ .context-item-value { font-size: small; color: #448; }
161
+ .context-item-desc { color: #333; padding-left: 2em; }
162
+
163
+ /* --- Method classes -------------------------- */
164
+ .method-detail {
165
+ background: #efefef;
166
+ padding: 0;
167
+ margin-top: 0.5em;
168
+ margin-bottom: 1em;
169
+ border: 1px dotted #ccc;
170
+ }
171
+ .method-heading {
172
+ color: black;
173
+ background: #ccc;
174
+ border-bottom: 1px solid #666;
175
+ padding: 0.2em 0.5em 0 0.5em;
176
+ }
177
+ .method-signature { color: black; background: inherit; }
178
+ .method-name { font-weight: bold; }
179
+ .method-args { font-style: italic; }
180
+ .method-description { padding: 0 0.5em 0 0.5em; }
181
+
182
+ /* --- Source code sections -------------------- */
183
+
184
+ a.source-toggle { font-size: 90%; }
185
+ div.method-source-code {
186
+ background: #262626;
187
+ color: #ffdead;
188
+ margin: 1em;
189
+ padding: 0.5em;
190
+ border: 1px dashed #999;
191
+ overflow: hidden;
192
+ }
193
+
194
+ div.method-source-code pre { color: #ffdead; overflow: hidden; }
195
+
196
+ /* --- Ruby keyword styles --------------------- */
197
+
198
+ .standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
199
+
200
+ .ruby-constant { color: #7fffd4; background: transparent; }
201
+ .ruby-keyword { color: #00ffff; background: transparent; }
202
+ .ruby-ivar { color: #eedd82; background: transparent; }
203
+ .ruby-operator { color: #00ffee; background: transparent; }
204
+ .ruby-identifier { color: #ffdead; background: transparent; }
205
+ .ruby-node { color: #ffa07a; background: transparent; }
206
+ .ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
207
+ .ruby-regexp { color: #ffa07a; background: transparent; }
208
+ .ruby-value { color: #7fffd4; background: transparent; }
@@ -0,0 +1,93 @@
1
+ require 'net/http'
2
+ require 'rexml/document'
3
+
4
+ # Pure ruby wrappers for TLC (http://www.tlcdelivers.com) web services
5
+ # Author:: Justin Duewel-Zahniser (mailto:justin@justindz.org)
6
+ # Copyright:: Copyright (c) 2006 Justin Duewel-Zahniser
7
+ # License:: Distributes under the same terms as Ruby
8
+
9
+ module TLC
10
+
11
+ # The LibrarySolution class represents programmatic access to a
12
+ # TLC Library.Solution v3.3.5 OPAC.
13
+ # The new method takes two arguments:
14
+ # * the web server domain - default "demo.tlcdelivers.com"
15
+ # * the configuration name - default "pac"
16
+ # e.g. - ls = TLC::LibrarySolution.new('demo.tlcdelivers.com', 'pac')
17
+
18
+ class LibrarySolution
19
+ attr_accessor(:web_server_address, :config)
20
+ attr_reader(:availability_url, :availability_rn_url, :detail_url)
21
+
22
+ def initialize(web_server_address='demo.tlcdelivers.com', config='pac')
23
+ @avail_url = "/TLCScripts/interpac.dll?GetAvailability&IdList="
24
+ @detail_url = "/TLCScripts/interpac.dll?LabelDisplay&config=pac&recordnumber="
25
+ @web_server_address = web_server_address
26
+ @config = config
27
+ end
28
+
29
+ # This method returns the raw XML for a request as a REXML::Document.
30
+ # It takes three parameters:
31
+ # * ids - either an ISBN or recordnumber or an array of ISBNs or recordnumbers
32
+ # * type - :isbn or :rn
33
+ # * detail - 0, 1 (default) or 2--you are unlikely to need to specify this
34
+ # The &curbranch=Mail (e.g.) option is not currently supported.
35
+ def get_avail(ids, type, detail=1)
36
+ if ids.class == Array
37
+ if type == :isbn
38
+ ids.each_with_index do |isbn, i|
39
+ ids[i] = clean(isbn)
40
+ end
41
+ end
42
+ ids = ids.join(",")
43
+ else
44
+ if type == :isbn
45
+ ids = clean(ids)
46
+ end
47
+ end
48
+ qs = "#{@avail_url}#{ids}&detail=#{detail.to_s}" + if type == :isbn then "&type=isbn" else "" end
49
+
50
+ xml = Net::HTTP.get(@web_server_address, qs)
51
+ doc = REXML::Document.new(xml)
52
+ return doc
53
+ end
54
+
55
+ # This method takes an ISBN and returns the internal recordnumber
56
+ def get_recordnumber(isbn)
57
+ return get_avail(isbn, :isbn, 0).root.elements['t'].attribute('rn')
58
+ end
59
+
60
+ # This method takes an ISBN and returns a URL to the title record display or nil
61
+ def get_url(isbn)
62
+ rn = get_recordnumber(isbn)
63
+ if rn.nil?
64
+ return nil
65
+ else
66
+ return "http://#{@web_server_address}#{@detail_url}#{rn.to_s}"
67
+ end
68
+ end
69
+
70
+ # This method takes an ISBN and returns a formatted link to the title record display or nil
71
+ def get_link(isbn)
72
+ doc = get_avail(isbn, :isbn)
73
+ rn = doc.root.elements['t'].attribute('rn')
74
+ if rn.nil?
75
+ return nil
76
+ else
77
+ ac = tc = 0
78
+ doc.elements.each("r/t/lo") { |lo| ac += lo.attributes.get_attribute('ac').value.to_i ; tc += lo.attributes.get_attribute('tc').value.to_i }
79
+ return "<a href=\"http://#{@web_server_address}#{@detail_url}#{rn.to_s}\">#{ac} of #{tc} available</a>"
80
+ end
81
+ end
82
+
83
+ # This method takes an ISBN, checks the catalog for a matching record and returns true or false
84
+ def has?(isbn)
85
+ return !get_avail(isbn, :isbn, 0).root.elements['t'].attributes.get_attribute("rn").nil?
86
+ end
87
+
88
+ # This helper method just cleans up ISBNs
89
+ def clean(isbn)
90
+ isbn.gsub(/[^0-9X]/,'')
91
+ end
92
+ end
93
+ end
metadata ADDED
@@ -0,0 +1,59 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.10
3
+ specification_version: 1
4
+ name: LibrarySolution
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.1.0
7
+ date: 2006-03-09
8
+ summary: "A Ruby wrapper for TLC's Library.Solution v3.3.5 OPAC Web Services API."
9
+ require_paths:
10
+ - lib
11
+ email: justindz@gmail.com
12
+ homepage: http://rubyforge.org/projects/librarysolution
13
+ rubyforge_project:
14
+ description:
15
+ autorequire: librarysolution
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: "true"
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ -
22
+ - ">"
23
+ - !ruby/object:Gem::Version
24
+ version: 0.0.0
25
+ version:
26
+ platform: ruby
27
+ authors:
28
+ - Justin Duewel-Zahniser
29
+ files:
30
+ - lib/librarysolution.rb
31
+ - doc/classes
32
+ - doc/created.rid
33
+ - doc/files
34
+ - doc/fr_class_index.html
35
+ - doc/fr_file_index.html
36
+ - doc/fr_method_index.html
37
+ - doc/index.html
38
+ - doc/rdoc-style.css
39
+ - doc/classes/TLC
40
+ - doc/classes/TLC.html
41
+ - doc/classes/TLC/LibrarySolution.html
42
+ - doc/classes/TLC/LibrarySolution.src
43
+ - doc/classes/TLC/LibrarySolution.src/M000001.html
44
+ - doc/classes/TLC/LibrarySolution.src/M000002.html
45
+ - doc/classes/TLC/LibrarySolution.src/M000003.html
46
+ - doc/classes/TLC/LibrarySolution.src/M000004.html
47
+ - doc/classes/TLC/LibrarySolution.src/M000005.html
48
+ - doc/classes/TLC/LibrarySolution.src/M000006.html
49
+ - doc/classes/TLC/LibrarySolution.src/M000007.html
50
+ - doc/files/library_solution_rb.html
51
+ - README
52
+ test_files: []
53
+ rdoc_options: []
54
+ extra_rdoc_files:
55
+ - README
56
+ executables: []
57
+ extensions: []
58
+ requirements: []
59
+ dependencies: []