summaryrefslogtreecommitdiff
path: root/Juick/Message.m
diff options
context:
space:
mode:
Diffstat (limited to 'Juick/Message.m')
-rw-r--r--Juick/Message.m13
1 files changed, 11 insertions, 2 deletions
diff --git a/Juick/Message.m b/Juick/Message.m
index 70d483c..5ba12d2 100644
--- a/Juick/Message.m
+++ b/Juick/Message.m
@@ -7,11 +7,16 @@
//
#import "Message.h"
+#import "PDKeychainBindings.h"
@implementation Message
-+(void) pullNextFromURL:(NSURL *)url callback:(void(^)(NSArray *))callback {
++(void) pullNextFromPath:(NSString *)path params:(NSDictionary *) params callback:(void(^)(NSArray *))callback {
+ if ([[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"] != nil) {
+ RKObjectManager *manager = [RKObjectManager sharedManager];
+ [manager.HTTPClient setAuthorizationHeaderWithUsername:[[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"] password:[[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.password"]];
+ }
RKObjectMapping *mapping = [RKObjectMapping mappingForClass:[Message class]];
[mapping addAttributeMappingsFromDictionary:@
{
@@ -28,7 +33,7 @@
}];
RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:mapping method:RKRequestMethodAny pathPattern:nil keyPath:nil statusCodes:nil];
- NSURLRequest *request = [NSURLRequest requestWithURL:url];
+ NSURLRequest *request = [[RKObjectManager sharedManager] requestWithObject:nil method:RKRequestMethodGET path:path parameters:params];
RKObjectRequestOperation *operation = [[RKObjectRequestOperation alloc] initWithRequest:request
responseDescriptors:@[responseDescriptor]];
[operation setCompletionBlockWithSuccess:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
@@ -47,4 +52,8 @@
return @"https://api.juick.com/thread";
}
++(NSString *) feedUrl {
+ return @"https://api.juick.com/home";
+}
+
@end