kkm

package module
v0.0.0-...-8618d76 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2015 License: BSD-3-Clause Imports: 16 Imported by: 0

README

kkm GoDoc

Get your ticket payment history or reverse lookup your personal details with your student card ID.

License

Although the kkm project is licensed under the 3-clause BSD license, by using commands and libraries included herewith you must not lookup student card IDs and/or KKM card IDs that do not belong to you.

(§5.3 Regulamin)

cmd/kkm-history GoDoc

Get your ticket payment history. Outputs []kkm.Ticket in JSON, sorted by PurchasedAt field in increasing order. The kkm.Ticket is defined as:

type Ticket struct {
	PurchasedAt time.Time `json:"purchased_at"`
	ExpiredAt   time.Time `json:"expires_at"`
	Type        string    `json:"type"`
	Price       int       `json:"price"`
	StudentID   int       `json:"student_id"`
	KKMID       int       `json:"kkm_id"`
}

Times are always in UTC. The price is a decimal with scale=2.

Installation

~ $ go get -u github.com/rjeczalik/kkm/cmd/kkm-history

Example

~ $ kkm-history -card UJ -id 1234567
[
	{
		"purchased_at": "2014-12-10T07:04:00Z",
		"expires_at": "2015-01-09T00:00:00Z",
		"type": "Ulgowy | Wszystkie dni tygodnia",
		"price": 4900,
		"student_id": 123456722,
		"kkm_id": 1234567890
	},
	{
		"purchased_at": "2015-01-13T07:25:00Z",
		"expires_at": "2015-02-12T00:00:00Z",
		"type": "Ulgowy | Wszystkie dni tygodnia",
		"price": 4900,
		"student_id": 123456722,
		"kkm_id": 1234567890
	}
]

cmd/kkm-detail GoDoc

Reverse lookup your personal details with your student card ID ((kkm.Ticket).StudentID) and KKM card ID ((kkm.Ticket).KKMID). Outputs *kkm.Detail in JSON. The kkm.Detail is defined as:

type Detail struct {
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Email     string `json:"email"`
	Phone     string `json:"phone"`
}

The Email and Phone may be empty.

Installation

~ $ go get -u github.com/rjeczalik/kkm/cmd/kkm-detail

Example

~ $ kkm-detail -id 123456722 -kkm 1234567890
{
	"first_name": "Twoja",
	"last_name": "Stara",
	"email": "Pierze",
	"phone": "W rzece"
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CityCardType = map[string]int{
	"wszib": 20,
	"agh":   21,
	"uj":    22,
	"pk":    23,
	"ue":    24,
	"ur":    25,
	"pwst":  26,
	"am":    27,
	"wse":   28,
	"aik":   29,
	"up":    30,
	"wsh":   31,
	"ka":    32,
	"wsei":  33,
	"ifj":   34,
	"if":    35,
	"ikifp": 36,
}

Functions

This section is empty.

Types

type Detail

type Detail struct {
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Email     string `json:"email"`
	Phone     string `json:"phone"`
}

func Details

func Details(studentID, kkmID int) (*Detail, error)

type Ticket

type Ticket struct {
	PurchasedAt time.Time `json:"purchased_at"`
	ExpiredAt   time.Time `json:"expires_at"`
	Type        string    `json:"type"`
	Price       int       `json:"price"`
	StudentID   int       `json:"student_id"`
	KKMID       int       `json:"kkm_id"`
}

func History

func History(cardType string, studentID int) ([]Ticket, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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