func printHourly(w *wunderground.Wunderground) {
	hourly, err := w.Hourly(zip)
	if err != nil {
		panic(err)
	}
	fmt.Printf("\nResponse:\n %+v\n", hourly.Response)
	fmt.Printf("\nHourly:\n %+v\n", hourly.Hourly)
}
func printConditions(w *wunderground.Wunderground) {
	conditions, err := w.Conditions(zip)
	if err != nil {
		panic(err)
	}

	fmt.Printf("\nResponse:\n %+v\n", conditions.Response)
	fmt.Printf("\nConditions:\n %+v\n", conditions.Condition)
}
Example #3
0
	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
		)

		BeforeEach(func() {
			fakeServer = NewMockWunderground()
			conf.ApiHost = fakeServer.Server.URL

			w = wunderground.New(conf)
		})

		AfterEach(func() {
			fakeServer.Close()
		})

		It("builds the correct url for the wunderground api", func() {
			zipCode := "80516"