Пример #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 <SandboxRideUpdate> ChangeRideStatus(string rideId, LyftConstants.RideStatus status)
        {
            Url     url  = new Url(ShyftConstants.BaseV1SandboxUrl).AppendPathSegments("rides", rideId);
            JObject data = JObject.FromObject(new
            {
                status = ShyftConstants.RideStatusToString(status)
            });

            return(await base.PutLyft <SandboxRideUpdate>(url, data));
        }
Пример #3
0
        private string GetScopesString(List <ShyftConstants.AuthScopes> scopes)
        {
            string scopesString = null;

            if (scopes != null && scopes.Count > 0)
            {
                List <string> scopesList = new List <string>();
                foreach (var scope in scopes)
                {
                    scopesList.Add(ShyftConstants.AuthScopeToString(scope));
                }
                scopesString = string.Join(" ", scopesList);
            }
            return(scopesString);
        }
Пример #4
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));
        }
Пример #5
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));
        }
Пример #6
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);
        }