compasscard

package module
v0.0.0-...-0053f9f Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2019 License: MIT Imports: 11 Imported by: 0

README

compasscard

client to fetch usage data from compasscard.ca

deprecated

Compasscard.ca introduced re-captcha, which breaks this web-crawling based approach. the code does not work anymore.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientOption

type ClientOption interface {
	Apply(*Session)
}

func WithCookieJar

func WithCookieJar(jar *cookiejar.Jar) ClientOption

type ClientOptionFunc

type ClientOptionFunc func(*Session)

func (ClientOptionFunc) Apply

func (fnc ClientOptionFunc) Apply(s *Session)

type Session

type Session struct {
	// contains filtered or unexported fields
}

func New

func New(username, password string, options ...ClientOption) (*Session, error)

func (*Session) Cards

func (s *Session) Cards() ([]string, error)

Cards loads all available cards from your compasscard account

func (*Session) Signout

func (s *Session) Signout() error

TODO add SignOut call to session

func (*Session) Usage

func (s *Session) Usage(ccsn string, opts UsageOptions) ([]UsageRecord, []byte, error)

Usage looks up a specific compasscard usage

type UsageOptions

type UsageOptions struct {
	StartDate time.Time
	EndDate   time.Time
}

type UsageRecord

type UsageRecord struct {
	DateTime       time.Time
	Transaction    string
	Product        string
	LineItem       string
	Amount         float64
	BalanceDetails float64
	OrderDate      string
	Payment        string
	OrderNumber    string
	AuthCode       string
	Total          string
}

func Parse

func Parse(raw []byte) ([]UsageRecord, error)

Parse converts a compass card csv response into UsageRecords

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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