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
f71fad65
Commit
f71fad65
authored
May 04, 2016
by
Dima Bart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add empty initializer for credentials, count property. Minor refactoring.
parent
34374ba6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
BUYAccountCredentials.h
Mobile Buy SDK/Mobile Buy SDK/Models/BUYAccountCredentials.h
+2
-0
BUYAccountCredentials.m
Mobile Buy SDK/Mobile Buy SDK/Models/BUYAccountCredentials.m
+15
-5
No files found.
Mobile Buy SDK/Mobile Buy SDK/Models/BUYAccountCredentials.h
View file @
f71fad65
...
...
@@ -41,9 +41,11 @@ extern NSString * const BUYAccountPasswordConfirmationKey;
*/
@interface
BUYAccountCredentials
:
NSObject
@property
(
nonatomic
,
assign
,
readonly
)
NSUInteger
count
;
@property
(
nonatomic
,
assign
,
readonly
,
getter
=
isValid
)
BOOL
valid
;
@property
(
nonatomic
,
strong
,
readonly
)
NSDictionary
*
JSONRepresentation
;
+
(
BUYAccountCredentials
*
)
credentials
;
+
(
BUYAccountCredentials
*
)
credentialsWithItems
:(
nullable
NSArray
<
BUYAccountCredentialItem
*>
*
)
items
;
-
(
instancetype
)
initWithItems
:(
nullable
NSArray
<
BUYAccountCredentialItem
*>
*
)
items
;
...
...
Mobile Buy SDK/Mobile Buy SDK/Models/BUYAccountCredentials.m
View file @
f71fad65
...
...
@@ -41,6 +41,11 @@ NSString * const BUYAccountPasswordConfirmationKey = @"password_confirmation";
@implementation
BUYAccountCredentials
+
(
BUYAccountCredentials
*
)
credentials
{
return
[
BUYAccountCredentials
credentialsWithItems
:
nil
];
}
+
(
BUYAccountCredentials
*
)
credentialsWithItems
:
(
NSArray
<
BUYAccountCredentialItem
*>
*
)
items
{
return
[[
BUYAccountCredentials
alloc
]
initWithItems
:
items
];
...
...
@@ -60,6 +65,11 @@ NSString * const BUYAccountPasswordConfirmationKey = @"password_confirmation";
}
#pragma mark - Accessors -
-
(
NSUInteger
)
count
{
return
self
.
items
.
count
;
}
-
(
BOOL
)
isValid
{
__block
BOOL
valid
=
YES
;
...
...
@@ -104,27 +114,27 @@ NSString * const BUYAccountPasswordConfirmationKey = @"password_confirmation";
#pragma mark - Init -
+
(
instancetype
)
itemEmailWithValue
:(
NSString
*
)
value
{
return
[
[
BUYAccountCredentialItem
alloc
]
init
WithKey
:
BUYAccountEmailKey
value
:
value
];
return
[
BUYAccountCredentialItem
item
WithKey
:
BUYAccountEmailKey
value
:
value
];
}
+
(
instancetype
)
itemFirstNameWithValue
:(
NSString
*
)
value
{
return
[
[
BUYAccountCredentialItem
alloc
]
init
WithKey
:
BUYAccountFirstNameKey
value
:
value
];
return
[
BUYAccountCredentialItem
item
WithKey
:
BUYAccountFirstNameKey
value
:
value
];
}
+
(
instancetype
)
itemLastNameWithValue
:(
NSString
*
)
value
{
return
[
[
BUYAccountCredentialItem
alloc
]
init
WithKey
:
BUYAccountLastNameKey
value
:
value
];
return
[
BUYAccountCredentialItem
item
WithKey
:
BUYAccountLastNameKey
value
:
value
];
}
+
(
instancetype
)
itemPasswordWithValue
:(
NSString
*
)
value
{
return
[
[
BUYAccountCredentialItem
alloc
]
init
WithKey
:
BUYAccountPasswordKey
value
:
value
];
return
[
BUYAccountCredentialItem
item
WithKey
:
BUYAccountPasswordKey
value
:
value
];
}
+
(
instancetype
)
itemPasswordConfirmationWithValue
:(
NSString
*
)
value
{
return
[
[
BUYAccountCredentialItem
alloc
]
init
WithKey
:
BUYAccountPasswordConfirmationKey
value
:
value
];
return
[
BUYAccountCredentialItem
item
WithKey
:
BUYAccountPasswordConfirmationKey
value
:
value
];
}
+
(
instancetype
)
itemWithKey
:(
NSString
*
)
key
value
:(
NSString
*
)
value
...
...
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