Exemplo n.º 1
0
func GetTaxiAPIInstruments(params c.TaxiApiParams, for_name string) (t.TaxiInterface, t.AddressSupplier, error) {
	switch api_name := params.Name; api_name {
	case i.INFINITY:
		return i.GetInfinityAPI(params, for_name), i.GetInfinityAddressSupplier(params, for_name), nil
	case t.FAKE:
		return t.GetFakeAPI(params), i.GetInfinityAddressSupplier(params, for_name), nil
	case sedi.SEDI:
		sedi_api := sedi.NewSediAPI(params)
		return sedi_api, sedi_api, nil
	}
	return nil, nil, errors.New("Not imply name of api")
}
Exemplo n.º 2
0
func main() {
	config := c.ReadConfig()
	tc, ok := config.Taxis["fake"]
	if !ok {
		panic("not fake taxi in config!!!")
	}
	inf := i.GetTestInfAPI(tc.Api)
	log.Printf("inf: %+v", inf)
	log.Printf("connected? %v", inf.IsConnected())
	log.Printf("orders: %+v", inf.Orders())
	log.Printf("cars: %+v", inf.GetCarsInfo())

	as := i.GetInfinityAddressSupplier(tc.Api, "test")
	log.Printf("is connected? %v", as.IsConnected())
	log.Printf("adress result: %+v", as.AddressesAutocomplete("Никол").Rows)
}
Exemplo n.º 3
0
func GetFakeInfinityOwnAddressHandler() *OwnAddressHandler {
	conf := configuration.ReadConfigInRecursive()
	ext := infinity.GetInfinityAddressSupplier(conf.Taxis["fake"].Api, "fake")
	own_ah := NewOwnAddressHandler(conf.Main.ElasticConn, conf.Taxis["fake"].Api.GeoOrbit, ext)
	return own_ah
}