package Net::Z3950::FOLIO;
use 5.008000;
use strict;
use warnings;
use Cpanel::JSON::XS qw(decode_json encode_json);
use Net::Z3950::SimpleServer;
use ZOOM; # For ZOOM::Exception
use LWP::UserAgent;
sub FORMAT_USMARC { '1.2.840.10003.5.10' }
sub FORMAT_XML { '1.2.840.10003.5.109.10' }
sub FORMAT_JSON { '1.2.840.10003.5.1000.81.3' }
sub ATTRSET_BIB1 { '1.2.840.10003.3.1' }
=head1 NAME
Net::Z395
g');
Creates and returns a new Net::Z3950::FOLIO object, configured according to
the JSON file C<$configFile.json> specified by the only argument. The format of
this file is described in C<Net::Z395
3950::FOLIO::Config;
use 5.008000;
use strict;
use warnings;
use IO::File;
use Cpanel::JSON::XS qw(decode_json);
# Possible values of $missingAction
sub MISSING_ERROR { 0 }
sub MISSING_TENANT { 1
ase, $cfgsub, $missingAction) = @_;
my $cfgname = $cfgbase . ($cfgsub ? ".$cfgsub" : '') . '.json';
my $fh = new IO::File("<$cfgname");
if (!$fh) {
if ($! == 2 && $missingAction == MISSI
}
die "$0: can't open config file '$cfgbase.json': $!"
}
my $json; { local $/; $json = <$fh> };
$fh->close();
my $cfg = decode_json($json);
_expandVariableReferences($cfg);
Net::Z3950::FOLIO::Session;
use strict;
use warnings;
use DateTime;
use Cpanel::JSON::XS qw(decode_json encode_json);
use Net::Z3950::FOLIO::Config;
use Net::Z3950::FOLIO::ResultSet;
sub _throw {
) = @_;
my $json = decode_json($res->content());
my $refreshTokenEpoch = _isoStringToEpoch($json->{refreshTokenExpiration});
my $accessTokenEpoch = _isoStringToEpoch($json->{accessTokenEx
);
$req->content(encode_json(\%body));
my $res = $this->{ua}->request($req);
_throw(3, $res->content()) if !$res->is_success();
my $obj = decode_json($res->content());
# warn "
$cfg = $rec->rs()->session()->{cfg}; # XXX maybe make an accessor method
my $holdings = $rec->jsonStructure()->{holdingsRecords2};
return [ map { _makeSingleHoldingsRecord($_, $marc, $cfg) }
ntacts at Lehigh.
#
# The list of valid statuses is wired right into the JSONN Schema at
# mod-inventory-storage/ramls/item.json
#
sub _makeRestrictions {
my($item) = @_;
my $status = $item->
ass = shift();
my($rs, $offset, $json) = @_;
return bless {
rs => $rs, # back-reference
offset => $offset, # zero-based position within rs
json => $json,
holdingsStructure => undef,
proc
= $this->{json}->{id};
return $id;
}
sub rs {
my $this = shift();
return $this->{rs};
}
sub jsonStructure {
my $this = shift();
return $this->{json};
}
sub prettyJSON {
my
$this = shift();
return _formatJSON($this->{json});
}
sub prettyXML {
my $this = shift();
return _formatXML($this->{json});
}
sub holdings {
my $this = shift();
my($marc) = @_;