Ruby/ZOOM API Reference *********************** ================================================================================ Class ZOOM::Connection ================================================================================ The Connection object is a session with a target. Inherits from: Object <- ZOOM::Connection. Included in: ZOOM. Class methods: ----------------------------------- open(host, port=nil) { |conn| ... } ----------------------------------- A convenience method that creates a new connection and attempts to establish a network connection to the given target, basically calling ZOOM::Connection.new and ZOOM::Connection#connect. If a block is given, then it will be called once the connection is established, passing a reference to the connection object as a parameter, and destroying the connection automatically at the end of the block. With no block, this method just returns the connection object. port : network port of the target to connect to. host : hostname of the target to connect to. Returns : a newly created ZOOM::Connection object. ---------------- new(options=nil) ---------------- Creates a new connection object, but does not establish a network connection immediately, allowing you to specify options before (if given). You can thus establish the connection using ZOOM::Connection#connect. options : options for the connection, as a Hash object. Returns : a newly created ZOOM::Connection object. Instance methods: ----------------------- connect(host, port=nil) ----------------------- Establishes a network connection to the target specified by the given arguments. If no port is given, 210 will be used. A colon in the host string denotes the beginning of a port number. If the host string includes a slash, the following part specifies a database for the connection. You can also prefix the host string with a scheme followed by a colon. The default scheme is tcp (Z39.50 protocol). The scheme http selects SRW over HTTP. This method raises an exception on error. port : network port of the target to connect to. host : hostname of the target to connect to. Returns : self. ---------------------- set_option(key, value) ---------------------- Sets an option on the connection. value : the value of this option (as a string, integer or boolean). key : the name of the option, as a string. Returns : self. --------------- get_option(key) --------------- Gets the value of a connection's option. key : the name of the option, as a string. Returns : the value of the given option, as a string, integer or boolean. ----------------- search(criterion) ----------------- Searches the connection from the given criterion. You can either create and pass a reference to a ZOOM::Query object, or you can simply pass a string that represents a PQF query. This method raises an exception on error. criterion : the search criterion, either as a ZOOM::Query object or as a string, representing a PQF query. Returns : a result set from the search, as a ZOOM::ResultSet object, empty if no results were found. ================================================================================ Class ZOOM::Query ================================================================================ Search queries. Inherits from: Object <- ZOOM::Query. Included in: ZOOM. Class methods: ------------------ new_prefix(prefix) ------------------ Creates a RPN query using the given PQF notation. prefix : PQF notation. Returns : a newly created ZOOM::Query object. --------------- new_cql(prefix) --------------- Creates a CQL query using the given CQL notation. prefix : CQL notation. Returns : a newly created ZOOM::Query object. --------------------- new_sort_by(criteria) --------------------- Creates a sort query from the YAZ sorting notation. criteria : a sort criteria. Returns : a newly created ZOOM::Query object. ================================================================================ Class ZOOM::Record ================================================================================ A record object is a retrieval record on the client side - created from result sets. Inherits from: Object <- ZOOM::Record. Included in: ZOOM. Instance methods: ------------------------------------------ database(charset_from=nil, charset_to=nil) ------------------------------------------ charset_from : the name of the charset to convert from (optional). charset_to : the name of the charset to convert to (optional). Returns : the database name of the record. ---------------------------------------- syntax(charset_from=nil, charset_to=nil) ---------------------------------------- charset_from : the name of the charset to convert from (optional). charset_to : the name of the charset to convert to (optional). Returns : the symbolic transfer syntax name of the record. ---------------------------------------- render(charset_from=nil, charset_to=nil) ---------------------------------------- charset_from : the name of the charset to convert from (optional). charset_to : the name of the charset to convert to (optional). Returns : a display friendly description of the record. ------------------------------------- xml(charset_from=nil, charset_to=nil) ------------------------------------- Returns an XML description of the record. SRW/SRU and Z39.50 records with transfer syntax XML are returned verbatim. MARC records are returned in MARCXML (converted from ISO2709 to MARCXML by YAZ). GRS-1 and OPAC records are not supported for this form. charset_from : the name of the charset to convert from (optional). charset_to : the name of the charset to convert to (optional). Returns : an XML description of the record. -------------------------------------- to_s(charset_from=nil, charset_to=nil) -------------------------------------- Synonym for ZOOM::Record#render. charset_from : the name of the charset to convert from (optional). charset_to : the name of the charset to convert to (optional). Returns : a display friendly description of the record. ================================================================================ Class ZOOM::ResultSet ================================================================================ The result set object is a container for records returned from a target. Inherits from: Object <- ZOOM::ResultSet. Included in: ZOOM. Instance methods: ---------------------- set_option(key, value) ---------------------- Sets an option on the result set. value : the value of this option (as a string, integer or boolean). key : the name of the option, as a string. Returns : self. --------------- get_option(key) --------------- Gets the value of a result set's option. key : the name of the option, as a string. Returns : the value of the given option, as a string, integer or boolean. ---- size ---- Returns : the number of hits. ------- [](key) ------- Retrieves one or many records from the result set, according to the given key. # Gets the first record. rset[0] # Gets the first, second and third records. rset[1..3] # Gets three records starting from the second one. rset[2, 3] key : either an integer, a range or an interval of 2 integers. Returns : one or many references to ZOOM::Record objects. ------- records ------- Lists the records inside the result set. Returns : an array of ZOOM::Record objects. ---------------------------- each_record { |record| ... } ---------------------------- Parses the records inside the result set and call the given block for each record, passing a reference to a ZOOM::Record object as parameter. Returns : self. ------ length ------ Synonym for ZOOM::ResultSet#size. Returns : the number of hits. -- This documentation has been generated by extdoc.rb 0.2.2, Fri Mar 18 21:36:36 CET 2005. Extdoc.rb is free software, written by Laurent Sansonetti , and released under the GNU General Public License.