Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shopify_iossdk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cemarose
shopify_iossdk
Commits
6c34fca6
Commit
6c34fca6
authored
Dec 09, 2015
by
Rune Madsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding extension for creating NSURLQueryItems from an NSDictionary + added tests.
parent
90dbe594
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
108 additions
and
22 deletions
+108
-22
BUYClientTest.m
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClientTest.m
+11
-0
project.pbxproj
Mobile Buy SDK/Mobile Buy SDK.xcodeproj/project.pbxproj
+16
-4
BUYClient.m
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.m
+6
-18
NSURLComponents+BUYAdditions.h
...y SDK/Mobile Buy SDK/Utils/NSURLComponents+BUYAdditions.h
+33
-0
NSURLComponents+BUYAdditions.m
...y SDK/Mobile Buy SDK/Utils/NSURLComponents+BUYAdditions.m
+42
-0
No files found.
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClientTest.m
View file @
6c34fca6
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#import "BUYAddress+Additions.h"
#import "BUYAddress+Additions.h"
#import "BUYClientTestBase.h"
#import "BUYClientTestBase.h"
#import "BUYCollection+Additions.h"
#import "BUYCollection+Additions.h"
#import "NSURLComponents+BUYAdditions.h"
@interface
BUYClient
()
@interface
BUYClient
()
...
@@ -213,6 +214,16 @@
...
@@ -213,6 +214,16 @@
[
self
testProductsInCollectionWithSortOrderCollectionDefault
];
[
self
testProductsInCollectionWithSortOrderCollectionDefault
];
}
}
-
(
void
)
testQueryItemsConversion
{
NSDictionary
*
dictionary
=
@{
@"collection_id"
:
@"1"
,
@"limit"
:
@"25"
,
@"page"
:
@"1"
,
@"sort_by"
:
@"collection-default"
};
NSURLComponents
*
components
=
[[
NSURLComponents
alloc
]
init
];
[
components
setQueryItemsWithDictionary
:
dictionary
];
NSSet
*
componentsQueryItems
=
[
NSSet
setWithArray
:
components
.
queryItems
];
NSSet
*
queryItems
=
[
NSSet
setWithArray
:@[[
NSURLQueryItem
queryItemWithName
:
@"collection_id"
value
:
@"1"
],
[
NSURLQueryItem
queryItemWithName
:
@"limit"
value
:
@"25"
],
[
NSURLQueryItem
queryItemWithName
:
@"page"
value
:
@"1"
],
[
NSURLQueryItem
queryItemWithName
:
@"sort_by"
value
:
@"collection-default"
]]];
XCTAssertEqualObjects
(
componentsQueryItems
,
queryItems
);
}
-
(
void
)
testProductsInCollectionWithSortOrderCollectionDefault
-
(
void
)
testProductsInCollectionWithSortOrderCollectionDefault
{
{
NSURLSessionDataTask
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortCollectionDefault
completion
:
nil
];
NSURLSessionDataTask
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortCollectionDefault
completion
:
nil
];
...
...
Mobile Buy SDK/Mobile Buy SDK.xcodeproj/project.pbxproj
View file @
6c34fca6
...
@@ -43,6 +43,10 @@
...
@@ -43,6 +43,10 @@
900396F71B69563400226B73
/* BUYCollection+Additions.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
900396F51B69563400226B73
/* BUYCollection+Additions.m */
;
};
900396F71B69563400226B73
/* BUYCollection+Additions.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
900396F51B69563400226B73
/* BUYCollection+Additions.m */
;
};
900E7C841B5DA553006F3C81
/* BUYImageKit.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
900E7C811B5DA32F006F3C81
/* BUYImageKit.h */
;
};
900E7C841B5DA553006F3C81
/* BUYImageKit.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
900E7C811B5DA32F006F3C81
/* BUYImageKit.h */
;
};
900E7C851B5DA559006F3C81
/* BUYImageKit.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
900E7C821B5DA32F006F3C81
/* BUYImageKit.m */
;
};
900E7C851B5DA559006F3C81
/* BUYImageKit.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
900E7C821B5DA32F006F3C81
/* BUYImageKit.m */
;
};
901335461C187E0400410ED0
/* NSURLComponents+BUYAdditions.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
901335441C187E0400410ED0
/* NSURLComponents+BUYAdditions.h */
;
};
901335471C187E0400410ED0
/* NSURLComponents+BUYAdditions.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
901335441C187E0400410ED0
/* NSURLComponents+BUYAdditions.h */
;
};
901335481C187E0400410ED0
/* NSURLComponents+BUYAdditions.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
901335451C187E0400410ED0
/* NSURLComponents+BUYAdditions.m */
;
};
901335491C187E0400410ED0
/* NSURLComponents+BUYAdditions.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
901335451C187E0400410ED0
/* NSURLComponents+BUYAdditions.m */
;
};
901930E31BC5B9BC00D1134E
/* BUYApplePayHelpers.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BE33B4EE1B15FF4D0067982B
/* BUYApplePayHelpers.m */
;
};
901930E31BC5B9BC00D1134E
/* BUYApplePayHelpers.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BE33B4EE1B15FF4D0067982B
/* BUYApplePayHelpers.m */
;
};
901930E41BC5B9BC00D1134E
/* BUYOptionSelectionViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BE9496AF1B4D96D800B38949
/* BUYOptionSelectionViewController.m */
;
};
901930E41BC5B9BC00D1134E
/* BUYOptionSelectionViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BE9496AF1B4D96D800B38949
/* BUYOptionSelectionViewController.m */
;
};
901930E51BC5B9BC00D1134E
/* BUYVariantOptionView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
90516CA21B4D771400E35E45
/* BUYVariantOptionView.m */
;
};
901930E51BC5B9BC00D1134E
/* BUYVariantOptionView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
90516CA21B4D771400E35E45
/* BUYVariantOptionView.m */
;
};
...
@@ -370,6 +374,8 @@
...
@@ -370,6 +374,8 @@
900396F51B69563400226B73
/* BUYCollection+Additions.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
"BUYCollection+Additions.m"
;
sourceTree
=
"<group>"
;
};
900396F51B69563400226B73
/* BUYCollection+Additions.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
"BUYCollection+Additions.m"
;
sourceTree
=
"<group>"
;
};
900E7C811B5DA32F006F3C81
/* BUYImageKit.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
BUYImageKit.h
;
sourceTree
=
"<group>"
;
};
900E7C811B5DA32F006F3C81
/* BUYImageKit.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
BUYImageKit.h
;
sourceTree
=
"<group>"
;
};
900E7C821B5DA32F006F3C81
/* BUYImageKit.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYImageKit.m
;
sourceTree
=
"<group>"
;
};
900E7C821B5DA32F006F3C81
/* BUYImageKit.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYImageKit.m
;
sourceTree
=
"<group>"
;
};
901335441C187E0400410ED0
/* NSURLComponents+BUYAdditions.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
"NSURLComponents+BUYAdditions.h"
;
sourceTree
=
"<group>"
;
};
901335451C187E0400410ED0
/* NSURLComponents+BUYAdditions.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
"NSURLComponents+BUYAdditions.m"
;
sourceTree
=
"<group>"
;
};
901931701BC5B9BC00D1134E
/* Buy.framework */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.framework
;
includeInIndex
=
0
;
path
=
Buy.framework
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
901931701BC5B9BC00D1134E
/* Buy.framework */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.framework
;
includeInIndex
=
0
;
path
=
Buy.framework
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
901931761BC5BC9100D1134E
/* libc++.tbd */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
"sourcecode.text-based-dylib-definition"
;
name
=
"libc++.tbd"
;
path
=
"usr/lib/libc++.tbd"
;
sourceTree
=
SDKROOT
;
};
901931761BC5BC9100D1134E
/* libc++.tbd */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
"sourcecode.text-based-dylib-definition"
;
name
=
"libc++.tbd"
;
path
=
"usr/lib/libc++.tbd"
;
sourceTree
=
SDKROOT
;
};
903BCC7A1B7D1C2D00C21FEB
/* BUYProductViewErrorView.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
lineEnding
=
0
;
name
=
BUYProductViewErrorView.h
;
path
=
"Product View/BUYProductViewErrorView.h"
;
sourceTree
=
"<group>"
;
xcLanguageSpecificationIdentifier
=
xcode.lang.objcpp
;
};
903BCC7A1B7D1C2D00C21FEB
/* BUYProductViewErrorView.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
lineEnding
=
0
;
name
=
BUYProductViewErrorView.h
;
path
=
"Product View/BUYProductViewErrorView.h"
;
sourceTree
=
"<group>"
;
xcLanguageSpecificationIdentifier
=
xcode.lang.objcpp
;
};
...
@@ -807,8 +813,6 @@
...
@@ -807,8 +813,6 @@
F70CE40E1A8BF1D90055BEB8
/* BUYApplePayAdditions.m */
,
F70CE40E1A8BF1D90055BEB8
/* BUYApplePayAdditions.m */
,
BE33B4ED1B15FF4D0067982B
/* BUYApplePayHelpers.h */
,
BE33B4ED1B15FF4D0067982B
/* BUYApplePayHelpers.h */
,
BE33B4EE1B15FF4D0067982B
/* BUYApplePayHelpers.m */
,
BE33B4EE1B15FF4D0067982B
/* BUYApplePayHelpers.m */
,
909944471B71B76800C40A33
/* UIFont+BUYAdditions.h */
,
909944481B71B76800C40A33
/* UIFont+BUYAdditions.m */
,
900E7C811B5DA32F006F3C81
/* BUYImageKit.h */
,
900E7C811B5DA32F006F3C81
/* BUYImageKit.h */
,
900E7C821B5DA32F006F3C81
/* BUYImageKit.m */
,
900E7C821B5DA32F006F3C81
/* BUYImageKit.m */
,
BE9496B61B4D96F100B38949
/* BUYProduct+Options.h */
,
BE9496B61B4D96F100B38949
/* BUYProduct+Options.h */
,
...
@@ -823,12 +827,16 @@
...
@@ -823,12 +827,16 @@
90A446241B5EC03F009602AA
/* NSDateFormatter+BUYAdditions.m */
,
90A446241B5EC03F009602AA
/* NSDateFormatter+BUYAdditions.m */
,
2AF52A9B1A7011DC0087DB2C
/* NSDecimalNumber+BUYAdditions.h */
,
2AF52A9B1A7011DC0087DB2C
/* NSDecimalNumber+BUYAdditions.h */
,
2AF52A9C1A7011DC0087DB2C
/* NSDecimalNumber+BUYAdditions.m */
,
2AF52A9C1A7011DC0087DB2C
/* NSDecimalNumber+BUYAdditions.m */
,
BE6D05971BD6BA6700772EBB
/* NSDictionary+Additions.h */
,
BE6D05981BD6BA6700772EBB
/* NSDictionary+Additions.m */
,
F76CFF1B19CB7BE30079C703
/* NSString+Trim.h */
,
F76CFF1B19CB7BE30079C703
/* NSString+Trim.h */
,
F76CFF1C19CB7BE30079C703
/* NSString+Trim.m */
,
F76CFF1C19CB7BE30079C703
/* NSString+Trim.m */
,
BE5DC39E1B71B13700B2BC1E
/* NSURL+BUYAdditions.h */
,
BE5DC39E1B71B13700B2BC1E
/* NSURL+BUYAdditions.h */
,
BE5DC39F1B71B13700B2BC1E
/* NSURL+BUYAdditions.m */
,
BE5DC39F1B71B13700B2BC1E
/* NSURL+BUYAdditions.m */
,
BE6D05971BD6BA6700772EBB
/* NSDictionary+Additions.h */
,
901335441C187E0400410ED0
/* NSURLComponents+BUYAdditions.h */
,
BE6D05981BD6BA6700772EBB
/* NSDictionary+Additions.m */
,
901335451C187E0400410ED0
/* NSURLComponents+BUYAdditions.m */
,
909944471B71B76800C40A33
/* UIFont+BUYAdditions.h */
,
909944481B71B76800C40A33
/* UIFont+BUYAdditions.m */
,
);
);
path
=
Utils
;
path
=
Utils
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -896,6 +904,7 @@
...
@@ -896,6 +904,7 @@
901931371BC5B9BC00D1134E
/* BUYTaxLine.h in Headers */
,
901931371BC5B9BC00D1134E
/* BUYTaxLine.h in Headers */
,
901931381BC5B9BC00D1134E
/* BUYVariantSelectionViewController.h in Headers */
,
901931381BC5B9BC00D1134E
/* BUYVariantSelectionViewController.h in Headers */
,
901931391BC5B9BC00D1134E
/* BUYOptionValueCell.h in Headers */
,
901931391BC5B9BC00D1134E
/* BUYOptionValueCell.h in Headers */
,
901335471C187E0400410ED0
/* NSURLComponents+BUYAdditions.h in Headers */
,
9019313A1BC5B9BC00D1134E
/* BUYImage.h in Headers */
,
9019313A1BC5B9BC00D1134E
/* BUYImage.h in Headers */
,
9019313B1BC5B9BC00D1134E
/* BUYOptionValue.h in Headers */
,
9019313B1BC5B9BC00D1134E
/* BUYOptionValue.h in Headers */
,
9019313C1BC5B9BC00D1134E
/* BUYShop.h in Headers */
,
9019313C1BC5B9BC00D1134E
/* BUYShop.h in Headers */
,
...
@@ -971,6 +980,7 @@
...
@@ -971,6 +980,7 @@
BEB74A7D1B5564870005A300
/* BUYVariantSelectionViewController.h in Headers */
,
BEB74A7D1B5564870005A300
/* BUYVariantSelectionViewController.h in Headers */
,
BE10079B1B6165EC0031CEE7
/* BUYOptionValueCell.h in Headers */
,
BE10079B1B6165EC0031CEE7
/* BUYOptionValueCell.h in Headers */
,
BE9A64591B503CD40033E558
/* BUYImage.h in Headers */
,
BE9A64591B503CD40033E558
/* BUYImage.h in Headers */
,
901335461C187E0400410ED0
/* NSURLComponents+BUYAdditions.h in Headers */
,
BE9A64681B503D080033E558
/* BUYOptionValue.h in Headers */
,
BE9A64681B503D080033E558
/* BUYOptionValue.h in Headers */
,
BE9A64661B503D010033E558
/* BUYShop.h in Headers */
,
BE9A64661B503D010033E558
/* BUYShop.h in Headers */
,
BE9A644D1B503CA20033E558
/* BUYShippingRate.h in Headers */
,
BE9A644D1B503CA20033E558
/* BUYShippingRate.h in Headers */
,
...
@@ -1190,6 +1200,7 @@
...
@@ -1190,6 +1200,7 @@
901930E31BC5B9BC00D1134E
/* BUYApplePayHelpers.m in Sources */
,
901930E31BC5B9BC00D1134E
/* BUYApplePayHelpers.m in Sources */
,
901930E41BC5B9BC00D1134E
/* BUYOptionSelectionViewController.m in Sources */
,
901930E41BC5B9BC00D1134E
/* BUYOptionSelectionViewController.m in Sources */
,
901930E51BC5B9BC00D1134E
/* BUYVariantOptionView.m in Sources */
,
901930E51BC5B9BC00D1134E
/* BUYVariantOptionView.m in Sources */
,
901335491C187E0400410ED0
/* NSURLComponents+BUYAdditions.m in Sources */
,
901930E61BC5B9BC00D1134E
/* BUYPresentationControllerForVariantSelection.m in Sources */
,
901930E61BC5B9BC00D1134E
/* BUYPresentationControllerForVariantSelection.m in Sources */
,
901930E71BC5B9BC00D1134E
/* NSDecimalNumber+BUYAdditions.m in Sources */
,
901930E71BC5B9BC00D1134E
/* NSDecimalNumber+BUYAdditions.m in Sources */
,
901930E81BC5B9BC00D1134E
/* BUYImage.m in Sources */
,
901930E81BC5B9BC00D1134E
/* BUYImage.m in Sources */
,
...
@@ -1284,6 +1295,7 @@
...
@@ -1284,6 +1295,7 @@
BE9A64751B503D370033E558
/* BUYApplePayHelpers.m in Sources */
,
BE9A64751B503D370033E558
/* BUYApplePayHelpers.m in Sources */
,
BEB74A7A1B55647C0005A300
/* BUYOptionSelectionViewController.m in Sources */
,
BEB74A7A1B55647C0005A300
/* BUYOptionSelectionViewController.m in Sources */
,
BEB74A7C1B5564840005A300
/* BUYVariantOptionView.m in Sources */
,
BEB74A7C1B5564840005A300
/* BUYVariantOptionView.m in Sources */
,
901335481C187E0400410ED0
/* NSURLComponents+BUYAdditions.m in Sources */
,
BEB74A241B554BF20005A300
/* BUYPresentationControllerForVariantSelection.m in Sources */
,
BEB74A241B554BF20005A300
/* BUYPresentationControllerForVariantSelection.m in Sources */
,
BE9A64711B503D260033E558
/* NSDecimalNumber+BUYAdditions.m in Sources */
,
BE9A64711B503D260033E558
/* NSDecimalNumber+BUYAdditions.m in Sources */
,
BE9A645A1B503CD90033E558
/* BUYImage.m in Sources */
,
BE9A645A1B503CD90033E558
/* BUYImage.m in Sources */
,
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.m
View file @
6c34fca6
...
@@ -27,17 +27,18 @@
...
@@ -27,17 +27,18 @@
#import "BUYAddress.h"
#import "BUYAddress.h"
#import "BUYCart.h"
#import "BUYCart.h"
#import "BUYCheckout.h"
#import "BUYCheckout.h"
#import "BUYCheckout_Private.h"
#import "BUYCreditCard.h"
#import "BUYCreditCard.h"
#import "BUYClient.h"
#import "BUYClient.h"
#import "BUYCollection.h"
#import "BUYCollection+Additions.h"
#import "BUYError.h"
#import "BUYGiftCard.h"
#import "BUYGiftCard.h"
#import "BUYProduct.h"
#import "BUYProduct.h"
#import "BUYShippingRate.h"
#import "BUYShippingRate.h"
#import "BUYShop.h"
#import "BUYShop.h"
#import "BUYCheckout_Private.h"
#import "NSDecimalNumber+BUYAdditions.h"
#import "NSDecimalNumber+BUYAdditions.h"
#import "BUYError.h"
#import "NSURLComponents+BUYAdditions.h"
#import "BUYCollection.h"
#import "BUYCollection+Additions.h"
#if __has_include(<PassKit/PassKit.h>)
#if __has_include(<PassKit/PassKit.h>)
@import
PassKit
;
@import
PassKit
;
...
@@ -266,23 +267,10 @@ NSString * const BUYVersionString = @"1.2.3";
...
@@ -266,23 +267,10 @@ NSString * const BUYVersionString = @"1.2.3";
components
.
scheme
=
@"https"
;
components
.
scheme
=
@"https"
;
components
.
host
=
self
.
shopDomain
;
components
.
host
=
self
.
shopDomain
;
components
.
path
=
[
NSString
stringWithFormat
:
@"/%@"
,
[
pathComponents
componentsJoinedByString
:
@"/"
]];
components
.
path
=
[
NSString
stringWithFormat
:
@"/%@"
,
[
pathComponents
componentsJoinedByString
:
@"/"
]];
components
.
queryItems
=
[
self
queryItemsWithNamesAndValues
:
queryItems
];
[
components
setQueryItemsWithDictionary
:
queryItems
];
return
components
;
return
components
;
}
}
-
(
NSArray
*
)
queryItemsWithNamesAndValues
:
(
NSDictionary
*
)
namesAndValues
{
if
(
namesAndValues
)
{
NSMutableArray
*
queryItems
=
[
NSMutableArray
array
];
for
(
NSString
*
key
in
[
namesAndValues
allKeys
])
{
[
queryItems
addObject
:[[
NSURLQueryItem
alloc
]
initWithName
:
key
value
:
namesAndValues
[
key
]]];
}
return
[
queryItems
copy
];
}
else
{
return
nil
;
}
}
#pragma mark - Checkout
#pragma mark - Checkout
-
(
void
)
handleCheckoutResponse
:
(
NSDictionary
*
)
json
error
:
(
NSError
*
)
error
block
:
(
BUYDataCheckoutBlock
)
block
-
(
void
)
handleCheckoutResponse
:
(
NSDictionary
*
)
json
error
:
(
NSError
*
)
error
block
:
(
BUYDataCheckoutBlock
)
block
...
...
Mobile Buy SDK/Mobile Buy SDK/Utils/NSURLComponents+BUYAdditions.h
0 → 100644
View file @
6c34fca6
//
// NSURLComponents+BUYAdditions.h
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
@import
Foundation
;
@interface
NSURLComponents
(
BUYAdditions
)
-
(
void
)
setQueryItemsWithDictionary
:(
NSDictionary
*
)
namesAndValues
;
@end
Mobile Buy SDK/Mobile Buy SDK/Utils/NSURLComponents+BUYAdditions.m
0 → 100644
View file @
6c34fca6
//
// NSURLComponents+BUYAdditions.m
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import "NSURLComponents+BUYAdditions.h"
@implementation
NSURLComponents
(
BUYAdditions
)
-
(
void
)
setQueryItemsWithDictionary
:(
NSDictionary
*
)
dictionary
{
if
(
dictionary
)
{
NSMutableArray
*
queryItems
=
[
NSMutableArray
array
];
for
(
NSString
*
key
in
[
dictionary
allKeys
])
{
[
queryItems
addObject
:[[
NSURLQueryItem
alloc
]
initWithName
:
key
value
:
dictionary
[
key
]]];
}
self
.
queryItems
=
[
queryItems
copy
];
}
}
@end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment