LP#1541559: org setting for OneClickdigital API base URI
authorJeff Davis <jdavis@sitka.bclibraries.ca>
Mon, 27 Feb 2017 21:40:55 +0000 (13:40 -0800)
committerKathy Lussier <klussier@masslnc.org>
Tue, 14 Mar 2017 19:40:22 +0000 (15:40 -0400)
Signed-off-by: Jeff Davis <jdavis@sitka.bclibraries.ca>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/EbookAPI/OneClickdigital.pm
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXX.data.org-setting.oneclickdigital-base-uri.sql [new file with mode: 0644]

index 9880b5f..166b7c9 100644 (file)
@@ -77,7 +77,8 @@ sub initialize {
     my $self = shift;
     my $ou = $self->{ou};
 
     my $self = shift;
     my $ou = $self->{ou};
 
-    $self->{base_uri} = 'https://api.oneclickdigital.us/v1'; # TODO pull from org setting?
+    my $base_uri = 'https://api.oneclickdigital.com/v1';
+    $self->{base_uri} = OpenILS::Application::AppUtils->ou_ancestor_setting_value($ou, 'ebook_api.oneclickdigital.base_uri') || $base_uri;
 
     my $library_id = OpenILS::Application::AppUtils->ou_ancestor_setting_value($ou, 'ebook_api.oneclickdigital.library_id');
     if ($library_id) {
 
     my $library_id = OpenILS::Application::AppUtils->ou_ancestor_setting_value($ou, 'ebook_api.oneclickdigital.library_id');
     if ($library_id) {
index ce5e03f..3729f08 100644 (file)
@@ -16804,6 +16804,22 @@ VALUES (
 INSERT INTO config.org_unit_setting_type
     (name, label, description, grp, datatype) 
 VALUES (
 INSERT INTO config.org_unit_setting_type
     (name, label, description, grp, datatype) 
 VALUES (
+    'ebook_api.oneclickdigital.base_uri',
+    oils_i18n_gettext(
+        'ebook_api.oneclickdigital.base_uri',
+        'OneClickdigital Base URI',
+        'coust',
+        'label'
+    ),
+    oils_i18n_gettext(
+        'ebook_api.oneclickdigital.base_uri',
+        'Base URI for OneClickdigital API (defaults to https://api.oneclickdigital.com/v1). Using HTTPS here is strongly encouraged.',
+        'coust',
+        'description'
+    ),
+    'ebook_api',
+    'string'
+),(
     'ebook_api.oneclickdigital.library_id',
     oils_i18n_gettext(
         'ebook_api.oneclickdigital.library_id',
     'ebook_api.oneclickdigital.library_id',
     oils_i18n_gettext(
         'ebook_api.oneclickdigital.library_id',
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXX.data.org-setting.oneclickdigital-base-uri.sql b/Open-ILS/src/sql/Pg/upgrade/XXX.data.org-setting.oneclickdigital-base-uri.sql
new file mode 100644 (file)
index 0000000..f063254
--- /dev/null
@@ -0,0 +1,26 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXX', :eg_version);
+
+INSERT INTO config.org_unit_setting_type
+    (name, label, description, grp, datatype) 
+VALUES (
+    'ebook_api.oneclickdigital.base_uri',
+    oils_i18n_gettext(
+        'ebook_api.oneclickdigital.base_uri',
+        'OneClickdigital Base URI',
+        'coust',
+        'label'
+    ),
+    oils_i18n_gettext(
+        'ebook_api.oneclickdigital.base_uri',
+        'Base URI for OneClickdigital API (defaults to https://api.oneclickdigital.com/v1). Using HTTPS here is strongly encouraged.',
+        'coust',
+        'description'
+    ),
+    'ebook_api',
+    'string'
+);
+
+COMMIT;
+