Skip to content

Setheck/oba

Repository files navigation

oba - Golang Api for One Bus Away

Build Status Go Report Card Coverage Status

OneBusAway

Summary

I wanted to write some apps that interface with one bus away and could not find a go api, so I wrote one! One Bus Away Documentation It was also a good excuse to have some fun with golang

Get

$ go get -u github.com/Setheck/oba

Import

import (
    "log"
    "github.com/Setheck/oba"
)

Use

Agency

func main() {
    client := oba.NewDefaultClientS(server.URL, TestApiKey)
    agency, e := client.Agency("1")
    if e != nil {
        log.Fatal(e)
    }
}

AgenciesWithCoverage

func main() {
    client := oba.NewDefaultClientS(server.URL, TestApiKey)
    awcs, e := client.AgenciesWithCoverage()
    if e != nil {
        log.Fatal(e)
    }
}

Route

func main() {
    client := oba.NewDefaultClientS("http://api.pugetsound.onebusaway.org/api/where/", "TEST")
    route, err := client.Route("1_100224")
    if err != nil {
        log.Fatal(err)
    }
    log.Print(route.ID)
}