Created
March 22, 2014 02:59
-
-
Save sachac/9700455 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Totally untested | |
(defvar clarissa/beeminder-user "example" "Username for Beeminder service.") | |
(defvar clarissa/beeminder-token "1234" "Token - get this from https://www.beeminder.com/api/v1/auth_token.json") | |
(defun clarissa/beeminder-post (goal datapoint) | |
(interactive "MGoal: \nMData: \nMToken value: ") | |
(let ((url-request-data (json-encode `((value . ,datapoint) (auth_token . ,clarissa/beeminder-token)))) | |
(url-request-method "POST") | |
(url-request-extra-headers '(("Content Type" . "application/json"))) | |
(url-mime-encoding-string "identity")) | |
(condition-case nil | |
(url-retrieve-synchronously | |
(format "https://www.beeminder.com/users/%s/goals/%s/datapoints.json" clarissa/beeminder-user goal))))) | |
(defun clarissa/beeminder-org-update () | |
(interactive) | |
(when (org-entry-get "GOAL") | |
(clarissa/beeminder-post (org-entry-get "GOAL") (or (org-entry-get "POINTS") (read-string "Points"))))) | |
(add-hook 'org-after-todo-state-change-hook 'clarissa/beeminder-org-update) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment