forked from RestKit/RestKit
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecated RKObjectManager methods that use queryParams. Added NSStri…
…ng category for achieving the same results without bloating the API
- Loading branch information
1 parent
e3a007f
commit a75ace8
Showing
5 changed files
with
80 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// NSString+RestKit.h | ||
// RestKit | ||
// | ||
// Created by Blake Watters on 6/15/11. | ||
// Copyright 2011 Two Toasters. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
/** | ||
A library of helpful additions to the NSString class to simplify | ||
common tasks within RestKit | ||
*/ | ||
@interface NSString (NSString) | ||
|
||
/** | ||
Returns a resource path with a dictionary of query parameters URL encoded and appended | ||
This is a convenience method for constructing a new resource path that includes a query. For example, | ||
when given a resourcePath of /contacts and a dictionary of parameters containing foo=bar and color=red, | ||
will return /contacts?foo=bar&color=red | ||
*NOTE* - Assumes that the resource path does not already contain any query parameters. | ||
@param queryParams A dictionary of query parameters to be URL encoded and appended to the resource path | ||
@return A new resource path with the query parameters appended | ||
@see RKPathAppendQueryParams | ||
*/ | ||
- (NSString*)appendQueryParams:(NSDictionary*)queryParams; | ||
|
||
/** | ||
Convenience method for generating a path against the properties of an object. Takes | ||
a string with property names encoded in parentheses and interpolates the values of | ||
the properties specified and returns the generated path. | ||
For example, given an 'article' object with an 'articleID' property of 12345 | ||
[@"articles/(articleID)" interpolateWithObject:article] would generate @"articles/12345" | ||
This functionality is the basis for resource path generation in the Router. | ||
@param object The object to interpolate the properties against | ||
*/ | ||
- (NSString*)interpolateWithObject:(id)object; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// NSString+RestKit.m | ||
// RestKit | ||
// | ||
// Created by Blake Watters on 6/15/11. | ||
// Copyright 2011 Two Toasters. All rights reserved. | ||
// | ||
|
||
#import "NSString+RestKit.h" | ||
#import "../Network/RKClient.h" | ||
|
||
@implementation NSString (RestKit) | ||
|
||
- (NSString*)appendQueryParams:(NSDictionary*)queryParams { | ||
return RKPathAppendQueryParams(self, queryParams); | ||
} | ||
|
||
- (NSString*)interpolateWithObject:(id)object { | ||
return RKMakePathWithObject(self, object); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ | |
#import "NSDictionary+RKAdditions.h" | ||
#import "RKMIMETypes.h" | ||
#import "RKLog.h" | ||
#import "NSString+RestKit.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters