transcelestial / ambientweather

Go client for the Ambientweather service.

Home Page:https://ambientweather.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Go client for the Ambientweather service.

https://ambientweather.net

License:MIT License


Languages

Language:Go 100.0%