Re: How to call a function read from an EDN file?

2018-03-13 Thread Simon Luetzelschwab
Hey Christopher,

Welcome to the wonderful world of Clojure and we're glad to have you!

It appears you are trying to authenticate using Google's OAuth library and
are currently using the google-apps-clj
 wrapper.

You have to either keep a reference to the return value of reading in the
config file that you can pass as the first argument to the function
google-apps-clj.credentials/get-auth-map or just pass (edn/read-string
(slurp "config/google-creds.edn")) as the first argument directly.

While I haven't used the library myself, here's how I would do steps 8, 9
and 10 in the REPL -

(let [config "config/google-creds.edn"
  creds (edn/read-string (slurp config))
  scopes ["https://www.googleapis.com/auth/calendar;]
  auth-map (google-apps-clj.credentials/get-auth-map creds scopes)
  updated-creds (assoc creds :auth-map auth-map)]
  (spit config (pr-str updated-creds))
  updated-creds)

I haven't tried this so forgive any typos, but it should give you the
general idea.

I hope this helps and feel free to post any follow up questions you may
have.

Best,
Simon

-- 
Alpeware LLC - 548 Market St #35286, San Francisco, CA 94104 - +1 415 200
3094

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to call a function read from an EDN file?

2018-03-12 Thread Christopher Lee

down votefavorite 


Clojure noob here.

After reading in the google-creds.edn file like so:

"(edn/read-string (slurp "config/google-creds.edn"))"

How do I call the function get-auth-map on this EDN file, along with the 
OAuth scope (["https://www.googleapis.com/auth/calendar;]) ?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.