Update WordPress plugin to v1.4.0 with new public API v1

- Switch from /api to /api/v1 endpoints
- Use X-API-Key header instead of Bearer token
- Update test connection to use /menu endpoint

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Kelly
2025-12-02 09:47:12 -07:00
parent 917e91297e
commit 9e5fa437ff
2 changed files with 9 additions and 9 deletions

View File

@@ -3,7 +3,7 @@
* Plugin Name: Crawlsy Menus
* Plugin URI: https://creationshop.io
* Description: Display cannabis product menus from Crawlsy with Elementor integration
* Version: 1.3.0
* Version: 1.4.0
* Author: Creationshop
* Author URI: https://creationshop.io
* License: GPL v2 or later
@@ -15,8 +15,8 @@ if (!defined('ABSPATH')) {
exit; // Exit if accessed directly
}
define('CRAWLSY_MENUS_VERSION', '1.3.0');
define('CRAWLSY_MENUS_API_URL', 'https://dispos.crawlsy.com/api');
define('CRAWLSY_MENUS_VERSION', '1.4.0');
define('CRAWLSY_MENUS_API_URL', 'https://dispos.crawlsy.com/api/v1');
define('CRAWLSY_MENUS_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('CRAWLSY_MENUS_PLUGIN_URL', plugin_dir_url(__FILE__));
@@ -156,15 +156,15 @@ class Crawlsy_Menus_Plugin {
$('#api-test-result').html('<p>Testing connection...</p>');
$.ajax({
url: apiUrl + '/auth/me',
url: apiUrl + '/menu',
method: 'GET',
headers: {
'Authorization': 'Bearer ' + apiToken
'X-API-Key': apiToken
},
success: function(response) {
$('#api-test-result').html(
'<div class="notice notice-success"><p><strong>Success!</strong> Connected as: ' +
response.user.email + '</p></div>'
'<div class="notice notice-success"><p><strong>Success!</strong> Connected to: ' +
response.dispensary + ' (' + response.menu.total_products + ' products)</p></div>'
);
},
error: function(xhr) {
@@ -241,7 +241,7 @@ class Crawlsy_Menus_Plugin {
$response = wp_remote_get($url, [
'headers' => [
'Authorization' => 'Bearer ' . $api_token
'X-API-Key' => $api_token
],
'timeout' => 30
]);
@@ -270,7 +270,7 @@ class Crawlsy_Menus_Plugin {
$response = wp_remote_get($url, [
'headers' => [
'Authorization' => 'Bearer ' . $api_token
'X-API-Key' => $api_token
],
'timeout' => 30
]);