From ab8539004cfc0e9655c95973eddcd5d3c72b7d50 Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Tue, 13 Jun 2023 17:54:46 -0700 Subject: [PATCH 1/2] Hardcode the CI mariadb version to get around failure. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a22dabb5..6bae63d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: services: mariadb: - image: mariadb + image: mariadb:10.11 ports: - 3306 env: From de19630552f0db963709c02d44f139f02cdbd313 Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Tue, 13 Jun 2023 18:17:30 -0700 Subject: [PATCH 2/2] Switch API form label from Account to Organization. --- modules/quant_api/src/Client/QuantClient.php | 10 ++++++++++ modules/quant_api/src/Form/SettingsForm.php | 4 +++- modules/quant_api/tests/src/Unit/QuantClientTest.php | 8 ++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/modules/quant_api/src/Client/QuantClient.php b/modules/quant_api/src/Client/QuantClient.php index 627e1f1b..dd193afa 100644 --- a/modules/quant_api/src/Client/QuantClient.php +++ b/modules/quant_api/src/Client/QuantClient.php @@ -80,6 +80,7 @@ public function __construct(Client $client, ConfigFactoryInterface $config_facto public function ping() { try { + // @todo Switch from 'Quant-Customer' to 'Quant-Organization'. $response = $this->client->get($this->endpoint . "/ping", [ 'http_errors' => FALSE, 'headers' => [ @@ -119,6 +120,7 @@ public function ping() { public function project() { try { + // @todo Switch from 'Quant-Customer' to 'Quant-Organization'. $response = $this->client->get($this->endpoint . "/ping", [ 'http_errors' => FALSE, 'headers' => [ @@ -157,6 +159,7 @@ public function project() { public function search() { try { + // @todo Switch from 'Quant-Customer' to 'Quant-Organization'. $response = $this->client->get($this->endpoint . "/search", [ 'http_errors' => FALSE, 'headers' => [ @@ -193,6 +196,7 @@ public function search() { * {@inheritdoc} */ public function send(array $data) : array { + // @todo Switch from 'Quant-Customer' to 'Quant-Organization'. $response = $this->client->post($this->endpoint, [ RequestOptions::JSON => $data, 'headers' => [ @@ -210,6 +214,7 @@ public function send(array $data) : array { * {@inheritdoc} */ public function sendRedirect(array $data) : array { + // @todo Switch from 'Quant-Customer' to 'Quant-Organization'. $response = $this->client->post($this->endpoint . '/redirect', [ RequestOptions::JSON => $data, 'headers' => [ @@ -237,6 +242,7 @@ public function sendFile(string $file, string $url, int $rid = NULL) : array { $resource = fopen($file, 'r'); $stream = Utils::streamFor($resource); + // @todo Switch from 'Quant-Customer' to 'Quant-Organization'. $headers = [ 'Quant-File-Url' => $url, 'Quant-Customer' => $this->username, @@ -274,6 +280,7 @@ public function sendFile(string $file, string $url, int $rid = NULL) : array { * The API response. */ public function unpublish(string $url) : array { + // @todo Switch from 'Quant-Customer' to 'Quant-Organization'. $response = $this->client->patch($this->endpoint . '/unpublish', [ 'headers' => [ 'Quant-Url' => $url, @@ -291,6 +298,7 @@ public function unpublish(string $url) : array { * {@inheritdoc} */ public function sendSearchRecords(array $records) : array { + // @todo Switch from 'Quant-Customer' to 'Quant-Organization'. $response = $this->client->post($this->endpoint . '/search', [ RequestOptions::JSON => $records, 'headers' => [ @@ -308,6 +316,7 @@ public function sendSearchRecords(array $records) : array { * {@inheritdoc} */ public function clearSearchIndex() : array { + // @todo Switch from 'Quant-Customer' to 'Quant-Organization'. $response = $this->client->delete($this->endpoint . '/search/all', [ 'headers' => [ 'Quant-Customer' => $this->username, @@ -324,6 +333,7 @@ public function clearSearchIndex() : array { * {@inheritdoc} */ public function addFacets(array $facets) : array { + // @todo Switch from 'Quant-Customer' to 'Quant-Organization'. $response = $this->client->post($this->endpoint . '/search/facet', [ RequestOptions::JSON => $facets, 'headers' => [ diff --git a/modules/quant_api/src/Form/SettingsForm.php b/modules/quant_api/src/Form/SettingsForm.php index 160fd667..1136eb0c 100644 --- a/modules/quant_api/src/Form/SettingsForm.php +++ b/modules/quant_api/src/Form/SettingsForm.php @@ -72,9 +72,10 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#required' => TRUE, ]; + // @todo Switch from 'api_account' to 'api_organization'. $form['api_account'] = [ '#type' => 'textfield', - '#title' => $this->t('API Account'), + '#title' => $this->t('API Organization'), '#default_value' => $config->get('api_account'), '#required' => TRUE, ]; @@ -109,6 +110,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { public function submitForm(array &$form, FormStateInterface $form_state) { // Retrieve the configuration. + // @todo Switch from 'api_account' to 'api_organization'. $this->configFactory->getEditable(self::SETTINGS) ->set('api_endpoint', $form_state->getValue('api_endpoint')) ->set('api_token', $form_state->getValue('api_token')) diff --git a/modules/quant_api/tests/src/Unit/QuantClientTest.php b/modules/quant_api/tests/src/Unit/QuantClientTest.php index 1943c821..871ade1b 100644 --- a/modules/quant_api/tests/src/Unit/QuantClientTest.php +++ b/modules/quant_api/tests/src/Unit/QuantClientTest.php @@ -112,6 +112,7 @@ public function testPingClientError() { $logger = $this->prophesize(LoggerChannelFactoryInterface::class); $config = $this->getConfigStub(); + // @todo Switch from 'Quant-Customer' to 'Quant-Organization'. $http->get('http://test/ping', [ 'http_errors' => FALSE, 'headers' => [ @@ -134,6 +135,7 @@ public function testPingValid() { $config = $this->getConfigStub(); $res = $this->getProjectResponse(); + // @todo Switch from 'Quant-Customer' to 'Quant-Organization'. $http->get('http://test/ping', [ 'http_errors' => FALSE, 'headers' => [ @@ -158,6 +160,7 @@ public function testPingInvalid() { $config = $this->getConfigStub(); $res = $this->getInvalidResponse(); + // @todo Switch from 'Quant-Customer' to 'Quant-Organization'. $http->get('http://test/ping', [ 'http_errors' => FALSE, 'headers' => [ @@ -181,6 +184,7 @@ public function testSendValid() { $config = $this->getConfigStub(); $res = $this->getProjectResponse(); + // @todo Switch from 'Quant-Customer' to 'Quant-Organization'. $http->post('http://test', [ RequestOptions::JSON => [], 'headers' => [ @@ -204,6 +208,7 @@ public function testSendError() { $config = $this->getConfigStub(); $res = $this->getInvalidResponse(); + // @todo Switch from 'Quant-Customer' to 'Quant-Organization'. $http->post('http://test', [ RequestOptions::JSON => [], 'headers' => [ @@ -225,6 +230,7 @@ public function testSendRedirectValid() { $config = $this->getConfigStub(); $res = $this->getRedirectResponse(); + // @todo Switch from 'Quant-Customer' to 'Quant-Organization'. $http->post('http://test/redirect', [ RequestOptions::JSON => [], 'headers' => [ @@ -257,6 +263,7 @@ public function testSendRedirectError() { $config = $this->getConfigStub(); $res = $this->getInvalidResponse(); + // @todo Switch from 'Quant-Customer' to 'Quant-Organization'. $http->post('http://test/redirect', [ RequestOptions::JSON => [], 'headers' => [ @@ -308,6 +315,7 @@ public function testSendFileValid() { $config = $this->getConfigStub(); $res = $this->getProjectResponse(); + // @todo Switch from 'Quant-Customer' to 'Quant-Organization'. $http->post('http://test', [ 'headers' => [ 'Quant-File-Url' => '/url',