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
6c758e68
Commit
6c758e68
authored
Jul 22, 2016
by
David Muzi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add customer update endpoint
remove customer update unit test
parent
edcaa8e9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
29 deletions
+5
-29
BUYClient+CustomerTests.m
...le Buy SDK/Mobile Buy SDK Tests/BUYClient+CustomerTests.m
+0
-23
BUYClient+Customers.h
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Customers.h
+2
-3
BUYClient+Customers.m
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Customers.m
+3
-3
No files found.
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClient+CustomerTests.m
View file @
6c758e68
...
...
@@ -197,29 +197,6 @@
[
self
waitForExpectationsWithTimeout
:
10
.
0
handler
:
^
(
NSError
*
error
)
{}];
}
#pragma mark - Update -
-
(
void
)
testCustomerUpdate
{
[
OHHTTPStubs
stubUsingResponseWithKey
:
@"testCustomerLogin"
useMocks
:[
self
shouldUseMocks
]];
XCTestExpectation
*
expectation
=
[
self
expectationWithDescription
:
NSStringFromSelector
(
_cmd
)];
BUYAccountCredentialItem
*
email
=
[
BUYAccountCredentialItem
itemWithEmail
:
self
.
customerEmail
];
BUYAccountCredentials
*
credentials
=
[
BUYAccountCredentials
credentialsWithItems
:@[
email
]];
[
self
.
client
updateCustomerWithCredentials
:
credentials
callback
:
^
(
BUYCustomer
*
customer
,
NSError
*
error
)
{
XCTAssertNil
(
error
);
XCTAssertNotNil
(
customer
);
XCTAssertEqualObjects
(
customer
.
email
,
self
.
customerEmail
);
[
expectation
fulfill
];
}];
[
self
waitForExpectationsWithTimeout
:
10
handler
:
^
(
NSError
*
error
)
{}];
}
#pragma mark - Address -
-
(
void
)
testGetAddresses
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Customers.h
View file @
6c758e68
...
...
@@ -119,14 +119,13 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
/**
* PUT /api/customers/:customer_id
* Update customer credentials represented by BUYAccountCredentials object
*
* @param c
redentials Credentials containing a password
* @param c
ustomer the customer object to update
* @param block (BUYCustomer *customer, NSError *error)
*
* @return The associated BUYRequestOperation
*/
-
(
NSOperation
*
)
updateCustomer
WithCredentials
:(
BUYAccountCredentials
*
)
credentials
callback
:(
BUYDataCustomerBlock
)
block
;
-
(
NSOperation
*
)
updateCustomer
:(
BUYCustomer
*
)
customer
callback
:(
BUYDataCustomerBlock
)
block
;
/**
* PUT /api/customers/:customer_id/reset
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Customers.m
View file @
6c758e68
...
...
@@ -82,10 +82,10 @@
}];
}
-
(
NSOperation
*
)
updateCustomer
WithCredentials
:(
BUYAccountCredentials
*
)
credentials
callback
:(
BUYDataCustomerBlock
)
block
-
(
NSOperation
*
)
updateCustomer
:(
BUYCustomer
*
)
customer
callback
:(
BUYDataCustomerBlock
)
block
{
NSURL
*
url
=
[
self
urlFor
LoggedInCustomer
];
return
[
self
putRequestForURL
:
url
object
:
credentials
.
JSONRepresentation
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
NSURL
*
url
=
[
self
urlFor
CustomersWithID
:
customer
.
identifier
.
stringValue
];
return
[
self
putRequestForURL
:
url
object
:
@{
@"customer"
:
customer
.
JSONDictionary
}
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
BUYCustomer
*
customer
=
nil
;
if
(
json
&&
!
error
)
{
customer
=
[
self
.
modelManager
customerWithJSONDictionary
:
json
];
...
...
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