Commit 9c2b37d0 by David Muzi Committed by GitHub

Merge pull request #260 from Shopify/task/number-ids

Use NSNumber for product id in Client APIs
parents 2e5a6170 7d678e77
...@@ -30,5 +30,5 @@ struct Config { ...@@ -30,5 +30,5 @@ struct Config {
static let shopDomain = "" static let shopDomain = ""
static let apiKey = "" static let apiKey = ""
static let appId = "" static let appId = ""
static let productId = "" static let productId = 0
} }
...@@ -177,7 +177,7 @@ ...@@ -177,7 +177,7 @@
[OHHTTPStubs stubUsingResponseWithKey:@"testGetNonexistentProduct_0" useMocks:[self shouldUseMocks]]; [OHHTTPStubs stubUsingResponseWithKey:@"testGetNonexistentProduct_0" useMocks:[self shouldUseMocks]];
XCTestExpectation *expectation = [self expectationWithDescription:NSStringFromSelector(_cmd)]; XCTestExpectation *expectation = [self expectationWithDescription:NSStringFromSelector(_cmd)];
[self.client getProductById:@"asdfdsasdfdsasdfdsasdfjkllkj" completion:^(BUYProduct *product, NSError *error) { [self.client getProductById:@123456 completion:^(BUYProduct *product, NSError *error) {
XCTAssertNil(product); XCTAssertNil(product);
XCTAssertEqual(BUYShopifyError_InvalidProductID, error.code); XCTAssertEqual(BUYShopifyError_InvalidProductID, error.code);
......
...@@ -158,7 +158,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc ...@@ -158,7 +158,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
* *
* @return The associated BUYRequestOperation * @return The associated BUYRequestOperation
*/ */
- (NSOperation *)getProductById:(NSString *)productId completion:(BUYDataProductBlock)block; - (NSOperation *)getProductById:(NSNumber *)productId completion:(BUYDataProductBlock)block;
/** /**
* Fetches a list of product by the ID of each product. * Fetches a list of product by the ID of each product.
...@@ -168,7 +168,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc ...@@ -168,7 +168,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
* *
* @return The associated BUYRequestOperation * @return The associated BUYRequestOperation
*/ */
- (NSOperation *)getProductsByIds:(NSArray<NSString *> *)productIds completion:(BUYDataProductsBlock)block; - (NSOperation *)getProductsByIds:(NSArray<NSNumber *> *)productIds completion:(BUYDataProductsBlock)block;
/** /**
* Fetches collections based off page * Fetches collections based off page
......
...@@ -94,7 +94,7 @@ static NSString * const BUYCollectionsKey = @"collection_listings"; ...@@ -94,7 +94,7 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
}]; }];
} }
- (NSOperation *)getProductById:(NSString *)productId completion:(BUYDataProductBlock)block - (NSOperation *)getProductById:(NSNumber *)productId completion:(BUYDataProductBlock)block
{ {
BUYAssert(productId, @"Failed to get product by ID. Product ID must not be nil."); BUYAssert(productId, @"Failed to get product by ID. Product ID must not be nil.");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment