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
cb433eee
Commit
cb433eee
authored
May 16, 2016
by
Dima Bart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename NSURLSessionDataTask return type to BUYRequestOperation.
parent
4524f2b7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
49 deletions
+50
-49
BUYClientTest.m
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClientTest.m
+18
-18
BUYClient+Customers.h
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Customers.h
+16
-16
BUYClient+Customers.m
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Customers.m
+9
-9
BUYClient.h
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.h
+1
-0
BUYClient.m
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.m
+6
-6
No files found.
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClientTest.m
View file @
cb433eee
This diff is collapsed.
Click to expand it.
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Customers.h
View file @
cb433eee
...
...
@@ -74,9 +74,9 @@ typedef void (^BUYDataOrdersBlock)(NSArray <BUYOrder*> * _Nullable orders, NSErr
* @param customerID A customer ID retrieved from either customer creation or login
* @param block (BUYCustomer *customer, NSError *error)
*
* @return The associated
NSURLSessionDataTask
* @return The associated
BUYRequestOperation
*/
-
(
NSURLSessionDataTask
*
)
getCustomerWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataCustomerBlock
)
block
;
-
(
BUYRequestOperation
*
)
getCustomerWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataCustomerBlock
)
block
;
/**
* POST /api/customers
...
...
@@ -86,11 +86,11 @@ typedef void (^BUYDataOrdersBlock)(NSArray <BUYOrder*> * _Nullable orders, NSErr
* @param credentials Credentials object containing items for required fields
* @param block (BUYCustomer *customer, NSString *token, NSError *error)
*
* @return The associated
NSURLSessionDataTask
* @return The associated
BUYRequestOperation
*
* @discussion The customer is automatically logged in using -loginCustomerWithCredentials:callback:
*/
-
(
NSURLSessionDataTask
*
)
createCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
callback
:(
BUYDataCustomerTokenBlock
)
block
;
-
(
BUYRequestOperation
*
)
createCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
callback
:(
BUYDataCustomerTokenBlock
)
block
;
/**
* POST /api/customers/customer_token
...
...
@@ -100,9 +100,9 @@ typedef void (^BUYDataOrdersBlock)(NSArray <BUYOrder*> * _Nullable orders, NSErr
* @param credentials Credentials object containing items for required fields
* @param block (BUYCustomer *customer, NSString *token, NSError *error)
*
* @return The associated
NSURLSessionDataTask
* @return The associated
BUYRequestOperation
*/
-
(
NSURLSessionDataTask
*
)
loginCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
callback
:(
BUYDataCustomerTokenBlock
)
block
;
-
(
BUYRequestOperation
*
)
loginCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
callback
:(
BUYDataCustomerTokenBlock
)
block
;
/**
* POST /api/customers/recover
...
...
@@ -111,9 +111,9 @@ typedef void (^BUYDataOrdersBlock)(NSArray <BUYOrder*> * _Nullable orders, NSErr
* @param email Email to send the password reset to
* @param block (BUYStatus status, NSError *error)
*
* @return the associated
NSURLSessionDataTask
* @return the associated
BUYRequestOperation
*/
-
(
NSURLSessionDataTask
*
)
recoverPasswordForCustomer
:(
NSString
*
)
email
callback
:(
BUYDataStatusBlock
)
block
;
-
(
BUYRequestOperation
*
)
recoverPasswordForCustomer
:(
NSString
*
)
email
callback
:(
BUYDataStatusBlock
)
block
;
/**
* PUT /api/customers/:customer_id/customer_token/renew
...
...
@@ -122,9 +122,9 @@ typedef void (^BUYDataOrdersBlock)(NSArray <BUYOrder*> * _Nullable orders, NSErr
* @param customerID ID of customer renewing token
* @param block (NSString *token, NSError *error)
*
* @return the associated
NSURLSessionDataTask
* @return the associated
BUYRequestOperation
*/
-
(
NSURLSessionDataTask
*
)
renewCustomerTokenWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataTokenBlock
)
block
;
-
(
BUYRequestOperation
*
)
renewCustomerTokenWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataTokenBlock
)
block
;
/**
* PUT /api/customers/:customer_id/activate
...
...
@@ -135,9 +135,9 @@ typedef void (^BUYDataOrdersBlock)(NSArray <BUYOrder*> * _Nullable orders, NSErr
* @param customerToken Token contained in activation URL
* @param block (BUYCustomer *customer, NSString *token, NSError *error)
*
* @return The associated
NSURLSessionDataTask
* @return The associated
BUYRequestOperation
*/
-
(
NSURLSessionDataTask
*
)
activateCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerID
:(
NSString
*
)
customerID
customerToken
:(
NSString
*
)
customerToken
callback
:(
BUYDataCustomerTokenBlock
)
block
;
-
(
BUYRequestOperation
*
)
activateCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerID
:(
NSString
*
)
customerID
customerToken
:(
NSString
*
)
customerToken
callback
:(
BUYDataCustomerTokenBlock
)
block
;
/**
* PUT /api/customers/:customer_id/reset
...
...
@@ -148,9 +148,9 @@ typedef void (^BUYDataOrdersBlock)(NSArray <BUYOrder*> * _Nullable orders, NSErr
* @param customerToken Token contained in reset URL
* @param block (BUYCustomer *customer, NSString *token, NSError *error)
*
* @return The associated
NSURLSessionDataTask
* @return The associated
BUYRequestOperation
*/
-
(
NSURLSessionDataTask
*
)
resetPasswordWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerID
:(
NSString
*
)
customerID
customerToken
:(
NSString
*
)
customerToken
callback
:(
BUYDataCustomerTokenBlock
)
block
;
-
(
BUYRequestOperation
*
)
resetPasswordWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerID
:(
NSString
*
)
customerID
customerToken
:(
NSString
*
)
customerToken
callback
:(
BUYDataCustomerTokenBlock
)
block
;
/**
* GET /api/customers/:customer_id/orders
...
...
@@ -159,9 +159,9 @@ typedef void (^BUYDataOrdersBlock)(NSArray <BUYOrder*> * _Nullable orders, NSErr
* @param token An auth token retrieved from customer creation or customer login API
* @param block (NSArray <BUYOrder*> *orders, NSError *error)
*
* @return The associated
NSURLSessionDataTask
* @return The associated
BUYRequestOperation
*/
-
(
NSURLSessionDataTask
*
)
getOrdersForCustomerWithCallback
:(
BUYDataOrdersBlock
)
block
;
-
(
BUYRequestOperation
*
)
getOrdersForCustomerWithCallback
:(
BUYDataOrdersBlock
)
block
;
@end
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Customers.m
View file @
cb433eee
...
...
@@ -38,7 +38,7 @@
#pragma mark - Customer
-
(
NSURLSessionDataTask
*
)
getCustomerWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataCustomerBlock
)
block
-
(
BUYRequestOperation
*
)
getCustomerWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataCustomerBlock
)
block
{
NSURL
*
route
=
[
self
urlForCustomersWithID
:
customerID
];
return
[
self
getRequestForURL
:
route
completionHandler
:
^
(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
)
{
...
...
@@ -50,7 +50,7 @@
}];
}
-
(
NSURLSessionDataTask
*
)
createCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
callback
:(
BUYDataCustomerTokenBlock
)
block
-
(
BUYRequestOperation
*
)
createCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
callback
:(
BUYDataCustomerTokenBlock
)
block
{
NSURL
*
route
=
[
self
urlForCustomers
];
return
[
self
postRequestForURL
:
route
object
:
credentials
.
JSONRepresentation
completionHandler
:^
(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
)
{
...
...
@@ -63,7 +63,7 @@
}];
}
-
(
NSURLSessionDataTask
*
)
createTokenForCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerJSON
:(
NSDictionary
*
)
customerJSON
callback
:(
BUYDataCustomerTokenBlock
)
block
-
(
BUYRequestOperation
*
)
createTokenForCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerJSON
:(
NSDictionary
*
)
customerJSON
callback
:(
BUYDataCustomerTokenBlock
)
block
{
NSURL
*
route
=
[
self
urlForCustomersToken
];
return
[
self
postRequestForURL
:
route
object
:
credentials
.
JSONRepresentation
completionHandler
:^
(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
)
{
...
...
@@ -87,12 +87,12 @@
}];
}
-
(
NSURLSessionDataTask
*
)
loginCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
callback
:(
BUYDataCustomerTokenBlock
)
block
-
(
BUYRequestOperation
*
)
loginCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
callback
:(
BUYDataCustomerTokenBlock
)
block
{
return
[
self
createTokenForCustomerWithCredentials
:
credentials
customerJSON
:
nil
callback
:
block
];
}
-
(
NSURLSessionDataTask
*
)
recoverPasswordForCustomer
:(
NSString
*
)
email
callback
:(
BUYDataStatusBlock
)
block
-
(
BUYRequestOperation
*
)
recoverPasswordForCustomer
:(
NSString
*
)
email
callback
:(
BUYDataStatusBlock
)
block
{
NSURL
*
route
=
[
self
urlForCustomersPasswordRecovery
];
return
[
self
postRequestForURL
:
route
object
:@{
@"email"
:
email
}
completionHandler
:^
(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
)
{
...
...
@@ -105,7 +105,7 @@
}];
}
-
(
NSURLSessionDataTask
*
)
renewCustomerTokenWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataTokenBlock
)
block
-
(
BUYRequestOperation
*
)
renewCustomerTokenWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataTokenBlock
)
block
{
if
(
self
.
customerToken
)
{
NSURL
*
route
=
[
self
urlForCustomersTokenRenewalWithID
:
customerID
];
...
...
@@ -130,7 +130,7 @@
}
}
-
(
NSURLSessionDataTask
*
)
activateCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerID
:(
NSString
*
)
customerID
customerToken
:(
NSString
*
)
customerToken
callback
:(
BUYDataCustomerTokenBlock
)
block
-
(
BUYRequestOperation
*
)
activateCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerID
:(
NSString
*
)
customerID
customerToken
:(
NSString
*
)
customerToken
callback
:(
BUYDataCustomerTokenBlock
)
block
{
NSURL
*
route
=
[
self
urlForCustomersActivationWithID
:
customerID
parameters
:@{
@"token"
:
customerToken
,
...
...
@@ -148,7 +148,7 @@
}];
}
-
(
NSURLSessionDataTask
*
)
resetPasswordWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerID
:(
NSString
*
)
customerID
customerToken
:(
NSString
*
)
customerToken
callback
:(
BUYDataCustomerTokenBlock
)
block
-
(
BUYRequestOperation
*
)
resetPasswordWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerID
:(
NSString
*
)
customerID
customerToken
:(
NSString
*
)
customerToken
callback
:(
BUYDataCustomerTokenBlock
)
block
{
NSURL
*
route
=
[
self
urlForCustomersPasswordResetWithID
:
customerID
parameters
:@{
@"token"
:
customerToken
,
...
...
@@ -166,7 +166,7 @@
}];
}
-
(
NSURLSessionDataTask
*
)
getOrdersForCustomerWithCallback
:(
BUYDataOrdersBlock
)
block
-
(
BUYRequestOperation
*
)
getOrdersForCustomerWithCallback
:(
BUYDataOrdersBlock
)
block
{
NSURL
*
route
=
[
self
urlForCustomersOrders
];
return
[
self
getRequestForURL
:
route
completionHandler
:
^
(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
)
{
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.h
View file @
cb433eee
...
...
@@ -27,6 +27,7 @@
@import
Foundation
;
@class
BUYModelManager
;
@class
BUYRequestOperation
;
/**
* A BUYStatus is associated with the completion of an enqueued job on Shopify.
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.m
View file @
cb433eee
...
...
@@ -118,27 +118,27 @@ static NSString * const BUYClientJSONMimeType = @"application/json";
#pragma mark - Convenience Requests
-
(
NSURLSessionDataTask
*
)
getRequestForURL
:
(
NSURL
*
)
url
completionHandler
:
(
void
(
^
)(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
))
completionHandler
-
(
BUYRequestOperation
*
)
getRequestForURL
:
(
NSURL
*
)
url
completionHandler
:
(
void
(
^
)(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
))
completionHandler
{
return
[
self
requestForURL
:
url
method
:
@"GET"
object
:
nil
completionHandler
:
completionHandler
];
}
-
(
NSURLSessionDataTask
*
)
postRequestForURL
:
(
NSURL
*
)
url
object
:
(
id
<
BUYSerializable
>
)
object
completionHandler
:
(
void
(
^
)(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
))
completionHandler
-
(
BUYRequestOperation
*
)
postRequestForURL
:
(
NSURL
*
)
url
object
:
(
id
<
BUYSerializable
>
)
object
completionHandler
:
(
void
(
^
)(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
))
completionHandler
{
return
[
self
requestForURL
:
url
method
:
@"POST"
object
:
object
completionHandler
:
completionHandler
];
}
-
(
NSURLSessionDataTask
*
)
putRequestForURL
:
(
NSURL
*
)
url
object
:
(
id
<
BUYSerializable
>
)
object
completionHandler
:
(
void
(
^
)(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
))
completionHandler
-
(
BUYRequestOperation
*
)
putRequestForURL
:
(
NSURL
*
)
url
object
:
(
id
<
BUYSerializable
>
)
object
completionHandler
:
(
void
(
^
)(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
))
completionHandler
{
return
[
self
requestForURL
:
url
method
:
@"PUT"
object
:
object
completionHandler
:
completionHandler
];
}
-
(
NSURLSessionDataTask
*
)
patchRequestForURL
:
(
NSURL
*
)
url
object
:
(
id
<
BUYSerializable
>
)
object
completionHandler
:
(
void
(
^
)(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
))
completionHandler
-
(
BUYRequestOperation
*
)
patchRequestForURL
:
(
NSURL
*
)
url
object
:
(
id
<
BUYSerializable
>
)
object
completionHandler
:
(
void
(
^
)(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
))
completionHandler
{
return
[
self
requestForURL
:
url
method
:
@"PATCH"
object
:
object
completionHandler
:
completionHandler
];
}
-
(
NSURLSessionDataTask
*
)
deleteRequestForURL
:
(
NSURL
*
)
url
completionHandler
:
(
void
(
^
)(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
))
completionHandler
-
(
BUYRequestOperation
*
)
deleteRequestForURL
:
(
NSURL
*
)
url
completionHandler
:
(
void
(
^
)(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
))
completionHandler
{
return
[
self
requestForURL
:
url
method
:
@"DELETE"
object
:
nil
completionHandler
:
completionHandler
];
}
...
...
@@ -156,7 +156,7 @@ static NSString * const BUYClientJSONMimeType = @"application/json";
return
[
NSString
stringWithFormat
:
@"%@ %@"
,
@"Basic"
,
[
data
base64EncodedStringWithOptions
:
0
]];
}
-
(
NSURLSessionDataTask
*
)
requestForURL
:
(
NSURL
*
)
url
method
:
(
NSString
*
)
method
object
:
(
id
<
BUYSerializable
>
)
object
completionHandler
:
(
void
(
^
)(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
))
completionHandler
-
(
BUYRequestOperation
*
)
requestForURL
:
(
NSURL
*
)
url
method
:
(
NSString
*
)
method
object
:
(
id
<
BUYSerializable
>
)
object
completionHandler
:
(
void
(
^
)(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
))
completionHandler
{
NSMutableURLRequest
*
request
=
[[
NSMutableURLRequest
alloc
]
initWithURL
:
url
];
if
(
object
)
{
...
...
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