Class: UlrichsLink
- Defined in:
- lib/service_adaptors/ulrichs_link.rb
Overview
A very simple service that simply generates a “highlighted_link” to the Ulrich’s periodical directory, if an ISSN is present. Does not actually look up first to make sure there are results, it’s a blind link. config params: link_name: Name to put on the link. Defaults to “Periodical Information from Ulrich’s Directory”.
Constant Summary
Constants inherited from Service
Service::LinkOutFilterTask, Service::StandardTask
Instance Attribute Summary
Attributes inherited from Service
#name, #priority, #request, #service_id, #session_id, #status, #task, #url
Instance Method Summary collapse
- #handle(request) ⇒ Object
-
#initialize(config) ⇒ UlrichsLink
constructor
A new instance of UlrichsLink.
- #service_types_generated ⇒ Object
- #url_for_issn(issn) ⇒ Object
Methods inherited from Service
#credits, #display_name, #handle_wrapper, #link_out_filter, #preempted_by, required_config_params, #response_to_view_data, #response_url, #view_data_from_service_type
Constructor Details
#initialize(config) ⇒ UlrichsLink
Returns a new instance of UlrichsLink.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/service_adaptors/ulrichs_link.rb', line 9 def initialize(config) # Original one, which just apes the UlrichsWeb html interface, and gives # you a search results screen even with only one hit. #@base_url = "http://www.ulrichsweb.com/ulrichsweb/Search/doAdvancedSearch.asp?QuickCriteria=ISSN&Action=Search&collection=SERIAL&QueryMode=Simple&ResultTemplate=quickSearchResults.hts&SortOrder=Asc&SortField=f_display_title&ScoreThreshold=0&ResultCount=25&SrchFrm=Home&setting_saving=on&QuickCriteriaText=" super(config) # better one, which Yvette at Ulrich's showed me for SFX, which seems to work better. @vendor ||= "Umlaut" @base_url ||= "https://ulrichsweb.serialssolutions.com/api/openurl?issn=" # Old one #@base_url ||= "http://www.ulrichsweb.com/ulrichsweb/Search/call_fullCitation.asp?/vendor_redirect.asp?oVendor=#{@vendor}&oIssn=" @link_name = "Periodical information" end |
Instance Method Details
#handle(request) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/service_adaptors/ulrichs_link.rb', line 26 def handle(request) unless (request.referent.issn.blank?) display_text = @link_name url = url_for_issn( request.referent.issn ) request.add_service_response( :service=>self, :url=>url, :display_text=>display_text, :service_type_value => :highlighted_link) end return request.dispatched(self, true) end |
#service_types_generated ⇒ Object
22 23 24 |
# File 'lib/service_adaptors/ulrichs_link.rb', line 22 def service_types_generated return [ServiceTypeValue[:highlighted_link]] end |
#url_for_issn(issn) ⇒ Object
42 43 44 45 |
# File 'lib/service_adaptors/ulrichs_link.rb', line 42 def url_for_issn(issn) # with or without hyphen should work fine. return @base_url + issn end |