Skip to content
This repository was archived by the owner on May 20, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/BCLib/PrimoServices/Availability/AlmaClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ class AlmaClient implements AvailabilityClient
public function __construct(Client $client, $alma_host, $library)
{
$this->client = $client;
$this->alma_host = $alma_host;

if (strpos($alma_host, 'http://') === 0 || strpos($alma_host, 'https://') === 0) {
$this->alma_host = $alma_host;
} else {
$this->alma_host = 'http://' . $alma_host;
}
$this->library = $library;

$this->ava_map = [
Expand Down Expand Up @@ -90,7 +95,7 @@ private function buildUrl($ids)
'library' => $this->library
]
);
return "http://{$this->alma_host}/view/publish_avail?$query";
return "{$this->alma_host}/view/publish_avail?$query";
}

/**
Expand Down Expand Up @@ -155,4 +160,4 @@ private function fetchAvailability(array $components)
$response = $this->client->get($url)->send();
return simplexml_load_string($response->getBody(true));
}
}
}
9 changes: 7 additions & 2 deletions src/BCLib/PrimoServices/PrimoServices.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ public function __construct(
$version = '4.9',
array $ignore_errors = []
) {
$this->_host = $host;
if (strpos($host, 'http://') === 0 || strpos($host, 'https://') === 0) {
$this->_host = $host;
} else {
$this->_host = 'http://' . $host;
}

$this->_institution = $institution;
if (null === $cache) {
$this->_cache = new NullCache();
Expand Down Expand Up @@ -198,7 +203,7 @@ public function createDeepLink()
*/
public function url($action, $query_string)
{
return "http://{$this->_host}/PrimoWebServices/xservice/search/$action?json=true&$query_string";
return "{$this->_host}/PrimoWebServices/xservice/search/$action?json=true&$query_string";
}

public function getHost() {
Expand Down