Class OpenURL::Transport
In: lib/openurl/transport.rb
Parent: Object

The Transport class is intended to be used to deliver ContextObject objects to an OpenURL enabled host. Currently only HTTP is supported. Usage: require ‘openurl’ include OpenURL context_object = ContextObject.new_from_kev(‘ctx_enc=info%3Aofi%2Fenc%3AUTF-8&ctx_ver=Z39.88-2004&rft.genre=article&rft_id=info%3Adoi%2F10.1016%2Fj.ipm.2005.03.024&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Aarticle&url_ctx_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Actx&url_ver=Z39.88-2004’) transport = Transport.new(‘demo.exlibrisgroup.com:9003/lr_3’, context_object) transport.get puts tranport.response

Methods

Attributes

code  [R] 
context_objects  [R] 
ctx_id  [RW] 
extra_args  [RW] 
message  [R] 
request_string  [R] 
response  [R] 

Public Class methods

Creates the transport object which can be used to initiate subsequent requests. The contextobject argument can be an OpenURL ContextObject object, and array of ContextObjects or nil. http_arguments set the Net::HTTP attributes: {:open_timeout=>3, :read_timeout=>5}, etc.

Public Instance methods

Can take either an OpenURL::ContextObject or an array of ContextObjects to send to the Transport target

Perform an inline HTTP GET request. Only one context object can be sent via GET, so pass the index of the desired context object (defaults to the first)

For a multiple context object request, takes the first context object in the context_objects attribute, and adds the other context objects to it, under /ctx:context-objects/ctx:context-object and serializes it all as XML. Returns a string of the XML document

POSTs an HTTP request to the transport target. To send an inline request, include a hash that looks like: {:inline=>true, :index=>n} (:index defaults to 0. Transport.post must be used to send multiple context objects to a target.

Accepts either a ContextObject or array index to remove from array being sent to the Transport target

Deprecated. Set by-reference in OpenURL::ContextObject and use .get or .post

Sends an by-value transport request. YOu can specify which HTTP method to use. Since a GET request is effectively the same as an inline request, the index of which context object must be specified (defaults to 0).

Sends an inline transport request. YOu can specify which HTTP method to use. Since you can only send one context object per inline request, the second argument is the index of the desired context object.

Protected Instance methods

Reads the HTTP::Response object and sets the response, code and message attributes

Sends the actual POST request.

[Validate]