aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Allred <code@seanallred.com>2014-11-27 12:57:04 -0500
committerSean Allred <code@seanallred.com>2014-11-27 12:57:04 -0500
commit686ff49e2f9ec57e7c5a712f7e934fa9f7099b0d (patch)
tree38a63312644dde60939e1bcc60cee8e8b62b95d0
parent6848008b60938100d04cda96c093a24cb3370f9a (diff)
parentf9c12d9c09e1dff7c29b3bf94dbccd042f48f078 (diff)
Merge pull request #108 from vermiculus/issue-82
Make site a url argument
-rw-r--r--sx-favorites.el3
-rw-r--r--sx-method.el18
2 files changed, 14 insertions, 7 deletions
diff --git a/sx-favorites.el b/sx-favorites.el
index aaf2734..d957167 100644
--- a/sx-favorites.el
+++ b/sx-favorites.el
@@ -52,7 +52,8 @@ Added as hook to initialization."
(defun sx-favorites--retrieve-favorites (site)
"Obtain list of starred QUESTION_IDs for SITE."
(sx-method-call 'me
- :submethod (format "favorites?site=%s" site)
+ :submethod 'favorites
+ :site site
:filter sx-favorite-list-filter
:auth t))
diff --git a/sx-method.el b/sx-method.el
index 4bd98a5..1b20cbf 100644
--- a/sx-method.el
+++ b/sx-method.el
@@ -75,8 +75,14 @@ Return the entire response as a complex alist."
(when id
(format "/%s" id))
(when submethod
- (format "/%s" submethod))))
- (call 'sx-request-make))
+ (format "/%s" submethod))
+ ;; On GET methods site is buggy, so we
+ ;; need to provide it as a url argument.
+ (when (and site (string= url-method "GET"))
+ (prog1
+ (format "?site=%s" site)
+ (setq site nil)))))
+ (call #'sx-request-make))
(lwarn "sx-call-method" :debug "A: %S T: %S. M: %S,%s. F: %S" (equal 'warn auth)
access-token method-auth full-method filter-auth)
(unless access-token
@@ -96,10 +102,10 @@ Return the entire response as a complex alist."
(error "This request requires authentication."))))
;; Concatenate all parameters now that filter is ensured.
(setq parameters
- (cons `(site . ,site)
- (cons (cons 'filter
- (sx-filter-get-var filter))
- keywords)))
+ (cons (cons 'filter (sx-filter-get-var filter))
+ keywords))
+ (when site
+ (setq parameters (cons (cons 'site site) parameters)))
(funcall call
full-method
parameters