rides-ios-sdk icon indicating copy to clipboard operation
rides-ios-sdk copied to clipboard

Enable `button.loadRideInformation()` to display estimates based on cheapest product

Open chardane opened this issue 9 years ago • 1 comments

Right now, this is how you would get a time estimate based on cheapest product and pickup location:

let button = RideRequestButton()
let pickupLocation = CLLocation(latitude: 37.775159, longitude: -122.417907)

let builder = RideParametersBuilder().setPickupLocation(pickupLocation)

let ridesClient = RidesClient()
// get cheapest product id separately
ridesClient.fetchCheapestProduct(pickupLocation: pickupLocation, completion: {
    product, response in
    if let productID = product?.productID {
        builder.setProductID(productID)
        button.rideParameters = builder.build()
        button.loadRideInformation()
    }
})

I would love for this to be boiled down to:

let button = RideRequestButton()
let pickupLocation = CLLocation(latitude: 37.775159, longitude: -122.417907)

let builder = RideParametersBuilder().setPickupLocation(pickupLocation)

button.rideParameters = builder.build()
button.loadRideInformation() //cheapest product ID is used magic whoa

So we can fetch the cheapest product ID automatically when we call loadRideInformation() and there is a pickupLocation set. 😄 🎉

chardane avatar Aug 30 '16 18:08 chardane

I agree :)

jbrophy17 avatar Sep 01 '16 00:09 jbrophy17