예제 #1
0
        public async Task <ValueObjects.UberRequest> GetUberRequest(CancellationToken ct, string accessToken, Guid requestId)
        {
            DrumbleApp.Shared.Infrastructure.Services.Api.Uber.Model.UberRequest uberRequest = await uberApi.GetRequest(ct, accessToken, requestId);

            if (uberRequest == null)
            {
                return(null);
            }

            ValueObjects.UberDriver uberDriver = null;

            if (uberRequest.driver != null)
            {
                uberDriver = new ValueObjects.UberDriver(uberRequest.driver.phone_number, uberRequest.driver.rating, new Uri(uberRequest.driver.picture_url), uberRequest.driver.name);
            }

            ValueObjects.UberVehicle uberVehicle = null;

            if (uberRequest.vehicle != null)
            {
                uberVehicle = new ValueObjects.UberVehicle(uberRequest.vehicle.make, uberRequest.vehicle.model, uberRequest.vehicle.license_plate, new Uri(uberRequest.vehicle.picture_url));
            }

            ValueObjects.Coordinate uberLocation = null;

            if (uberRequest.location != null)
            {
                uberLocation = new ValueObjects.Coordinate(uberRequest.location.latitude, uberRequest.location.longitude);
            }

            Uri surgeMultiplierHref = null;

            if (!String.IsNullOrEmpty(uberRequest.surge_multiplier_href))
            {
                surgeMultiplierHref = new Uri(uberRequest.surge_multiplier_href);
            }

            return(new ValueObjects.UberRequest(Guid.Parse(uberRequest.request_id), uberRequest.status, uberRequest.surge_multiplier, uberRequest.eta, uberVehicle, uberDriver, uberLocation, surgeMultiplierHref, uberRequest.surge_confirmation_id));
        }
예제 #2
0
        public async Task<ValueObjects.UberRequest> GetUberRequest(CancellationToken ct, string accessToken, Guid requestId)
        {
            DrumbleApp.Shared.Infrastructure.Services.Api.Uber.Model.UberRequest uberRequest = await uberApi.GetRequest(ct, accessToken, requestId);

            if (uberRequest == null)
            {
                return null;
            }

            ValueObjects.UberDriver uberDriver = null;

            if (uberRequest.driver != null)
            {
                uberDriver = new ValueObjects.UberDriver(uberRequest.driver.phone_number, uberRequest.driver.rating, new Uri(uberRequest.driver.picture_url), uberRequest.driver.name);
            }

            ValueObjects.UberVehicle uberVehicle = null;

            if (uberRequest.vehicle != null)
            {
                uberVehicle = new ValueObjects.UberVehicle(uberRequest.vehicle.make, uberRequest.vehicle.model, uberRequest.vehicle.license_plate, new Uri(uberRequest.vehicle.picture_url));
            }

            ValueObjects.Coordinate uberLocation = null;

            if (uberRequest.location != null)
            {
                uberLocation = new ValueObjects.Coordinate(uberRequest.location.latitude, uberRequest.location.longitude);
            }

            Uri surgeMultiplierHref = null;
            if (!String.IsNullOrEmpty(uberRequest.surge_multiplier_href))
            {
                surgeMultiplierHref = new Uri(uberRequest.surge_multiplier_href);
            }

            return new ValueObjects.UberRequest(Guid.Parse(uberRequest.request_id), uberRequest.status, uberRequest.surge_multiplier, uberRequest.eta, uberVehicle, uberDriver, uberLocation, surgeMultiplierHref, uberRequest.surge_confirmation_id);
        }