Skip to content

Commit fccb1ed

Browse files
committed
FIX #10, EDN to query string function implemented
1 parent b378c18 commit fccb1ed

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/wc_api_clj/v3/coupons.clj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"Helper functions to communicate with the WooCommerce REST API's coupons endpoints.
33
These functions need authentication by `consumer_key` and `consumer_secret`.</br>
44
https://woocommerce.github.io/woocommerce-rest-api-docs/#coupons"
5-
(:require [wc-api-clj.core :as woo]))
5+
(:require [wc-api-clj.core :as woo]
6+
[wc-api-clj.util :as util]))
67

78
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
89
;; Coupons REST API v3 helper functions ;;
@@ -58,7 +59,7 @@
5859
"Delete a coupon by the coupon's ID."
5960
[{:keys [url consumer_key consumer_secret coupon exception insecure]}]
6061
(try (woo/delete-req {:siteurl url
61-
:uri (str "/wp-json/wc/v3/coupons/" coupon "?force=true")
62+
:uri (str "/wp-json/wc/v3/coupons/" coupon (util/edn-to-query-str {:force true}))
6263
:username consumer_key
6364
:password consumer_secret
6465
:exception (not (not exception))

src/wc_api_clj/v3/orders.clj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"Helper functions to communicate with the WooCommerce REST API's orders endpoints.
33
These functions need authentication by `consumer_key` and `consumer_secret`.</br>
44
https://woocommerce.github.io/woocommerce-rest-api-docs/#orders"
5-
(:require [wc-api-clj.core :as woo]))
5+
(:require [wc-api-clj.core :as woo]
6+
[wc-api-clj.util :as util]))
67

78
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
89
;; Orders REST API v3 helper functions ;;
@@ -58,7 +59,7 @@
5859
"Delete an order by the order's ID."
5960
[{:keys [url consumer_key consumer_secret order exception insecure]}]
6061
(try (woo/delete-req {:siteurl url
61-
:uri (str "/wp-json/wc/v3/orders/" order "?force=true")
62+
:uri (str "/wp-json/wc/v3/orders/" order (util/edn-to-query-str {:force true}))
6263
:username consumer_key
6364
:password consumer_secret
6465
:exception (not (not exception))

src/wc_api_clj/v3/products.clj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"Helper functions to communicate with the WooCommerce REST API's products endpoints.
33
These functions need authentication by `consumer_key` and `consumer_secret`.</br>
44
https://woocommerce.github.io/woocommerce-rest-api-docs/#products"
5-
(:require [wc-api-clj.core :as woo]))
5+
(:require [wc-api-clj.core :as woo]
6+
[wc-api-clj.util :as util]))
67

78
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
89
;; Products REST API v3 helper functions ;;
@@ -58,7 +59,7 @@
5859
"Delete a product by the porduct's ID."
5960
[{:keys [url consumer_key consumer_secret product exception insecure]}]
6061
(try (woo/delete-req {:siteurl url
61-
:uri (str "/wp-json/wc/v3/products/" product "?force=true")
62+
:uri (str "/wp-json/wc/v3/products/" product (util/edn-to-query-str {:force true}))
6263
:username consumer_key
6364
:password consumer_secret
6465
:exception (not (not exception))

0 commit comments

Comments
 (0)