fullers

package module
v0.0.0-...-b72f598 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2017 License: MIT Imports: 7 Imported by: 0

README

fullers-go

GoDoc Go Report Card license

Scraps timetables and alerts of Fullers destinations from their site.

Installation

go get -u github.com/mattevans/fullers-go

Example

Find supported destinations.

client := fullers.NewClient()
locations, err := client.Location.GetLocations()
if err != nil {
  return err
}

Which will give you...

[
    {
        "name": "Auckland City",
        "code": "AUCK"
    },
    {
        "name": "Bayswater",
        "code": "BAYS"
    },
    {
        "name": "Beach Haven",
        "code": "BEAC"
    },
    ...
]

Find a specific timetable.

client := fullers.NewClient()
timetables, err := client.Timetable.GetTimetable(&fullers.TimetableRequest{
    Origin:      "BAYS",
    Destination: "AUCK",
})

Which will give you...

[
    {
        "origin": "From: Bayswater",
        "destination": "To: Auckland City",
        "duration": "12 minutes",
        "column_titles": [
            "Mon to Fri",
            "Sat",
            "Sun & Pub Hols"
        ],
        "column_data": [
        [
            "6:40 AM",
            "7:10 AM",
            "7:40 AM",
            "8:10 AM",
        ...

Contributing

If you've found a bug or would like to contribute, please create an issue here on GitHub, or better yet fork the project and submit a pull request!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BackendURL *url.URL
	Location   *LocationService
	Timetable  *TimetableService
}

Client ...

func NewClient

func NewClient() *Client

NewClient ...

type Location

type Location struct {
	Name string `json:"name"`
	Code string `json:"code"`
}

Location ...

type LocationService

type LocationService service

LocationService ...

func (*LocationService) BuildLocationRequestURL

func (s *LocationService) BuildLocationRequestURL() string

BuildLocationRequestURL ...

func (*LocationService) GetLocations

func (s *LocationService) GetLocations() ([]Location, error)

GetLocations ...

func (*LocationService) InitLocations

func (s *LocationService) InitLocations()

InitLocations ...

func (*LocationService) ValidLocation

func (s *LocationService) ValidLocation(locs []string) error

ValidLocation ...

type Timetable

type Timetable struct {
	Origin       string              `json:"origin"`
	Destination  string              `json:"destination"`
	Duration     string              `json:"duration"`
	ColumnTitles []string            `json:"column_titles"`
	ColumnData   [][]string          `json:"column_data"`
	Footnotes    []string            `json:"footnotes"`
	ColumnCount  int                 `json:"column_count"`
	RowCount     int                 `json:"row_count"`
	Alerts       []map[string]string `json:"alerts"`
}

Timetable ...

type TimetableRequest

type TimetableRequest struct {
	Origin      string `json:"origin"`
	Destination string `json:"destination"`
}

TimetableRequest ...

type TimetableService

type TimetableService service

TimetableService ...

func (*TimetableService) BuildTimetableAlertRequestURL

func (s *TimetableService) BuildTimetableAlertRequestURL(request *TimetableRequest) string

BuildTimetableAlertRequestURL ...

func (*TimetableService) BuildTimetableRequestURL

func (s *TimetableService) BuildTimetableRequestURL(request *TimetableRequest) string

BuildTimetableRequestURL ...

func (*TimetableService) GetTimetable

func (s *TimetableService) GetTimetable(request *TimetableRequest) ([]Timetable, error)

GetTimetable ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL