Inherits from NSObject
Declared in OIUser.h
OIUser.m

Overview

Class contain basic informations about user.

Tasks

Other Methods

Address Methods

CreditCard Methods

Order Methods

Properties

addresses

Array of user addresses.

@property (nonatomic, readwrite, retain) NSMutableArray *addresses

Discussion

Array of user addresses.

Declared In

OIUser.h

creditCards

Array of user credit cards.

@property (nonatomic, readwrite, retain) NSMutableArray *creditCards

Discussion

Array of user credit cards.

Declared In

OIUser.h

firstName

First name.

@property (nonatomic, readwrite, copy) NSString *firstName

Discussion

First name.

Declared In

OIUser.h

lastName

Last name.

@property (nonatomic, readwrite, copy) NSString *lastName

Discussion

Last name.

Declared In

OIUser.h

orders

Array of user orders.

@property (nonatomic, readwrite, retain) NSMutableArray *orders

Discussion

Array of user orders.

Declared In

OIUser.h

Class Methods

accountInfo:password:usingBlockUser:usingBlockError:

Load account information by user email and password.

+ (void)accountInfo:(NSString *)email password:(NSString *)password usingBlockUser:(void ( ^ ) ( OIUser *user ))blockUser usingBlockError:(void ( ^ ) ( NSError *error ))blockError

Parameters

email

User email.

password

User password.

Return Value

block Return (OIUser) instance if request finished correctly.

blockError Return (NSError) instance.

Discussion

Load account information by user email and password.

Declared In

OIUser.h

createNewAccount:email:password:usingBlock:

Create new account for OIUser instance. Call block with nil parameter if succeeded or with a request error if failed

+ (void)createNewAccount:(OIUser *)account email:(NSString *)email password:(NSString *)password usingBlock:(void ( ^ ) ( NSError *error ))block

Parameters

email

User email.

password

User password.

Information

about new account (OIUser).

Return Value

block Return nil if request finished correctly.

Discussion

Create new account for OIUser instance. Call block with nil parameter if succeeded or with a request error if failed

Declared In

OIUser.h

updatePassword:usingBlock:

Update user password.

+ (void)updatePassword:(NSString *)password usingBlock:(void ( ^ ) ( NSError *error ))block

Parameters

password

New password.

block

Block return nil if request finished successfully else error (NSError).

Discussion

Update user password.

Declared In

OIUser.h

userWithFirstName:lastName:

Create new OIUser instance by email, first name and last name.

+ (OIUser *)userWithFirstName:(NSString *)firstName lastName:(NSString *)lastName

Parameters

firstName

First name of user.

lastName

Last name of user.

Discussion

Create new OIUser instance by email, first name and last name.

Declared In

OIUser.h

Instance Methods

addAddress:

Add address (OIAddress) to the server and to the addresses of the user (OIUser).

- (void)addAddress:(OIAddress *)address

Parameters

address

New address (OIAddress) which will be added to the user addresses (server, application).

Discussion

Add address (OIAddress) to the server and to the addresses of the user (OIUser).

Declared In

OIUser.h

addCreditCard:

Add credit card (OICardInfo) to the server and to the credit cards of the user (OIUser).

- (void)addCreditCard:(OICardInfo *)creditCard

Parameters

address

New credit card (OICardInfo), which will be added to the user credit cards (server, application).

Discussion

Add credit card (OICardInfo) to the server and to the credit cards of the user (OIUser).

Declared In

OIUser.h

deleteAddressByNickname:

Delete user address by its nickname.

- (void)deleteAddressByNickname:(NSString *)nickname

Parameters

nickname

Addresses nickname, which will be deleted.

Discussion

Delete user address by its nickname.

Declared In

OIUser.h

deleteCreditCardByNickname:

Delete user credit card by its nickname.

- (void)deleteCreditCardByNickname:(NSString *)nickname

Parameters

nickname

Credit cards nickname, which will be deleted.

Discussion

Delete user credit card by its nickname.

Declared In

OIUser.h

initAllAddresses

Load all user addresses into the OIUser instance. Call block with nil parameter.

- (void)initAllAddresses

Discussion

Load all user addresses into the OIUser instance. Call block with nil parameter.

Declared In

OIUser.h

initAllCreditCards

Load all user credit cards into the OIUser instance.

- (void)initAllCreditCards

Discussion

Load all user credit cards into the OIUser instance.

Declared In

OIUser.h

initOrderHistory

Load all user orders into the OIUser instance.

- (void)initOrderHistory

Discussion

Load all user orders into the OIUser instance.

Declared In

OIUser.h

updateAddressAtIndex:withAddress:

Change user address (overwrite).

- (void)updateAddressAtIndex:(NSUInteger)index withAddress:(OIAddress *)newAddress

Parameters

index

Index of the address (OIAddress) in user addresses, which will be updated.

newAddress

Changed address (OIAddress), which will replace previous address.

Discussion

Change user address (overwrite).

Declared In

OIUser.h

updateCreditCardAtIndex:withCreditCard:

Change user credit card (overwrite).

- (void)updateCreditCardAtIndex:(NSUInteger)index withCreditCard:(OICardInfo *)newCreditCard

Parameters

index

Index of the credit card (OICardInfo) in user credit cards, which will be updated.

newCreditCard

(OICardInfo) Changed credit card, which will replace previous credit card.

Discussion

Change user credit card (overwrite).

Declared In

OIUser.h