- Fix vari

This commit is contained in:
giuseppenuc committed 2016-02-03 02:01:13 +01:00
1 parent 07ae0d3b42
commit 41c856b3c9
18 files changed
+794 -681

No files matched your search

+24 -1
View File
@@ -6,7 +6,7 @@
//
//
#import <PNObject/PNObject.h>
#import "PNObject.h"
@interface PNAccessToken : PNObject
@@ -14,6 +14,20 @@ typedef NS_ENUM(NSInteger, TokenType) {
TokenTypeBasic = 1,
TokenTypeBearer = 2
};
/**
* gets singleton object of current user session.
*
* @return singleton
*/
+ (instancetype _Nonnull) currentUser;
///--------------------------------------
#pragma mark - PNAccessToken Properties
///--------------------------------------
/**
* <#Description#>
*/
@@ -22,9 +36,18 @@ typedef NS_ENUM(NSInteger, TokenType) {
* <#Description#>
*/
@property (nonatomic, strong, nullable) NSDate *expirationDate;
@property (nonatomic, strong, nullable) NSNumber *expiresIn;
/**
* <#Description#>
*/
@property (nonatomic) TokenType tokenType;
@property (nonatomic, strong, nullable) NSString *tokenTypeString;
@property (nonatomic, strong, nullable) NSString *scope;
@property (nonatomic, strong, nullable) NSString *refreshToken;
@end
+26 -6
View File
@@ -7,6 +7,7 @@
//
#import "PNAccessToken.h"
#import <NSDate_Utils/NSDate+NSDate_Util.h>
@interface PNAccessToken() <PNObjectSubclassing>
@@ -19,13 +20,35 @@
+ (NSDictionary *)objcetMapping {
NSDictionary *mapping = @{
@"accessToken":@"accessToken",
@"expirationDate":@"expirationDate",
@"tokenType":@"tokenType",
@"accessToken":@"access_token",
@"expiresIn":@"expires_in",
@"tokenTypeString":@"token_type",
@"tokenType":@"scope",
@"refreshToken":@"refresh_token",
};
return mapping;
}
- (instancetype) initWithJSON:(NSDictionary *)JSON {
self = [super initWithJSON:JSON];
if (self) {
((void (^)())@{
@"beaer" : ^{
_tokenType = TokenTypeBearer;
},
@"basic" : ^{
_tokenType = TokenTypeBasic;
}
}[_tokenTypeString] ?: ^{
})();
_expirationDate = [[NSDate date] dateByAddingHours:[_expiresIn integerValue]];
}
return self;
}
+ (NSString *)objectClassName {
return @"AccessToken";
}
@@ -38,7 +61,4 @@
@end
+2 -2
View File
@@ -7,7 +7,7 @@
//
#import "PNObject.h"
#import "PNAccessToken.h"
@interface PNUser : PNObject
@@ -33,7 +33,7 @@
//- (void) setPassword:(NSString * _Nonnull)password inBackGroundWithBlock:(nullable void (^)(BOOL saveStatus, id responseObject, NSError * error)) responseBlock;
///--------------------------------------
#pragma mark - PNLocation Properties
#pragma mark - PNUser Properties
///--------------------------------------
/**