+// ...
+
// Objective-C
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// China based apps should specify the region
@@ -298,7 +309,7 @@ You can optionally set a `LoginButtonDelegate` to handle logging in / logging ou
```swift
// Swift
-let scopes = [.Profile, .Places, .Request]
+let scopes: [RidesScope] = [.Profile, .Places, .Request]
let loginManager = LoginManager(loginType: .Native)
let loginButton = LoginButton(frame: CGRectZero, scopes: scopes, loginManager: loginManager)
loginButton.presentingViewController = self
@@ -365,7 +376,8 @@ let button = RideRequestButton()
let ridesClient = RidesClient()
let pickupLocation = CLLocation(latitude: 37.787654, longitude: -122.402760)
let dropoffLocation = CLLocation(latitude: 37.775200, longitude: -122.417587)
-let builder = RideParametersBuilder().setPickupLocation(pickupLocation).setDropoffLocation(dropoffLocation)
+let dropoffNickname = "Work"
+let builder = RideParametersBuilder().setPickupLocation(pickupLocation).setDropoffLocation(dropoffLocation, nickname: dropoffNickname)
ridesClient.fetchCheapestProduct(pickupLocation: pickupLocation, completion: {
product, response in
if let productID = product?.productID {
@@ -382,9 +394,10 @@ UBSDKRideRequestButton *button = [[UBSDKRideRequestButton alloc] init];
UBSDKRidesClient *ridesClient = [[UBSDKRidesClient alloc] init];
CLLocation *pickupLocation = [[CLLocation alloc] initWithLatitude: 37.787654 longitude: -122.402760];
CLLocation *dropoffLocation = [[CLLocation alloc] initWithLatitude: 37.775200 longitude: -122.417587];
+NSString *dropoffNickname = @"Work";
__block UBSDKRideParametersBuilder *builder = [[UBSDKRideParametersBuilder alloc] init];
builder = [builder setPickupLocation: pickupLocation];
-builder = [builder setDropoffLocation: dropoffLocation];
+builder = [builder setDropoffLocation: dropoffLocation nickname: dropoffNickname];
[ridesClient fetchCheapestProductWithPickupLocation: pickupLocation completion:^(UBSDKUberProduct* _Nullable product, UBSDKResponse* _Nullable response) {
if (product) {
builder = [builder setProductID: product.productID];
@@ -919,13 +932,41 @@ extension your_class : RideRequestViewControllerDelegate {
## Example Apps
-Example apps can be found in the `examples` folder. To run build them, you need to use Carthage. (A quick overview of installing Carthage can be found in the **Getting Started** section.) From inside the `examples/Swift SDK` or `examples/Obj-C SDK` folder, run:
+Example apps can be found in the `examples` folder. To run build them, you can use Carthage or Cocoapods.
+
+### Carthage
+(A quick overview of installing Carthage can be found in the **Getting Started** section.) From inside the `examples/Swift SDK` or `examples/Obj-C SDK` folder, run:
```
carthage update --platform iOS
```
This will build the required dependencies. Once you do that, open `Swift SDK.xcodeproj` or `Obj-C SDK.xcodeproj` in Xcode and run it.
+### CocoaPods
+First, you will have to remove Carthage dependencies. Navigate to `examples/Swift SDK` or `examples/Obj-C SDK` and remove `Cartfile` and `Cartfile.resolved`. If you see a `Carthage` folder, remove that as well. Open .xcworkspace and navigate to **General** tab, scroll to **Embedded Binaries** select `ObjectMapper.framework` and click the `-` button, do the same for `UberRides.framework`. Now go to **Build Settings** tab and scroll to **Search Paths**, click on **Framework Search Paths** and remove the line $(PROJECT_DIR)/Carthage/Build/iOS.
+Now go to **Build Phases** find the **Copy Carthage Frameworks** and remove it.
+
+Now, still inside either `examples/Swift SDK` or `examples/Obj-C SDK`, create a new **Podfile** by running `pod init`, then add `pod 'UberRides'` to your main target. If you are using the Swift SDK, make sure to add the line `use_frameworks!`. Your **Podfile** should look something like this:
+
+
+```ruby
+use_frameworks!
+
+target 'Your Project Name' do
+pod 'UberRides'
+end
+```
+
+Then, run the following command to install the dependency:
+
+```bash
+$ pod install
+```
+
+For Objective-C projects, set the **Embedded Content Contains Swift Code** flag in your project to **Yes** (found under **Build Options** in the **Build Settings** tab).
+
+Now you can build the project.
+
Don’t forget to set `UberClientID`, `UberDisplayName`, and `UberCallbackURIs` in your `Info.plist` file.
diff --git a/UberRides.podspec b/UberRides.podspec
index 7c4a1de3..0bb2d80a 100644
--- a/UberRides.podspec
+++ b/UberRides.podspec
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "UberRides"
- s.version = "0.5.2"
+ s.version = "0.5.3"
s.summary = "The Official Uber Rides iOS SDK."
s.description = <<-DESC
This Swift library allows you to integrate Uber into your iOS app. It is designed to make it quick and easy to add a 'Request a Ride' button in your application, seamlessly connecting your users with Uber.
diff --git a/examples/Obj-C SDK/Cartfile.resolved b/examples/Obj-C SDK/Cartfile.resolved
deleted file mode 100644
index 6979ddb0..00000000
--- a/examples/Obj-C SDK/Cartfile.resolved
+++ /dev/null
@@ -1,2 +0,0 @@
-github "Hearst-DD/ObjectMapper" "1.3.0"
-github "uber/rides-ios-sdk" "v0.5.0"
diff --git a/examples/Swift SDK/Cartfile.resolved b/examples/Swift SDK/Cartfile.resolved
deleted file mode 100644
index 6979ddb0..00000000
--- a/examples/Swift SDK/Cartfile.resolved
+++ /dev/null
@@ -1,2 +0,0 @@
-github "Hearst-DD/ObjectMapper" "1.3.0"
-github "uber/rides-ios-sdk" "v0.5.0"
diff --git a/source/UberRides.xcodeproj/project.pbxproj b/source/UberRides.xcodeproj/project.pbxproj
index 225d6526..75029520 100644
--- a/source/UberRides.xcodeproj/project.pbxproj
+++ b/source/UberRides.xcodeproj/project.pbxproj
@@ -16,7 +16,7 @@
AC04049A1BFACE5400AC1501 /* RequestDeeplinkTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC0404991BFACE5400AC1501 /* RequestDeeplinkTests.swift */; };
D80D4A521CD01894000EE8A9 /* AuthorizationCodeGrantAuthenticator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D80D4A511CD01894000EE8A9 /* AuthorizationCodeGrantAuthenticator.swift */; };
D81A8B161C658A2800339C13 /* TimeEstimate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D81A8B151C658A2800339C13 /* TimeEstimate.swift */; };
- D81A8B181C658A4F00339C13 /* gettimeestimates.json in Resources */ = {isa = PBXBuildFile; fileRef = D81A8B171C658A4F00339C13 /* gettimeestimates.json */; };
+ D81A8B181C658A4F00339C13 /* getTimeEstimates.json in Resources */ = {isa = PBXBuildFile; fileRef = D81A8B171C658A4F00339C13 /* getTimeEstimates.json */; };
D81A8B1A1C69186B00339C13 /* RequestLayerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D81A8B191C69186B00339C13 /* RequestLayerTests.swift */; };
D81A9EC91C6A6C3A000F33F9 /* RidesError.swift in Sources */ = {isa = PBXBuildFile; fileRef = D81A9EC81C6A6C3A000F33F9 /* RidesError.swift */; };
D81C85261CC74F0200DC82EE /* LoginViewAuthenticator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D81C85251CC74F0200DC82EE /* LoginViewAuthenticator.swift */; };
@@ -27,29 +27,29 @@
D81C85321CC819C500DC82EE /* Place.swift in Sources */ = {isa = PBXBuildFile; fileRef = D81C85311CC819C500DC82EE /* Place.swift */; };
D81C85341CC830F800DC82EE /* DistanceEstimate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D81C85331CC830F800DC82EE /* DistanceEstimate.swift */; };
D81C85361CC8315200DC82EE /* RideEstimate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D81C85351CC8315200DC82EE /* RideEstimate.swift */; };
- D81C85381CC831F900DC82EE /* requestestimate.json in Resources */ = {isa = PBXBuildFile; fileRef = D81C85371CC831F900DC82EE /* requestestimate.json */; };
+ D81C85381CC831F900DC82EE /* requestEstimate.json in Resources */ = {isa = PBXBuildFile; fileRef = D81C85371CC831F900DC82EE /* requestEstimate.json */; };
D81C853A1CC836F300DC82EE /* place.json in Resources */ = {isa = PBXBuildFile; fileRef = D81C85391CC836F300DC82EE /* place.json */; };
D81C853C1CC848F800DC82EE /* PaymentMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = D81C853B1CC848F800DC82EE /* PaymentMethod.swift */; };
- D81C853E1CC84DE200DC82EE /* getpaymentmethods.json in Resources */ = {isa = PBXBuildFile; fileRef = D81C853D1CC84DE200DC82EE /* getpaymentmethods.json */; };
+ D81C853E1CC84DE200DC82EE /* getPaymentMethods.json in Resources */ = {isa = PBXBuildFile; fileRef = D81C853D1CC84DE200DC82EE /* getPaymentMethods.json */; };
D81C85501CCEE14900DC82EE /* UberAuthenticatingProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D81C854F1CCEE14900DC82EE /* UberAuthenticatingProtocol.swift */; };
D82706FD1CCF2D1F00D9297E /* RideReceipt.swift in Sources */ = {isa = PBXBuildFile; fileRef = D82706FC1CCF2D1F00D9297E /* RideReceipt.swift */; };
D82706FF1CCF2D6700D9297E /* RideCharge.swift in Sources */ = {isa = PBXBuildFile; fileRef = D82706FE1CCF2D6700D9297E /* RideCharge.swift */; };
- D82707011CCF327E00D9297E /* ridereceipt.json in Resources */ = {isa = PBXBuildFile; fileRef = D82707001CCF327E00D9297E /* ridereceipt.json */; };
+ D82707011CCF327E00D9297E /* rideReceipt.json in Resources */ = {isa = PBXBuildFile; fileRef = D82707001CCF327E00D9297E /* rideReceipt.json */; };
D82707051CCF37BD00D9297E /* RideMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = D82707041CCF37BD00D9297E /* RideMap.swift */; };
- D82707071CCF39B000D9297E /* ridemap.json in Resources */ = {isa = PBXBuildFile; fileRef = D82707061CCF39B000D9297E /* ridemap.json */; };
+ D82707071CCF39B000D9297E /* rideMap.json in Resources */ = {isa = PBXBuildFile; fileRef = D82707061CCF39B000D9297E /* rideMap.json */; };
D829FD531C98A09F00AC6578 /* UserActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = D829FD521C98A09F00AC6578 /* UserActivity.swift */; };
- D829FD551C98A0B200AC6578 /* gethistory.json in Resources */ = {isa = PBXBuildFile; fileRef = D829FD541C98A0B200AC6578 /* gethistory.json */; };
+ D829FD551C98A0B200AC6578 /* getHistory.json in Resources */ = {isa = PBXBuildFile; fileRef = D829FD541C98A0B200AC6578 /* getHistory.json */; };
D829FD9C1C9A3E5200AC6578 /* RideRequestView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D829FD9B1C9A3E5200AC6578 /* RideRequestView.swift */; };
D829FD9E1C9A3E5800AC6578 /* EndpointsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D829FD9D1C9A3E5800AC6578 /* EndpointsManager.swift */; };
D844751B1C5B01FB00B03456 /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = D844751A1C5B01FB00B03456 /* Request.swift */; };
D8505CF91C598FE1007DC576 /* APIManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8505CF81C598FE1007DC576 /* APIManagerTests.swift */; };
- D8582C0D1C5ACB8D00E55231 /* getproducts.json in Resources */ = {isa = PBXBuildFile; fileRef = D8582C0C1C5ACB8D00E55231 /* getproducts.json */; };
+ D8582C0D1C5ACB8D00E55231 /* getProducts.json in Resources */ = {isa = PBXBuildFile; fileRef = D8582C0C1C5ACB8D00E55231 /* getProducts.json */; };
D885CD3C1CADEF1E0055976D /* UberButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = D885CD3B1CADEF1E0055976D /* UberButton.swift */; };
D8874F291C5ABB9E0098DF99 /* UberProduct.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8874F281C5ABB9E0098DF99 /* UberProduct.swift */; };
D8874F2B1C5AC4DB0098DF99 /* ObjectMappingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8874F2A1C5AC4DB0098DF99 /* ObjectMappingTests.swift */; };
- D8874F2E1C5AC5470098DF99 /* getproductid.json in Resources */ = {isa = PBXBuildFile; fileRef = D8874F2D1C5AC5470098DF99 /* getproductid.json */; };
+ D8874F2E1C5AC5470098DF99 /* getProductID.json in Resources */ = {isa = PBXBuildFile; fileRef = D8874F2D1C5AC5470098DF99 /* getProductID.json */; };
D89338F11C77CAE0005B5486 /* OAuthTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D89338F01C77CAE0005B5486 /* OAuthTests.swift */; };
- D8A0D7191C72798400707DC6 /* gettimeestimateproduct.json in Resources */ = {isa = PBXBuildFile; fileRef = D8A0D7181C72798400707DC6 /* gettimeestimateproduct.json */; };
+ D8A0D7191C72798400707DC6 /* getTimeEstimateProduct.json in Resources */ = {isa = PBXBuildFile; fileRef = D8A0D7181C72798400707DC6 /* getTimeEstimateProduct.json */; };
D8A0D71D1C72E3C400707DC6 /* RidesClientTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8A0D71C1C72E3C400707DC6 /* RidesClientTests.swift */; };
D8A0D7231C73A74700707DC6 /* RidesScope.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8A0D7221C73A74700707DC6 /* RidesScope.swift */; };
D8A196BC1C56FC250050A264 /* Media.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D8A196B81C56FC250050A264 /* Media.xcassets */; };
@@ -65,18 +65,20 @@
D8D18E7F1CBF417600055B76 /* Ride.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D18E7E1CBF417600055B76 /* Ride.swift */; };
D8D18E811CBF419700055B76 /* RideStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D18E801CBF419700055B76 /* RideStatus.swift */; };
D8D18E831CBF41F200055B76 /* Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D18E821CBF41F200055B76 /* Driver.swift */; };
- D8D18E851CBF429C00055B76 /* getrequest.json in Resources */ = {isa = PBXBuildFile; fileRef = D8D18E841CBF429C00055B76 /* getrequest.json */; };
- D8D18E871CBF42AD00055B76 /* postrequests.json in Resources */ = {isa = PBXBuildFile; fileRef = D8D18E861CBF42AD00055B76 /* postrequests.json */; };
+ D8D18E851CBF429C00055B76 /* getRequest.json in Resources */ = {isa = PBXBuildFile; fileRef = D8D18E841CBF429C00055B76 /* getRequest.json */; };
+ D8D18E871CBF42AD00055B76 /* postRequests.json in Resources */ = {isa = PBXBuildFile; fileRef = D8D18E861CBF42AD00055B76 /* postRequests.json */; };
D8D2DC091C90E54700A65FF0 /* UserProfile.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D2DC081C90E54700A65FF0 /* UserProfile.swift */; };
- D8D2DC0B1C90E55900A65FF0 /* getme.json in Resources */ = {isa = PBXBuildFile; fileRef = D8D2DC0A1C90E55900A65FF0 /* getme.json */; };
+ D8D2DC0B1C90E55900A65FF0 /* getMe.json in Resources */ = {isa = PBXBuildFile; fileRef = D8D2DC0A1C90E55900A65FF0 /* getMe.json */; };
D8DAB6371C60240B007DE82C /* ModelMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8DAB6361C60240B007DE82C /* ModelMapper.swift */; };
D8E2C96C1C62B3B2006091BA /* PriceEstimate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8E2C96B1C62B3B2006091BA /* PriceEstimate.swift */; };
- D8E2C96E1C62B3C7006091BA /* getpriceestimates.json in Resources */ = {isa = PBXBuildFile; fileRef = D8E2C96D1C62B3C7006091BA /* getpriceestimates.json */; };
+ D8E2C96E1C62B3C7006091BA /* getPriceEstimates.json in Resources */ = {isa = PBXBuildFile; fileRef = D8E2C96D1C62B3C7006091BA /* getPriceEstimates.json */; };
DC1039731C96B1CE004854E3 /* RidesScopeExtensionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC1039721C96B1CE004854E3 /* RidesScopeExtensionsTests.swift */; };
DC1AE1B91CF6BF3900B8CFCB /* LoginButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC1AE1B81CF6BF3900B8CFCB /* LoginButton.swift */; };
DC1AE1BB1CF775F800B8CFCB /* LoginButtonTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC1AE1BA1CF775F800B8CFCB /* LoginButtonTests.swift */; };
DC1AE1BD1CF78A3300B8CFCB /* refresh.json in Resources */ = {isa = PBXBuildFile; fileRef = DC1AE1BC1CF78A3300B8CFCB /* refresh.json */; };
DC1AE1BF1CF78ADF00B8CFCB /* RefreshEndpointTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC1AE1BE1CF78ADF00B8CFCB /* RefreshEndpointTests.swift */; };
+ DC1D80321DA34CA400712178 /* getTimeEstimatesEmpty.json in Resources */ = {isa = PBXBuildFile; fileRef = DC1D80311DA34CA400712178 /* getTimeEstimatesEmpty.json */; };
+ DC1D80341DA34CD600712178 /* getPriceEstimatesEmpty.json in Resources */ = {isa = PBXBuildFile; fileRef = DC1D80331DA34CD600712178 /* getPriceEstimatesEmpty.json */; };
DC2730EF1CBC46520044AB04 /* RidesMocks.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC2730EE1CBC46520044AB04 /* RidesMocks.swift */; };
DC2C77911CACDDD000A052BA /* ModalRideRequestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC2C77901CACDDD000A052BA /* ModalRideRequestViewController.swift */; };
DC3F740B1CF63D6700A713AA /* DeeplinkErrorType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC3F740A1CF63D6700A713AA /* DeeplinkErrorType.swift */; };
@@ -123,8 +125,8 @@
DCAEA9941CEE91D000E6F239 /* AuthenticationURLUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCAEA9931CEE91D000E6F239 /* AuthenticationURLUtility.swift */; };
DCB0D38E1CAD9D5800194DD5 /* RideRequestViewRequestingBehavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCB0D38D1CAD9D5800194DD5 /* RideRequestViewRequestingBehavior.swift */; };
DCB0D3901CADAA6300194DD5 /* RideRequestViewRequestingBehaviorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCB0D38F1CADAA6300194DD5 /* RideRequestViewRequestingBehaviorTests.swift */; };
- DCD8060C1CFE50F300EF6EB1 /* RequestEstimateNoCars.json in Resources */ = {isa = PBXBuildFile; fileRef = DCD8060B1CFE50F300EF6EB1 /* RequestEstimateNoCars.json */; };
- DCD8060E1CFE533F00EF6EB1 /* RideReceiptNullSurgeTotalOwed.json in Resources */ = {isa = PBXBuildFile; fileRef = DCD8060D1CFE533F00EF6EB1 /* RideReceiptNullSurgeTotalOwed.json */; };
+ DCD8060C1CFE50F300EF6EB1 /* requestEstimateNoCars.json in Resources */ = {isa = PBXBuildFile; fileRef = DCD8060B1CFE50F300EF6EB1 /* requestEstimateNoCars.json */; };
+ DCD8060E1CFE533F00EF6EB1 /* rideReceiptNullSurgeTotalOwed.json in Resources */ = {isa = PBXBuildFile; fileRef = DCD8060D1CFE533F00EF6EB1 /* rideReceiptNullSurgeTotalOwed.json */; };
DCE7A0011CF5238A003AC3BD /* BaseDeeplinkTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCE7A0001CF5238A003AC3BD /* BaseDeeplinkTests.swift */; };
DCED60F21C9724D4001A65E0 /* AccessTokenFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCED60F11C9724D4001A65E0 /* AccessTokenFactory.swift */; };
DCED60F61C9770D9001A65E0 /* AccessTokenFactoryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCED60F51C9770D9001A65E0 /* AccessTokenFactoryTests.swift */; };
@@ -161,7 +163,7 @@
C1C60712D3DA8E230F9B36D2 /* Pods-UberRidesTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UberRidesTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-UberRidesTests/Pods-UberRidesTests.release.xcconfig"; sourceTree = ""; };
D80D4A511CD01894000EE8A9 /* AuthorizationCodeGrantAuthenticator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AuthorizationCodeGrantAuthenticator.swift; path = OAuth/AuthorizationCodeGrantAuthenticator.swift; sourceTree = ""; };
D81A8B151C658A2800339C13 /* TimeEstimate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TimeEstimate.swift; path = Model/TimeEstimate.swift; sourceTree = ""; };
- D81A8B171C658A4F00339C13 /* gettimeestimates.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = gettimeestimates.json; sourceTree = ""; };
+ D81A8B171C658A4F00339C13 /* getTimeEstimates.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getTimeEstimates.json; sourceTree = ""; };
D81A8B191C69186B00339C13 /* RequestLayerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RequestLayerTests.swift; sourceTree = ""; };
D81A9EC81C6A6C3A000F33F9 /* RidesError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RidesError.swift; path = Model/RidesError.swift; sourceTree = ""; };
D81C85251CC74F0200DC82EE /* LoginViewAuthenticator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LoginViewAuthenticator.swift; path = OAuth/LoginViewAuthenticator.swift; sourceTree = ""; };
@@ -172,29 +174,29 @@
D81C85311CC819C500DC82EE /* Place.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Place.swift; path = Model/Place.swift; sourceTree = ""; };
D81C85331CC830F800DC82EE /* DistanceEstimate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DistanceEstimate.swift; path = Model/DistanceEstimate.swift; sourceTree = ""; };
D81C85351CC8315200DC82EE /* RideEstimate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RideEstimate.swift; path = Model/RideEstimate.swift; sourceTree = ""; };
- D81C85371CC831F900DC82EE /* requestestimate.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = requestestimate.json; sourceTree = ""; };
+ D81C85371CC831F900DC82EE /* requestEstimate.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = requestEstimate.json; sourceTree = ""; };
D81C85391CC836F300DC82EE /* place.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = place.json; sourceTree = ""; };
D81C853B1CC848F800DC82EE /* PaymentMethod.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PaymentMethod.swift; path = Model/PaymentMethod.swift; sourceTree = ""; };
- D81C853D1CC84DE200DC82EE /* getpaymentmethods.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getpaymentmethods.json; sourceTree = ""; };
+ D81C853D1CC84DE200DC82EE /* getPaymentMethods.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getPaymentMethods.json; sourceTree = ""; };
D81C854F1CCEE14900DC82EE /* UberAuthenticatingProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = UberAuthenticatingProtocol.swift; path = OAuth/UberAuthenticatingProtocol.swift; sourceTree = ""; };
D82706FC1CCF2D1F00D9297E /* RideReceipt.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RideReceipt.swift; path = Model/RideReceipt.swift; sourceTree = ""; };
D82706FE1CCF2D6700D9297E /* RideCharge.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RideCharge.swift; path = Model/RideCharge.swift; sourceTree = ""; };
- D82707001CCF327E00D9297E /* ridereceipt.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = ridereceipt.json; sourceTree = ""; };
+ D82707001CCF327E00D9297E /* rideReceipt.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = rideReceipt.json; sourceTree = ""; };
D82707041CCF37BD00D9297E /* RideMap.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RideMap.swift; path = Model/RideMap.swift; sourceTree = ""; };
- D82707061CCF39B000D9297E /* ridemap.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = ridemap.json; sourceTree = ""; };
+ D82707061CCF39B000D9297E /* rideMap.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = rideMap.json; sourceTree = ""; };
D829FD521C98A09F00AC6578 /* UserActivity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = UserActivity.swift; path = Model/UserActivity.swift; sourceTree = ""; };
- D829FD541C98A0B200AC6578 /* gethistory.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = gethistory.json; sourceTree = ""; };
+ D829FD541C98A0B200AC6578 /* getHistory.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getHistory.json; sourceTree = ""; };
D829FD9B1C9A3E5200AC6578 /* RideRequestView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RideRequestView.swift; sourceTree = ""; };
D829FD9D1C9A3E5800AC6578 /* EndpointsManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EndpointsManager.swift; sourceTree = ""; };
D844751A1C5B01FB00B03456 /* Request.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Request.swift; sourceTree = ""; };
D8505CF81C598FE1007DC576 /* APIManagerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = APIManagerTests.swift; sourceTree = ""; };
- D8582C0C1C5ACB8D00E55231 /* getproducts.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getproducts.json; sourceTree = ""; };
+ D8582C0C1C5ACB8D00E55231 /* getProducts.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getProducts.json; sourceTree = ""; };
D885CD3B1CADEF1E0055976D /* UberButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UberButton.swift; sourceTree = ""; };
D8874F281C5ABB9E0098DF99 /* UberProduct.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = UberProduct.swift; path = Model/UberProduct.swift; sourceTree = ""; };
D8874F2A1C5AC4DB0098DF99 /* ObjectMappingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectMappingTests.swift; sourceTree = ""; };
- D8874F2D1C5AC5470098DF99 /* getproductid.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getproductid.json; sourceTree = ""; };
+ D8874F2D1C5AC5470098DF99 /* getProductID.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getProductID.json; sourceTree = ""; };
D89338F01C77CAE0005B5486 /* OAuthTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OAuthTests.swift; sourceTree = ""; };
- D8A0D7181C72798400707DC6 /* gettimeestimateproduct.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = gettimeestimateproduct.json; sourceTree = ""; };
+ D8A0D7181C72798400707DC6 /* getTimeEstimateProduct.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getTimeEstimateProduct.json; sourceTree = ""; };
D8A0D71C1C72E3C400707DC6 /* RidesClientTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RidesClientTests.swift; sourceTree = ""; };
D8A0D7221C73A74700707DC6 /* RidesScope.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RidesScope.swift; path = Model/RidesScope.swift; sourceTree = ""; };
D8A196B81C56FC250050A264 /* Media.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Media.xcassets; path = Resources/Media.xcassets; sourceTree = ""; };
@@ -210,18 +212,20 @@
D8D18E7E1CBF417600055B76 /* Ride.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Ride.swift; path = Model/Ride.swift; sourceTree = ""; };
D8D18E801CBF419700055B76 /* RideStatus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RideStatus.swift; path = Model/RideStatus.swift; sourceTree = ""; };
D8D18E821CBF41F200055B76 /* Driver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Driver.swift; path = Model/Driver.swift; sourceTree = ""; };
- D8D18E841CBF429C00055B76 /* getrequest.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getrequest.json; sourceTree = ""; };
- D8D18E861CBF42AD00055B76 /* postrequests.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = postrequests.json; sourceTree = ""; };
+ D8D18E841CBF429C00055B76 /* getRequest.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getRequest.json; sourceTree = ""; };
+ D8D18E861CBF42AD00055B76 /* postRequests.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = postRequests.json; sourceTree = ""; };
D8D2DC081C90E54700A65FF0 /* UserProfile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = UserProfile.swift; path = Model/UserProfile.swift; sourceTree = ""; };
- D8D2DC0A1C90E55900A65FF0 /* getme.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getme.json; sourceTree = ""; };
+ D8D2DC0A1C90E55900A65FF0 /* getMe.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getMe.json; sourceTree = ""; };
D8DAB6361C60240B007DE82C /* ModelMapper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModelMapper.swift; sourceTree = ""; };
D8E2C96B1C62B3B2006091BA /* PriceEstimate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PriceEstimate.swift; path = Model/PriceEstimate.swift; sourceTree = ""; };
- D8E2C96D1C62B3C7006091BA /* getpriceestimates.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getpriceestimates.json; sourceTree = ""; };
+ D8E2C96D1C62B3C7006091BA /* getPriceEstimates.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getPriceEstimates.json; sourceTree = ""; };
DC1039721C96B1CE004854E3 /* RidesScopeExtensionsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RidesScopeExtensionsTests.swift; sourceTree = ""; };
DC1AE1B81CF6BF3900B8CFCB /* LoginButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginButton.swift; sourceTree = ""; };
DC1AE1BA1CF775F800B8CFCB /* LoginButtonTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginButtonTests.swift; sourceTree = ""; };
DC1AE1BC1CF78A3300B8CFCB /* refresh.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = refresh.json; sourceTree = ""; };
DC1AE1BE1CF78ADF00B8CFCB /* RefreshEndpointTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RefreshEndpointTests.swift; sourceTree = ""; };
+ DC1D80311DA34CA400712178 /* getTimeEstimatesEmpty.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getTimeEstimatesEmpty.json; sourceTree = ""; };
+ DC1D80331DA34CD600712178 /* getPriceEstimatesEmpty.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getPriceEstimatesEmpty.json; sourceTree = ""; };
DC2730EE1CBC46520044AB04 /* RidesMocks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RidesMocks.swift; sourceTree = ""; };
DC2C77901CACDDD000A052BA /* ModalRideRequestViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModalRideRequestViewController.swift; sourceTree = ""; };
DC3F740A1CF63D6700A713AA /* DeeplinkErrorType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeeplinkErrorType.swift; sourceTree = ""; };
@@ -235,7 +239,7 @@
DC676EBA1CEEA0E4009F7209 /* AuthenticationURLUtilityTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthenticationURLUtilityTests.swift; sourceTree = ""; };
DC676EBC1CEEAA5E009F7209 /* AuthenticationDeeplinkTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthenticationDeeplinkTests.swift; sourceTree = ""; };
DC6852C71CED17B100DCAA3E /* DeeplinkingProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeeplinkingProtocol.swift; sourceTree = ""; };
- DC75DFE51CA4FB5400071417 /* testInfoNoServerToken.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = testInfoNoServerToken.plist; sourceTree = ""; };
+ DC75DFE51CA4FB5400071417 /* testInfoNoServerToken.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = testInfoNoServerToken.plist; sourceTree = ""; };
DC75DFE71CA51DB000071417 /* RideRequestViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RideRequestViewController.swift; sourceTree = ""; };
DC75DFEB1CA5EC1200071417 /* RideParameters.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RideParameters.swift; path = Model/RideParameters.swift; sourceTree = ""; };
DC75DFED1CA5F5EB00071417 /* RideParametersTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RideParametersTest.swift; sourceTree = ""; };
@@ -253,7 +257,7 @@
DC8D42A81CF4C95000C16D16 /* RidesAppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RidesAppDelegate.swift; sourceTree = ""; };
DC8E2ACF1C9AA17400EDD74B /* Configuration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Configuration.swift; sourceTree = ""; };
DC8E2AD11C9B19ED00EDD74B /* ConfigurationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfigurationTests.swift; sourceTree = ""; };
- DC8E2AD31C9B268600EDD74B /* testInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = testInfo.plist; sourceTree = ""; };
+ DC8E2AD31C9B268600EDD74B /* testInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = testInfo.plist; sourceTree = ""; };
DC8FC3621CBDF4D000D58839 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = Resources/en.lproj/Localizable.strings; sourceTree = ""; };
DC8FC3641CBDF4E800D58839 /* hi-IN */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "hi-IN"; path = "Resources/hi-IN.lproj/Localizable.strings"; sourceTree = ""; };
DC8FC3651CBDF52200D58839 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "Resources/zh-Hans.lproj/Localizable.strings"; sourceTree = ""; };
@@ -272,12 +276,12 @@
DCAEA9931CEE91D000E6F239 /* AuthenticationURLUtility.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AuthenticationURLUtility.swift; path = Utilities/AuthenticationURLUtility.swift; sourceTree = ""; };
DCB0D38D1CAD9D5800194DD5 /* RideRequestViewRequestingBehavior.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RideRequestViewRequestingBehavior.swift; sourceTree = ""; };
DCB0D38F1CADAA6300194DD5 /* RideRequestViewRequestingBehaviorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RideRequestViewRequestingBehaviorTests.swift; sourceTree = ""; };
- DCD8060B1CFE50F300EF6EB1 /* RequestEstimateNoCars.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = RequestEstimateNoCars.json; sourceTree = ""; };
- DCD8060D1CFE533F00EF6EB1 /* RideReceiptNullSurgeTotalOwed.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = RideReceiptNullSurgeTotalOwed.json; sourceTree = ""; };
+ DCD8060B1CFE50F300EF6EB1 /* requestEstimateNoCars.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = requestEstimateNoCars.json; sourceTree = ""; };
+ DCD8060D1CFE533F00EF6EB1 /* rideReceiptNullSurgeTotalOwed.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = rideReceiptNullSurgeTotalOwed.json; sourceTree = ""; };
DCE7A0001CF5238A003AC3BD /* BaseDeeplinkTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseDeeplinkTests.swift; sourceTree = ""; };
DCED60F11C9724D4001A65E0 /* AccessTokenFactory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AccessTokenFactory.swift; path = OAuth/AccessTokenFactory.swift; sourceTree = ""; };
DCED60F51C9770D9001A65E0 /* AccessTokenFactoryTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccessTokenFactoryTests.swift; sourceTree = ""; };
- DCF87E781CF2F7AF0081894C /* testInfoMissingCallbacks.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = testInfoMissingCallbacks.plist; sourceTree = ""; };
+ DCF87E781CF2F7AF0081894C /* testInfoMissingCallbacks.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = testInfoMissingCallbacks.plist; sourceTree = ""; };
DCF87E7A1CF3995C0081894C /* BaseAuthenticator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BaseAuthenticator.swift; path = OAuth/BaseAuthenticator.swift; sourceTree = ""; };
DCF87E7C1CF3A9D40081894C /* BaseAuthenticatorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseAuthenticatorTests.swift; sourceTree = ""; };
DCF87E7E1CF3DD010081894C /* NativeAuthenticatorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NativeAuthenticatorTests.swift; sourceTree = ""; };
@@ -442,28 +446,31 @@
D8874F2C1C5AC52B0098DF99 /* Test Data */ = {
isa = PBXGroup;
children = (
- D81A8B171C658A4F00339C13 /* gettimeestimates.json */,
- D8E2C96D1C62B3C7006091BA /* getpriceestimates.json */,
- D8874F2D1C5AC5470098DF99 /* getproductid.json */,
- D8582C0C1C5ACB8D00E55231 /* getproducts.json */,
- D8A0D7181C72798400707DC6 /* gettimeestimateproduct.json */,
- D8D2DC0A1C90E55900A65FF0 /* getme.json */,
- D829FD541C98A0B200AC6578 /* gethistory.json */,
+ D81A8B171C658A4F00339C13 /* getTimeEstimates.json */,
+ D8E2C96D1C62B3C7006091BA /* getPriceEstimates.json */,
+ D8874F2D1C5AC5470098DF99 /* getProductID.json */,
+ D8582C0C1C5ACB8D00E55231 /* getProducts.json */,
+ D8A0D7181C72798400707DC6 /* getTimeEstimateProduct.json */,
+ D8D2DC0A1C90E55900A65FF0 /* getMe.json */,
+ D829FD541C98A0B200AC6578 /* getHistory.json */,
+ D8D18E841CBF429C00055B76 /* getRequest.json */,
+ D8D18E861CBF42AD00055B76 /* postRequests.json */,
+ D81C85371CC831F900DC82EE /* requestEstimate.json */,
+ D81C85391CC836F300DC82EE /* place.json */,
+ D81C853D1CC84DE200DC82EE /* getPaymentMethods.json */,
+ D82707001CCF327E00D9297E /* rideReceipt.json */,
+ D82707061CCF39B000D9297E /* rideMap.json */,
+ DC1AE1BC1CF78A3300B8CFCB /* refresh.json */,
+ DCD8060B1CFE50F300EF6EB1 /* requestEstimateNoCars.json */,
+ DCD8060D1CFE533F00EF6EB1 /* rideReceiptNullSurgeTotalOwed.json */,
DC8E2AD31C9B268600EDD74B /* testInfo.plist */,
DC75DFE51CA4FB5400071417 /* testInfoNoServerToken.plist */,
DCF87E781CF2F7AF0081894C /* testInfoMissingCallbacks.plist */,
- D8D18E841CBF429C00055B76 /* getrequest.json */,
- D8D18E861CBF42AD00055B76 /* postrequests.json */,
- D81C85371CC831F900DC82EE /* requestestimate.json */,
- D81C85391CC836F300DC82EE /* place.json */,
- D81C853D1CC84DE200DC82EE /* getpaymentmethods.json */,
- D82707001CCF327E00D9297E /* ridereceipt.json */,
- D82707061CCF39B000D9297E /* ridemap.json */,
- DC1AE1BC1CF78A3300B8CFCB /* refresh.json */,
- DCD8060B1CFE50F300EF6EB1 /* RequestEstimateNoCars.json */,
- DCD8060D1CFE533F00EF6EB1 /* RideReceiptNullSurgeTotalOwed.json */,
+ DC1D80311DA34CA400712178 /* getTimeEstimatesEmpty.json */,
+ DC1D80331DA34CD600712178 /* getPriceEstimatesEmpty.json */,
);
name = "Test Data";
+ path = TestData;
sourceTree = "";
};
D8A196B61C56FC1A0050A264 /* Resources */ = {
@@ -631,26 +638,28 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- D8D18E871CBF42AD00055B76 /* postrequests.json in Resources */,
+ D8D18E871CBF42AD00055B76 /* postRequests.json in Resources */,
DC1AE1BD1CF78A3300B8CFCB /* refresh.json in Resources */,
- D81C853E1CC84DE200DC82EE /* getpaymentmethods.json in Resources */,
- D829FD551C98A0B200AC6578 /* gethistory.json in Resources */,
+ D81C853E1CC84DE200DC82EE /* getPaymentMethods.json in Resources */,
+ D829FD551C98A0B200AC6578 /* getHistory.json in Resources */,
D81C853A1CC836F300DC82EE /* place.json in Resources */,
DCF87E791CF2F7AF0081894C /* testInfoMissingCallbacks.plist in Resources */,
- DCD8060E1CFE533F00EF6EB1 /* RideReceiptNullSurgeTotalOwed.json in Resources */,
- D8D2DC0B1C90E55900A65FF0 /* getme.json in Resources */,
- D82707011CCF327E00D9297E /* ridereceipt.json in Resources */,
- D8582C0D1C5ACB8D00E55231 /* getproducts.json in Resources */,
- D8874F2E1C5AC5470098DF99 /* getproductid.json in Resources */,
+ DCD8060E1CFE533F00EF6EB1 /* rideReceiptNullSurgeTotalOwed.json in Resources */,
+ D8D2DC0B1C90E55900A65FF0 /* getMe.json in Resources */,
+ D82707011CCF327E00D9297E /* rideReceipt.json in Resources */,
+ D8582C0D1C5ACB8D00E55231 /* getProducts.json in Resources */,
+ D8874F2E1C5AC5470098DF99 /* getProductID.json in Resources */,
DC8E2AD41C9B268600EDD74B /* testInfo.plist in Resources */,
- D8A0D7191C72798400707DC6 /* gettimeestimateproduct.json in Resources */,
+ DC1D80341DA34CD600712178 /* getPriceEstimatesEmpty.json in Resources */,
+ D8A0D7191C72798400707DC6 /* getTimeEstimateProduct.json in Resources */,
DC75DFE61CA4FB5400071417 /* testInfoNoServerToken.plist in Resources */,
- D8E2C96E1C62B3C7006091BA /* getpriceestimates.json in Resources */,
- D82707071CCF39B000D9297E /* ridemap.json in Resources */,
- DCD8060C1CFE50F300EF6EB1 /* RequestEstimateNoCars.json in Resources */,
- D81C85381CC831F900DC82EE /* requestestimate.json in Resources */,
- D8D18E851CBF429C00055B76 /* getrequest.json in Resources */,
- D81A8B181C658A4F00339C13 /* gettimeestimates.json in Resources */,
+ DC1D80321DA34CA400712178 /* getTimeEstimatesEmpty.json in Resources */,
+ D8E2C96E1C62B3C7006091BA /* getPriceEstimates.json in Resources */,
+ D82707071CCF39B000D9297E /* rideMap.json in Resources */,
+ DCD8060C1CFE50F300EF6EB1 /* requestEstimateNoCars.json in Resources */,
+ D81C85381CC831F900DC82EE /* requestEstimate.json in Resources */,
+ D8D18E851CBF429C00055B76 /* getRequest.json in Resources */,
+ D81A8B181C658A4F00339C13 /* getTimeEstimates.json in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/source/UberRides/Info.plist b/source/UberRides/Info.plist
index 0d4fc0a8..c89d5f29 100644
--- a/source/UberRides/Info.plist
+++ b/source/UberRides/Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 0.5.2
+ 0.5.3
CFBundleSignature
????
CFBundleVersion
diff --git a/source/UberRides/Model/Ride.swift b/source/UberRides/Model/Ride.swift
index ff074fbc..1ff1ae36 100644
--- a/source/UberRides/Model/Ride.swift
+++ b/source/UberRides/Model/Ride.swift
@@ -50,7 +50,7 @@ import ObjectMapper
public private(set) var requestID: String?
/// The status of the Request indicating state.
- public private(set) var status: RideStatus?
+ public private(set) var status: RideStatus = .Unknown
/// The surge pricing multiplier used to calculate the increased price of a Request.
public private(set) var surgeMultiplier: Double = 1.0
diff --git a/source/UberRides/Model/RidesError.swift b/source/UberRides/Model/RidesError.swift
index 3371e487..e11aec91 100644
--- a/source/UberRides/Model/RidesError.swift
+++ b/source/UberRides/Model/RidesError.swift
@@ -45,6 +45,18 @@ import ObjectMapper
override init() {
}
+
+ /// Convenience initializer.
+ ///
+ /// - parameter status: The Status code to use for this error
+ /// - parameter code: The underscore delimited code string to use for this error
+ /// - parameter title: Human readable message which corresponds to this error
+ public convenience init(status: Int, code: String?, title: String?) {
+ self.init()
+ self.status = status
+ self.code = code
+ self.title = title
+ }
public required init?(_ map: Map) {
}
diff --git a/source/UberRides/Model/RidesScope.swift b/source/UberRides/Model/RidesScope.swift
index 1d9ddf5c..30afaa69 100644
--- a/source/UberRides/Model/RidesScope.swift
+++ b/source/UberRides/Model/RidesScope.swift
@@ -173,6 +173,12 @@ class RidesScopeFactory : NSObject {
return .Profile
case RidesScopeType.RideWidgets.toString():
return .RideWidgets
+ case RidesScopeType.AllTrips.toString():
+ return .AllTrips
+ case RidesScopeType.Request.toString():
+ return .Request
+ case RidesScopeType.RequestReceipt.toString():
+ return .RequestReceipt
default:
return nil
}
diff --git a/source/UberRides/OAuth/KeychainWrapper.swift b/source/UberRides/OAuth/KeychainWrapper.swift
index 52b76931..720806b8 100644
--- a/source/UberRides/OAuth/KeychainWrapper.swift
+++ b/source/UberRides/OAuth/KeychainWrapper.swift
@@ -66,7 +66,7 @@ class KeychainWrapper: NSObject {
if result == errSecDuplicateItem {
result = SecItemUpdate(keychainItemData, [ValueData: value])
}
-
+
return result == errSecSuccess
}
@@ -127,7 +127,7 @@ class KeychainWrapper: NSObject {
keychainItemData[Class] = kSecClassGenericPassword
if !accessGroup.isEmpty {
- keychainItemData[AttrAccount] = accessGroup
+ keychainItemData[AttrAccessGroup] = accessGroup
}
return keychainItemData
diff --git a/source/UberRides/OAuth/LoginManager.swift b/source/UberRides/OAuth/LoginManager.swift
index f949d3c8..cb1bfa7d 100644
--- a/source/UberRides/OAuth/LoginManager.swift
+++ b/source/UberRides/OAuth/LoginManager.swift
@@ -91,7 +91,7 @@
- returns: An initialized LoginManager
*/
@objc public convenience init(loginType: LoginType) {
- self.init(accessTokenIdentifier: Configuration.getDefaultAccessTokenIdentifier(), keychainAccessGroup: Configuration.getDefaultAccessTokenIdentifier(), loginType: loginType)
+ self.init(accessTokenIdentifier: Configuration.getDefaultAccessTokenIdentifier(), keychainAccessGroup: Configuration.getDefaultKeychainAccessGroup(), loginType: loginType)
}
/**
@@ -102,7 +102,7 @@
- returns: An initialized LoginManager
*/
@objc public convenience override init() {
- self.init(accessTokenIdentifier: Configuration.getDefaultAccessTokenIdentifier(), keychainAccessGroup: Configuration.getDefaultAccessTokenIdentifier(), loginType: LoginType.Native)
+ self.init(accessTokenIdentifier: Configuration.getDefaultAccessTokenIdentifier(), keychainAccessGroup: Configuration.getDefaultKeychainAccessGroup(), loginType: LoginType.Native)
}
// Mark: LoginManaging
diff --git a/source/UberRides/RideRequestButton.swift b/source/UberRides/RideRequestButton.swift
index 66c24cf1..bab81123 100644
--- a/source/UberRides/RideRequestButton.swift
+++ b/source/UberRides/RideRequestButton.swift
@@ -278,6 +278,7 @@ import CoreLocation
*/
public func loadRideInformation() {
guard client != nil else {
+ delegate?.rideRequestButton(self, didReceiveError: createValidationFailedError())
return
}
@@ -339,8 +340,13 @@ import CoreLocation
attrString.addAttribute(NSFontAttributeName, value: metadataFont, range: (attrString.string as NSString).rangeOfString(title))
attrString.addAttribute(NSFontAttributeName, value: metadataFont, range: (attrString.string as NSString).rangeOfString(subtitle))
-
- uberTitleLabel.text = LocalizationUtil.localizedString(forKey: "Get a ride", comment: "Request button shorter description")
+
+ if attrString.string.isEmpty {
+ uberTitleLabel.text = LocalizationUtil.localizedString(forKey: "Ride there with Uber", comment: "Request button description")
+ } else {
+ uberTitleLabel.text = LocalizationUtil.localizedString(forKey: "Get a ride", comment: "Request button shorter description")
+ }
+
uberMetadataLabel.attributedText = attrString
}
@@ -356,7 +362,11 @@ import CoreLocation
return attachment
}
-
+
+ private func createValidationFailedError() -> RidesError {
+ return RidesError(status: 422, code: "validation_failed", title: "Invalid Request")
+ }
+
/**
Sets metadata on button by fetching all required information.
*/
@@ -365,6 +375,7 @@ import CoreLocation
* These are all required for the following requests.
*/
guard let client = client, let pickupLatitude = metadata.pickupLatitude, let pickupLongitude = metadata.pickupLongitude, let productID = metadata.productID else {
+ delegate?.rideRequestButton(self, didReceiveError: createValidationFailedError())
return
}
@@ -375,40 +386,44 @@ import CoreLocation
// Set the information on the button label once all information is retrieved.
dispatch_group_notify(downloadGroup, dispatch_get_main_queue(), {
- guard let estimate = self.metadata.timeEstimate?.estimate else {
- for error in errors {
- self.delegate?.rideRequestButton(self, didReceiveError: error)
+
+ var titleText = ""
+ var subtitleText = ""
+
+ if let timeEstimate = self.metadata.timeEstimate?.estimate {
+ let mins = timeEstimate / 60
+ if mins == 1 {
+ titleText = String(format: LocalizationUtil.localizedString(forKey: "%d min away", comment: "Estimate is for car one minute away"), mins).uppercaseStringWithLocale(NSLocale.currentLocale())
+ } else {
+ titleText = String(format: LocalizationUtil.localizedString(forKey: "%d mins away", comment: "Estimate is for car multiple minutes away"), mins).uppercaseStringWithLocale(NSLocale.currentLocale())
}
- return
- }
-
- let mins = estimate/60
- var titleText: String
- if mins == 1 {
- titleText = String(format: LocalizationUtil.localizedString(forKey: "%d min away", comment: "Estimate is for car one minute away"), mins).uppercaseStringWithLocale(NSLocale.currentLocale())
- } else {
- titleText = String(format: LocalizationUtil.localizedString(forKey: "%d mins away", comment: "Estimate is for car multiple minutes away"), mins).uppercaseStringWithLocale(NSLocale.currentLocale())
}
- var subtitleText = ""
+
var surge = false
-
- if let productName = self.metadata.productName {
- for estimate in self.metadata.priceEstimates {
- if estimate.productID == productID, let price = estimate.estimate {
- if estimate.surgeMultiplier > 1.0 {
- surge = true
- }
- subtitleText = String(format: LocalizationUtil.localizedString(forKey: "%1$@ for %2$@", comment: "Price estimate string for an Uber product"), price, productName)
+ for estimate in self.metadata.priceEstimates {
+ if let price = estimate.estimate, productName = estimate.name where estimate.productID == productID {
+ if estimate.surgeMultiplier > 1.0 {
+ surge = true
+ }
+ let priceEstimateString = String(format: LocalizationUtil.localizedString(forKey: "%1$@ for %2$@", comment: "Price estimate string for an Uber product"), price, productName)
+ if titleText.isEmpty {
+ titleText = priceEstimateString
+ } else {
+ subtitleText = priceEstimateString
}
+ break
}
}
-
- self.setMultilineAttributedString(titleText, subtitle: subtitleText, surge: surge)
- self.delegate?.rideRequestButtonDidLoadRideInformation(self)
+
+ if !titleText.isEmpty {
+ self.setMultilineAttributedString(titleText, subtitle: subtitleText, surge: surge)
+ }
for error in errors {
self.delegate?.rideRequestButton(self, didReceiveError: error)
}
+
+ self.delegate?.rideRequestButtonDidLoadRideInformation(self)
})
// Get time estimate for productID
@@ -418,14 +433,9 @@ import CoreLocation
dispatch_group_leave(downloadGroup)
return
}
-
- if timeEstimates.count == 0 {
- dispatch_group_leave(downloadGroup)
- return
- }
-
- self.metadata.timeEstimate = timeEstimates.first!
- self.metadata.productName = timeEstimates.first!.name
+
+ self.metadata.timeEstimate = timeEstimates.first
+ self.metadata.productName = timeEstimates.first?.name
dispatch_group_leave(downloadGroup)
}
@@ -439,12 +449,7 @@ import CoreLocation
dispatch_group_leave(downloadGroup)
return
}
-
- if priceEstimates.count == 0 {
- dispatch_group_leave(downloadGroup)
- return
- }
-
+
self.metadata.priceEstimates = priceEstimates
dispatch_group_leave(downloadGroup)
}
@@ -482,9 +487,9 @@ struct ButtonMetadata {
var dropoffLongitude: Double?
var timeEstimate: TimeEstimate?
private var priceEstimateList: [PriceEstimate]?
- var priceEstimates: [PriceEstimate]! {
+ var priceEstimates: [PriceEstimate] {
get {
- return priceEstimateList != nil ? priceEstimateList : []
+ return priceEstimateList ?? []
}
set {
priceEstimateList = newValue
diff --git a/source/UberRides/RidesClient.swift b/source/UberRides/RidesClient.swift
index 32bbd4ae..02717e6e 100644
--- a/source/UberRides/RidesClient.swift
+++ b/source/UberRides/RidesClient.swift
@@ -44,7 +44,7 @@ import CoreLocation
private var serverToken: String? = Configuration.getServerToken()
/**
- Initializer for the RidesClient. The RidesClient handles making reqeusts to the API
+ Initializer for the RidesClient. The RidesClient handles making requests to the API
for you.
- parameter accessTokenIdentifier: The accessTokenIdentifier to use. This identifier
@@ -64,11 +64,11 @@ import CoreLocation
}
/**
- Initializer for the RidesClient. The RidesClient handles making reqeusts to the API
+ Initializer for the RidesClient. The RidesClient handles making requests to the API
for you.
By default, uses NSURLSessionConfiguration.defaultSessionConfiguration() for the URL requests
- - parameter accessTokenIdentifier: Initializer for the RidesClient. The RidesClient handles making reqeusts to the API
+ - parameter accessTokenIdentifier: Initializer for the RidesClient. The RidesClient handles making requests to the API
for you.
By default, it is initialized using the keychainAccessGroup default from your Configuration object
Also uses NSURLSessionConfiguration.defaultSessionConfiguration() for the URL requests
@@ -85,7 +85,7 @@ import CoreLocation
}
/**
- Initializer for the RidesClient. The RidesClient handles making reqeusts to the API
+ Initializer for the RidesClient. The RidesClient handles making requests to the API
for you.
By default, it is initialized using the keychainAccessGroup default from your Configuration object
@@ -102,7 +102,7 @@ import CoreLocation
}
/**
- Initializer for the RidesClient. The RidesClient handles making reqeusts to the API
+ Initializer for the RidesClient. The RidesClient handles making requests to the API
for you.
By default, it is initialized using the keychainAccessGroup default from your Configuration object
Also uses NSURLSessionConfiguration.defaultSessionConfiguration() for the URL requests
@@ -119,7 +119,7 @@ import CoreLocation
}
/**
- Initializer for the RidesClient. The RidesClient handles making reqeusts to the API
+ Initializer for the RidesClient. The RidesClient handles making requests to the API
for you.
By default, it is initialized using the accessTokenIdentifier & keychainAccessGroup
defaults from your Configuration object
diff --git a/source/UberRidesTests/LoginButtonTests.swift b/source/UberRidesTests/LoginButtonTests.swift
index 1413b24d..c6731ca9 100644
--- a/source/UberRidesTests/LoginButtonTests.swift
+++ b/source/UberRidesTests/LoginButtonTests.swift
@@ -45,52 +45,46 @@ class LoginButtonTests : XCTestCase {
func testButtonState_whenSignedOut() {
let identifier = "testIdentifier"
- let accessGroup = "testAccessGroup"
-
- keychain?.setAccessGroup(accessGroup)
- keychain?.deleteObjectForKey(identifier)
+
+ keychain!.deleteObjectForKey(identifier)
- let token = TokenManager.fetchToken(identifier, accessGroup: accessGroup)
+ let token = TokenManager.fetchToken(identifier)
XCTAssertNil(token)
- let loginManager = LoginManager(accessTokenIdentifier: identifier, keychainAccessGroup: accessGroup, loginType: .Implicit)
+ let loginManager = LoginManager(accessTokenIdentifier: identifier, keychainAccessGroup: nil, loginType: .Implicit)
let loginButton = LoginButton(frame: CGRectZero, scopes: [], loginManager: loginManager)
XCTAssertEqual(loginButton.buttonState, LoginButtonState.SignedOut)
- keychain?.deleteObjectForKey(identifier)
+ keychain!.deleteObjectForKey(identifier)
}
func testLabelText_whenSignedIn() {
let identifier = "testIdentifier"
- let accessGroup = "testAccessGroup"
let token = getTestToken()
+
+ XCTAssertTrue(keychain!.setObject(token, key: identifier))
- keychain?.setAccessGroup(accessGroup)
- keychain?.setObject(token, key: identifier)
-
- let loginManager = LoginManager(accessTokenIdentifier: identifier, keychainAccessGroup: accessGroup, loginType: .Implicit)
+ let loginManager = LoginManager(accessTokenIdentifier: identifier, keychainAccessGroup: nil, loginType: .Implicit)
let loginButton = LoginButton(frame: CGRectZero, scopes: [], loginManager: loginManager)
XCTAssertEqual(loginButton.buttonState, LoginButtonState.SignedIn)
- keychain?.deleteObjectForKey(identifier)
+ XCTAssertTrue(keychain!.deleteObjectForKey(identifier))
}
func testLoginCalled_whenSignedOut() {
let identifier = "testIdentifier"
- let accessGroup = "testAccessGroup"
-
- keychain?.setAccessGroup(accessGroup)
- keychain?.deleteObjectForKey(identifier)
+
+ keychain!.deleteObjectForKey(identifier)
- let token = TokenManager.fetchToken(identifier, accessGroup: accessGroup)
+ let token = TokenManager.fetchToken(identifier)
XCTAssertNil(token)
let expectation = expectationWithDescription("Expected executeLogin() called")
- let loginManager = LoginManagerPartialMock(accessTokenIdentifier: identifier, keychainAccessGroup: accessGroup, loginType: .Implicit)
+ let loginManager = LoginManagerPartialMock(accessTokenIdentifier: identifier, keychainAccessGroup: nil, loginType: .Implicit)
loginManager.executeLoginClosure = {
expectation.fulfill()
}
@@ -102,23 +96,20 @@ class LoginButtonTests : XCTestCase {
loginButton.uberButtonTapped(loginButton)
waitForExpectationsWithTimeout(0.2) { _ in
- self.keychain?.deleteObjectForKey(identifier)
+ self.keychain!.deleteObjectForKey(identifier)
}
}
func testLogOut_whenSignedIn() {
let identifier = "testIdentifier"
- let accessGroup = "testAccessGroup"
-
- keychain?.setAccessGroup(accessGroup)
- keychain?.deleteObjectForKey(identifier)
+
+ keychain!.deleteObjectForKey(identifier)
let token = getTestToken()
+
+ XCTAssertTrue(keychain!.setObject(token, key: identifier))
- keychain?.setAccessGroup(accessGroup)
- keychain?.setObject(token, key: identifier)
-
- let loginManager = LoginManager(accessTokenIdentifier: identifier, keychainAccessGroup: accessGroup, loginType: .Implicit)
+ let loginManager = LoginManager(accessTokenIdentifier: identifier, keychainAccessGroup: nil, loginType: .Implicit)
let loginButton = LoginButton(frame: CGRectZero, scopes: [.Profile], loginManager: loginManager)
loginButton.presentingViewController = UIViewController()
@@ -126,9 +117,9 @@ class LoginButtonTests : XCTestCase {
XCTAssertEqual(loginButton.buttonState, LoginButtonState.SignedIn)
loginButton.uberButtonTapped(loginButton)
- XCTAssertNil(TokenManager.fetchToken(identifier, accessGroup: accessGroup))
+ XCTAssertNil(TokenManager.fetchToken(identifier))
- self.keychain?.deleteObjectForKey(identifier)
+ keychain!.deleteObjectForKey(identifier)
}
//Mark: Helpers
diff --git a/source/UberRidesTests/ObjectMappingTests.swift b/source/UberRidesTests/ObjectMappingTests.swift
index f56ac2cb..636b0bc3 100644
--- a/source/UberRidesTests/ObjectMappingTests.swift
+++ b/source/UberRidesTests/ObjectMappingTests.swift
@@ -44,7 +44,7 @@ class ObjectMappingTests: XCTestCase {
*/
func testGetProduct() {
let bundle = NSBundle(forClass: ObjectMappingTests.self)
- if let path = bundle.pathForResource("getproductid", ofType: "json") {
+ if let path = bundle.pathForResource("getProductID", ofType: "json") {
if let jsonData = NSData(contentsOfFile: path) {
let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)!
let product = ModelMapper().mapFromJSON(JSONString)
@@ -79,7 +79,7 @@ class ObjectMappingTests: XCTestCase {
*/
func testGetProductBadJSON() {
let bundle = NSBundle(forClass: ObjectMappingTests.self)
- if let path = bundle.pathForResource("getproductid", ofType: "json") {
+ if let path = bundle.pathForResource("getProductID", ofType: "json") {
if let jsonData = NSData(contentsOfFile: path) {
var JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)!
@@ -97,7 +97,7 @@ class ObjectMappingTests: XCTestCase {
*/
func testGetAllProducts() {
let bundle = NSBundle(forClass: ObjectMappingTests.self)
- if let path = bundle.pathForResource("getproducts", ofType: "json") {
+ if let path = bundle.pathForResource("getProducts", ofType: "json") {
if let jsonData = NSData(contentsOfFile: path) {
let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)!
let products = ModelMapper().mapFromJSON(JSONString)
@@ -118,7 +118,7 @@ class ObjectMappingTests: XCTestCase {
*/
func testGetAllProductsBadJSON() {
let bundle = NSBundle(forClass: ObjectMappingTests.self)
- if let path = bundle.pathForResource("getproducts", ofType: "json") {
+ if let path = bundle.pathForResource("getProducts", ofType: "json") {
if let jsonData = NSData(contentsOfFile: path) {
var JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)!
@@ -136,7 +136,7 @@ class ObjectMappingTests: XCTestCase {
*/
func testGetTimeEstimates() {
let bundle = NSBundle(forClass: ObjectMappingTests.self)
- if let path = bundle.pathForResource("gettimeestimates", ofType: "json") {
+ if let path = bundle.pathForResource("getTimeEstimates", ofType: "json") {
if let jsonData = NSData(contentsOfFile: path) {
let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)!
let timeEstimates = ModelMapper().mapFromJSON(JSONString)
@@ -160,7 +160,7 @@ class ObjectMappingTests: XCTestCase {
*/
func testGetTimeEstimatesBadJSON() {
let bundle = NSBundle(forClass: ObjectMappingTests.self)
- if let path = bundle.pathForResource("gettimeestimates", ofType: "json") {
+ if let path = bundle.pathForResource("getTimeEstimates", ofType: "json") {
if let jsonData = NSData(contentsOfFile: path) {
var JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)!
@@ -178,7 +178,7 @@ class ObjectMappingTests: XCTestCase {
*/
func testGetPriceEstimates() {
let bundle = NSBundle(forClass: ObjectMappingTests.self)
- if let path = bundle.pathForResource("getpriceestimates", ofType: "json") {
+ if let path = bundle.pathForResource("getPriceEstimates", ofType: "json") {
if let jsonData = NSData(contentsOfFile: path) {
let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)!
let priceEstimates = ModelMapper().mapFromJSON(JSONString)
@@ -205,7 +205,7 @@ class ObjectMappingTests: XCTestCase {
*/
func testGetPriceEstimatesBadJSON() {
let bundle = NSBundle(forClass: ObjectMappingTests.self)
- if let path = bundle.pathForResource("getpriceestimates", ofType: "json") {
+ if let path = bundle.pathForResource("getPriceEstimates", ofType: "json") {
if let jsonData = NSData(contentsOfFile: path) {
var JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)!
@@ -223,7 +223,7 @@ class ObjectMappingTests: XCTestCase {
*/
func testGetTripHistory() {
let bundle = NSBundle(forClass: ObjectMappingTests.self)
- if let path = bundle.pathForResource("gethistory", ofType: "json") {
+ if let path = bundle.pathForResource("getHistory", ofType: "json") {
if let jsonData = NSData(contentsOfFile: path) {
let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)!
let userActivity = ModelMapper().mapFromJSON(JSONString)
@@ -258,7 +258,7 @@ class ObjectMappingTests: XCTestCase {
*/
func testGetHistoryBadJSON() {
let bundle = NSBundle(forClass: ObjectMappingTests.self)
- if let path = bundle.pathForResource("gethistory", ofType: "json") {
+ if let path = bundle.pathForResource("getHistory", ofType: "json") {
if let jsonData = NSData(contentsOfFile: path) {
var JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)!
@@ -276,7 +276,7 @@ class ObjectMappingTests: XCTestCase {
*/
func testGetUserProfile() {
let bundle = NSBundle(forClass: ObjectMappingTests.self)
- if let path = bundle.pathForResource("getme", ofType: "json") {
+ if let path = bundle.pathForResource("getMe", ofType: "json") {
if let jsonData = NSData(contentsOfFile: path) {
let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)!
let userProfile = ModelMapper().mapFromJSON(JSONString)
@@ -296,7 +296,7 @@ class ObjectMappingTests: XCTestCase {
*/
func testGetUserProfileBadJSON() {
let bundle = NSBundle(forClass: ObjectMappingTests.self)
- if let path = bundle.pathForResource("getme", ofType: "json") {
+ if let path = bundle.pathForResource("getMe", ofType: "json") {
if let jsonData = NSData(contentsOfFile: path) {
var JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)!
JSONString = JSONString.stringByReplacingOccurrencesOfString("{", withString: "")
@@ -312,7 +312,7 @@ class ObjectMappingTests: XCTestCase {
*/
func testPostRequest() {
let bundle = NSBundle(forClass: ObjectMappingTests.self)
- if let path = bundle.pathForResource("postrequests", ofType: "json") {
+ if let path = bundle.pathForResource("postRequests", ofType: "json") {
if let jsonData = NSData(contentsOfFile: path) {
let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)!
guard let trip = ModelMapper().mapFromJSON(JSONString) else {
@@ -337,7 +337,7 @@ class ObjectMappingTests: XCTestCase {
*/
func testGetRequest() {
let bundle = NSBundle(forClass: ObjectMappingTests.self)
- if let path = bundle.pathForResource("getrequest", ofType: "json") {
+ if let path = bundle.pathForResource("getRequest", ofType: "json") {
if let jsonData = NSData(contentsOfFile: path) {
let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)!
guard let trip = ModelMapper().mapFromJSON(JSONString) else {
@@ -385,7 +385,7 @@ class ObjectMappingTests: XCTestCase {
*/
func testGetRequestEstimate() {
let bundle = NSBundle(forClass: ObjectMappingTests.self)
- if let path = bundle.pathForResource("requestestimate", ofType: "json") {
+ if let path = bundle.pathForResource("requestEstimate", ofType: "json") {
if let jsonData = NSData(contentsOfFile: path) {
let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)!
let estimate = ModelMapper().mapFromJSON(JSONString)
@@ -406,7 +406,7 @@ class ObjectMappingTests: XCTestCase {
func testGetRequestEstimateNoCars() {
let bundle = NSBundle(forClass: ObjectMappingTests.self)
- if let path = bundle.pathForResource("RequestEstimateNoCars", ofType: "json") {
+ if let path = bundle.pathForResource("requestEstimateNoCars", ofType: "json") {
if let jsonData = NSData(contentsOfFile: path) {
let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)!
let estimate = ModelMapper().mapFromJSON(JSONString)
@@ -451,7 +451,7 @@ class ObjectMappingTests: XCTestCase {
*/
func testGetPaymentMethods() {
let bundle = NSBundle(forClass: ObjectMappingTests.self)
- if let path = bundle.pathForResource("getpaymentmethods", ofType: "json") {
+ if let path = bundle.pathForResource("getPaymentMethods", ofType: "json") {
if let jsonData = NSData(contentsOfFile: path) {
let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)!
guard let paymentMethods = ModelMapper().mapFromJSON(JSONString) else {
@@ -494,7 +494,7 @@ class ObjectMappingTests: XCTestCase {
*/
func testGetRideReceipt() {
let bundle = NSBundle(forClass: ObjectMappingTests.self)
- if let path = bundle.pathForResource("ridereceipt", ofType: "json") {
+ if let path = bundle.pathForResource("rideReceipt", ofType: "json") {
if let jsonData = NSData(contentsOfFile: path) {
let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)!
guard let receipt = ModelMapper().mapFromJSON(JSONString) else {
@@ -563,7 +563,7 @@ class ObjectMappingTests: XCTestCase {
func testGetRideReceipt_withNullSurge_withTotalOwed() {
let bundle = NSBundle(forClass: ObjectMappingTests.self)
- if let path = bundle.pathForResource("RideReceiptNullSurgeTotalOwed", ofType: "json") {
+ if let path = bundle.pathForResource("rideReceiptNullSurgeTotalOwed", ofType: "json") {
if let jsonData = NSData(contentsOfFile: path) {
let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)!
guard let receipt = ModelMapper().mapFromJSON(JSONString) else {
@@ -628,7 +628,7 @@ class ObjectMappingTests: XCTestCase {
*/
func testGetRideReceiptBadJSON() {
let bundle = NSBundle(forClass: ObjectMappingTests.self)
- if let path = bundle.pathForResource("ridereceipt", ofType: "json") {
+ if let path = bundle.pathForResource("rideReceipt", ofType: "json") {
if let jsonData = NSData(contentsOfFile: path) {
var JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)!
JSONString = JSONString.stringByReplacingOccurrencesOfString("[", withString: "")
@@ -646,7 +646,7 @@ class ObjectMappingTests: XCTestCase {
*/
func testGetRideMap() {
let bundle = NSBundle(forClass: ObjectMappingTests.self)
- if let path = bundle.pathForResource("ridemap", ofType: "json") {
+ if let path = bundle.pathForResource("rideMap", ofType: "json") {
if let jsonData = NSData(contentsOfFile: path) {
let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)!
guard let map = ModelMapper().mapFromJSON(JSONString) else {
diff --git a/source/UberRidesTests/RequestButtonTests.swift b/source/UberRidesTests/RequestButtonTests.swift
index 5b9d4694..7b870a3d 100644
--- a/source/UberRidesTests/RequestButtonTests.swift
+++ b/source/UberRidesTests/RequestButtonTests.swift
@@ -183,7 +183,7 @@ class RequestButtonTests: XCTestCase {
*/
func testGetMetadataSimple() {
stub(isHost("sandbox-api.uber.com")) { _ in
- return OHHTTPStubsResponse(fileAtPath:OHPathForFile("gettimeestimateproduct.json", self.dynamicType)!, statusCode:200, headers:nil)
+ return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getTimeEstimateProduct.json", self.dynamicType)!, statusCode:200, headers:nil)
}
expectation = expectationWithDescription("information loaded")
@@ -207,9 +207,9 @@ class RequestButtonTests: XCTestCase {
func testGetMetadataDetailed() {
stub(isHost("sandbox-api.uber.com")) { urlRequest in
if isPath("/v1/estimates/price")(urlRequest) {
- return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getpriceestimates.json", self.dynamicType)!, statusCode:200, headers:nil)
+ return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getPriceEstimates.json", self.dynamicType)!, statusCode:200, headers:nil)
} else if isPath("/v1/estimates/time")(urlRequest) {
- return OHHTTPStubsResponse(fileAtPath:OHPathForFile("gettimeestimateproduct.json", self.dynamicType)!, statusCode:200, headers:nil)
+ return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getTimeEstimateProduct.json", self.dynamicType)!, statusCode:200, headers:nil)
} else {
XCTAssert(false)
return OHHTTPStubsResponse()
@@ -234,7 +234,7 @@ class RequestButtonTests: XCTestCase {
func testErrorGettingPriceEstimates() {
stub(isHost("sandbox-api.uber.com")) { urlRequest in
if isPath("/v1/estimates/time")(urlRequest) {
- return OHHTTPStubsResponse(fileAtPath:OHPathForFile("gettimeestimateproduct.json", self.dynamicType)!, statusCode:200, headers: [ "Authorization" : "Bearer token" ])
+ return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getTimeEstimateProduct.json", self.dynamicType)!, statusCode:200, headers: [ "Authorization" : "Bearer token" ])
} else if isPath("/v1/estimates/price")(urlRequest) {
let obj = ["code":"price_estimate_error"]
return OHHTTPStubsResponse(JSONObject: obj, statusCode: 404, headers: nil)
@@ -263,7 +263,7 @@ class RequestButtonTests: XCTestCase {
func testErrorGettingTimeEstimates() {
stub(isHost("sandbox-api.uber.com")) { urlRequest in
if isPath("/v1/estimates/price")(urlRequest) {
- return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getpriceestimates.json", self.dynamicType)!, statusCode:200, headers:nil)
+ return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getPriceEstimates.json", self.dynamicType)!, statusCode:200, headers:nil)
} else if isPath("/v1/estimates/time")(urlRequest) {
let obj = ["code":"time_estimate_error"]
return OHHTTPStubsResponse(JSONObject: obj, statusCode: 404, headers: nil)
@@ -283,11 +283,154 @@ class RequestButtonTests: XCTestCase {
waitForExpectationsWithTimeout(timeout, handler: { error in
XCTAssertNil(error)
- XCTAssertEqual(self.button.uberTitleLabel.text!, "Ride there with Uber")
+ XCTAssertEqual(self.button.uberTitleLabel.text!, "Get a ride")
+ XCTAssertEqual(self.button.uberMetadataLabel.text!, "$15 for uberX")
XCTAssertEqual(self.rideButtonError.code, "time_estimate_error")
})
}
-
+
+ func testEmptyTimeEstimatesCallsDelegateValidPriceEstimates() {
+ stub(isHost("sandbox-api.uber.com")) { urlRequest in
+
+ if isPath("/v1/estimates/price")(urlRequest) {
+ return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getPriceEstimates.json", self.dynamicType)!, statusCode:200, headers:nil)
+ } else if isPath("/v1/estimates/time")(urlRequest) {
+ return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getTimeEstimatesEmpty.json", self.dynamicType)!, statusCode:200, headers:nil)
+ } else {
+ XCTAssert(false)
+ return OHHTTPStubsResponse()
+ }
+ }
+
+ expectation = expectationWithDescription("information loaded")
+
+ let pickupLocation = CLLocation(latitude: pickupLat, longitude: pickupLong)
+ let dropoffLocation = CLLocation(latitude: dropoffLat, longitude: dropoffLong)
+ let rideParams = RideParametersBuilder().setProductID(productID).setPickupLocation(pickupLocation).setDropoffLocation(dropoffLocation).build()
+ button = RideRequestButton(client: client, rideParameters:rideParams, requestingBehavior: DeeplinkRequestingBehavior())
+ button.delegate = self
+ button.loadRideInformation()
+
+ waitForExpectationsWithTimeout(timeout, handler: { error in
+ XCTAssertNil(error)
+ XCTAssertEqual(self.button.uberTitleLabel.text!, "Get a ride")
+ XCTAssertEqual(self.button.uberMetadataLabel.text!, "$15 for uberX")
+ })
+ }
+
+ func testEmptyPriceEstimatesValidTimeEstimates() {
+ stub(isHost("sandbox-api.uber.com")) { urlRequest in
+ if isPath("/v1/estimates/price")(urlRequest) {
+ return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getPriceEstimatesEmpty.json", self.dynamicType)!, statusCode:200, headers:nil)
+ } else if isPath("/v1/estimates/time")(urlRequest) {
+ return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getTimeEstimateProduct.json", self.dynamicType)!, statusCode:200, headers:nil)
+ } else {
+ XCTAssert(false)
+ return OHHTTPStubsResponse()
+ }
+ }
+
+ expectation = expectationWithDescription("information loaded")
+ let pickupLocation = CLLocation(latitude: pickupLat, longitude: pickupLong)
+ let dropoffLocation = CLLocation(latitude: dropoffLat, longitude: dropoffLong)
+ let rideParams = RideParametersBuilder().setProductID(productID).setPickupLocation(pickupLocation).setDropoffLocation(dropoffLocation).build()
+ button = RideRequestButton(client: client, rideParameters:rideParams, requestingBehavior: DeeplinkRequestingBehavior())
+ button.delegate = self
+ button.loadRideInformation()
+
+ waitForExpectationsWithTimeout(timeout, handler: { error in
+ XCTAssertNil(error)
+ XCTAssertEqual(self.button.uberTitleLabel.text!, "Get a ride")
+ XCTAssertEqual(self.button.uberMetadataLabel.text!, "4 MINS AWAY")
+ })
+ }
+
+ func testEmptyPriceEstimatesEmptyTimeEstimates() {
+ stub(isHost("sandbox-api.uber.com")) { urlRequest in
+ if isPath("/v1/estimates/price")(urlRequest) {
+ return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getPriceEstimatesEmpty.json", self.dynamicType)!, statusCode:200, headers:nil)
+ } else if isPath("/v1/estimates/time")(urlRequest) {
+ return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getTimeEstimatesEmpty.json", self.dynamicType)!, statusCode:200, headers:nil)
+ } else {
+ XCTAssert(false)
+ return OHHTTPStubsResponse()
+ }
+ }
+
+ expectation = expectationWithDescription("information loaded")
+ let pickupLocation = CLLocation(latitude: pickupLat, longitude: pickupLong)
+ let dropoffLocation = CLLocation(latitude: dropoffLat, longitude: dropoffLong)
+ let rideParams = RideParametersBuilder().setProductID(productID).setPickupLocation(pickupLocation).setDropoffLocation(dropoffLocation).build()
+ button = RideRequestButton(client: client, rideParameters:rideParams, requestingBehavior: DeeplinkRequestingBehavior())
+ button.delegate = self
+ button.loadRideInformation()
+
+ waitForExpectationsWithTimeout(timeout, handler: { error in
+ XCTAssertNil(error)
+ XCTAssertEqual(self.button.uberTitleLabel.text!, "Ride there with Uber")
+ XCTAssertNil(self.button.uberMetadataLabel.text)
+ })
+ }
+
+ func testMissingClientTriggersErrorDelegate() {
+ errorExpectation = expectationWithDescription("Expected to receive 422 error")
+ let pickupLocation = CLLocation(latitude: pickupLat, longitude: pickupLong)
+ let dropoffLocation = CLLocation(latitude: dropoffLat, longitude: dropoffLong)
+ let rideParams = RideParametersBuilder().setProductID(productID).setPickupLocation(pickupLocation).setDropoffLocation(dropoffLocation).build()
+ button = RideRequestButton(client: client, rideParameters:rideParams, requestingBehavior: DeeplinkRequestingBehavior())
+ button.delegate = self
+ button.client = nil
+ button.loadRideInformation()
+
+ waitForExpectationsWithTimeout(timeout, handler: { error in
+ guard let ridesError = self.rideButtonError else {
+ XCTFail("Expected to receive 422 error")
+ return
+ }
+ XCTAssertEqual(ridesError.status, 422)
+ XCTAssertEqual(ridesError.code, "validation_failed")
+ XCTAssertEqual(ridesError.title, "Invalid Request")
+ })
+ }
+
+ func testMissingPickupTriggersErrorDelegate() {
+ errorExpectation = expectationWithDescription("Expected to receive 422 error")
+ let dropoffLocation = CLLocation(latitude: dropoffLat, longitude: dropoffLong)
+ let rideParams = RideParametersBuilder().setProductID(productID).setDropoffLocation(dropoffLocation).build()
+ button = RideRequestButton(client: client, rideParameters:rideParams, requestingBehavior: DeeplinkRequestingBehavior())
+ button.delegate = self
+ button.loadRideInformation()
+
+ waitForExpectationsWithTimeout(timeout, handler: { error in
+ guard let ridesError = self.rideButtonError else {
+ XCTFail("Expected to receive 422 error")
+ return
+ }
+ XCTAssertEqual(ridesError.status, 422)
+ XCTAssertEqual(ridesError.code, "validation_failed")
+ XCTAssertEqual(ridesError.title, "Invalid Request")
+ })
+ }
+
+ func testUseCurrentLocationTriggersErrorDelegate() {
+ errorExpectation = expectationWithDescription("Expected to receive 422 error")
+ let dropoffLocation = CLLocation(latitude: dropoffLat, longitude: dropoffLong)
+ let rideParams = RideParametersBuilder().setProductID(productID).setDropoffLocation(dropoffLocation).setPickupToCurrentLocation().build()
+ button = RideRequestButton(client: client, rideParameters:rideParams, requestingBehavior: DeeplinkRequestingBehavior())
+ button.delegate = self
+ button.loadRideInformation()
+
+ waitForExpectationsWithTimeout(timeout, handler: { error in
+ guard let ridesError = self.rideButtonError else {
+ XCTFail("Expected to receive 422 error")
+ return
+ }
+ XCTAssertEqual(ridesError.status, 422)
+ XCTAssertEqual(ridesError.code, "validation_failed")
+ XCTAssertEqual(ridesError.title, "Invalid Request")
+ })
+ }
+
/**
Test that button defaults to "Get a Ride" when no productID is set.
*/
diff --git a/source/UberRidesTests/RequestLayerTests.swift b/source/UberRidesTests/RequestLayerTests.swift
index 2c424266..e99ca948 100644
--- a/source/UberRidesTests/RequestLayerTests.swift
+++ b/source/UberRidesTests/RequestLayerTests.swift
@@ -52,7 +52,7 @@ class RequestLayerTests: XCTestCase {
*/
func test200Response() {
stub(isHost("sandbox-api.uber.com")) { _ in
- return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getproductid.json", self.dynamicType)!, statusCode:200, headers:self.headers)
+ return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getProductID.json", self.dynamicType)!, statusCode:200, headers:self.headers)
}
let expectation = expectationWithDescription("200 success response")
diff --git a/source/UberRidesTests/RidesClientTests.swift b/source/UberRidesTests/RidesClientTests.swift
index 421c4bae..db6d836a 100644
--- a/source/UberRidesTests/RidesClientTests.swift
+++ b/source/UberRidesTests/RidesClientTests.swift
@@ -64,7 +64,7 @@ class RidesClientTests: XCTestCase {
*/
func testGetCheapestProduct() {
stub(isHost("sandbox-api.uber.com")) { _ in
- return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getproducts.json", self.dynamicType)!, statusCode:200, headers:nil)
+ return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getProducts.json", self.dynamicType)!, statusCode:200, headers:nil)
}
let expectation = expectationWithDescription("get cheapest product")
@@ -88,7 +88,7 @@ class RidesClientTests: XCTestCase {
*/
func testGetProducts() {
stub(isHost("sandbox-api.uber.com")) { _ in
- return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getproducts.json", self.dynamicType)!, statusCode:200, headers:nil)
+ return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getProducts.json", self.dynamicType)!, statusCode:200, headers:nil)
}
let expectation = expectationWithDescription("get all products")
@@ -117,7 +117,7 @@ class RidesClientTests: XCTestCase {
*/
func testGetProductByID() {
stub(isHost("sandbox-api.uber.com")) { _ in
- return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getproductid.json", self.dynamicType)!, statusCode:200, headers:nil)
+ return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getProductID.json", self.dynamicType)!, statusCode:200, headers:nil)
}
let expectation = expectationWithDescription("get product by id")
@@ -143,7 +143,7 @@ class RidesClientTests: XCTestCase {
*/
func testGetTimeEstimates() {
stub(isHost("sandbox-api.uber.com")) { _ in
- return OHHTTPStubsResponse(fileAtPath:OHPathForFile("gettimeestimates.json", self.dynamicType)!, statusCode:200, headers:nil)
+ return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getTimeEstimates.json", self.dynamicType)!, statusCode:200, headers:nil)
}
let expectation = expectationWithDescription("get time estimates")
@@ -171,7 +171,7 @@ class RidesClientTests: XCTestCase {
*/
func testGetPriceEstimates() {
stub(isHost("sandbox-api.uber.com")) { _ in
- return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getpriceestimates.json", self.dynamicType)!, statusCode:200, headers:nil)
+ return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getPriceEstimates.json", self.dynamicType)!, statusCode:200, headers:nil)
}
let expectation = expectationWithDescription("get price estimates")
@@ -200,7 +200,7 @@ class RidesClientTests: XCTestCase {
*/
func testGetHistory() {
stub(isHost("sandbox-api.uber.com")) { _ in
- return OHHTTPStubsResponse(fileAtPath:OHPathForFile("gethistory.json", self.dynamicType)!, statusCode:200, headers:nil)
+ return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getHistory.json", self.dynamicType)!, statusCode:200, headers:nil)
}
let expectation = expectationWithDescription("get user history")
@@ -226,7 +226,7 @@ class RidesClientTests: XCTestCase {
*/
func testGetUserProfile() {
stub(isHost("sandbox-api.uber.com")) { _ in
- return OHHTTPStubsResponse(fileAtPath: OHPathForFile("getme.json", self.dynamicType)!, statusCode: 200, headers: nil)
+ return OHHTTPStubsResponse(fileAtPath: OHPathForFile("getMe.json", self.dynamicType)!, statusCode: 200, headers: nil)
}
let expectation = expectationWithDescription("get user profile")
@@ -251,7 +251,7 @@ class RidesClientTests: XCTestCase {
*/
func testMakeRideRequest() {
stub(isHost("sandbox-api.uber.com")) { _ in
- return OHHTTPStubsResponse(fileAtPath: OHPathForFile("postrequests.json", self.dynamicType)!, statusCode: 200, headers: nil)
+ return OHHTTPStubsResponse(fileAtPath: OHPathForFile("postRequests.json", self.dynamicType)!, statusCode: 200, headers: nil)
}
let expectation = expectationWithDescription("make ride request")
@@ -259,7 +259,7 @@ class RidesClientTests: XCTestCase {
let rideParameters = RideParametersBuilder().setPickupPlaceID("home").build()
client.requestRide(rideParameters, completion: { ride, response in
XCTAssertNotNil(ride)
- XCTAssertEqual(ride!.status, .Processing)
+ XCTAssertEqual(ride!.status, RideStatus.Processing)
XCTAssertEqual(ride!.requestID, "852b8fdd-4369-4659-9628-e122662ad257")
XCTAssertEqual(ride!.eta, 5)
@@ -278,7 +278,7 @@ class RidesClientTests: XCTestCase {
*/
func testGetCurrentRide() {
stub(isHost("sandbox-api.uber.com")) { _ in
- return OHHTTPStubsResponse(fileAtPath: OHPathForFile("getrequest.json", self.dynamicType)!, statusCode: 200, headers: nil)
+ return OHHTTPStubsResponse(fileAtPath: OHPathForFile("getRequest.json", self.dynamicType)!, statusCode: 200, headers: nil)
}
let expectation = expectationWithDescription("get current ride")
@@ -286,7 +286,7 @@ class RidesClientTests: XCTestCase {
client.fetchCurrentRide({ ride, response in
XCTAssertNotNil(ride)
XCTAssertEqual(ride!.requestID, "17cb78a7-b672-4d34-a288-a6c6e44d5315")
- XCTAssertEqual(ride!.status, .Accepted)
+ XCTAssertEqual(ride!.status, RideStatus.Accepted)
expectation.fulfill()
})
@@ -303,7 +303,7 @@ class RidesClientTests: XCTestCase {
*/
func testGetRideByID() {
stub(isHost("sandbox-api.uber.com")) { _ in
- return OHHTTPStubsResponse(fileAtPath: OHPathForFile("getrequest.json", self.dynamicType)!, statusCode: 200, headers: nil)
+ return OHHTTPStubsResponse(fileAtPath: OHPathForFile("getRequest.json", self.dynamicType)!, statusCode: 200, headers: nil)
}
let expectation = expectationWithDescription("get ride by ID")
@@ -311,7 +311,7 @@ class RidesClientTests: XCTestCase {
client.fetchRideDetails("someID", completion: { ride, response in
XCTAssertNotNil(ride)
XCTAssertEqual(ride!.requestID, "17cb78a7-b672-4d34-a288-a6c6e44d5315")
- XCTAssertEqual(ride!.status, .Accepted)
+ XCTAssertEqual(ride!.status, RideStatus.Accepted)
expectation.fulfill()
})
@@ -328,7 +328,7 @@ class RidesClientTests: XCTestCase {
*/
func testGetRequestEstimate() {
stub(isHost("sandbox-api.uber.com")) { _ in
- return OHHTTPStubsResponse(fileAtPath: OHPathForFile("requestestimate.json", self.dynamicType)!, statusCode: 200, headers: nil)
+ return OHHTTPStubsResponse(fileAtPath: OHPathForFile("requestEstimate.json", self.dynamicType)!, statusCode: 200, headers: nil)
}
let expectation = expectationWithDescription("get request estimate")
@@ -753,7 +753,7 @@ class RidesClientTests: XCTestCase {
*/
func testGetPaymentMethods() {
stub(isHost("sandbox-api.uber.com")) { _ in
- return OHHTTPStubsResponse(fileAtPath: OHPathForFile("getpaymentmethods.json", self.dynamicType)!, statusCode: 200, headers: nil)
+ return OHHTTPStubsResponse(fileAtPath: OHPathForFile("getPaymentMethods.json", self.dynamicType)!, statusCode: 200, headers: nil)
}
let expectation = expectationWithDescription("get payment methods")
@@ -778,7 +778,7 @@ class RidesClientTests: XCTestCase {
func testGetRideReceipt() {
stub(isHost("sandbox-api.uber.com")) { _ in
- return OHHTTPStubsResponse(fileAtPath: OHPathForFile("ridereceipt.json", self.dynamicType)!, statusCode: 200, headers: nil)
+ return OHHTTPStubsResponse(fileAtPath: OHPathForFile("rideReceipt.json", self.dynamicType)!, statusCode: 200, headers: nil)
}
let expectation = expectationWithDescription("ride receipt")
@@ -801,7 +801,7 @@ class RidesClientTests: XCTestCase {
func testGetRideMap() {
stub(isHost("sandbox-api.uber.com")) { _ in
- return OHHTTPStubsResponse(fileAtPath: OHPathForFile("ridemap.json", self.dynamicType)!, statusCode: 200, headers: nil)
+ return OHHTTPStubsResponse(fileAtPath: OHPathForFile("rideMap.json", self.dynamicType)!, statusCode: 200, headers: nil)
}
let expectation = expectationWithDescription("ride map")
@@ -922,14 +922,14 @@ class RidesClientTests: XCTestCase {
let tokenGroup = Configuration.getDefaultKeychainAccessGroup()
keychainHelper.setAccessGroup(tokenGroup)
- keychainHelper.setObject(token, key: tokenKey)
+ XCTAssertTrue(keychainHelper.setObject(token, key: tokenKey))
defer {
- keychainHelper.deleteObjectForKey(tokenKey)
+ XCTAssertTrue(keychainHelper.deleteObjectForKey(tokenKey))
}
let ridesClient = RidesClient()
guard let accessToken = ridesClient.fetchAccessToken() else {
- XCTAssert(false)
+ XCTFail("Unable to fetch Access Token")
return
}
XCTAssertEqual(accessToken.tokenString, token.tokenString)
@@ -961,126 +961,16 @@ class RidesClientTests: XCTestCase {
let tokenGroup = Configuration.getDefaultKeychainAccessGroup()
keychainHelper.setAccessGroup(tokenGroup)
- keychainHelper.setObject(token, key: tokenKey)
+ XCTAssertTrue(keychainHelper.setObject(token, key: tokenKey))
defer {
- keychainHelper.deleteObjectForKey(tokenKey)
+ XCTAssertTrue(keychainHelper.deleteObjectForKey(tokenKey))
}
let ridesClient = RidesClient(accessTokenIdentifier: tokenKey)
guard let accessToken = ridesClient.fetchAccessToken() else {
- XCTAssert(false)
- return
- }
- XCTAssertEqual(accessToken.tokenString, token.tokenString)
- }
-
- /**
- Test to check getting the access token when using the default ID and cusom group
- and the token exists
- */
- func testGetAccessTokenSuccess_defaultId_customGroup() {
- let tokenData = [ "access_token" : "testAccessToken" ]
- guard let token = AccessToken(JSON: tokenData) else {
- XCTAssert(false)
- return
- }
- let keychainHelper = KeychainWrapper()
-
- let tokenKey = Configuration.getDefaultAccessTokenIdentifier()
- let tokenGroup = "newTokenGroup"
-
- keychainHelper.setAccessGroup(tokenGroup)
- keychainHelper.setObject(token, key: tokenKey)
- defer {
- keychainHelper.deleteObjectForKey(tokenKey)
- }
-
- let ridesClient = RidesClient(accessTokenIdentifier: tokenKey, keychainAccessGroup:tokenGroup)
- guard let accessToken = ridesClient.fetchAccessToken() else {
- XCTAssert(false)
- return
- }
- XCTAssertEqual(accessToken.tokenString, token.tokenString)
- }
-
- /**
- Test to check getting the access token when using custom settings
- and the token exists
- */
- func testGetAccessTokenSuccess_customId_customGroup() {
- let tokenData = [ "access_token" : "testAccessToken" ]
- guard let token = AccessToken(JSON: tokenData) else {
- XCTAssert(false)
- return
- }
- let keychainHelper = KeychainWrapper()
-
- let tokenKey = "newTokenID"
- let tokenGroup = "newTokenGroup"
-
- keychainHelper.setAccessGroup(tokenGroup)
- keychainHelper.setObject(token, key: tokenKey)
- defer {
- keychainHelper.deleteObjectForKey(tokenKey)
- }
-
- let ridesClient = RidesClient(accessTokenIdentifier: tokenKey, keychainAccessGroup:tokenGroup)
- guard let accessToken = ridesClient.fetchAccessToken() else {
- XCTAssert(false)
+ XCTFail("Unable to fetch Access Token")
return
}
XCTAssertEqual(accessToken.tokenString, token.tokenString)
}
-
- /**
- Test to check getting the access token when using custom settings
- and the token doesn't exist
- */
- func testGetAccessTokenFailure_customId_customGroup() {
- let tokenData = [ "access_token" : "testAccessToken" ]
- guard let token = AccessToken(JSON: tokenData) else {
- XCTAssert(false)
- return
- }
- let keychainHelper = KeychainWrapper()
-
- let tokenKey = "newTokenID"
- let tokenGroup = "newTokenGroup"
-
- keychainHelper.setAccessGroup(tokenGroup)
- keychainHelper.setObject(token, key: tokenKey)
- defer {
- keychainHelper.deleteObjectForKey(tokenKey)
- }
-
- let ridesClient = RidesClient()
- let accessToken = ridesClient.fetchAccessToken()
- XCTAssertNil(accessToken)
- }
-
- /**
- Test to check getting the access token fails when using a matching ID but different
- group
- */
- func testGetAccessTokenFailure_groupMismatch() {
- let tokenData = [ "access_token" : "testAccessToken" ]
- guard let token = AccessToken(JSON: tokenData) else {
- XCTAssert(false)
- return
- }
- let keychainHelper = KeychainWrapper()
-
- let tokenKey = "newTokenID"
- let tokenGroup = "newTokenGroup"
-
- keychainHelper.setAccessGroup(tokenGroup)
- keychainHelper.setObject(token, key: tokenKey)
- defer {
- keychainHelper.deleteObjectForKey(tokenKey)
- }
-
- let ridesClient = RidesClient(accessTokenIdentifier: tokenKey)
- let accessToken = ridesClient.fetchAccessToken()
- XCTAssertNil(accessToken)
- }
}
diff --git a/source/UberRidesTests/RidesScopeFactoryTests.swift b/source/UberRidesTests/RidesScopeFactoryTests.swift
index 9c720747..21ac670e 100644
--- a/source/UberRidesTests/RidesScopeFactoryTests.swift
+++ b/source/UberRidesTests/RidesScopeFactoryTests.swift
@@ -30,6 +30,9 @@ class RidesScopeFactoryTests: XCTestCase {
RidesScopeType.HistoryLite : RidesScopeType.HistoryLite.toString(),
RidesScopeType.Places : RidesScopeType.Places.toString(),
RidesScopeType.RideWidgets : RidesScopeType.RideWidgets.toString(),
+ RidesScopeType.AllTrips : RidesScopeType.AllTrips.toString(),
+ RidesScopeType.Request : RidesScopeType.Request.toString(),
+ RidesScopeType.RequestReceipt : RidesScopeType.RequestReceipt.toString(),
]
func testCreateRidesScopeByRidesScopeType() {
diff --git a/source/UberRidesTests/gethistory.json b/source/UberRidesTests/TestData/getHistory.json
similarity index 100%
rename from source/UberRidesTests/gethistory.json
rename to source/UberRidesTests/TestData/getHistory.json
diff --git a/source/UberRidesTests/getme.json b/source/UberRidesTests/TestData/getMe.json
similarity index 100%
rename from source/UberRidesTests/getme.json
rename to source/UberRidesTests/TestData/getMe.json
diff --git a/source/UberRidesTests/getpaymentmethods.json b/source/UberRidesTests/TestData/getPaymentMethods.json
similarity index 100%
rename from source/UberRidesTests/getpaymentmethods.json
rename to source/UberRidesTests/TestData/getPaymentMethods.json
diff --git a/source/UberRidesTests/getpriceestimates.json b/source/UberRidesTests/TestData/getPriceEstimates.json
similarity index 100%
rename from source/UberRidesTests/getpriceestimates.json
rename to source/UberRidesTests/TestData/getPriceEstimates.json
diff --git a/source/UberRidesTests/TestData/getPriceEstimatesEmpty.json b/source/UberRidesTests/TestData/getPriceEstimatesEmpty.json
new file mode 100644
index 00000000..01f51abe
--- /dev/null
+++ b/source/UberRidesTests/TestData/getPriceEstimatesEmpty.json
@@ -0,0 +1,3 @@
+{
+ "prices": []
+}
diff --git a/source/UberRidesTests/getproductid.json b/source/UberRidesTests/TestData/getProductID.json
similarity index 100%
rename from source/UberRidesTests/getproductid.json
rename to source/UberRidesTests/TestData/getProductID.json
diff --git a/source/UberRidesTests/getproducts.json b/source/UberRidesTests/TestData/getProducts.json
similarity index 100%
rename from source/UberRidesTests/getproducts.json
rename to source/UberRidesTests/TestData/getProducts.json
diff --git a/source/UberRidesTests/getrequest.json b/source/UberRidesTests/TestData/getRequest.json
similarity index 100%
rename from source/UberRidesTests/getrequest.json
rename to source/UberRidesTests/TestData/getRequest.json
diff --git a/source/UberRidesTests/gettimeestimateproduct.json b/source/UberRidesTests/TestData/getTimeEstimateProduct.json
similarity index 100%
rename from source/UberRidesTests/gettimeestimateproduct.json
rename to source/UberRidesTests/TestData/getTimeEstimateProduct.json
diff --git a/source/UberRidesTests/gettimeestimates.json b/source/UberRidesTests/TestData/getTimeEstimates.json
similarity index 100%
rename from source/UberRidesTests/gettimeestimates.json
rename to source/UberRidesTests/TestData/getTimeEstimates.json
diff --git a/source/UberRidesTests/TestData/getTimeEstimatesEmpty.json b/source/UberRidesTests/TestData/getTimeEstimatesEmpty.json
new file mode 100644
index 00000000..8896e1ba
--- /dev/null
+++ b/source/UberRidesTests/TestData/getTimeEstimatesEmpty.json
@@ -0,0 +1,3 @@
+{
+ "times": []
+}
diff --git a/source/UberRidesTests/place.json b/source/UberRidesTests/TestData/place.json
similarity index 100%
rename from source/UberRidesTests/place.json
rename to source/UberRidesTests/TestData/place.json
diff --git a/source/UberRidesTests/postrequests.json b/source/UberRidesTests/TestData/postRequests.json
similarity index 100%
rename from source/UberRidesTests/postrequests.json
rename to source/UberRidesTests/TestData/postRequests.json
diff --git a/source/UberRidesTests/refresh.json b/source/UberRidesTests/TestData/refresh.json
similarity index 100%
rename from source/UberRidesTests/refresh.json
rename to source/UberRidesTests/TestData/refresh.json
diff --git a/source/UberRidesTests/requestestimate.json b/source/UberRidesTests/TestData/requestEstimate.json
similarity index 100%
rename from source/UberRidesTests/requestestimate.json
rename to source/UberRidesTests/TestData/requestEstimate.json
diff --git a/source/UberRidesTests/RequestEstimateNoCars.json b/source/UberRidesTests/TestData/requestEstimateNoCars.json
similarity index 100%
rename from source/UberRidesTests/RequestEstimateNoCars.json
rename to source/UberRidesTests/TestData/requestEstimateNoCars.json
diff --git a/source/UberRidesTests/ridemap.json b/source/UberRidesTests/TestData/rideMap.json
similarity index 100%
rename from source/UberRidesTests/ridemap.json
rename to source/UberRidesTests/TestData/rideMap.json
diff --git a/source/UberRidesTests/ridereceipt.json b/source/UberRidesTests/TestData/rideReceipt.json
similarity index 100%
rename from source/UberRidesTests/ridereceipt.json
rename to source/UberRidesTests/TestData/rideReceipt.json
diff --git a/source/UberRidesTests/RideReceiptNullSurgeTotalOwed.json b/source/UberRidesTests/TestData/rideReceiptNullSurgeTotalOwed.json
similarity index 100%
rename from source/UberRidesTests/RideReceiptNullSurgeTotalOwed.json
rename to source/UberRidesTests/TestData/rideReceiptNullSurgeTotalOwed.json
diff --git a/source/UberRidesTests/testInfo.plist b/source/UberRidesTests/TestData/testInfo.plist
similarity index 100%
rename from source/UberRidesTests/testInfo.plist
rename to source/UberRidesTests/TestData/testInfo.plist
diff --git a/source/UberRidesTests/testInfoMissingCallbacks.plist b/source/UberRidesTests/TestData/testInfoMissingCallbacks.plist
similarity index 100%
rename from source/UberRidesTests/testInfoMissingCallbacks.plist
rename to source/UberRidesTests/TestData/testInfoMissingCallbacks.plist
diff --git a/source/UberRidesTests/testInfoNoServerToken.plist b/source/UberRidesTests/TestData/testInfoNoServerToken.plist
similarity index 100%
rename from source/UberRidesTests/testInfoNoServerToken.plist
rename to source/UberRidesTests/TestData/testInfoNoServerToken.plist
diff --git a/source/UberRidesTests/TokenManagerTests.swift b/source/UberRidesTests/TokenManagerTests.swift
index a72c22c1..f5faacd0 100644
--- a/source/UberRidesTests/TokenManagerTests.swift
+++ b/source/UberRidesTests/TokenManagerTests.swift
@@ -47,65 +47,59 @@ class TokenManagerTests: XCTestCase {
func testSave() {
let identifier = "testIdentifier"
- let accessGroup = "testAccessGroup"
let token = getTestToken()
- XCTAssertTrue(TokenManager.saveToken(token, tokenIdentifier:identifier, accessGroup: accessGroup))
-
- keychain?.setAccessGroup(accessGroup)
+ XCTAssertTrue(TokenManager.saveToken(token, tokenIdentifier:identifier))
+
guard let actualToken = keychain?.getObjectForKey(identifier) as? AccessToken else {
- XCTAssert(false)
+ XCTFail("Unable to fetch token")
return
}
XCTAssertEqual(actualToken.tokenString, token.tokenString)
- keychain?.deleteObjectForKey(identifier)
+ XCTAssertTrue(keychain!.deleteObjectForKey(identifier))
}
func testSave_firesNotification() {
let identifier = "testIdentifier"
- let accessGroup = "testAccessGroup"
let token = getTestToken()
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(handleTokenManagerNotifications), name: TokenManager.TokenManagerDidSaveTokenNotification, object: nil)
- XCTAssertTrue(TokenManager.saveToken(token, tokenIdentifier:identifier, accessGroup: accessGroup))
+ XCTAssertTrue(TokenManager.saveToken(token, tokenIdentifier:identifier))
NSNotificationCenter.defaultCenter().removeObserver(self)
-
- keychain?.setAccessGroup(accessGroup)
+
guard let actualToken = keychain?.getObjectForKey(identifier) as? AccessToken else {
- XCTAssert(false)
+ XCTFail("Unable to fetch token")
return
}
XCTAssertEqual(actualToken.tokenString, token.tokenString)
XCTAssertTrue(notificationFired)
- keychain?.deleteObjectForKey(identifier)
+ XCTAssertTrue(keychain!.deleteObjectForKey(identifier))
}
func testGet() {
let identifier = "testIdentifier"
- let accessGroup = "testAccessGroup"
let token = getTestToken()
+
+ XCTAssertTrue(keychain!.setObject(token, key: identifier))
- keychain?.setAccessGroup(accessGroup)
- keychain?.setObject(token, key: identifier)
-
- let actualToken = TokenManager.fetchToken(identifier, accessGroup: accessGroup)
+ let actualToken = TokenManager.fetchToken(identifier)
XCTAssertNotNil(actualToken)
XCTAssertEqual(actualToken?.tokenString, token.tokenString)
- keychain?.deleteObjectForKey(identifier)
+ XCTAssertTrue(keychain!.deleteObjectForKey(identifier))
}
func testGet_nonExistent() {
@@ -116,19 +110,17 @@ class TokenManagerTests: XCTestCase {
func testDelete() {
let identifier = "testIdentifier"
- let accessGroup = "testAccessGroup"
let token = getTestToken()
+
+ XCTAssertTrue(keychain!.setObject(token, key: identifier))
- keychain?.setAccessGroup(accessGroup)
- keychain?.setObject(token, key: identifier)
-
- XCTAssertTrue(TokenManager.deleteToken(identifier, accessGroup: accessGroup))
+ XCTAssertTrue(TokenManager.deleteToken(identifier))
let actualToken = keychain?.getObjectForKey(identifier) as? AccessToken
guard actualToken == nil else {
- XCTAssert(false)
- keychain?.deleteObjectForKey(identifier)
+ XCTFail("Token should have been deleted")
+ XCTAssertTrue(keychain!.deleteObjectForKey(identifier))
return
}
}
@@ -143,16 +135,14 @@ class TokenManagerTests: XCTestCase {
func testDelete_firesNotification() {
let identifier = "testIdentifier"
- let accessGroup = "testAccessGroup"
let token = getTestToken()
-
- keychain?.setAccessGroup(accessGroup)
- keychain?.setObject(token, key: identifier)
+
+ XCTAssertTrue(keychain!.setObject(token, key: identifier))
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(handleTokenManagerNotifications), name: TokenManager.TokenManagerDidDeleteTokenNotification, object: nil)
- XCTAssertTrue(TokenManager.deleteToken(identifier, accessGroup: accessGroup))
+ XCTAssertTrue(TokenManager.deleteToken(identifier))
NSNotificationCenter.defaultCenter().removeObserver(self)
@@ -160,8 +150,8 @@ class TokenManagerTests: XCTestCase {
let actualToken = keychain?.getObjectForKey(identifier) as? AccessToken
guard actualToken == nil else {
- XCTAssert(false)
- keychain?.deleteObjectForKey(identifier)
+ XCTFail("Token should have been deleted")
+ XCTAssertTrue(keychain!.deleteObjectForKey(identifier))
return
}
}
@@ -201,14 +191,12 @@ class TokenManagerTests: XCTestCase {
XCTAssertEqual(cookieStorage.cookiesForURL(chinaURL)?.count, 2)
let identifier = "testIdentifier"
- let accessGroup = "testAccessGroup"
let token = getTestToken()
-
- keychain?.setAccessGroup(accessGroup)
+
keychain?.setObject(token, key: identifier)
- XCTAssertTrue(TokenManager.deleteToken(identifier, accessGroup: accessGroup))
+ XCTAssertTrue(TokenManager.deleteToken(identifier))
let actualToken = keychain?.getObjectForKey(identifier) as? AccessToken
guard actualToken == nil else {