Bug 17600: Standardize our EXPORT_OK
[srvgit] / Koha / SuggestionEngine / Plugin / LibrisSpellcheck.pm
index 5d0b7f0..38d9df2 100644 (file)
@@ -18,7 +18,7 @@ package Koha::SuggestionEngine::Plugin::LibrisSpellcheck;
 
 use Modern::Perl;
 use LWP::UserAgent;
-use XML::Simple qw(XMLin);
+use XML::Simple qw( XMLin );
 use C4::Context;
 use base qw(Koha::SuggestionEngine::Base);
 
@@ -29,9 +29,9 @@ sub NAME {
 sub get_suggestions {
     my ($self, $query) = @_;
     my $key = C4::Context->preference('LibrisKey');
-
+    my $base = C4::Context->preference('LibrisURL');
     my $search = $query->{'search'};
-    my $response = LWP::UserAgent->new->get("http://api.libris.kb.se/bibspell/spell?query={$search}&key=$key");
+    my $response = LWP::UserAgent->new->get($base."spell?query={$search}&key=$key");
     my $xml = XMLin($response->content, NoAttr => 1, ForceArray => qr/term/);
 
     my @terms;
@@ -71,10 +71,20 @@ This module provides facilities for using the LIBRIS spell checker API
 
 =over
 
+=item NAME
+
+my $name = $plugin->NAME;
+
+=back
+
+=over
+
 =item get_suggestions(query)
 
 Sends in the search query and gets an XML with a suggestion
 
+my $suggestions = $plugin->get_suggestions(\%query);
+
 =back
 
 =cut