コード例 #1
0
func main() {

	conf := wunderground.DefaultConfig(apiKey)
	w := wunderground.New(conf)

	printConditions(w)
	printHourly(w)
}
コード例 #2
0
	BeforeEach(func() {
		apiKey = "some_api_key"
		conf = wunderground.DefaultConfig(apiKey)
	})

	Context("Default Config", func() {
		It("sets the api key and defaults for the HttpClient and api host", func() {
			Expect(conf.ApiKey).To(Equal(apiKey))
			Expect(conf.ApiHost).To(Equal("http://api.wunderground.com"))
		})
	})

	Context("Initialization", func() {
		It("panics if no api key is set in the config", func() {
			conf.ApiKey = ""
			Expect(func() { wunderground.New(conf) }).To(Panic())
		})

		It("panics if no api host is set in the config", func() {
			conf.ApiHost = ""
			Expect(func() { wunderground.New(conf) }).To(Panic())
		})
	})

	Context("Conditions", func() {

		var (
			fakeServer *MockWunderground
			w          *wunderground.Wunderground
		)