[cl-soap-cvs] CVS update: cl-soap/test/test-google-adwords.lisp
Sven Van Caekenberghe
scaekenberghe at common-lisp.net
Thu Sep 22 15:30:04 UTC 2005
Update of /project/cl-soap/cvsroot/cl-soap/test
In directory common-lisp.net:/tmp/cvs-serv26088/test
Modified Files:
test-google-adwords.lisp
Log Message:
more work on xsd type handling in wsdl-soap-call
more specifically type element multiplicity
added some simple experimental wsdl caching
Date: Thu Sep 22 17:30:01 2005
Author: scaekenberghe
Index: cl-soap/test/test-google-adwords.lisp
diff -u cl-soap/test/test-google-adwords.lisp:1.5 cl-soap/test/test-google-adwords.lisp:1.6
--- cl-soap/test/test-google-adwords.lisp:1.5 Wed Sep 21 19:08:04 2005
+++ cl-soap/test/test-google-adwords.lisp Thu Sep 22 17:30:01 2005
@@ -1,6 +1,6 @@
;;;; -*- mode: lisp -*-
;;;;
-;;;; $Id: test-google-adwords.lisp,v 1.5 2005/09/21 17:08:04 scaekenberghe Exp $
+;;;; $Id: test-google-adwords.lisp,v 1.6 2005/09/22 15:30:01 scaekenberghe Exp $
;;;;
;;;; Some test on the Google AdWords API (not publically available)
;;;;
@@ -58,6 +58,14 @@
(defun parse-all-wsdl ()
(mapcar #'parse-wsdl-url *google-adwords-api-wsdl-urls*))
+(defvar *wsdl-cache* (make-hash-table :test #'equal))
+
+(defun wsdl-cache-get (url)
+ (let ((cached (gethash url *wsdl-cache*)))
+ (if cached
+ cached
+ (setf (gethash url *wsdl-cache*) (parse-wsdl-url url)))))
+
;;; some test calls
(defun get-usage-quota-this-month ()
@@ -78,13 +86,13 @@
#+NIL
(defun get-usage-quota-this-month ()
- (wsdl-soap-call "https://adwords.google.com:443/api/adwords/v2/InfoService?wsdl"
+ (wsdl-soap-call (wsdl-cache-get "https://adwords.google.com:443/api/adwords/v2/InfoService?wsdl")
"getUsageQuotaThisMonth"
:headers `("email" ,*google-adwords-email*
"password" ,*google-adwords-password*
"useragent" ,*google-adwords-user-agent*
"token" ,*google-adwords-token*
- "clientEmail" *google-client-email*)))
+ "clientEmail" ,*google-client-email*)))
(defun get-method-cost (service method &optional (date (ut)))
(multiple-value-bind (result headers)
@@ -107,7 +115,7 @@
#+NIL
(defun get-method-cost (service method &optional (date (ut)))
- (wsdl-soap-call "https://adwords.google.com:443/api/adwords/v2/InfoService?wsdl"
+ (wsdl-soap-call (wsdl-cache-get "https://adwords.google.com:443/api/adwords/v2/InfoService?wsdl")
"getMethodCost"
:input `("service" ,service
"method" ,method
@@ -116,12 +124,12 @@
"password" ,*google-adwords-password*
"useragent" ,*google-adwords-user-agent*
"token" ,*google-adwords-token*
- "clientEmail" *google-client-email*)))
+ "clientEmail" ,*google-client-email*)))
(defun get-operation-count (start-date &optional (end-date start-date)))
(defun get-unit-count (&optional (start-date (ut)) (end-date start-date))
- (wsdl-soap-call "https://adwords.google.com:443/api/adwords/v2/InfoService?wsdl"
+ (wsdl-soap-call (wsdl-cache-get "https://adwords.google.com:443/api/adwords/v2/InfoService?wsdl")
"getUnitCount"
:input `("startDate" ,start-date
"endDate" ,end-date)
@@ -160,6 +168,16 @@
:envelope-attributes `(:|xmlns| ,+google-adwords-ns-uri+))
(values result headers)))
+(defun get-all-adwords-campaigns (client-email)
+ (wsdl-soap-call (wsdl-cache-get "https://adwords.google.com:443/api/adwords/v2/CampaignService?wsdl")
+ "getAllAdWordsCampaigns"
+ :input '("dummy" 1)
+ :headers `("email" ,*google-adwords-email*
+ "password" ,*google-adwords-password*
+ "useragent" ,*google-adwords-user-agent*
+ "token" ,*google-adwords-token*
+ "clientEmail" ,client-email)))
+
(defun get-campaign (id client-email)
(multiple-value-bind (result headers)
(soap-call (make-soap-end-point "https://adwords.google.com:443/api/adwords/v2/CampaignService")
@@ -195,7 +213,7 @@
(defun estimate-keyword-list (keywords)
"((<text> <type> <max-cpc>)*) where type is Broad|Phrase|Exact"
- (wsdl-soap-call "https://adwords.google.com:443/api/adwords/v2/TrafficEstimatorService?wsdl"
+ (wsdl-soap-call (wsdl-cache-get "https://adwords.google.com:443/api/adwords/v2/TrafficEstimatorService?wsdl")
"estimateKeywordList"
:input (mapcar #'(lambda (keyword)
(destructuring-bind (text type max-cpc)
More information about the Cl-soap-cvs
mailing list