Sha256: 143c1742d00b88525b4b5e22c80272e90265152744c86ef9125aed0e483e5282

Contents?: true

Size: 1.78 KB

Versions: 39

Compression:

Stored size: 1.78 KB

Contents

# 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". 
class UlrichsLink < Service

  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
  
  def service_types_generated
    return [ServiceTypeValue[:highlighted_link]]
  end

  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

  def url_for_issn(issn)
    # with or without hyphen should work fine. 
    return @base_url + issn
  end
  
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
umlaut-3.3.1 app/service_adaptors/ulrichs_link.rb
umlaut-3.3.0 app/service_adaptors/ulrichs_link.rb
umlaut-3.2.0 app/service_adaptors/ulrichs_link.rb
umlaut-3.1.1 app/service_adaptors/ulrichs_link.rb
umlaut-3.1.0 app/service_adaptors/ulrichs_link.rb
umlaut-3.1.0.pre2 app/service_adaptors/ulrichs_link.rb
umlaut-3.1.0.pre1 app/service_adaptors/ulrichs_link.rb
umlaut-3.0.5 lib/service_adaptors/ulrichs_link.rb
umlaut-3.0.4 lib/service_adaptors/ulrichs_link.rb
umlaut-3.0.3 lib/service_adaptors/ulrichs_link.rb
umlaut-3.0.2 lib/service_adaptors/ulrichs_link.rb
umlaut-3.0.1 lib/service_adaptors/ulrichs_link.rb
umlaut-3.0.0 lib/service_adaptors/ulrichs_link.rb
umlaut-3.0.0rc1 lib/service_adaptors/ulrichs_link.rb
umlaut-3.0.0beta10 lib/service_adaptors/ulrichs_link.rb
umlaut-3.0.0beta9 lib/service_adaptors/ulrichs_link.rb
umlaut-3.0.0beta8 lib/service_adaptors/ulrichs_link.rb
umlaut-3.0.0beta7 lib/service_adaptors/ulrichs_link.rb
umlaut-3.0.0beta6 lib/service_adaptors/ulrichs_link.rb
umlaut-3.0.0beta5 lib/service_adaptors/ulrichs_link.rb