Hello everyone.  Hopefully this is an easy question to answer.

Our company is using a dashboard application that uses Clojure called 
Brainiac (https://github.com/cmonty/brainiac).  It accesses weather data 
from Dark Sky.  Dark Sky has upgraded their API and now the weather data is 
in arrays, which it wasn't previously.
I can't get the data from inside the JSON arrays from Clojure. 
 Specifically, I looking to get the data from the "currently" array taken 
from this Dark Sky data:

{"latitude":41.85,"longitude":-87.65,"timezone":"America/Chicago","offset":-5,*"currently":{"time":1367940558,"summary":"Partly
 
Cloudy","icon":"partly-cloudy-day","precipIntensity":0,"temperature":61.2,"dewPoint":42.12,"windSpeed":6.67,"windBearing":14,"cloudCover":0.31,"humidity":0.49,"pressure":1017.73,"visibility":10,"ozone":365.8}*,"minutely":{"summary":"Partly
 cloudy for the 
hour.","icon":"partly-cloudy-day","data":[{"time":1367940540,"precipIntensity":0}


The Clojure code I am attempting to access the data is as follows, with the 
*bold* where I'm assuming I'm missing it:


(ns brainiac.plugins.dark-sky
  (:require [brainiac.plugin :as brainiac]
            [clojure.contrib.json :as json :only (read-json)]
            [clojure.java.io :as io :only (reader)]
            [clojure.contrib.string :as string]))

*(defn format-forecast [forecast]
  {
    :currently (:summary (:currently forecast))
    :current-summary (:summary (:currently forecast))
    :hour-summary (:timezone forecast)
  })*

(defn transform [stream]
  (let [json (json/read-json (io/reader stream))]
    (assoc {}
      :name "dark-sky"
      :title "Right now, outside..."
      :data (format-forecast json))))

(defn url [api-key lat lon]
  (format "https://api.forecast.io/forecast/%s/%s,%s"; api-key lat lon))

(defn configure [{:keys [api-key lat lon program-name]}]
  (brainiac/simple-http-plugin
    {:url (url api-key lat lon)}
    transform program-name))



Thanks for any help on this.  Just starting in Clojure.

-- 
-- 
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/groups/opt_out.


Reply via email to