To run the example project, clone the repo, and run pod install
from the Example directory first.
- Tests. Tests. Tests!!
- Caching
- Persistence
StamperyKit is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "StamperyKit"
First, import the library:
#import <StamperyKit/StamperyKit.h>
Then, calling to the +sharedInstance
method will initialize the library.
Login
NSString *emailString = @"test@email.com"
NSString *passwordString = @"some-p@ssw0rd"
[[StamperyKit sharedInstance] loginWithEmail:emailString andPassword:passwordString completion:^(id response) {
// Response contains the HTTP body
// Once logged in, [[StamperyKit sharedInstance] userProfile] will contain the user profile
} errorBlock:^(NSError *error) {
// error contains a NSError instance with the given error
}];
Sign up
NSString *emailString = @"test@email.com";
NSString *passwordString = @"some-p@ssw0rd";
NSString *nameString = @"John Doe";
[[StamperyKit sharedInstance] registerWithEmail:emailString password:passwordString name:nameString completion:^(id response) {
// Response contains the HTTP body
// Once logged in, [[StamperyKit sharedInstance] userProfile] will contain the user profile
} errorBlock:^(NSError *error) {
// error contains a NSError instance with the given error
}];
List stamps [needs login]
[[StamperyKit sharedInstance] listStampsWithCompletion:^(id response) {
// Response will contain a NSArray containing 'Stamp' elements
} errorBlock:^(NSError * error) {
// error contains a NSError instance with the given error
}];
Get stamp details
NSString *stampHash = @"xxx-xxx-xxx";
[[StamperyKit sharedInstance] detailsForStampHash:stampHash completion:^(id response) {
// response has an instance of Stamp, containing the specified stamp info
} errorBlock:^(NSError *error) {
// error contains the raised error
}];
Stamping
This part will change eventually to make the library less opinionated. For now you can only stamp a file, by creating a PreStamp
instance
PreStamp *preStamp = [[PreStamp alloc] ...];
BOOL backupStamp = YES;
[[StamperyKit sharedInstance] stampFile:preStamp backupFile:backupStamp completion:^(id response) {
// response contains the server response
} errorBlock:^(NSError *error) {
// error contains the raised error
}];
These are the basic methods to start using basic functionality. Check StamperyKit.h for the full list of methods
Pablo Merino, pablo@stampery.co
StamperyKit is available under the MIT license. See the LICENSE file for more info.