diff options
Diffstat (limited to 'Juick/Message.m')
-rw-r--r-- | Juick/Message.m | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/Juick/Message.m b/Juick/Message.m deleted file mode 100644 index de08e98..0000000 --- a/Juick/Message.m +++ /dev/null @@ -1,52 +0,0 @@ -// -// Message.m -// Juick -// -// Created by Vitaly Takmazov on 29.10.13. -// Copyright (c) 2013 com.juick. All rights reserved. -// - -#import "Message.h" -#import "PDKeychainBindings.h" - -@implementation Message - -+ (NSDictionary *)modelCustomPropertyMapper { - return @{@"text" : @"body", - @"MID" : @"mid", - @"RID" : @"rid", - @"attach" : @"photo.small", - @"repliesCount": @"replies", - @"repliesBy": @"repliesby"}; -} - - -+(void) pullNextFromPath:(NSString *)path params:(NSDictionary *) params callback:(void(^)(NSArray *))callback { - AFHTTPSessionManager *manager = [APIClient sharedClient].manager; - if ([[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"] != nil) { - [manager.requestSerializer setAuthorizationHeaderFieldWithUsername:[[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"] password:[[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.password"]]; - } - [manager GET:path parameters:params progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { - NSMutableArray *messages = [NSMutableArray new]; - [((NSArray *)responseObject) enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { - [messages addObject:[Message yy_modelWithJSON:obj]]; - }]; - callback(messages); - } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { - NSLog(@"REST Error: %@", error); - }]; -} - -+(NSString *) messagesUrl { - return @"https://api.juick.com/messages"; -} - -+(NSString *) threadUrl { - return @"https://api.juick.com/thread"; -} - -+(NSString *) feedUrl { - return @"https://api.juick.com/home"; -} - -@end |