busstop

package
v0.0.0-...-69338bc Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const BASE_URL = "http://web.smsbus.cl/web/buscarAction.do"
View Source
const BUS_DISTANCE_SELECTOR = "#distancia_respuesta_solo_paradero, #proximo_distancia_respuesta"
View Source
const BUS_ID_SELECTOR = "#bus_respuesta_solo_paradero, #proximo_bus_respuesta"
View Source
const BUS_SERVICE_SELECTOR = "#servicio_respuesta_solo_paradero"
View Source
const BUS_TIME_SELECTOR = "#tiempo_respuesta_solo_paradero, #proximo_tiempo_respuesta"
View Source
const SERVICE_ERROR_DESCRIPTION_SELECTOR = "#respuesta_error_solo_paradero"
View Source
const SERVICE_ERROR_SELECTOR = "#servicio_error_solo_paradero"
View Source
const SERVICE_OK_SELECTOR = "#proximo_solo_paradero, #siguiente_respuesta"
View Source
const SESSION_URL = BASE_URL + "?d=cargarServicios"
View Source
const SINGLE_SERVICE_ERROR_SELECTOR = "#respuesta_error"
View Source
const SINGLE_SERVICE_OK_SELECTOR = "#proximo_respuesta"
View Source
const STOP_ERROR = "#respuesta_error"

Data Selector Constants

View Source
const STOP_ID_SELECTOR = "#numero_parada_respuesta .texto_h2"
View Source
const STOP_NAME_SELECTOR = "#nombre_paradero_respuesta"

Variables

View Source
var Errors = map[ErrorCode]string{
	0:  "Itinerario obtenido satisfactoriamente",
	10: "Error indeterminado al interpretar parámetro ID de Parada",
	11: "Parámetro ID de Parada faltante",
	12: "Parámetro ID de Parada mal formado",
	20: "Error indeterminado al parsear información desde SMSBus",
	21: "SMSBus no contesta",
	22: "SMSBus contesta, pero no entrega información interpretable",
	23: "Imposible interpretar valores de itinerario",
	30: "Error indeterminado con paradero",
}
View Source
var MenosRegex = regexp.MustCompile("[Mm]enos")
View Source
var TimeRegex = regexp.MustCompile("[0-9]{1,2}")

Functions

This section is empty.

Types

type BusResponse

type BusResponse struct {
	ID             string `json:"id"`
	MetersDistance int    `json:"meters_distance"`
	MinArrivalTime int    `json:"min_arrival_time"`
	MaxArrivalTime int    `json:"max_arrival_time"`
}

type ErrorCode

type ErrorCode int

type Parser

type Parser struct {
	Request       *http.Request
	Session       string
	BusStopRegexp *regexp.Regexp
}

func (*Parser) GetCronTasks

func (p *Parser) GetCronTasks() []*common.CronTask

func (*Parser) GetRoute

func (bp *Parser) GetRoute() string

func (*Parser) Parse

func (bp *Parser) Parse(c *gin.Context)

func (*Parser) StartParser

func (bp *Parser) StartParser()

func (*Parser) StopParser

func (bp *Parser) StopParser()

type Response

type Response struct {
	ID                string             `json:"id"`
	Name              string             `json:"name"`
	StatusCode        ErrorCode          `json:"status_code"`
	StatusDescription string             `json:"status_description"`
	Services          []*ServiceResponse `json:"services"`
}

func (*Response) SetStatus

func (br *Response) SetStatus(code ErrorCode)

type ServiceResponse

type ServiceResponse struct {
	ID                string         `json:"id"`
	Valid             bool           `json:"valid"`
	StatusDescription string         `json:"status_description"`
	Buses             []*BusResponse `json:"buses"`
}

Jump to

Keyboard shortcuts

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