Lyft
Requirements
Please signup and read: developer.lyft.com
Installation
Lyft is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod Lyft
Copy the code
Usage
API Keys
Lyft.set(clientId: clientId, clientSecret: clientSecret)
Copy the code
Deeplinking
OpenLyftRide (rideType:.line, destination: Address(lat: 37.7763592, LNG: -122.4242038)Copy the code
Dont forget to update Info.plist to support lyft://
Authentication
Client Credentials (2-legged) flow for public endpoints
Lyft.publicLogin { success, error in
}
Copy the code
3-Legged flow for accessing user-specific endpoints
Lyft.userLogin(scope:public) { success, error in }
You will need to setup a redirect too:
swift
func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) - Bool {
return Lyft.openURL(url)
}
Availability
Lyft. RequestRideTypes (rideTypesQuery: rideTypesQuery (lat: 37.7833, LNG: -122.4167)) {result, response, error in} Lyft. RequestETA (etaQuery: etaQuery (Lat: 37.7833, LNG: -122.4167)) {result, response, error in} Lyft. RequestCost (costQuery: costQuery (startLat: 37.7833, startLng: 37.7972-122.4167, endLat: endLng: 122.4533)) {the result, the response, the error in} Lyft. RequestNearbyDrivers (nearbyDriversQuery: nearbyDriversQuery (lat: 37.7789, LNG: -122.45690)) {result, response, error in}Copy the code
Rides
RequestRide (requestRideQuery: requestRideQuery (originLat: 34.305658, originLng: -118.8893667, originAddress:; 123 Main St, Anytown, CA, destinationLat: 36.9442175, destinationLng: -123.8679133, destinationAddress:; 123 Main St, Anytown, CA, rideType: .Lyft)) { result, response, error in } Lyft.requestRideDetails(rideId: 123456789) { result, response, error in } Lyft.cancelRide(rideId: 123456789) { result, response, error in } Lyft.rateAndTipRide(rideId: 123456789, rateAndTipQuery: RateAndTipQuery(rating: 5, tipAmount: 100, tipCurrency: USA, feedback:great ride!) { result, response, error in } Lyft.requestRideReceipt(rideId: 123456789) { result, response, error in } Lyft.requestRidesHistory(ridesHistoryQuery: RidesHistoryQuery(startTime:2015-12-01T21:04:22Z, endTime: 2015-12-04T21:04:22Zuot; , limit: 10)) { result, response, error in }Copy the code
Author
Genady Okrain, [email protected]
License
Lyft is available under the MIT license. See the LICENSE file for more info.