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
da1318c5
Commit
da1318c5
authored
Jul 20, 2016
by
Brent Gulanowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove customerID parameter from address API.
Use the customerID from the customerToken instead.
parent
b8be173a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
26 deletions
+21
-26
BUYClient+Address.h
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Address.h
+5
-10
BUYClient+Address.m
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Address.m
+10
-10
BUYClient+Routing.h
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Routing.h
+2
-2
BUYClient+Routing.m
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Routing.m
+4
-4
No files found.
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Address.h
View file @
da1318c5
...
@@ -51,60 +51,55 @@ typedef void (^BUYDataAddressBlock)(BUYAddress * _Nullable address, NSError * _N
...
@@ -51,60 +51,55 @@ typedef void (^BUYDataAddressBlock)(BUYAddress * _Nullable address, NSError * _N
* GET /api/customers/:customer_id/addresses
* GET /api/customers/:customer_id/addresses
* Fetch all customer addresses
* Fetch all customer addresses
*
*
* @param customerID Customer ID for which to fetch all address
* @param block (NSArray<BUYAddress *> *addresses, NSError *error)
* @param block (NSArray<BUYAddress *> *addresses, NSError *error)
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
NSOperation
*
)
getAddresses
ForCustomerID
:(
NSString
*
)
customerID
c
allback
:(
BUYDataAddressesBlock
)
block
;
-
(
NSOperation
*
)
getAddresses
C
allback
:(
BUYDataAddressesBlock
)
block
;
/**
/**
* GET /api/customers/:customer_id/addresses/:id
* GET /api/customers/:customer_id/addresses/:id
* Fetch a customer address by ID
* Fetch a customer address by ID
*
*
* @param addressID Identifier of the address to fetch
* @param addressID Identifier of the address to fetch
* @param customerID Customer ID for which to fetch the address
* @param block (BUYAddress *address, NSError *error)
* @param block (BUYAddress *address, NSError *error)
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
NSOperation
*
)
getAddressWithID
:(
NSNumber
*
)
addressID
c
ustomerID
:(
NSString
*
)
customerID
c
allback
:(
BUYDataAddressBlock
)
block
;
-
(
NSOperation
*
)
getAddressWithID
:(
NSNumber
*
)
addressID
callback
:(
BUYDataAddressBlock
)
block
;
/**
/**
* POST /api/customers/:customer_id/addresses
* POST /api/customers/:customer_id/addresses
* Creates a new customer address
* Creates a new customer address
*
*
* @param address Address to create
* @param address Address to create
* @param customer Customer ID for which to create the address
* @param block (BUYAddress *address, NSError *error)
* @param block (BUYAddress *address, NSError *error)
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
NSOperation
*
)
createAddress
:(
BUYAddress
*
)
address
c
ustomerID
:(
NSString
*
)
customerID
c
allback
:(
BUYDataAddressBlock
)
block
;
-
(
NSOperation
*
)
createAddress
:(
BUYAddress
*
)
address
callback
:(
BUYDataAddressBlock
)
block
;
/**
/**
* PUT /api/customers/:customer_id/addresses/:id
* PUT /api/customers/:customer_id/addresses/:id
* Updates the customer address
* Updates the customer address
*
*
* @param address Address to update, containing updated values
* @param address Address to update, containing updated values
* @param customerID Customer ID for which to update the address
* @param block (BUYAddress *address, NSError *error)
* @param block (BUYAddress *address, NSError *error)
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
NSOperation
*
)
updateAddress
:(
BUYAddress
*
)
address
c
ustomerID
:(
NSString
*
)
customerID
c
allback
:(
BUYDataAddressBlock
)
block
;
-
(
NSOperation
*
)
updateAddress
:(
BUYAddress
*
)
address
callback
:(
BUYDataAddressBlock
)
block
;
/**
/**
* DELETE /api/customers/:customer_id/addresses/:id
* DELETE /api/customers/:customer_id/addresses/:id
* Delete the customer address
* Delete the customer address
*
*
* @param addressID Address ID to delete
* @param addressID Address ID to delete
* @param customerID Customer ID for which to delete the address
* @param block (BUYStatus status, NSError *error)
* @param block (BUYStatus status, NSError *error)
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
NSOperation
*
)
deleteAddressWithID
:(
NSNumber
*
)
addressID
c
ustomerID
:(
NSString
*
)
customerID
c
allback
:(
BUYDataStatusBlock
)
block
;
-
(
NSOperation
*
)
deleteAddressWithID
:(
NSNumber
*
)
addressID
callback
:(
BUYDataStatusBlock
)
block
;
@end
@end
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Address.m
View file @
da1318c5
...
@@ -33,9 +33,9 @@
...
@@ -33,9 +33,9 @@
@implementation
BUYClient
(
Address
)
@implementation
BUYClient
(
Address
)
-
(
NSOperation
*
)
getAddresses
ForCustomerID
:(
NSString
*
)
customerID
c
allback
:(
BUYDataAddressesBlock
)
block
-
(
NSOperation
*
)
getAddresses
C
allback
:(
BUYDataAddressesBlock
)
block
{
{
NSURL
*
route
=
[
self
urlForCustomersAddresses
WithID
:
customerID
];
NSURL
*
route
=
[
self
urlForCustomersAddresses
];
return
[
self
getRequestForURL
:
route
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
return
[
self
getRequestForURL
:
route
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
NSArray
<
BUYAddress
*>
*
addresses
=
nil
;
NSArray
<
BUYAddress
*>
*
addresses
=
nil
;
if
(
json
&&
!
error
)
{
if
(
json
&&
!
error
)
{
...
@@ -45,9 +45,9 @@
...
@@ -45,9 +45,9 @@
}];
}];
}
}
-
(
NSOperation
*
)
getAddressWithID
:(
NSNumber
*
)
addressID
c
ustomerID
:(
NSString
*
)
customerID
c
allback
:(
BUYDataAddressBlock
)
block
-
(
NSOperation
*
)
getAddressWithID
:(
NSNumber
*
)
addressID
callback
:(
BUYDataAddressBlock
)
block
{
{
NSURL
*
route
=
[
self
urlForCustomersAddressWith
ID
:
customerID
a
ddressID
:
addressID
];
NSURL
*
route
=
[
self
urlForCustomersAddressWith
A
ddressID
:
addressID
];
return
[
self
getRequestForURL
:
route
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
return
[
self
getRequestForURL
:
route
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
BUYAddress
*
address
=
nil
;
BUYAddress
*
address
=
nil
;
if
(
json
&&
!
error
)
{
if
(
json
&&
!
error
)
{
...
@@ -57,9 +57,9 @@
...
@@ -57,9 +57,9 @@
}];
}];
}
}
-
(
NSOperation
*
)
createAddress
:(
BUYAddress
*
)
address
c
ustomerID
:(
NSString
*
)
customerID
c
allback
:(
BUYDataAddressBlock
)
block
-
(
NSOperation
*
)
createAddress
:(
BUYAddress
*
)
address
callback
:(
BUYDataAddressBlock
)
block
{
{
NSURL
*
route
=
[
self
urlForCustomersAddresses
WithID
:
customerID
];
NSURL
*
route
=
[
self
urlForCustomersAddresses
];
return
[
self
postRequestForURL
:
route
object
:@{
@"address"
:
address
.
JSONDictionary
}
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
return
[
self
postRequestForURL
:
route
object
:@{
@"address"
:
address
.
JSONDictionary
}
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
BUYAddress
*
address
=
nil
;
BUYAddress
*
address
=
nil
;
if
(
json
&&
!
error
)
{
if
(
json
&&
!
error
)
{
...
@@ -69,11 +69,11 @@
...
@@ -69,11 +69,11 @@
}];
}];
}
}
-
(
NSOperation
*
)
updateAddress
:(
BUYAddress
*
)
address
c
ustomerID
:(
NSString
*
)
customerID
c
allback
:(
BUYDataAddressBlock
)
block
-
(
NSOperation
*
)
updateAddress
:(
BUYAddress
*
)
address
callback
:(
BUYDataAddressBlock
)
block
{
{
BUYAssert
(
address
.
identifier
,
@"Failed to update address. Address must have a valid identifier."
);
BUYAssert
(
address
.
identifier
,
@"Failed to update address. Address must have a valid identifier."
);
NSURL
*
route
=
[
self
urlForCustomersAddressWith
ID
:
customerID
a
ddressID
:
address
.
identifier
];
NSURL
*
route
=
[
self
urlForCustomersAddressWith
A
ddressID
:
address
.
identifier
];
return
[
self
putRequestForURL
:
route
object
:@{
@"address"
:
address
.
JSONDictionary
}
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
return
[
self
putRequestForURL
:
route
object
:@{
@"address"
:
address
.
JSONDictionary
}
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
BUYAddress
*
address
=
nil
;
BUYAddress
*
address
=
nil
;
if
(
json
&&
!
error
)
{
if
(
json
&&
!
error
)
{
...
@@ -83,11 +83,11 @@
...
@@ -83,11 +83,11 @@
}];
}];
}
}
-
(
NSOperation
*
)
deleteAddressWithID
:(
NSNumber
*
)
addressID
c
ustomerID
:(
NSString
*
)
customerID
c
allback
:(
BUYDataStatusBlock
)
block
-
(
NSOperation
*
)
deleteAddressWithID
:(
NSNumber
*
)
addressID
callback
:(
BUYDataStatusBlock
)
block
{
{
BUYAssert
(
addressID
,
@"Failed to update address. Address must have a valid identifier."
);
BUYAssert
(
addressID
,
@"Failed to update address. Address must have a valid identifier."
);
NSURL
*
route
=
[
self
urlForCustomersAddressWith
ID
:
customerID
a
ddressID
:
addressID
];
NSURL
*
route
=
[
self
urlForCustomersAddressWith
A
ddressID
:
addressID
];
return
[
self
deleteRequestForURL
:
route
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
return
[
self
deleteRequestForURL
:
route
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
block
(
response
.
statusCode
,
error
);
block
(
response
.
statusCode
,
error
);
}];
}];
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Routing.h
View file @
da1318c5
...
@@ -60,7 +60,7 @@
...
@@ -60,7 +60,7 @@
-
(
NSURL
*
)
urlForCustomersActivationWithID
:(
NSString
*
)
identifier
parameters
:(
NSDictionary
*
)
parameters
;
-
(
NSURL
*
)
urlForCustomersActivationWithID
:(
NSString
*
)
identifier
parameters
:(
NSDictionary
*
)
parameters
;
-
(
NSURL
*
)
urlForCustomersPasswordResetWithID
:(
NSString
*
)
identifier
parameters
:(
NSDictionary
*
)
parameters
;
-
(
NSURL
*
)
urlForCustomersPasswordResetWithID
:(
NSString
*
)
identifier
parameters
:(
NSDictionary
*
)
parameters
;
-
(
NSURL
*
)
urlForCustomersAddresses
WithID
:(
NSString
*
)
customerID
;
-
(
NSURL
*
)
urlForCustomersAddresses
;
-
(
NSURL
*
)
urlForCustomersAddressWith
ID
:(
NSString
*
)
customerID
a
ddressID
:(
NSNumber
*
)
addressID
;
-
(
NSURL
*
)
urlForCustomersAddressWith
A
ddressID
:(
NSNumber
*
)
addressID
;
@end
@end
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Routing.m
View file @
da1318c5
...
@@ -233,14 +233,14 @@
...
@@ -233,14 +233,14 @@
#pragma mark - Customer Addresses -
#pragma mark - Customer Addresses -
-
(
NSURL
*
)
urlForCustomersAddresses
WithID
:
(
NSString
*
)
customerID
-
(
NSURL
*
)
urlForCustomersAddresses
{
{
return
[[[
self
urlFor
CustomersWithID
:
customerID
]
appendPath
:
@"/addresses"
]
appendExtension
];
return
[[[
self
urlFor
LoggedInCustomer
]
appendPath
:
@"/addresses"
]
appendExtension
];
}
}
-
(
NSURL
*
)
urlForCustomersAddressWith
ID
:
(
NSString
*
)
customerID
a
ddressID
:
(
NSNumber
*
)
addressID
-
(
NSURL
*
)
urlForCustomersAddressWith
A
ddressID
:
(
NSNumber
*
)
addressID
{
{
return
[[[[
self
urlFor
CustomersWithID
:
customerID
]
appendPath
:
@"/addresses"
]
appendIdentifier
:
addressID
]
appendExtension
];
return
[[[[
self
urlFor
LoggedInCustomer
]
appendPath
:
@"/addresses"
]
appendIdentifier
:
addressID
]
appendExtension
];
}
}
#pragma mark - Utilities -
#pragma mark - Utilities -
...
...
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