2 function Vendor(name) {
7 function Ebook(vendor, id) {
9 this.id = id; // external ID for this title
10 this.rec_id; // bre.id for this title's MARC record
11 this.avail; // availability info for this title
12 this.holdings = {}; // holdings info
15 Ebook.prototype.getAvailability = function(callback) {
16 var ses = dojo.cookie(this.vendor);
17 new OpenSRF.ClientSession('open-ils.ebook_api').request({
18 method: 'open-ils.ebook_api.title.availability',
19 params: [ ses, this.id ],
21 oncomplete: function(r) {
24 console.log('availability response: ' + resp.content());
25 this.avail = resp.content();
26 return callback(resp.content());
32 Ebook.prototype.getHoldings = function(callback) {
33 var ses = dojo.cookie(this.vendor);
34 new OpenSRF.ClientSession('open-ils.ebook_api').request({
35 method: 'open-ils.ebook_api.title.holdings',
36 params: [ ses, this.id ],
38 oncomplete: function(r) {
41 console.log('holdings response: ' + resp.content());
42 this.holdings = resp.content();
43 return callback(resp.content());