Commit 8a119535 by Dima Bart

Update `deleteAddress` to take an ID instead of BUYAddress

parent d4a6e276
...@@ -325,7 +325,7 @@ ...@@ -325,7 +325,7 @@
}]; }];
XCTestExpectation *expectation = [self expectationWithDescription:NSStringFromSelector(_cmd)]; XCTestExpectation *expectation = [self expectationWithDescription:NSStringFromSelector(_cmd)];
[self.client deleteAddress:self.createdAddress forCustomerID:self.customer.identifier.stringValue callback:^(BUYStatus status, NSError * _Nullable error) { [self.client deleteAddressWithID:self.createdAddress.identifier forCustomerID:self.customer.identifier.stringValue callback:^(BUYStatus status, NSError * _Nullable error) {
XCTAssertEqual(status, 204); XCTAssertEqual(status, 204);
XCTAssertNil(error); XCTAssertNil(error);
......
...@@ -98,13 +98,13 @@ typedef void (^BUYDataAddressBlock)(BUYAddress * _Nullable address, NSError * _N ...@@ -98,13 +98,13 @@ typedef void (^BUYDataAddressBlock)(BUYAddress * _Nullable address, NSError * _N
* DELETE /api/customers/:customer_id/addresses/:id * DELETE /api/customers/:customer_id/addresses/:id
* Delete the customer address * Delete the customer address
* *
* @param address Address to delete * @param addressID Address ID to delete
* @param customerID Customer ID for which to delete the address * @param customerID Customer ID for which to delete the address
* @param block (BUYStatus status, NSError *error) * @param block (BUYStatus status, NSError *error)
* *
* @return The associated BUYRequestOperation * @return The associated BUYRequestOperation
*/ */
- (BUYRequestOperation *)deleteAddress:(BUYAddress *)address forCustomerID:(NSString *)customerID callback:(BUYDataStatusBlock)block; - (BUYRequestOperation *)deleteAddressWithID:(NSNumber *)addressID forCustomerID:(NSString *)customerID callback:(BUYDataStatusBlock)block;
@end @end
......
...@@ -83,11 +83,11 @@ ...@@ -83,11 +83,11 @@
}]; }];
} }
- (BUYRequestOperation *)deleteAddress:(BUYAddress *)address forCustomerID:(NSString *)customerID callback:(BUYDataStatusBlock)block - (BUYRequestOperation *)deleteAddressWithID:(NSNumber *)addressID forCustomerID:(NSString *)customerID callback:(BUYDataStatusBlock)block
{ {
BUYAssert(address.identifier, @"Failed to update address. Address must have a valid identifier."); BUYAssert(addressID, @"Failed to update address. Address must have a valid identifier.");
NSURL *route = [self urlForCustomersAddressWithID:customerID addressID:address.identifier]; NSURL *route = [self urlForCustomersAddressWithID:customerID addressID:addressID];
return [self deleteRequestForURL:route completionHandler:^(NSDictionary *json, NSHTTPURLResponse *response, NSError *error) { return [self deleteRequestForURL:route completionHandler:^(NSDictionary *json, NSHTTPURLResponse *response, NSError *error) {
block(response.statusCode, error); block(response.statusCode, error);
}]; }];
......
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