Skip to content

Commit

Permalink
Merge branch '8.x-1.x' into feat/queue-uniqueness
Browse files Browse the repository at this point in the history
  • Loading branch information
steveworley authored Jul 21, 2023
2 parents 98eec26 + cb0723d commit 1c6a0f8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

services:
mariadb:
image: mariadb:10.5
image: mariadb:10.11
ports:
- 3306:3306
env:
Expand Down
10 changes: 10 additions & 0 deletions modules/quant_api/src/Client/QuantClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand Down Expand Up @@ -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' => [
Expand Down Expand Up @@ -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' => [
Expand Down Expand Up @@ -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' => [
Expand All @@ -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' => [
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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' => [
Expand All @@ -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,
Expand All @@ -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' => [
Expand Down
4 changes: 3 additions & 1 deletion modules/quant_api/src/Form/SettingsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
Expand Down Expand Up @@ -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'))
Expand Down
8 changes: 8 additions & 0 deletions modules/quant_api/tests/src/Unit/QuantClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand All @@ -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' => [
Expand All @@ -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' => [
Expand All @@ -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' => [
Expand All @@ -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' => [
Expand All @@ -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' => [
Expand Down Expand Up @@ -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' => [
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 1c6a0f8

Please sign in to comment.