Skip to content

Commit

Permalink
Update Postman collection with product_list
Browse files Browse the repository at this point in the history
Bump to 2.8.2
  • Loading branch information
toddlahman committed Dec 19, 2022
1 parent ae96f5f commit 77be08c
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 29 deletions.
3 changes: 2 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
*** WooCommerce API Manager PHP Library for Plugins and Themes Changelog ***

2021.10.22 - version 2.8.2
2022.12.19 - version 2.8.2
* Fix: Mispelled word in error message.
* Tweak: Updated API endpoint query example Postman collection to include new product_list API endpoint.

2021.07.09 - version 2.8.1
* Fix: Warning: Trying to access array offset on value of type bool. PHP warning fixed by checking if the API Key string is not empty before using the string to access the api_key element in an array.
Expand Down
79 changes: 57 additions & 22 deletions postman_api_query_example_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"info": {
"_postman_id": "15a2f398-c8a1-4fb9-9eae-4fbd2dc7bab7",
"name": "WC >= 2.0",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "3311052"
},
"item": [
{
Expand All @@ -11,7 +12,7 @@
"method": "POST",
"header": [],
"url": {
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=activate&instance=p1uOusaNM5ub3&object=http://dev.toddlahman.com/&product_id=137890&version=1.0&api_key=9f9273c809979608220752449d55fec9fbe85c3e",
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=activate&instance=p1uOusaNM5ub3&object=http://dev.wc.com&product_id=32960&version=1.0&api_key=b9dc373c7983cda3897c1502574b1bf929e02a53",
"protocol": "http",
"host": [
"wc"
Expand All @@ -34,19 +35,19 @@
},
{
"key": "object",
"value": "http://dev.toddlahman.com/"
"value": "http://dev.wc.com"
},
{
"key": "product_id",
"value": "137890"
"value": "32960"
},
{
"key": "version",
"value": "1.0"
},
{
"key": "api_key",
"value": "9f9273c809979608220752449d55fec9fbe85c3e"
"value": "b9dc373c7983cda3897c1502574b1bf929e02a53"
}
]
}
Expand All @@ -59,7 +60,7 @@
"method": "POST",
"header": [],
"url": {
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=deactivate&instance=p1uOusaNM5ub3&product_id=137890&api_key=9f9273c809979608220752449d55fec9fbe85c3e",
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=deactivate&instance=p1uOusaNM5ub3&product_id=32960&api_key=b9dc373c7983cda3897c1502574b1bf929e02a53",
"protocol": "http",
"host": [
"wc"
Expand All @@ -82,11 +83,11 @@
},
{
"key": "product_id",
"value": "137890"
"value": "32960"
},
{
"key": "api_key",
"value": "9f9273c809979608220752449d55fec9fbe85c3e"
"value": "b9dc373c7983cda3897c1502574b1bf929e02a53"
}
]
}
Expand All @@ -99,7 +100,7 @@
"method": "POST",
"header": [],
"url": {
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=status&instance=p1uOusaNM5ub3&product_id=137890&api_key=9f9273c809979608220752449d55fec9fbe85c3e",
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=status&instance=p1uOusaNM5ub3&product_id=32960&api_key=b9dc373c7983cda3897c1502574b1bf929e02a53",
"protocol": "http",
"host": [
"wc"
Expand All @@ -122,11 +123,47 @@
},
{
"key": "product_id",
"value": "137890"
"value": "32960"
},
{
"key": "api_key",
"value": "9f9273c809979608220752449d55fec9fbe85c3e"
"value": "b9dc373c7983cda3897c1502574b1bf929e02a53"
}
]
}
},
"response": []
},
{
"name": "product_list 2.4.6",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=product_list&instance=p1uOusaNM5ub3&api_key=b9dc373c7983cda3897c1502574b1bf929e02a53",
"protocol": "http",
"host": [
"wc"
],
"path": [
""
],
"query": [
{
"key": "wc-api",
"value": "wc-am-api"
},
{
"key": "wc_am_action",
"value": "product_list"
},
{
"key": "instance",
"value": "p1uOusaNM5ub3"
},
{
"key": "api_key",
"value": "b9dc373c7983cda3897c1502574b1bf929e02a53"
}
]
}
Expand All @@ -139,7 +176,7 @@
"method": "POST",
"header": [],
"url": {
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=information&instance=p1uOusaNM5ub3&product_id=137890&version=1.0&api_key=9f9273c809979608220752449d55fec9fbe85c3e&plugin_name=simple-comments/simple-comments.php",
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=information&instance=p1uOusaNM5ub3&product_id=32960&version=1.0&api_key=b9dc373c7983cda3897c1502574b1bf929e02a53&plugin_name=search-engine-ping/search-engine-ping.php",
"protocol": "http",
"host": [
"wc"
Expand All @@ -162,19 +199,19 @@
},
{
"key": "product_id",
"value": "137890"
"value": "32960"
},
{
"key": "version",
"value": "1.0"
},
{
"key": "api_key",
"value": "9f9273c809979608220752449d55fec9fbe85c3e"
"value": "b9dc373c7983cda3897c1502574b1bf929e02a53"
},
{
"key": "plugin_name",
"value": "simple-comments/simple-comments.php"
"value": "search-engine-ping/search-engine-ping.php"
}
]
}
Expand All @@ -187,7 +224,7 @@
"method": "POST",
"header": [],
"url": {
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=update&instance=p1uOusaNM5ub3&product_id=137890&version=1.0&api_key=9f9273c809979608220752449d55fec9fbe85c3e&plugin_name=simple-comments",
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=update&instance=p1uOusaNM5ub3&product_id=32960&version=1.0&api_key=b9dc373c7983cda3897c1502574b1bf929e02a53&plugin_name=search-engine-ping",
"protocol": "http",
"host": [
"wc"
Expand All @@ -210,23 +247,23 @@
},
{
"key": "product_id",
"value": "137890"
"value": "32960"
},
{
"key": "version",
"value": "1.0"
},
{
"key": "api_key",
"value": "9f9273c809979608220752449d55fec9fbe85c3e"
"value": "b9dc373c7983cda3897c1502574b1bf929e02a53"
},
{
"key": "plugin_name",
"value": "simple-comments"
"value": "search-engine-ping"
},
{
"key": "slug",
"value": "api-manager-php-library",
"value": "search-engine-ping",
"disabled": true
}
]
Expand All @@ -239,7 +276,6 @@
{
"listen": "prerequest",
"script": {
"id": "abf60ea2-7527-488c-a97a-3f4eeb8b9fd7",
"type": "text/javascript",
"exec": [
""
Expand All @@ -249,7 +285,6 @@
{
"listen": "test",
"script": {
"id": "37707542-3069-4c8a-8d71-26882d5b1616",
"type": "text/javascript",
"exec": [
""
Expand Down
22 changes: 16 additions & 6 deletions wc-api-manager-php-library.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

/**
* Plugin Name: WooCommerce API Manager PHP Library for Plugins and Themes
* Plugin Name: WooCommerce API Manager PHP Library for Plugins and Themes Example plugin
* Plugin URI: https://toddlahman.com/shop/woocommerce-api-manager-php-library-for-plugins-and-themes/
* Description: Drop the wc-am-client.php library into a plugin or theme, and use the example code below after line 26.
* Version: 2.8.1
* Version: 2.8.2
* Author: Todd Lahman LLC
* Author URI: https://www.toddlahman.com/
* License: Copyright Todd Lahman LLC
Expand Down Expand Up @@ -54,7 +54,7 @@
* If $product_id is empty, the customer can manually enter the product_id into a form field on the activation screen.
*
* @param string $file Must be __FILE__ from the root plugin file, or theme functions, file locations.
* @param int $product_id Must match the Product ID number (integer) in the product.
* @param int $product_id (Optional, can be an empty string) Must match the Product ID number (integer) in the product if set.
* @param string $software_version This product's current software version.
* @param string $plugin_or_theme 'plugin' or 'theme'
* @param string $api_url The URL to the site that is running the API Manager. Example: https://www.toddlahman.com/ Must be the root URL.
Expand All @@ -68,9 +68,19 @@
// Theme example.
//$wcam_lib = new WC_AM_Client_2_8_2( __FILE__, 234, '1.0', 'theme', 'http://wc/', 'WooCommerce API Manager PHP Library for Plugins and Themes' );

// Second argument must be the Product ID number if used. If left empty the client will need to enter it in the activation form.
// Plugin example. The $wcam_lib is optional, and must have a unique name if used to check if the API Key has been activated before allowing use of the plugin/theme.
//$wcam_lib = new WC_AM_Client_2_8_2( __FILE__, 138828, '2.7.3', 'plugin', 'http://wc/', 'WooCommerce API Manager PHP Library for Plugins and Themes' );
/*
* Plugin example.
*
* Second argument must be the Product ID number if used. If left empty the client will need to enter it in the activation form.
* The $wcam_lib is optional, and must have a unique name if used to check if the API Key has been activated before allowing use of the plugin/theme.
* Remember if the $wcam_lib variable is set it will be globally visible.
*
* In the two examples below, one has the Product ID set, and the other does not, so it will be an empter string. If the Product ID is not set
* the customer will see a form field when activating the API Key that requires the Product ID along with a form field for the API Key.
* Setting the Product ID below will eliminate the required form field for the customer to enter the Product ID, so the customer will only
* be required to enter the API Key. If you will offer the product as a variable product where the customer can switch to another product
* with a different Product ID, then do not set the Product ID here.
*/

//$wcam_lib = new WC_AM_Client_2_8_2( __FILE__, 32960, '1.2', 'plugin', 'http://wc/', 'WooCommerce API Manager PHP Library for Plugins and Themes' );
$wcam_lib = new WC_AM_Client_2_8_2( __FILE__, '', '1.2', 'plugin', 'http://wc/', 'WooCommerce API Manager PHP Library for Plugins and Themes' );
Expand Down

0 comments on commit 77be08c

Please sign in to comment.