Skip to content

Commit d7d7b91

Browse files
committed
Merge pull request #91 from tumblr/feature/ziba-nested-dictionaries
Adding Ziba's nested parameter dictionary changes, along with a test
2 parents fdfb95e + 3e92903 commit d7d7b91

19 files changed

+220
-991
lines changed

Podfile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,3 @@ platform :ios, '5.0'
44

55
pod 'JXHTTP', '~> 2.0'
66
pod 'Spectacles', '~> 1.0'
7-
8-
target :test, :exclusive => true do
9-
link_with 'TMTumblrSDKTests'
10-
pod 'OCMock'
11-
end

TMTumblrSDK.podspec.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "TMTumblrSDK",
3-
"version": "2.1.2",
3+
"version": "2.1.3",
44
"summary": "An unopinionated and flexible library for easily integrating Tumblr data into your iOS or OS X application.",
55
"authors": {
66
"Bryan Irace": "[email protected]"
@@ -12,7 +12,7 @@
1212
},
1313
"source": {
1414
"git": "https://github.com/tumblr/TMTumblrSDK.git",
15-
"tag": "2.1.2"
15+
"tag": "2.1.3"
1616
},
1717
"requires_arc": true,
1818
"platforms": {

TMTumblrSDK.xcodeproj/project.pbxproj

Lines changed: 139 additions & 183 deletions
Large diffs are not rendered by default.

TMTumblrSDK.xcodeproj/xcshareddata/xcschemes/TMTumblrSDK.xcscheme

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,22 @@
3232
skipped = "NO">
3333
<BuildableReference
3434
BuildableIdentifier = "primary"
35-
BlueprintIdentifier = "93E52A80168BB43700E5471A"
36-
BuildableName = "TMTumblrSDKTests.xctest"
37-
BlueprintName = "TMTumblrSDKTests"
35+
BlueprintIdentifier = "93A015BA1B0696E20047F8C4"
36+
BuildableName = "Tests.xctest"
37+
BlueprintName = "Tests"
3838
ReferencedContainer = "container:TMTumblrSDK.xcodeproj">
3939
</BuildableReference>
40-
<SkippedTests>
41-
<Test
42-
Identifier = "TMAPIClientBlogTest">
43-
</Test>
44-
<Test
45-
Identifier = "TMAPIClientPostTest">
46-
</Test>
47-
<Test
48-
Identifier = "TMAPIClientTagTest">
49-
</Test>
50-
<Test
51-
Identifier = "TMAPIClientUnitTest">
52-
</Test>
53-
<Test
54-
Identifier = "TMAPIClientUserTest">
55-
</Test>
56-
</SkippedTests>
5740
</TestableReference>
5841
</Testables>
42+
<MacroExpansion>
43+
<BuildableReference
44+
BuildableIdentifier = "primary"
45+
BlueprintIdentifier = "93E52A6F168BB43600E5471A"
46+
BuildableName = "libTMTumblrSDK.a"
47+
BlueprintName = "TMTumblrSDK"
48+
ReferencedContainer = "container:TMTumblrSDK.xcodeproj">
49+
</BuildableReference>
50+
</MacroExpansion>
5951
</TestAction>
6052
<LaunchAction
6153
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
@@ -66,6 +58,15 @@
6658
ignoresPersistentStateOnLaunch = "NO"
6759
debugDocumentVersioning = "YES"
6860
allowLocationSimulation = "YES">
61+
<MacroExpansion>
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "93E52A6F168BB43600E5471A"
65+
BuildableName = "libTMTumblrSDK.a"
66+
BlueprintName = "TMTumblrSDK"
67+
ReferencedContainer = "container:TMTumblrSDK.xcodeproj">
68+
</BuildableReference>
69+
</MacroExpansion>
6970
<AdditionalOptions>
7071
</AdditionalOptions>
7172
</LaunchAction>
@@ -75,6 +76,15 @@
7576
useCustomWorkingDirectory = "NO"
7677
buildConfiguration = "Release"
7778
debugDocumentVersioning = "YES">
79+
<MacroExpansion>
80+
<BuildableReference
81+
BuildableIdentifier = "primary"
82+
BlueprintIdentifier = "93E52A6F168BB43600E5471A"
83+
BuildableName = "libTMTumblrSDK.a"
84+
BlueprintName = "TMTumblrSDK"
85+
ReferencedContainer = "container:TMTumblrSDK.xcodeproj">
86+
</BuildableReference>
87+
</MacroExpansion>
7888
</ProfileAction>
7989
<AnalyzeAction
8090
buildConfiguration = "Debug">

TMTumblrSDK.xcodeproj/xcshareddata/xcschemes/TMTumblrSDKTests.xcscheme

Lines changed: 0 additions & 69 deletions
This file was deleted.

TMTumblrSDK/Core/TMSDKFunctions.m

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,30 @@ @implementation TMSDKFunctions
5858
NSString *TMDictionaryToQueryString(NSDictionary *dictionary) {
5959
NSMutableArray *parameters = [NSMutableArray array];
6060

61-
void (^addParameter)(NSString *key, NSString *value) = ^(NSString *key, NSString *value) {
62-
[parameters addObject:[NSString stringWithFormat:@"%@=%@", TMURLEncode(key), TMURLEncode(value)]];
63-
};
64-
6561
for (NSString *key in [[dictionary allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]) {
66-
id value = dictionary[key];
67-
68-
if ([value isKindOfClass:[NSArray class]]) {
69-
for (NSString *arrayValue in (NSArray *)value)
70-
addParameter(key, arrayValue);
71-
} else
72-
addParameter(key, value);
62+
TMAddKeyValuePairToQueryStringMutableArray(key, dictionary[key], parameters);
7363
}
7464

7565
return [parameters componentsJoinedByString:@"&"];
7666
}
7767

68+
#pragma mark - Private
69+
70+
void TMAddKeyValuePairToQueryStringMutableArray(NSString *key, id value, NSMutableArray *parameters) {
71+
if ([value isKindOfClass:[NSDictionary class]]) {
72+
NSDictionary *dictionary = (NSDictionary *)value;
73+
for (NSString *subKey in [dictionary.allKeys sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]) {
74+
TMAddKeyValuePairToQueryStringMutableArray([NSString stringWithFormat:@"%@[%@]", key, subKey], dictionary[subKey], parameters);
75+
}
76+
}
77+
else if ([value isKindOfClass:[NSArray class]]) {
78+
for (id arrayValue in (NSArray *)value){
79+
TMAddKeyValuePairToQueryStringMutableArray(key, arrayValue, parameters);
80+
}
81+
}
82+
else {
83+
[parameters addObject:[NSString stringWithFormat:@"%@=%@", TMURLEncode(key), TMURLEncode(value)]];
84+
}
85+
}
86+
7887
@end

TMTumblrSDKTests/TMAPIClientBlogTest.h

Lines changed: 0 additions & 14 deletions
This file was deleted.

TMTumblrSDKTests/TMAPIClientBlogTest.m

Lines changed: 0 additions & 122 deletions
This file was deleted.

TMTumblrSDKTests/TMAPIClientPostTest.h

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)