forked from 3sidedcube/ThunderRequest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gets project running on OS X Adds ability for all encoding content types
- Loading branch information
1 parent
9382fae
commit 926b96a
Showing
10 changed files
with
626 additions
and
4 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,17 @@ | ||
// | ||
// NSDictionary+URLEncoding.h | ||
// ThunderRequest | ||
// | ||
// Created by Simon Mitchell on 23/02/2015. | ||
// Copyright (c) 2015 3 SIDED CUBE. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface NSDictionary (URLEncoding) | ||
|
||
- (NSData *)urlEncodedFormData; | ||
|
||
- (NSString *)urlEncodedFormString; | ||
|
||
@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,43 @@ | ||
// | ||
// NSDictionary+URLEncoding.m | ||
// ThunderRequest | ||
// | ||
// Created by Simon Mitchell on 23/02/2015. | ||
// Copyright (c) 2015 3 SIDED CUBE. All rights reserved. | ||
// | ||
|
||
#import "NSDictionary+URLEncoding.h" | ||
|
||
@implementation NSDictionary (URLEncoding) | ||
|
||
static NSString *toString(id object) { | ||
return [NSString stringWithFormat: @"%@", object]; | ||
} | ||
|
||
// helper function: get the url encoded string form of any object | ||
static NSString *urlEncode(id object) { | ||
NSString *string = toString(object); | ||
return [string stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]; | ||
} | ||
|
||
- (NSString *)urlEncodedFormString | ||
{ | ||
if (self.allKeys.count == 0) { | ||
return nil; | ||
} | ||
|
||
NSMutableArray *parts = [NSMutableArray new]; | ||
|
||
[self enumerateKeysAndObjectsUsingBlock:^(NSString *key, id obj, BOOL *stop) { | ||
[parts addObject:[NSString stringWithFormat:@"%@=%@",urlEncode(key),urlEncode(obj)]]; | ||
}]; | ||
|
||
return [parts componentsJoinedByString:@"&"]; | ||
} | ||
|
||
- (NSData *)urlEncodedFormData | ||
{ | ||
return [[self urlEncodedFormString] dataUsingEncoding:NSUTF8StringEncoding]; | ||
} | ||
|
||
@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
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
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,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.threesidedcube.$(PRODUCT_NAME:rfc1034identifier)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>FMWK</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>$(CURRENT_PROJECT_VERSION)</string> | ||
<key>NSHumanReadableCopyright</key> | ||
<string>Copyright © 2015 threesidedcube. All rights reserved.</string> | ||
<key>NSPrincipalClass</key> | ||
<string></string> | ||
</dict> | ||
</plist> |
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,29 @@ | ||
// | ||
// ThunderRequestMac.h | ||
// ThunderRequestMac | ||
// | ||
// Created by Simon Mitchell on 29/09/2015. | ||
// Copyright (c) 2015 threesidedcube. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
//! Project version number for ThunderRequestMac. | ||
FOUNDATION_EXPORT double ThunderRequestMacVersionNumber; | ||
|
||
//! Project version string for ThunderRequestMac. | ||
FOUNDATION_EXPORT const unsigned char ThunderRequestMacVersionString[]; | ||
|
||
// In this header, you should import all the public headers of your framework using statements like #import <ThunderRequestMac/PublicHeader.h> | ||
|
||
#import <ThunderRequestMac/TSCRequestController.h> | ||
#import <ThunderRequestMac/TSCRequest.h> | ||
#import <ThunderRequestMac/TSCRequestCredential.h> | ||
#import <ThunderRequestMacTSCRequestResponse.h> | ||
#import <ThunderRequestMac/TSCRequestDefines.h> | ||
#import <ThunderRequestMac/TSCRequestController.h> | ||
#import <ThunderRequestMac/TSCRequest.h> | ||
#import <ThunderRequestMac/TSCRequestResponse.h> | ||
#import <ThunderRequestMac/TSCErrorRecoveryAttempter.h> | ||
#import <ThunderRequestMac/TSCErrorRecoveryOption.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.threesidedcube.$(PRODUCT_NAME:rfc1034identifier)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>BNDL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
</dict> | ||
</plist> |
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,40 @@ | ||
// | ||
// ThunderRequestMacTests.m | ||
// ThunderRequestMacTests | ||
// | ||
// Created by Simon Mitchell on 29/09/2015. | ||
// Copyright (c) 2015 threesidedcube. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
#import <XCTest/XCTest.h> | ||
|
||
@interface ThunderRequestMacTests : XCTestCase | ||
|
||
@end | ||
|
||
@implementation ThunderRequestMacTests | ||
|
||
- (void)setUp { | ||
[super setUp]; | ||
// Put setup code here. This method is called before the invocation of each test method in the class. | ||
} | ||
|
||
- (void)tearDown { | ||
// Put teardown code here. This method is called after the invocation of each test method in the class. | ||
[super tearDown]; | ||
} | ||
|
||
- (void)testExample { | ||
// This is an example of a functional test case. | ||
XCTAssert(YES, @"Pass"); | ||
} | ||
|
||
- (void)testPerformanceExample { | ||
// This is an example of a performance test case. | ||
[self measureBlock:^{ | ||
// Put the code you want to measure the time of here. | ||
}]; | ||
} | ||
|
||
@end |