Skip to content

transcelestial/ambientweather

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ambientweather

Go client for the Ambientweather service.

GitHub Workflow Status

Usage

  1. Generate an app and API key from your account

  2. Use the API:

package main

import (
	"fmt"
	"log"
	"net/http"

	ambient "github.com/transcelestial/ambientweather"
)

func main() {
	key := ambient.NewKey("appkey", "apikey")

	devices, err := ambient.GetDevice(key)
	if err != nil {
		log.Fatal(err)
	}

	if devices.HTTPResponseCode == http.StatusOK {
		for _, dev := range devices.DeviceRecords {
			fmt.Println(dev)
		}
	}
}

Test

To run tests run:

go test .

To avoid caching during tests use:

go test -count=1 .

To get coverage reports use the -cover flag:

go test -coverprofile=coverage.out .

And to view the profile run:

go tool cover -html=coverage.out

To run static analysis on the code run:

go vet .

Contribute

If you wish to contribute, please use the following guidelines:

Credits/Contributors