Commit 38df8cfe by Dima Bart

Rename routeFor to urlFor.

parent 384a25a0
......@@ -53,92 +53,92 @@
NSDictionary *parameters = @{ @"param" : @"value" };
XCTAssertEqualObjects(
[self.client routeForAPI].absoluteString,
[self.client urlForAPI].absoluteString,
@"https://_DOMAIN_/api"
);
XCTAssertEqualObjects(
[self.client routeForApps].absoluteString,
[self.client urlForApps].absoluteString,
@"https://_DOMAIN_/api/apps/_APP_ID_"
);
XCTAssertEqualObjects(
[self.client routeForShop].absoluteString,
[self.client urlForShop].absoluteString,
@"https://_DOMAIN_/meta.json"
);
XCTAssertEqualObjects(
[self.client routeForProductListingsWithParameters:parameters].absoluteString,
[self.client urlForProductListingsWithParameters:parameters].absoluteString,
@"https://_DOMAIN_/api/apps/_APP_ID_/product_listings.json?param=value"
);
XCTAssertEqualObjects(
[self.client routeForCollectionListingsWithParameters:parameters].absoluteString,
[self.client urlForCollectionListingsWithParameters:parameters].absoluteString,
@"https://_DOMAIN_/api/apps/_APP_ID_/collection_listings.json?param=value"
);
XCTAssertEqualObjects(
[self.client routeForCheckouts].absoluteString,
[self.client urlForCheckouts].absoluteString,
@"https://_DOMAIN_/api/checkouts.json"
);
XCTAssertEqualObjects(
[self.client routeForCheckoutsWithToken:token].absoluteString,
[self.client urlForCheckoutsWithToken:token].absoluteString,
@"https://_DOMAIN_/api/checkouts/_TOKEN_.json"
);
XCTAssertEqualObjects(
[self.client routeForCheckoutsProcessingWithToken:token].absoluteString,
[self.client urlForCheckoutsProcessingWithToken:token].absoluteString,
@"https://_DOMAIN_/api/checkouts/_TOKEN_/processing.json"
);
XCTAssertEqualObjects(
[self.client routeForCheckoutsCompletionWithToken:token].absoluteString,
[self.client urlForCheckoutsCompletionWithToken:token].absoluteString,
@"https://_DOMAIN_/api/checkouts/_TOKEN_/complete.json"
);
XCTAssertEqualObjects(
[self.client routeForCheckoutsShippingRatesWithToken:token parameters:parameters].absoluteString,
[self.client urlForCheckoutsShippingRatesWithToken:token parameters:parameters].absoluteString,
@"https://_DOMAIN_/api/checkouts/_TOKEN_/shipping_rates.json?param=value"
);
XCTAssertEqualObjects(
[self.client routeForCheckoutsUsingGiftCard].absoluteString,
[self.client urlForCheckoutsUsingGiftCard].absoluteString,
@"https://_DOMAIN_/api/checkouts/gift_cards.json"
);
XCTAssertEqualObjects(
[self.client routeForCheckoutsUsingGiftCardWithToken:token].absoluteString,
[self.client urlForCheckoutsUsingGiftCardWithToken:token].absoluteString,
@"https://_DOMAIN_/api/checkouts/_TOKEN_/gift_cards.json"
);
XCTAssertEqualObjects(
[self.client routeForCheckoutsUsingGiftCard:@999 token:token].absoluteString,
[self.client urlForCheckoutsUsingGiftCard:@999 token:token].absoluteString,
@"https://_DOMAIN_/api/checkouts/_TOKEN_/gift_cards/999.json"
);
XCTAssertEqualObjects(
[self.client routeForCustomers].absoluteString,
[self.client urlForCustomers].absoluteString,
@"https://_DOMAIN_/api/customers.json"
);
XCTAssertEqualObjects(
[self.client routeForCustomersOrders].absoluteString,
[self.client urlForCustomersOrders].absoluteString,
@"https://_DOMAIN_/api/customers/orders.json"
);
XCTAssertEqualObjects(
[self.client routeForCustomersWithID:identifier].absoluteString,
[self.client urlForCustomersWithID:identifier].absoluteString,
@"https://_DOMAIN_/api/customers/_ID_.json"
);
XCTAssertEqualObjects(
[self.client routeForCustomersActivationWithID:identifier parameters:parameters].absoluteString,
[self.client urlForCustomersActivationWithID:identifier parameters:parameters].absoluteString,
@"https://_DOMAIN_/api/customers/_ID_/activate.json?param=value"
);
XCTAssertEqualObjects(
[self.client routeForCustomersToken].absoluteString,
[self.client urlForCustomersToken].absoluteString,
@"https://_DOMAIN_/api/customers/customer_token.json"
);
XCTAssertEqualObjects(
[self.client routeForCustomersTokenRenewalWithID:identifier].absoluteString,
[self.client urlForCustomersTokenRenewalWithID:identifier].absoluteString,
@"https://_DOMAIN_/api/customers/_ID_/customer_token/renew.json"
);
XCTAssertEqualObjects(
[self.client routeForCustomersPasswordRecovery].absoluteString,
[self.client urlForCustomersPasswordRecovery].absoluteString,
@"https://_DOMAIN_/api/customers/recover.json"
);
XCTAssertEqualObjects(
[self.client routeForCustomersPasswordResetWithID:identifier parameters:parameters].absoluteString,
[self.client urlForCustomersPasswordResetWithID:identifier parameters:parameters].absoluteString,
@"https://_DOMAIN_/api/customers/_ID_/reset.json?param=value"
);
}
......
......@@ -83,7 +83,7 @@
- (NSURLSessionDataTask *)postCheckout:(NSDictionary *)checkoutJSON completion:(BUYDataCheckoutBlock)block
{
return [self postRequestForURL:[self routeForCheckouts] object:checkoutJSON completionHandler:^(NSDictionary *json, NSURLResponse *response, NSError *error) {
return [self postRequestForURL:[self urlForCheckouts] object:checkoutJSON completionHandler:^(NSDictionary *json, NSURLResponse *response, NSError *error) {
[self handleCheckoutResponse:json error:error block:block];
}];
}
......@@ -94,7 +94,7 @@
BUYAssert(giftCardCode.length > 0, @"Failed to apply gift card code. Invalid gift card code.");
BUYGiftCard *giftCard = [self.modelManager giftCardWithCode:giftCardCode];
NSURL *route = [self routeForCheckoutsUsingGiftCardWithToken:checkout.token];
NSURL *route = [self urlForCheckoutsUsingGiftCardWithToken:checkout.token];
return [self postRequestForURL:route object:giftCard completionHandler:^(NSDictionary *json, NSURLResponse *response, NSError *error) {
if (json && !error) {
......@@ -109,7 +109,7 @@
BUYAssertCheckout(checkout);
BUYAssert(giftCard.identifier, @"Failed to remove gift card. Gift card must have a valid identifier.");
NSURL *route = [self routeForCheckoutsUsingGiftCard:giftCard.identifier token:checkout.token];
NSURL *route = [self urlForCheckoutsUsingGiftCard:giftCard.identifier token:checkout.token];
return [self deleteRequestForURL:route completionHandler:^(NSDictionary *json, NSURLResponse *response, NSError *error) {
if (!error) {
[self updateCheckout:checkout withGiftCardDictionary:json[@"gift_card"] addingGiftCard:NO];
......@@ -139,7 +139,7 @@
{
BUYAssertCheckout(checkout);
NSURL *route = [self routeForCheckoutsWithToken:checkout.token];
NSURL *route = [self urlForCheckoutsWithToken:checkout.token];
return [self getRequestForURL:route completionHandler:^(NSDictionary *json, NSURLResponse *response, NSError *error) {
[self handleCheckoutResponse:json error:error block:block];
}];
......@@ -149,7 +149,7 @@
{
BUYAssertCheckout(checkout);
NSURL *route = [self routeForCheckoutsWithToken:checkout.token];
NSURL *route = [self urlForCheckoutsWithToken:checkout.token];
return [self patchRequestForURL:route object:checkout completionHandler:^(NSDictionary *json, NSURLResponse *response, NSError *error) {
[self handleCheckoutResponse:json error:error block:block];
}];
......@@ -163,7 +163,7 @@
BUYAssert(paymentToken || isFree, @"Failed to complete checkout. Checkout must have a payment token or have a payment value equal to $0.00");
NSURL *route = [self routeForCheckoutsCompletionWithToken:checkout.token];
NSURL *route = [self urlForCheckoutsCompletionWithToken:checkout.token];
return [self postRequestForURL:route object:[paymentToken JSONDictionary] completionHandler:^(NSDictionary *json, NSURLResponse *response, NSError *error) {
[self handleCheckoutResponse:json error:error block:block];
}];
......@@ -195,7 +195,7 @@
- (NSURLSessionDataTask *)getCompletionStatusOfCheckoutToken:(NSString *)token completion:(BUYDataStatusBlock)block
{
NSURL *route = [self routeForCheckoutsProcessingWithToken:token];
NSURL *route = [self urlForCheckoutsProcessingWithToken:token];
return [self getRequestForURL:route completionHandler:^(NSDictionary *json, NSURLResponse *response, NSError *error) {
NSInteger statusCode = [(NSHTTPURLResponse *)response statusCode];
block([self statusForStatusCode:statusCode error:error], error);
......@@ -208,7 +208,7 @@
{
BUYAssertCheckout(checkout);
NSURL *route = [self routeForCheckoutsShippingRatesWithToken:checkout.token parameters:@{
NSURL *route = [self urlForCheckoutsShippingRatesWithToken:checkout.token parameters:@{
@"checkout" : @"",
}];
......
......@@ -40,7 +40,7 @@
- (NSURLSessionDataTask *)getCustomerWithID:(NSString *)customerID callback:(BUYDataCustomerBlock)block
{
NSURL *route = [self routeForCustomersWithID:customerID];
NSURL *route = [self urlForCustomersWithID:customerID];
return [self getRequestForURL:route completionHandler:^(NSDictionary *json, NSURLResponse *response, NSError *error) {
BUYCustomer *customer = nil;
if (json && !error) {
......@@ -52,7 +52,7 @@
- (NSURLSessionDataTask *)createCustomerWithCredentials:(BUYAccountCredentials *)credentials callback:(BUYDataCustomerTokenBlock)block
{
NSURL *route = [self routeForCustomers];
NSURL *route = [self urlForCustomers];
return [self postRequestForURL:route object:credentials.JSONRepresentation completionHandler:^(NSDictionary *json, NSURLResponse *response, NSError *error) {
if (json && !error) {
[self createTokenForCustomerWithCredentials:credentials customerJSON:json callback:block];
......@@ -65,7 +65,7 @@
- (NSURLSessionDataTask *)createTokenForCustomerWithCredentials:(BUYAccountCredentials *)credentials customerJSON:(NSDictionary *)customerJSON callback:(BUYDataCustomerTokenBlock)block
{
NSURL *route = [self routeForCustomersToken];
NSURL *route = [self urlForCustomersToken];
return [self postRequestForURL:route object:credentials.JSONRepresentation completionHandler:^(NSDictionary *json, NSURLResponse *response, NSError *error) {
if (json && !error) {
BUYAuthenticatedResponse *authenticatedResponse = [BUYAuthenticatedResponse responseWithJSON:json];
......@@ -94,7 +94,7 @@
- (NSURLSessionDataTask *)recoverPasswordForCustomer:(NSString *)email callback:(BUYDataStatusBlock)block
{
NSURL *route = [self routeForCustomersPasswordRecovery];
NSURL *route = [self urlForCustomersPasswordRecovery];
return [self postRequestForURL:route object:@{@"email": email} completionHandler:^(NSDictionary *json, NSURLResponse *response, NSError *error) {
NSInteger statusCode = [(NSHTTPURLResponse *)response statusCode];
......@@ -109,7 +109,7 @@
- (NSURLSessionDataTask *)renewCustomerTokenWithID:(NSString *)customerID callback:(BUYDataTokenBlock)block
{
if (self.customerToken) {
NSURL *route = [self routeForCustomersTokenRenewalWithID:customerID];
NSURL *route = [self urlForCustomersTokenRenewalWithID:customerID];
return [self putRequestForURL:route object:nil completionHandler:^(NSDictionary *json, NSURLResponse *response, NSError *error) {
......@@ -134,7 +134,7 @@
- (NSURLSessionDataTask *)activateCustomerWithCredentials:(BUYAccountCredentials *)credentials customerID:(NSString *)customerID customerToken:(NSString *)customerToken callback:(BUYDataCustomerTokenBlock)block
{
NSURL *route = [self routeForCustomersActivationWithID:customerID parameters:@{
NSURL *route = [self urlForCustomersActivationWithID:customerID parameters:@{
@"token": customerToken,
}];
......@@ -152,7 +152,7 @@
- (NSURLSessionDataTask *)resetPasswordWithCredentials:(BUYAccountCredentials *)credentials customerID:(NSString *)customerID customerToken:(NSString *)customerToken callback:(BUYDataCustomerTokenBlock)block
{
NSURL *route = [self routeForCustomersPasswordResetWithID:customerID parameters:@{
NSURL *route = [self urlForCustomersPasswordResetWithID:customerID parameters:@{
@"token": customerToken,
}];
......@@ -170,7 +170,7 @@
- (NSURLSessionDataTask *)getOrdersForCustomerWithCallback:(BUYDataOrdersBlock)block
{
NSURL *route = [self routeForCustomersOrders];
NSURL *route = [self urlForCustomersOrders];
return [self getRequestForURL:route completionHandler:^(NSDictionary *json, NSURLResponse *response, NSError *error) {
if (json && !error) {
NSArray *orders = [self.modelManager ordersWithJSONDictionary:json];
......
......@@ -28,30 +28,30 @@
@interface BUYClient (Routing)
- (NSURL *)routeForAPI;
- (NSURL *)routeForApps;
- (NSURL *)routeForShop;
- (NSURL *)routeForProductListingsWithParameters:(NSDictionary *)parameters;
- (NSURL *)routeForCollectionListingsWithParameters:(NSDictionary *)parameters;
- (NSURL *)routeForCheckouts;
- (NSURL *)routeForCheckoutsWithToken:(NSString *)token;
- (NSURL *)routeForCheckoutsProcessingWithToken:(NSString *)token;
- (NSURL *)routeForCheckoutsCompletionWithToken:(NSString *)token;
- (NSURL *)routeForCheckoutsShippingRatesWithToken:(NSString *)token parameters:(NSDictionary *)parameters;
- (NSURL *)routeForCheckoutsUsingGiftCard;
- (NSURL *)routeForCheckoutsUsingGiftCardWithToken:(NSString *)token;
- (NSURL *)routeForCheckoutsUsingGiftCard:(NSNumber *)giftCardID token:(NSString *)token;
- (NSURL *)routeForCustomers;
- (NSURL *)routeForCustomersOrders;
- (NSURL *)routeForCustomersWithID:(NSString *)identifier;
- (NSURL *)routeForCustomersActivationWithID:(NSString *)identifier parameters:(NSDictionary *)parameters;
- (NSURL *)routeForCustomersToken;
- (NSURL *)routeForCustomersTokenRenewalWithID:(NSString *)customerID;
- (NSURL *)routeForCustomersPasswordRecovery;
- (NSURL *)routeForCustomersPasswordResetWithID:(NSString *)identifier parameters:(NSDictionary *)parameters;
- (NSURL *)urlForAPI;
- (NSURL *)urlForApps;
- (NSURL *)urlForShop;
- (NSURL *)urlForProductListingsWithParameters:(NSDictionary *)parameters;
- (NSURL *)urlForCollectionListingsWithParameters:(NSDictionary *)parameters;
- (NSURL *)urlForCheckouts;
- (NSURL *)urlForCheckoutsWithToken:(NSString *)token;
- (NSURL *)urlForCheckoutsProcessingWithToken:(NSString *)token;
- (NSURL *)urlForCheckoutsCompletionWithToken:(NSString *)token;
- (NSURL *)urlForCheckoutsShippingRatesWithToken:(NSString *)token parameters:(NSDictionary *)parameters;
- (NSURL *)urlForCheckoutsUsingGiftCard;
- (NSURL *)urlForCheckoutsUsingGiftCardWithToken:(NSString *)token;
- (NSURL *)urlForCheckoutsUsingGiftCard:(NSNumber *)giftCardID token:(NSString *)token;
- (NSURL *)urlForCustomers;
- (NSURL *)urlForCustomersOrders;
- (NSURL *)urlForCustomersWithID:(NSString *)identifier;
- (NSURL *)urlForCustomersActivationWithID:(NSString *)identifier parameters:(NSDictionary *)parameters;
- (NSURL *)urlForCustomersToken;
- (NSURL *)urlForCustomersTokenRenewalWithID:(NSString *)customerID;
- (NSURL *)urlForCustomersPasswordRecovery;
- (NSURL *)urlForCustomersPasswordResetWithID:(NSString *)identifier parameters:(NSDictionary *)parameters;
@end
......@@ -92,127 +92,127 @@
#pragma mark - API -
- (NSURL *)routeForShopDomain
- (NSURL *)urlForShopDomain
{
return [NSURL URLWithFormat:@"https://%@", self.shopDomain];
}
- (NSURL *)routeForAPI
- (NSURL *)urlForAPI
{
return [[self routeForShopDomain] appendPath:@"/api"];
return [[self urlForShopDomain] appendPath:@"/api"];
}
- (NSURL *)routeForApps
- (NSURL *)urlForApps
{
return [[self routeForAPI] appendFormat:@"/apps/%@", self.appId];
return [[self urlForAPI] appendFormat:@"/apps/%@", self.appId];
}
#pragma mark - Storefront -
- (NSURL *)routeForShop
- (NSURL *)urlForShop
{
return [[[self routeForShopDomain] appendPath:@"/meta"] appendExtension];
return [[[self urlForShopDomain] appendPath:@"/meta"] appendExtension];
}
- (NSURL *)routeForProductListingsWithParameters:(NSDictionary *)parameters
- (NSURL *)urlForProductListingsWithParameters:(NSDictionary *)parameters
{
return [[[[self routeForApps] appendPath:@"/product_listings"] appendExtension] appendParameters:parameters];
return [[[[self urlForApps] appendPath:@"/product_listings"] appendExtension] appendParameters:parameters];
}
- (NSURL *)routeForCollectionListingsWithParameters:(NSDictionary *)parameters
- (NSURL *)urlForCollectionListingsWithParameters:(NSDictionary *)parameters
{
return [[[[self routeForApps] appendPath:@"/collection_listings"] appendExtension] appendParameters:parameters];
return [[[[self urlForApps] appendPath:@"/collection_listings"] appendExtension] appendParameters:parameters];
}
#pragma mark - Checkout -
- (NSURL *)routeForCheckouts
- (NSURL *)urlForCheckouts
{
return [[[self routeForAPI] appendPath:@"/checkouts"] appendExtension];
return [[[self urlForAPI] appendPath:@"/checkouts"] appendExtension];
}
- (NSURL *)routeForCheckoutsWithToken:(NSString *)token
- (NSURL *)urlForCheckoutsWithToken:(NSString *)token
{
return [self _routeForCheckoutsAction:@"" withToken:token];
return [self _urlForCheckoutsAction:@"" withToken:token];
}
- (NSURL *)routeForCheckoutsProcessingWithToken:(NSString *)token
- (NSURL *)urlForCheckoutsProcessingWithToken:(NSString *)token
{
return [self _routeForCheckoutsAction:@"/processing" withToken:token];
return [self _urlForCheckoutsAction:@"/processing" withToken:token];
}
- (NSURL *)routeForCheckoutsCompletionWithToken:(NSString *)token
- (NSURL *)urlForCheckoutsCompletionWithToken:(NSString *)token
{
return [self _routeForCheckoutsAction:@"/complete" withToken:token];
return [self _urlForCheckoutsAction:@"/complete" withToken:token];
}
- (NSURL *)routeForCheckoutsShippingRatesWithToken:(NSString *)token parameters:(NSDictionary *)parameters
- (NSURL *)urlForCheckoutsShippingRatesWithToken:(NSString *)token parameters:(NSDictionary *)parameters
{
return [[self _routeForCheckoutsAction:@"/shipping_rates" withToken:token] appendParameters:parameters];
return [[self _urlForCheckoutsAction:@"/shipping_rates" withToken:token] appendParameters:parameters];
}
- (NSURL *)routeForCheckoutsUsingGiftCard
- (NSURL *)urlForCheckoutsUsingGiftCard
{
return [[[self routeForCheckouts] appendPath:@"/gift_cards"] appendExtension];
return [[[self urlForCheckouts] appendPath:@"/gift_cards"] appendExtension];
}
- (NSURL *)routeForCheckoutsUsingGiftCardWithToken:(NSString *)token
- (NSURL *)urlForCheckoutsUsingGiftCardWithToken:(NSString *)token
{
return [[[[self routeForCheckouts] appendPath:token] appendPath:@"/gift_cards"] appendExtension];
return [[[[self urlForCheckouts] appendPath:token] appendPath:@"/gift_cards"] appendExtension];
}
- (NSURL *)routeForCheckoutsUsingGiftCard:(NSNumber *)giftCardID token:(NSString *)token
- (NSURL *)urlForCheckoutsUsingGiftCard:(NSNumber *)giftCardID token:(NSString *)token
{
return [[[self routeForCheckoutsUsingGiftCardWithToken:token] appendIdentifier:giftCardID] appendExtension];
return [[[self urlForCheckoutsUsingGiftCardWithToken:token] appendIdentifier:giftCardID] appendExtension];
}
#pragma mark - Customers -
- (NSURL *)routeForCustomers
- (NSURL *)urlForCustomers
{
return [[[self routeForAPI] appendPath:@"/customers"] appendExtension];
return [[[self urlForAPI] appendPath:@"/customers"] appendExtension];
}
- (NSURL *)routeForCustomersOrders
- (NSURL *)urlForCustomersOrders
{
return [[[self routeForCustomers] appendPath:@"/orders"] appendExtension];
return [[[self urlForCustomers] appendPath:@"/orders"] appendExtension];
}
- (NSURL *)routeForCustomersWithID:(NSString *)identifier
- (NSURL *)urlForCustomersWithID:(NSString *)identifier
{
return [[[self routeForCustomers] appendPath:identifier] appendExtension];
return [[[self urlForCustomers] appendPath:identifier] appendExtension];
}
- (NSURL *)routeForCustomersActivationWithID:(NSString *)identifier parameters:(NSDictionary *)parameters
- (NSURL *)urlForCustomersActivationWithID:(NSString *)identifier parameters:(NSDictionary *)parameters
{
return [[[[self routeForCustomersWithID:identifier] appendPath:@"/activate"] appendParameters:parameters] appendExtension];
return [[[[self urlForCustomersWithID:identifier] appendPath:@"/activate"] appendParameters:parameters] appendExtension];
}
- (NSURL *)routeForCustomersToken
- (NSURL *)urlForCustomersToken
{
return [[[self routeForCustomers] appendPath:@"/customer_token"] appendExtension];
return [[[self urlForCustomers] appendPath:@"/customer_token"] appendExtension];
}
- (NSURL *)routeForCustomersTokenRenewalWithID:(NSString *)customerID
- (NSURL *)urlForCustomersTokenRenewalWithID:(NSString *)customerID
{
return [[[self routeForCustomersWithID:customerID] appendPath:@"/customer_token/renew"] appendExtension];
return [[[self urlForCustomersWithID:customerID] appendPath:@"/customer_token/renew"] appendExtension];
}
- (NSURL *)routeForCustomersPasswordRecovery
- (NSURL *)urlForCustomersPasswordRecovery
{
return [[[self routeForCustomers] appendPath:@"/recover"] appendExtension];
return [[[self urlForCustomers] appendPath:@"/recover"] appendExtension];
}
- (NSURL *)routeForCustomersPasswordResetWithID:(NSString *)identifier parameters:(NSDictionary *)parameters
- (NSURL *)urlForCustomersPasswordResetWithID:(NSString *)identifier parameters:(NSDictionary *)parameters
{
return [[[[self routeForCustomersWithID:identifier] appendPath:@"/reset"] appendExtension] appendParameters:parameters];
return [[[[self urlForCustomersWithID:identifier] appendPath:@"/reset"] appendExtension] appendParameters:parameters];
}
#pragma mark - Utilities -
- (NSURL *)_routeForCheckoutsAction:(NSString *)action withToken:(NSString *)token
- (NSURL *)_urlForCheckoutsAction:(NSString *)action withToken:(NSString *)token
{
return [[[[self routeForCheckouts] appendPath:token] appendPath:action] appendExtension];
return [[[[self urlForCheckouts] appendPath:token] appendPath:action] appendExtension];
}
@end
......@@ -49,7 +49,7 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
- (NSURLSessionDataTask *)getShop:(BUYDataShopBlock)block
{
return [self getRequestForURL:[self routeForShop] completionHandler:^(NSDictionary *json, NSURLResponse *response, NSError *error) {
return [self getRequestForURL:[self urlForShop] completionHandler:^(NSDictionary *json, NSURLResponse *response, NSError *error) {
BUYShop *shop = nil;
if (json && !error) {
shop = [self.modelManager insertShopWithJSONDictionary:json];
......@@ -60,7 +60,7 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
- (NSURLSessionDataTask *)getProductsPage:(NSUInteger)page completion:(BUYDataProductListBlock)block
{
NSURL *route = [self routeForProductListingsWithParameters:@{
NSURL *route = [self urlForProductListingsWithParameters:@{
@"limit" : @(self.pageSize),
@"page" : @(page),
}];
......@@ -95,7 +95,7 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
{
BUYAssert(productIds, @"Failed to get product by IDs. Product IDs array must not be nil.");
NSURL *route = [self routeForProductListingsWithParameters:@{
NSURL *route = [self urlForProductListingsWithParameters:@{
@"product_ids" : [productIds componentsJoinedByString:@","],
}];
......@@ -121,7 +121,7 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
- (NSURLSessionDataTask *)getCollectionsPage:(NSUInteger)page completion:(BUYDataCollectionsListBlock)block
{
NSURL *route = [self routeForCollectionListingsWithParameters:@{
NSURL *route = [self urlForCollectionListingsWithParameters:@{
@"limit" : @(self.pageSize),
@"page" : @(page),
}];
......@@ -145,7 +145,7 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
{
BUYAssert(collectionId, @"Failed to get products page. Invalid collectionID.");
NSURL *route = [self routeForProductListingsWithParameters:@{
NSURL *route = [self urlForProductListingsWithParameters:@{
@"collection_id" : collectionId,
@"limit" : @(self.pageSize),
@"page" : @(page),
......
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