Created
January 15, 2016 19:50
-
-
Save yokolet/bb68ad5357195ae67562 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
(ns signups-manager.core | |
(:require [clojure.edn :as edn] | |
[clojure.data.json :as json] | |
[clj-http.client :as http] | |
[google-apps-clj.credentials :as creds] | |
[google-apps-clj.google-sheets :as sh])) | |
(defn read-creds | |
[] | |
(edn/read-string (slurp "config/google-creds.edn"))) | |
(defn sheets-auth-map | |
[] | |
(creds/get-auth-map (read-creds) ["https://spreadsheets.google.com/feeds"])) | |
(defn sheet-service | |
[ctx] | |
(sh/build-sheet-service ctx)) | |
(comment | |
(def svc (sheet-service (read-creds))) | |
(def sheet (sh/find-spreadsheet-by-title svc "test sheets")) | |
(def entries (.getWorksheets (:spreadsheet sheet))) | |
(def cell (sh/find-cell-by-row-col svc (first entries) 2 7)) | |
(-> cell :cell .getCell .getValue) ;; => brooklyn | |
(def data (sh/read-worksheet-values svc (first entries))) | |
(def LOC_COL 6) | |
(def r (http/get "https://maps.googleapis.com/maps/api/geocode/json?address=brooklyn")) | |
(def addr (-> (json/read-str (:body r) :key-fn keyword) :results first)) | |
(def loc (get-in addr [:geometry :location])) | |
;=> {:lat 40.6781784, :lng -73.9441579} | |
;; what range of lat/lng diffs considered close? | |
;; convert address, space to plus | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment