示例#1
0
 internal static Url SetRideType(this Url url, LyftConstants.RideType rideType)
 {
     if (rideType != LyftConstants.RideType.Other)
     {
         url.SetQueryParam("ride_type", ShyftConstants.RideTypeToString(rideType));
     }
     return(url);
 }
示例#2
0
        public async Task <RideRequest> RequestRide(double originLat, double originLng, double destinationLat, double destinationLng, LyftConstants.RideType rideType,
                                                    string originAddress = null, string destinationAddress = null, string costToken = null)
        {
            Url     url  = new Url(ShyftConstants.BaseV1Url).AppendPathSegment("rides");
            JObject data = new JObject();

            data["origin"]      = CreateLocation(originLat, originLng, originAddress);
            data["destination"] = CreateLocation(destinationLat, destinationLng, destinationAddress);
            data["ride_type"]   = ShyftConstants.RideTypeToString(rideType);
            if (!string.IsNullOrEmpty(costToken))
            {
                data["cost_token"] = costToken;
            }
            return(await PostLyft <RideRequest>(url, data));
        }
示例#3
0
        public async Task <SandboxRideType> ChangeRideTypes(double lat, double lng, List <LyftConstants.RideType> rideTypes)
        {
            Url    url       = new Url(ShyftConstants.BaseV1SandboxUrl).AppendPathSegment("ridetypes");
            JArray rideTypeA = new JArray();

            foreach (var rideType in rideTypes)
            {
                rideTypeA.Add(ShyftConstants.RideTypeToString(rideType));
            }
            JObject data = JObject.FromObject(new
            {
                lat        = lat,
                lng        = lng,
                ride_types = rideTypeA
            });

            return(await PutLyft <SandboxRideType>(url, data));
        }
示例#4
0
        public async Task ChangeDriverAvailability(LyftConstants.RideType rideType, double lat, double lng, bool driverAvailability)
        {
            Url     url  = new Url(ShyftConstants.BaseV1SandboxUrl).AppendPathSegments("ridetypes", ShyftConstants.RideTypeToString(rideType));
            JObject data = JObject.FromObject(new
            {
                lat = lat,
                lng = lng,
                driver_availability = driverAvailability
            });

            await PutLyft(url, data);
        }